(script: dict, variable: VariableBase)
| 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 |
no test coverage detected