eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyChecker
Module implementing the checker for simplifying Python code.
Global Attributes
Classes
SimplifyChecker |
Class implementing a checker for to help simplifying Python code. |
Functions
SimplifyChecker
Class implementing a checker for to help simplifying Python code.
Derived from
None
Class Attributes
Class Methods
Methods
SimplifyChecker |
Constructor |
__addMeta |
Private method to amend the nodes of the given AST tree with backward and forward references. |
__error |
Private method to record an issue. |
__ignoreCode |
Private method to check if the message code should be ignored. |
run |
Public method to check the given source against functions to be replaced by 'pathlib' equivalents. |
Static Methods
SimplifyChecker (Constructor)
SimplifyChecker(source, filename, tree, selected, ignored, expected, repeat)
Constructor
- source (list of str)
-
source code to be checked
- filename (str)
-
name of the source file
- tree (ast.Module)
-
AST tree of the source code
- selected (list of str)
-
list of selected codes
- ignored (list of str)
-
list of codes to be ignored
- expected (list of str)
-
list of expected codes
- repeat (bool)
-
flag indicating to report each occurrence of a code
SimplifyChecker.__addMeta
__addMeta(root, level=0)
Private method to amend the nodes of the given AST tree with backward and
forward references.
- root (ast.AST)
-
reference to the root node of the tree
- level (int (optional))
-
nesting level (defaults to 0)
SimplifyChecker.__error
__error(lineNumber, offset, code, *args)
Private method to record an issue.
- lineNumber (int)
-
line number of the issue
- offset (int)
-
position within line of the issue
- code (str)
-
message code
- args (list)
-
arguments for the message
SimplifyChecker.__ignoreCode
__ignoreCode(code)
Private method to check if the message code should be ignored.
- code (str)
-
message code to check for
- Return:
-
flag indicating to ignore the given code
- Return Type:
-
bool
SimplifyChecker.run
run()
Public method to check the given source against functions
to be replaced by 'pathlib' equivalents.