Best Python code snippet using lisa_python
search_space.py
Source:search_space.py
...414 raise LisaException(415 f"not support to get intersect on countspace type: {type(requirement)}"416 )417 return result418def check_setspace(419 requirement: Optional[Union[SetSpace[T], T]],420 capability: Optional[Union[SetSpace[T], T]],421) -> ResultReason:422 result = ResultReason()423 if capability is None:424 result.add_reason("capability shouldn't be None")425 else:426 if requirement is not None:427 has_met_check = False428 if not isinstance(capability, SetSpace):429 capability = SetSpace[T](items=[capability])430 if not isinstance(requirement, SetSpace):431 requirement = SetSpace[T](items=[requirement])432 for item in requirement:433 if item in capability:434 has_met_check = True435 break436 if not has_met_check:437 result.add_reason(438 f"requirement not supported in capability. "439 f"requirement: {requirement}, "440 f"capability: {capability}"441 )442 return result443def generate_min_capability_setspace_by_priority(444 requirement: Optional[Union[SetSpace[T], T]],445 capability: Optional[Union[SetSpace[T], T]],446 priority_list: List[T],447) -> T:448 check_result = check_setspace(requirement, capability)449 if not check_result.result:450 raise NotMeetRequirementException(451 "cannot get min value, capability doesn't support requirement"452 f"{check_result.reasons}"453 )454 assert capability is not None, "Capability shouldn't be None"455 # Ensure that both cap and req are instance of SetSpace456 if not isinstance(capability, SetSpace):457 capability = SetSpace[T](items=[capability])458 if requirement is None:459 requirement = capability460 if not isinstance(requirement, SetSpace):461 requirement = SetSpace[T](items=[requirement])462 # Find min capability463 min_cap: Optional[T] = None464 for item in priority_list:465 if item in requirement and item in capability:466 min_cap = item467 break468 assert min_cap, (469 "Cannot find min capability on data path, "470 f"requirement: {requirement}"471 f"capability: {capability}"472 )473 return min_cap474def intersect_setspace_by_priority(475 requirement: Optional[Union[SetSpace[T], T]],476 capability: Optional[Union[SetSpace[T], T]],477 priority_list: List[T],478) -> Any:479 # intersect doesn't need to take care about priority.480 check_result = check_setspace(requirement, capability)481 if not check_result.result:482 raise NotMeetRequirementException(483 f"capability doesn't support requirement: {check_result.reasons}"484 )485 assert capability is not None, "Capability shouldn't be None"486 value = SetSpace[T]()487 # Ensure that both cap and req are instance of SetSpace488 if not isinstance(capability, SetSpace):489 capability = SetSpace[T](items=[capability])490 if requirement is None:491 requirement = capability492 if not isinstance(requirement, SetSpace):493 requirement = SetSpace[T](items=[requirement])494 # Find min capability...
features.py
Source:features.py
...303 capability, AwsDiskOptionSettings304 ), f"actual: {type(capability)}"305 result = super().check(capability)306 result.merge(307 search_space.check_setspace(self.disk_type, capability.disk_type),308 "disk_type",309 )310 result.merge(311 search_space.check_countspace(312 self.data_disk_count, capability.data_disk_count313 ),314 "data_disk_count",315 )316 result.merge(317 search_space.check_countspace(318 self.data_disk_iops, capability.data_disk_iops319 ),320 "data_disk_iops",321 )...
security_profile.py
Source:security_profile.py
...70 capability, SecurityProfileSettings71 ), f"actual: {type(capability)}"72 result = super().check(capability)73 result.merge(74 search_space.check_setspace(75 self.security_profile, capability.security_profile76 ),77 "security_profile",78 )79 return result80class SecurityProfile(Feature):81 @classmethod82 def on_before_deployment(cls, *args: Any, **kwargs: Any) -> None:83 raise NotImplementedError()84 @classmethod85 def name(cls) -> str:86 return FEATURE_NAME_SECURITY_PROFILE87 @classmethod88 def settings_type(cls) -> Type[schema.FeatureSettings]:...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!