%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/mypy/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/mypy/freetree.py

"""Generic node traverser visitor"""

from mypy.traverser import TraverserVisitor
from mypy.nodes import Block, MypyFile


class TreeFreer(TraverserVisitor):
    def visit_block(self, block: Block) -> None:
        super().visit_block(block)
        block.body.clear()


def free_tree(tree: MypyFile) -> None:
    """Free all the ASTs associated with a module.

    This needs to be done recursively, since symbol tables contain
    references to definitions, so those won't be freed but we want their
    contents to be.
    """
    tree.accept(TreeFreer())
    tree.defs.clear()

Zerion Mini Shell 1.0