class documentation

Undocumented

Method __init__ Undocumented
Method depart_AsyncFunctionDef Undocumented
Method depart_ClassDef Undocumented
Method depart_FunctionDef Undocumented
Method depart_Module Undocumented
Method visit_AnnAssign Undocumented
Method visit_Assign Undocumented
Method visit_AsyncFunctionDef Undocumented
Method visit_AugAssign Undocumented
Method visit_ClassDef Undocumented
Method visit_Expr Undocumented
Method visit_FunctionDef Undocumented
Method visit_If Undocumented
Method visit_Import Process an import statement.
Method visit_ImportFrom Undocumented
Method visit_Module Undocumented
Instance Variable builder Undocumented
Instance Variable module Undocumented
Instance Variable system Undocumented
Class Method _handleConstant Undocumented
Static Method _setAttributeAnnotation Undocumented
Static Method _storeAttrValue Undocumented
Static Method _tweakConstantAnnotation Undocumented
Method _annotations_from_function Get annotations from a function definition.
Method _getCurrentModuleExports Undocumented
Method _handleAssignment Undocumented
Method _handleAssignmentInClass Undocumented
Method _handleAssignmentInModule Undocumented
Method _handleClassVar Undocumented
Method _handleDocstringUpdate Undocumented
Method _handleFunctionDef Undocumented
Method _handleInstanceVar Undocumented
Method _handleModuleVar Undocumented
Method _handleOldSchoolMethodDecoration Undocumented
Method _handlePropertyDef Undocumented
Method _handleReExport Move re-exported objects into current module.
Method _importAll Handle a from <modname> import * statement.
Method _importNames Handle a from <modname> import <names> statement.
Method _infer_attr_annotations Undocumented
Method _storeCurrentAttr Undocumented

Inherited from NodeVisitor:

Class Method get_children Returns the nested nodes in the body of a node.
Method generic_visit Helper method to visit a node by calling visit() on each child of the node. This is useful because this vistitor only visits statements inside .body attribute.

Inherited from PartialVisitor (via NodeVisitor):

Method unknown_departure Called before exiting unknown object types.
Method unknown_visit Called when entering unknown object types.

Inherited from Visitor (via NodeVisitor, PartialVisitor):

Exception SkipChildren Do not visit any children of the current node. The current node's siblings and depart_... method are not affected.
Exception SkipDeparture Do not call the current node's depart_... method. The current node's children and siblings are not affected.
Exception SkipNode Do not visit the current node's children, and do not call the current node's depart_... method.
Exception SkipSiblings Do not visit any more siblings (to the right) of the current node. The current node's children and its depart_... method are not affected.
Method depart Extend the base depart with extensions.
Method visit Extend the base visit with extensions.
Method walk Traverse a tree of objects, calling the visit() method of visitor when entering each node. (The walkabout() method is similar, except it also calls the depart() method before exiting each objects.)
Method walkabout Perform a tree traversal similarly to walk() (which see), except also call the depart() method before exiting each node.
Instance Variable extensions Undocumented
Exception _TreePruningException Base class for Visitor-related tree pruning exceptions.
def __init__(self, builder: ASTBuilder, module: model.Module): (source)

Undocumented

def depart_AsyncFunctionDef(self, node: ast.AsyncFunctionDef): (source)

Undocumented

def depart_ClassDef(self, node: ast.ClassDef): (source)

Undocumented

def depart_FunctionDef(self, node: ast.FunctionDef): (source)

Undocumented

def depart_Module(self, node: ast.Module): (source)

Undocumented

def visit_AnnAssign(self, node: ast.AnnAssign): (source)

Undocumented

def visit_Assign(self, node: ast.Assign): (source)

Undocumented

def visit_AsyncFunctionDef(self, node: ast.AsyncFunctionDef): (source)

Undocumented

def visit_AugAssign(self, node: ast.AugAssign): (source)

Undocumented

def visit_ClassDef(self, node: ast.ClassDef): (source)

Undocumented

def visit_Expr(self, node: ast.Expr): (source)

Undocumented

def visit_FunctionDef(self, node: ast.FunctionDef): (source)

