Module implementing a checker for import statements.
None |
ImportsChecker | Class implementing a checker for import statements. |
None |
Class implementing a checker for import statements.
Codes |
None |
ImportsChecker | Constructor |
__atoi | Private method to convert the given text to an integer number. |
__checkBannedImport | Private method to check import of banned modules. |
__checkBannedRelativeImports | Private method to check if relative imports are banned. |
__checkImportOrder | Private method to check the order of import statements. |
__checkLocalImports | Private method to check local imports. |
__checkUnnecessaryAlias | Private method to check unnecessary import aliases. |
__compileUnstructuredGlob | Private method to convert a pattern to a regex such that ".*" matches zero or more modules. |
__error | Private method to record an issue. |
__findErrorInAll | Private method to check the '__all__' node for errors. |
__findNodes | Private method to find all import and import from nodes of the given tree. |
__ignoreCode | Private method to check if the message code should be ignored. |
__isModuleBanned | Private method to check, if the given module name banned. |
__naturalKeys | Private method to generate keys for natural sorting. |
__naturally | Private method to sort the given list of names naturally. |
__tidyImports | Private method to check various other import related topics. |
getStandardModules | Public method to get a list of modules of the standard library. |
keyCallback | |
moduleKey | Public method to generate a key for the given module name. |
run | Public method to check the given source against miscellaneous conditions. |
sorted | Public method to sort the given list of names. |
None |
Constructor
Private method to convert the given text to an integer number.
Private method to check import of banned modules.
Private method to check if relative imports are banned.
Private method to check the order of import statements.
Private method to check local imports.
Private method to check unnecessary import aliases.
Private method to convert a pattern to a regex such that ".*" matches zero or more modules.
Private method to record an issue.
Private method to check the '__all__' node for errors.
Private method to find all import and import from nodes of the given tree.
Private method to check if the message code should be ignored.
Private method to check, if the given module name banned.
Private method to generate keys for natural sorting.
Private method to sort the given list of names naturally.
Note: Natural sorting maintains the sort order of numbers (i.e. [Q1, Q10, Q2] is sorted as [Q1, Q2, Q10] while the Python standard sort would yield [Q1, Q10, Q2].
Private method to check various other import related topics.
Public method to get a list of modules of the standard library.
Public method to generate a key for the given module name.
Public method to check the given source against miscellaneous conditions.
Public method to sort the given list of names.