eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.SysVersionVisitor

Module implementing a node visitor to check the use of sys.version and sys.version_info.

Global Attributes

None

Classes

SysVersionVisitor Class implementing a node visitor to check the use of sys.version and sys.version_info.

Functions

None


SysVersionVisitor

Class implementing a node visitor to check the use of sys.version and sys.version_info.

Note: This class is modeled after flake8-2020 v1.8.1.

Derived from

ast.NodeVisitor

Class Attributes

None

Class Methods

None

Methods

SysVersionVisitor Constructor
__isSys Private method to check for a reference to sys attribute.
__isSysVersionUpperSlice Private method to check the upper slice of sys.version.
visit_Attribute Public method to handle an attribute.
visit_Compare Public method to handle a comparison.
visit_ImportFrom Public method to handle a from ...
visit_Name Public method to handle an name.
visit_Subscript Public method to handle a subscript.

Static Methods

None

SysVersionVisitor (Constructor)

SysVersionVisitor()

Constructor

SysVersionVisitor.__isSys

__isSys(attr, node)

Private method to check for a reference to sys attribute.

attr (str)
attribute name
node (ast.Node)
reference to the node to be checked
Return:
flag indicating a match
Return Type:
bool

SysVersionVisitor.__isSysVersionUpperSlice

__isSysVersionUpperSlice(node, n)

Private method to check the upper slice of sys.version.

node (ast.Node)
reference to the node to be checked
n (int)
slice value to check against
Return:
flag indicating a match
Return Type:
bool

SysVersionVisitor.visit_Attribute

visit_Attribute(node)

Public method to handle an attribute.

node (ast.Attribute)
reference to the node to be processed

SysVersionVisitor.visit_Compare

visit_Compare(node)

Public method to handle a comparison.

node (ast.Compare)
reference to the node to be processed

SysVersionVisitor.visit_ImportFrom

visit_ImportFrom(node)

Public method to handle a from ... import ... statement.

node (ast.ImportFrom)
reference to the node to be processed

SysVersionVisitor.visit_Name

visit_Name(node)

Public method to handle an name.

node (ast.Name)
reference to the node to be processed

SysVersionVisitor.visit_Subscript

visit_Subscript(node)

Public method to handle a subscript.

node (ast.Subscript)
reference to the node to be processed
Up