init
This commit is contained in:
commit
38355d2442
9083 changed files with 1225834 additions and 0 deletions
21
.venv/lib/python3.8/site-packages/mypy/freetree.py
Normal file
21
.venv/lib/python3.8/site-packages/mypy/freetree.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"""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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue