class documentation

class ModuleVistor(ast.NodeVisitor):

Known subclasses: pydoctor.zopeinterface.ZopeInterfaceModuleVisitor

View In Hierarchy

Undocumented

Method __init__ Undocumented
Method default Undocumented
Method visit_​Ann​Assign Undocumented
Method visit_​Assign Undocumented
Method visit_​Async​Function​Def Undocumented
Method visit_​Class​Def Undocumented
Method visit_​Expr Undocumented
Method visit_​Function​Def Undocumented
Method visit_​Import Process an import statement.
Method visit_​Import​From Undocumented
Method visit_​Module Undocumented
Instance Variable builder Undocumented
Instance Variable curr​Attr Undocumented
Instance Variable module Undocumented
Instance Variable new​Attr Undocumented
Instance Variable system Undocumented
Method ​_annotation​_from​_attrib No summary
Method ​_annotations​_from​_function No summary
Method _handle​Assignment Undocumented
Method _handle​Assignment​In​Class Undocumented
Method _handle​Assignment​In​Module Undocumented
Method _handle​Class​Var Undocumented
Method _handle​Constant Must be called after obj.setLineNumber() to have the right line number in the warning.
Method _handle​Docstring​Update Undocumented
Method _handle​Function​Def Undocumented
Method _handle​Instance​Var Undocumented
Method _handle​Module​Var Undocumented
Method _handle​Old​School​Method​Decoration Undocumented
Method _handle​Property​Def Undocumented
Method _import​All Handle a from <modname> import * statement.
Method _import​Names Handle a from <modname> import <names> statement.
Method ​_unstring​_annotation Replace all strings in the given expression by parsed versions. @return: The unstringed node. If parsing fails, an error is logged and the original node is returned.
Method _warns​Constant​Assigment​Override Undocumented
Method _warns​Constant​Re​Assigment​In​Instance Undocumented
def __init__(self, builder, module):

Undocumented

Parameters
builder:ASTBuilderUndocumented
module:model.ModuleUndocumented
def default(self, node):

Undocumented

Parameters
node:ast.ASTUndocumented
def visit_AnnAssign(self, node):

Undocumented

Parameters
node:ast.AnnAssignUndocumented
def visit_Assign(self, node):

Undocumented

Parameters
node:ast.AssignUndocumented
def visit_AsyncFunctionDef(self, node):

Undocumented

Parameters
node:ast.AsyncFunctionDefUndocumented
def visit_ClassDef(self, node):

Undocumented

Parameters
node:ast.ClassDefUndocumented
Returns
Optional[model.Class]Undocumented
def visit_Expr(self, node):

Undocumented

Parameters
node:ast.ExprUndocumented
def visit_FunctionDef(self, node):

Undocumented

Parameters
node:ast.FunctionDefUndocumented
def visit_Import(self, node):

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.

Parameters
node:ast.ImportUndocumented
def visit_ImportFrom(self, node):

Undocumented

Parameters
node:ast.ImportFromUndocumented
def visit_Module(self, node):

Undocumented

Parameters
node:ast.ModuleUndocumented
builder =

Undocumented

currAttr =

Undocumented

module =

Undocumented

newAttr =
system =

Undocumented

def _annotation_from_attrib(self, expr, ctx):
Get the type of an attr.ib definition.
Parameters
expr:ast.exprThe expression's AST.
ctx:model.DocumentableThe context in which this expression is evaluated.
Returns
Optional[ast.expr]A type annotation, or None if the expression is not an attr.ib definition or contains no type information.
def _annotations_from_function(self, func):
Get annotations from a function definition.
Parameters
func:Union[ast.AsyncFunctionDef, ast.FunctionDef]The function definition's AST.
Returns
Mapping[str, Optional[ast.expr]]Mapping from argument name to annotation. The name return is used for the return type. Unannotated arguments are omitted.
def _handleAssignment(self, targetNode, annotation, expr, lineno):

Undocumented

Parameters
target​Node:ast.exprUndocumented
annotation:Optional[ast.expr]Undocumented
expr:Optional[ast.expr]Undocumented
lineno:intUndocumented
def _handleAssignmentInClass(self, target, annotation, expr, lineno):

Undocumented

Parameters
target:strUndocumented
annotation:Optional[ast.expr]Undocumented
expr:Optional[ast.expr]Undocumented
lineno:intUndocumented
def _handleAssignmentInModule(self, target, annotation, expr, lineno):

Undocumented

Parameters
target:strUndocumented
annotation:Optional[ast.expr]Undocumented
expr:Optional[ast.expr]Undocumented
lineno:intUndocumented
def _handleClassVar(self, name, annotation, expr, lineno):

Undocumented

Parameters
name:strUndocumented
annotation:Optional[ast.expr]Undocumented
expr:Optional[ast.expr]Undocumented
lineno:intUndocumented
def _handleConstant(self, obj, value, lineno):
Must be called after obj.setLineNumber() to have the right line number in the warning.
Parameters
obj:model.AttributeUndocumented
value:Optional[ast.expr]Undocumented
lineno:intUndocumented
def _handleDocstringUpdate(self, targetNode, expr, lineno):

Undocumented

Parameters
target​Node:ast.exprUndocumented
expr:Optional[ast.expr]Undocumented
lineno:intUndocumented
def _handleFunctionDef(self, node, is_async):

Undocumented

Parameters
node:Union[ast.AsyncFunctionDef, ast.FunctionDef]Undocumented
is​_async:boolUndocumented
def _handleInstanceVar(self, name, annotation, expr, lineno):

Undocumented

Parameters
name:strUndocumented
annotation:Optional[ast.expr]Undocumented
expr:Optional[ast.expr]Undocumented
lineno:intUndocumented
def _handleModuleVar(self, target, annotation, expr, lineno):

Undocumented

Parameters
target:strUndocumented
annotation:Optional[ast.expr]Undocumented
expr:Optional[ast.expr]Undocumented
lineno:intUndocumented
def _handleOldSchoolMethodDecoration(self, target, expr):

Undocumented

Parameters
target:strUndocumented
expr:Optional[ast.expr]Undocumented
Returns
boolUndocumented
def _handlePropertyDef(self, node, docstring, lineno):

Undocumented

Parameters
node:Union[ast.AsyncFunctionDef, ast.FunctionDef]Undocumented
docstring:Optional[ast.Str]Undocumented
lineno:intUndocumented
Returns
model.AttributeUndocumented
def _importAll(self, modname):
Handle a from <modname> import * statement.
Parameters
modname:strUndocumented
def _importNames(self, modname, names):
Handle a from <modname> import <names> statement.
Parameters
modname:strUndocumented
names:Iterable[ast.alias]Undocumented
def _unstring_annotation(self, node):
Replace all strings in the given expression by parsed versions.
Parameters
node:ast.exprUndocumented
Returns
ast.exprThe unstringed node. If parsing fails, an error is logged and the original node is returned.
def _warnsConstantAssigmentOverride(self, obj, lineno_offset):

Undocumented

Parameters
obj:model.AttributeUndocumented
lineno​_offset:intUndocumented
def _warnsConstantReAssigmentInInstance(self, obj, lineno_offset=0):

Undocumented

Parameters
obj:model.AttributeUndocumented
lineno​_offset:intUndocumented