Undocumented

def visit_If(self, node: ast.If): (source)

Undocumented

def visit_Import(self, node: ast.Import): (source)

Process an import statement.

The grammar for the statement is roughly:

mod_as := DOTTEDNAME ['as' NAME] import_stmt := 'import' mod_as (',' mod_as)*

and this is translated into a node which is an instance of Import wih an attribute 'names', which is in turn a list of 2-tuples (dotted_name, as_name) where as_name is None if there was no 'as foo' part of the statement.

def visit_ImportFrom(self, node: ast.ImportFrom): (source)

Undocumented

def visit_Module(self, node: ast.Module): (source)

Undocumented

Undocumented

Undocumented

Undocumented

@classmethod
def _handleConstant(cls, obj: model.Attribute, annotation: ast.expr | None, value: ast.expr | None, lineno: int, defaultKind: model.DocumentableKind): (source)

Undocumented

@staticmethod
def _setAttributeAnnotation(obj: model.Attribute, annotation: ast.expr | None): (source)

Undocumented

@staticmethod
def _storeAttrValue(obj: model.Attribute, new_value: ast.expr | None, augassign: ast.operator | None = None): (source)

Undocumented

@staticmethod
def _tweakConstantAnnotation(obj: model.Attribute, annotation: ast.expr | None, value: ast.expr | None, lineno: int): (source)

Undocumented

def _annotations_from_function(self, func: ast.AsyncFunctionDef | ast.FunctionDef) -> Mapping[str, ast.expr | None]: (source)

Get annotations from a function definition.

Parameters
func:ast.AsyncFunctionDef | ast.FunctionDefThe function definition's AST.
Returns
Mapping[str, ast.expr | None]Mapping from argument name to annotation. The name return is used for the return type. Unannotated arguments are omitted.
def _getCurrentModuleExports(self) -> Collection[str]: (source)

Undocumented

def _handleAssignment(self, targetNode: ast.expr, annotation: ast.expr | None, expr: ast.expr | None, lineno: int, augassign: ast.operator | None = None): (source)

Undocumented

def _handleAssignmentInClass(self, target: str, annotation: ast.expr | None, expr: ast.expr | None, lineno: int, augassign: ast.operator | None): (source)

Undocumented

def _handleAssignmentInModule(self, target: str, annotation: ast.expr | None, expr: ast.expr | None, lineno: int, augassign: ast.operator | None): (source)

Undocumented

def _handleClassVar(self, name: str, annotation: ast.expr | None, expr: ast.expr | None, lineno: int, augassign: ast.operator | None): (source)

Undocumented

def _handleDocstringUpdate(self, targetNode: ast.expr, expr: ast.expr | None, lineno: int): (source)

Undocumented

def _handleFunctionDef(self, node: ast.AsyncFunctionDef | ast.FunctionDef, is_async: bool): (source)

Undocumented

def _handleInstanceVar(self, name: str, annotation: ast.expr | None, expr: ast.expr | None, lineno: int): (source)

Undocumented

def _handleModuleVar(self, target: str, annotation: ast.expr | None, expr: ast.expr | None, lineno: int, augassign: ast.operator | None): (source)

Undocumented

def _handleOldSchoolMethodDecoration(self, target: str, expr: ast.expr | None) -> bool: (source)

Undocumented

def _handlePropertyDef(self, node: ast.AsyncFunctionDef | ast.FunctionDef, doc_node: Str | None, lineno: int) -> model.Attribute: (source)

Undocumented

def _handleReExport(self, curr_mod_exports: Collection[str], origin_name: str, as_name: str, origin_module: model.Module) -> bool: (source)

Move re-exported objects into current module.

Returns
boolTrue if the imported name has been sucessfully re-exported.
def _importAll(self, modname: str): (source)

Handle a from <modname> import * statement.

def _importNames(self, modname: str, names: Iterable[ast.alias]): (source)

Handle a from <modname> import <names> statement.

def _infer_attr_annotations(self, scope: model.Documentable): (source)

Undocumented

def _storeCurrentAttr(self, obj: model.Attribute, augassign: object | None = None): (source)

Undocumented