class documentation

class LookupMixIn: (source)

Known subclasses: astroid.nodes.AssignName, astroid.nodes.DelName, astroid.nodes.Name, astroid.nodes.scoped_nodes.LocalsDictNodeNG

View In Hierarchy

Mixin to look up a name in the right scope.
Method ilookup Lookup the inferred values of the given variable.
Method lookup Lookup where the given variable is assigned.
def ilookup(self, name): (source)
Lookup the inferred values of the given variable.
Parameters
name:strThe variable name to find values for.
Returns
iterableThe inferred values of the statements returned from lookup.
@lru_cache(maxsize=None)
def lookup(self, name): (source)

Lookup where the given variable is assigned.

The lookup starts from self's scope. If self is not a frame itself and the name is found in the inner frame locals, statements will be filtered to remove ignorable statements according to self's location.

Parameters
name:strThe name of the variable to find assignments for.
Returns
tuple(str, list(NodeNG))The scope node and the list of assignments associated to the given name according to the scope where it has been found (locals, globals or builtin).