MCPcopy Create free account
hub / github.com/WwwwwyDev/crawlipt / _replace_variable

Method _replace_variable

crawlipt/script.py:394–407  ·  view source on GitHub ↗
(script: dict, variable: VariableBase)

Source from the content-addressed store, hash-verified

392 @staticmethod
393 @check
394 def _replace_variable(script: dict, variable: VariableBase) -> None:
395 while script:
396 for key in script.keys():
397 if key not in ScriptProcess.__POP_KEY and isinstance(script[key], str) and script[key].startswith(
398 "__v-") and script[key].endswith("__"):
399 variable_name = script[key][4:-2]
400 if variable_name not in variable:
401 msg = f"The {variable_name} is not defined."
402 raise VariableError(msg)
403 script[key] = variable.get(variable_name)
404 for key in script.keys():
405 if key in {"loop", "if", "check", "while", "script", "fail_script"}:
406 ScriptProcess._replace_variable(script=script[key], variable=variable)
407 script = script.get("next")
408
409 @staticmethod
410 @check

Callers 1

processMethod · 0.80

Calls 2

VariableErrorClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected