eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.ConstantModificationVisitor

Module implementing a node visitor to check for modifications of constants.

Global Attributes

None

Classes

ConstantModificationVisitor Class implementing a node visitor to check for modifications of constants.

Functions

None


ConstantModificationVisitor

Class implementing a node visitor to check for modifications of constants.

Derived from

None

Class Attributes

DEFAULT_NON_MODIFYING_METHODS

Class Methods

None

Methods

ConstantModificationVisitor Constructor
__checkAssignment Private method to check assignment statements.
__checkAugAssignment Private method to check augmented assignment statements.
__checkCall Private method to check function call statements.
__currentScope Private method to return the name of the current scope.
__currentScopeMsg Private method to return the name of the current scope for the error message.
visit Public method to traverse the node tree.

Static Methods

None

ConstantModificationVisitor (Constructor)

ConstantModificationVisitor()

Constructor

ConstantModificationVisitor.__checkAssignment

__checkAssignment(node)

Private method to check assignment statements.

node (ast.Assign or ast.AnnAssign)
reference to the node to be checked

ConstantModificationVisitor.__checkAugAssignment

__checkAugAssignment(node)

Private method to check augmented assignment statements.

node (ast.AugAssign)
reference to the node to be checked

ConstantModificationVisitor.__checkCall

__checkCall(node)

Private method to check function call statements.

node (ast.Call)
reference to the node to be checked

ConstantModificationVisitor.__currentScope

__currentScope()

Private method to return the name of the current scope.

Return:
name of the current scope
Return Type:
str

ConstantModificationVisitor.__currentScopeMsg

__currentScopeMsg()

Private method to return the name of the current scope for the error message.

Return:
current scope for the error message
Return Type:
str

ConstantModificationVisitor.visit

visit(node)

Public method to traverse the node tree.

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