Metadata-Version: 2.1
Name: ast_scope
Version: 0.1.0
Summary: Annotates a Python AST with the scope of symbols.
Home-page: https://github.com/kavigupta/ast_scope
Author: Kavi Gupta
License: UNKNOWN
Download-URL: https://github.com/kavigupta/ast_scope/archive/0.1.0.zip
Description: 
        # ast_scope
        
        This package is an implementation of Python's lexical scoping rules. It's interface is simple, you pass in an AST object to the `annotate` function, and it provides a mapping from each node in the tree that represents a symbol to the containing scope.
        
        ## Example Usage
        
        Let's say you have the code
        
        ```
        code = """
        def f():
            x = 3
            lambda z: theta
            return x + y
        """
        ```
        
        and you want to determine which global variables are referenced by it. All you need to do is run
        
        ```
        import ast
        import ast_scope
        tree = ast.parse(code)
        scope_info = ast_scope.annotate(tree)
        global_variables = sorted(scope_info.global_scope.symbols_in_frame)
        ```
        
        Once you have executed this code, `global_variables` will be bound to `['f', 'theta', 'y']`.
        
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Operating System :: OS Independent
Requires-Python: >=3.5
Description-Content-Type: text/markdown
