llmcompressor.pipelines.sequential.ast_utils.name_analyzer
Classes:
-
NameAnalyzer–Determines the unbound, assigned, and conditionally assigned names associated with
NameAnalyzer
Bases: NodeVisitor
Determines the unbound, assigned, and conditionally assigned names associated with a piece of code. This information is used to determine the arguments and return values of the wrapper function
For example, for the following piece of code
a is unbound, meaning that it must be an input of wrapper function b is assigned, meaning that it must be an output of the wrapper function c is conditionally assigned, meaning that it must be an output of the wrapper function, and might be an input iff c already exists in the namespace
Note that names which are assigned to before being read are not considered unbound
Methods:
-
analyze–Analyzes the use of names in the given piece of code
Source code in llmcompressor/pipelines/sequential/ast_utils/name_analyzer.py
analyze
Analyzes the use of names in the given piece of code
Parameters:
-
(nodeAST) –code to analyze return: tuple of unbound names, assigned names, and conditionally assigned names