MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / get_variables

Method get_variables

code2flow/model.py:581–599  ·  view source on GitHub ↗

Get in-scope variables from this group. This assumes every variable will be in-scope in nested functions line_number is included for compatibility with Node.get_variables but is not used :param int line_number: :rtype: list[Variable]

(self, line_number=None)

Source from the content-addressed store, hash-verified

579 return ret
580
581 def get_variables(self, line_number=None):
582 """
583 Get in-scope variables from this group.
584 This assumes every variable will be in-scope in nested functions
585 line_number is included for compatibility with Node.get_variables but is not used
586
587 :param int line_number:
588 :rtype: list[Variable]
589 """
590
591 if self.root_node:
592 variables = (self.root_node.variables
593 + _wrap_as_variables(self.subgroups)
594 + _wrap_as_variables(n for n in self.nodes if n != self.root_node))
595 if any(v.line_number for v in variables):
596 return sorted(variables, key=lambda v: v.line_number, reverse=True)
597 return variables
598 else:
599 return []
600
601 def remove_from_parent(self):
602 """

Callers

nothing calls this directly

Calls 1

_wrap_as_variablesFunction · 0.85

Tested by

no test coverage detected