Best Python code snippet using lisa_python
runbook.py
Source:runbook.py
...68 return builder69 def resolve(70 self, variables: Optional[Dict[str, VariableEntry]] = None71 ) -> schema.Runbook:72 parsed_data = self._internal_resolve(self.raw_data, variables)73 # validate runbook, after extensions loaded74 runbook = self._validate_and_load(parsed_data)75 return runbook76 def partial_resolve(77 self, partial_name: str, variables: Optional[Dict[str, VariableEntry]] = None78 ) -> Any:79 result: Any = None80 if partial_name in self.raw_data:81 raw_data = copy.deepcopy(self.raw_data[partial_name])82 result = self._internal_resolve(raw_data, variables)83 return result84 def derive(85 self, variables: Optional[Dict[str, VariableEntry]] = None86 ) -> "RunbookBuilder":87 """88 create a new instance with a copy of variables. If the variables is not89 given, it copies current variables90 """91 result = RunbookBuilder(self._path, self._cmd_args)92 if variables is None:93 variables = {key: value.copy() for key, value in self.variables.items()}94 result._variables = variables95 result._raw_data = self._raw_data96 return result97 def dump_variables(self) -> None:98 variables = self.variables99 # log message for unused variables, it's helpful to see which variable100 # is not used.101 unused_keys = [key for key, value in variables.items() if not value.is_used]102 if unused_keys:103 self._log.debug(f"variables {unused_keys} are not used.")104 # print runbook later, after __post_init__ executed, so secrets are handled.105 for key, value in variables.items():106 self._log.debug(f"variable '{key}': {value.data}")107 def _internal_resolve(108 self, raw_data: Any, variables: Optional[Dict[str, VariableEntry]] = None109 ) -> Any:110 raw_data = copy.deepcopy(raw_data)111 if variables is None:112 variables = self.variables113 try:114 parsed_data = replace_variables(raw_data, variables)115 except Exception as identifier:116 # log current data for troubleshooting.117 self._log.debug(f"parsed raw data: {raw_data}")118 raise identifier119 return parsed_data120 def _import_extensions(self) -> None:121 # load extended modules...
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!!