(self, value: str, by: str = "name", multiple: bool = False)
| 409 | return None |
| 410 | |
| 411 | def find_variable(self, value: str, by: str = "name", multiple: bool = False) -> None | vlb.Variable | list[vlb.Variable]: |
| 412 | _ret = [] |
| 413 | by = by.lower() |
| 414 | for _variable in self.variables + self._local_globals: |
| 415 | if not isinstance(_variable, vlb.Variable): |
| 416 | continue |
| 417 | |
| 418 | if by == "id": |
| 419 | compare = _variable.id |
| 420 | else: |
| 421 | # Defaulting |
| 422 | compare = _variable.name |
| 423 | if compare == value: |
| 424 | if multiple: |
| 425 | _ret.append(_variable) |
| 426 | else: |
| 427 | return _variable |
| 428 | # Search in stage for global variables |
| 429 | if self.project: |
| 430 | if not self.is_stage: |
| 431 | if multiple: |
| 432 | _ret += self.stage.find_variable(value, by, True) |
| 433 | else: |
| 434 | return self.stage.find_variable(value, by) |
| 435 | |
| 436 | if multiple: |
| 437 | return _ret |
| 438 | return None |
| 439 | |
| 440 | def find_list(self, value: str, by: str = "name", multiple: bool = False) -> None | vlb.List | list[vlb.List]: |
| 441 | _ret = [] |
no outgoing calls
no test coverage detected