class documentation

class VariableCommentPicker(ast.NodeVisitor):

View In Hierarchy

Python source code parser to pick up variable comments.
Method __init__ Undocumented
Method add​_entry Undocumented
Method add​_final​_entry Undocumented
Method add​_overload​_entry Undocumented
Method add​_variable​_annotation Undocumented
Method add​_variable​_comment Undocumented
Method get​_line Returns specified line.
Method get​_qualname​_for Get qualified name for given object as a list of string(s).
Method get​_self Returns the name of the first argument if in a function.
Method is​_final Undocumented
Method is​_overload Undocumented
Method visit Updates self.previous to the given node.
Method visit_​Ann​Assign Handles AnnAssign node and pick up a variable comment.
Method visit_​Assign Handles Assign node and pick up a variable comment.
Method visit_​Async​Function​Def Handles AsyncFunctionDef node and set context.
Method visit_​Class​Def Handles ClassDef node and set context.
Method visit_​Expr Handles Expr node and pick up a comment if string.
Method visit_​Function​Def Handles FunctionDef node and set context.
Method visit_​Import Handles Import node and record the order of definitions.
Method visit_​Import​From Handles Import node and record the order of definitions.
Method visit_​Try Handles Try node and processes body and else-clause.
Instance Variable annotations Undocumented
Instance Variable buffers Undocumented
Instance Variable comments Undocumented
Instance Variable context Undocumented
Instance Variable counter Undocumented
Instance Variable current​_classes Undocumented
Instance Variable current​_function Undocumented
Instance Variable deforders Undocumented
Instance Variable encoding Undocumented
Instance Variable finals Undocumented
Instance Variable overloads Undocumented
Instance Variable previous Undocumented
Instance Variable typing Undocumented
Instance Variable typing​_final Undocumented
Instance Variable typing​_overload Undocumented
def __init__(self, buffers, encoding):

Undocumented

Parameters
buffers:List[str]Undocumented
encoding:strUndocumented
def add_entry(self, name):

Undocumented

Parameters
name:strUndocumented
def add_final_entry(self, name):

Undocumented

Parameters
name:strUndocumented
def add_overload_entry(self, func):

Undocumented

Parameters
func:ast.FunctionDefUndocumented
def add_variable_annotation(self, name, annotation):

Undocumented

Parameters
name:strUndocumented
annotation:ast.ASTUndocumented
def add_variable_comment(self, name, comment):

Undocumented

Parameters
name:strUndocumented
comment:strUndocumented
def get_line(self, lineno):
Returns specified line.
Parameters
lineno:intUndocumented
Returns
strUndocumented
def get_qualname_for(self, name):
Get qualified name for given object as a list of string(s).
Parameters
name:strUndocumented
Returns
Optional[List[str]]Undocumented
def get_self(self):
Returns the name of the first argument if in a function.
Returns
Optional[ast.arg]Undocumented
def is_final(self, decorators):

Undocumented

Parameters
decorators:List[ast.expr]Undocumented
Returns
boolUndocumented
def is_overload(self, decorators):

Undocumented

Parameters
decorators:List[ast.expr]Undocumented
Returns
boolUndocumented
def visit(self, node):
Updates self.previous to the given node.
Parameters
node:ast.ASTUndocumented
def visit_AnnAssign(self, node):
Handles AnnAssign node and pick up a variable comment.
Parameters
node:ast.AnnAssignUndocumented
def visit_Assign(self, node):
Handles Assign node and pick up a variable comment.
Parameters
node:ast.AssignUndocumented
def visit_AsyncFunctionDef(self, node):
Handles AsyncFunctionDef node and set context.
Parameters
node:ast.AsyncFunctionDefUndocumented
def visit_ClassDef(self, node):
Handles ClassDef node and set context.
Parameters
node:ast.ClassDefUndocumented
def visit_Expr(self, node):
Handles Expr node and pick up a comment if string.
Parameters
node:ast.ExprUndocumented
def visit_FunctionDef(self, node):
Handles FunctionDef node and set context.
Parameters
node:ast.FunctionDefUndocumented
def visit_Import(self, node):
Handles Import node and record the order of definitions.
Parameters
node:ast.ImportUndocumented
def visit_ImportFrom(self, node):
Handles Import node and record the order of definitions.
Parameters
node:ast.ImportFromUndocumented
def visit_Try(self, node):

Handles Try node and processes body and else-clause.

Note

pycode parser ignores objects definition in except-clause.

Parameters
node:ast.TryUndocumented
annotations: Dict[Tuple[str, str], str] =

Undocumented

buffers =

Undocumented

comments: Dict[Tuple[str, str], str] =

Undocumented

context: List[str] =

Undocumented

counter =

Undocumented

current_classes: List[str] =

Undocumented

current_function =

Undocumented

deforders: Dict[str, int] =

Undocumented

encoding =

Undocumented

finals: List[str] =

Undocumented

overloads: Dict[str, List[Signature]] =

Undocumented

previous =

Undocumented

typing =

Undocumented

typing_final =

Undocumented

typing_overload: Optional[str] =

Undocumented