basics
¶
Module Contents¶
Classes¶
The low-level base visitor class for traversing a CST. This should be used in |
|
The low-level base visitor class for traversing a CST and creating an |
Attributes¶
- class basics.TypingCollector¶
Bases:
libcst.CSTVisitor
The low-level base visitor class for traversing a CST. This should be used in conjunction with the
visit()
method on aCSTNode
to visit each element in a tree starting with that node. UnlikeCSTTransformer
, instances of this class cannot modify the tree.When visiting nodes using a
CSTVisitor
, the return value ofvisit()
will equal the passed in tree.- visit_ClassDef(self, node: libcst.ClassDef) Optional[bool] ¶
- Parameters
node (libcst.ClassDef) –
- Return type
Optional[bool]
- leave_ClassDef(self, node: libcst.ClassDef) None ¶
- Parameters
node (libcst.ClassDef) –
- Return type
None
- class basics.TypingTransformer(annotations)¶
Bases:
libcst.CSTTransformer
The low-level base visitor class for traversing a CST and creating an updated copy of the original CST. This should be used in conjunction with the
visit()
method on aCSTNode
to visit each element in a tree starting with that node, and possibly returning a new node in its place.When visiting nodes using a
CSTTransformer
, the return value ofvisit()
will be a new tree with any changes made inon_leave()
calls reflected in its children.- visit_ClassDef(self, node: libcst.ClassDef) Optional[bool] ¶
- Parameters
node (libcst.ClassDef) –
- Return type
Optional[bool]
- leave_ClassDef(self, original_node: libcst.ClassDef, updated_node: libcst.ClassDef) libcst.CSTNode ¶
- Parameters
original_node (libcst.ClassDef) –
updated_node (libcst.ClassDef) –
- Return type
libcst.CSTNode
- visit_FunctionDef(self, node: libcst.FunctionDef) Optional[bool] ¶
- Parameters
node (libcst.FunctionDef) –
- Return type
Optional[bool]
- leave_FunctionDef(self, original_node: libcst.FunctionDef, updated_node: libcst.FunctionDef) libcst.CSTNode ¶
- Parameters
original_node (libcst.FunctionDef) –
updated_node (libcst.FunctionDef) –
- Return type
libcst.CSTNode
- basics.source_tree¶
- basics.info_tree¶
- basics.visitor¶
- basics.transformer¶
- basics.modified_tree¶