eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor

Module implementing a node visitor for bytes and str instances.

Global Attributes

None

Classes

TextVisitor Class implementing a node visitor for bytes and str instances.

Functions

None


TextVisitor

Class implementing a node visitor for bytes and str instances.

It tries to detect docstrings as string of the first expression of each module, class or function.

Derived from

ast.NodeVisitor

Class Attributes

None

Class Methods

None

Methods

TextVisitor Constructor
__addNode Private method to add a node to our list of nodes.
__visitBody Private method to traverse the body of the node manually.
__visitDefinition Private method handling class and function definitions.
visit_AsyncFunctionDef Public method to handle an asynchronous function definition.
visit_Call Public method to handle a function call.
visit_ClassDef Public method to handle a class definition.
visit_Constant Public method to handle constant nodes.
visit_FunctionDef Public method to handle a function definition.
visit_Module Public method to handle a module.

Static Methods

None

TextVisitor (Constructor)

TextVisitor()

Constructor

TextVisitor.__addNode

__addNode(node)

Private method to add a node to our list of nodes.

node (ast.AST)
reference to the node to add

TextVisitor.__visitBody

__visitBody(node)

Private method to traverse the body of the node manually.

If the first node is an expression which contains a string or bytes it marks that as a docstring.

node (ast.AST)
reference to the node to traverse

TextVisitor.__visitDefinition

__visitDefinition(node)

Private method handling class and function definitions.

node (ast.FunctionDef, ast.AsyncFunctionDef or ast.ClassDef)
reference to the node to handle

TextVisitor.visit_AsyncFunctionDef

visit_AsyncFunctionDef(node)

Public method to handle an asynchronous function definition.

node (ast.AsyncFunctionDef)
reference to the node to handle

TextVisitor.visit_Call

visit_Call(node)

Public method to handle a function call.

node (ast.Call)
reference to the node to handle

TextVisitor.visit_ClassDef

visit_ClassDef(node)

Public method to handle a class definition.

node (ast.ClassDef)
reference to the node to handle

TextVisitor.visit_Constant

visit_Constant(node)

Public method to handle constant nodes.

node (ast.Constant)
reference to the bytes node

TextVisitor.visit_FunctionDef

visit_FunctionDef(node)

Public method to handle a function definition.

node (ast.FunctionDef)
reference to the node to handle

TextVisitor.visit_Module

visit_Module(node)

Public method to handle a module.

node (ast.Module)
reference to the node to handle
Up