module documentation

Imports checkers for Python code.

Class ImportsChecker BaseChecker for import statements.
Function register Undocumented
Constant DEFAULT_KNOWN_THIRD_PARTY Undocumented
Constant DEFAULT_PREFERRED_MODULES Undocumented
Constant DEFAULT_STANDARD_LIBRARY Undocumented
Constant DEPRECATED_MODULES Undocumented
Constant MSGS Undocumented
Function _dependencies_graph Write dependencies as a dot (graphviz) file.
Function _get_first_import Return the node where [base.]<name> is imported or None if not found.
Function _ignore_import_failure Undocumented
Function _make_graph Generate a dependencies graph and add some information about it in the report's section.
Function _make_tree_defs Get a list of 2-uple (module, list_of_files_which_import_this_module), it will return a dictionary to represent this as a tree.
Function _qualified_names Split the names of the given module into subparts.
Function _repr_tree_defs Return a string which represents imports as a tree.
Type Alias _ImportTree Undocumented
def register(linter: PyLinter): (source)

Undocumented

DEFAULT_KNOWN_THIRD_PARTY: tuple[str, ...] = (source)

Undocumented

Value
('enchant')
DEFAULT_PREFERRED_MODULES: tuple = (source)

Undocumented

Value
()
DEFAULT_STANDARD_LIBRARY: tuple = (source)

Undocumented

Value
()
DEPRECATED_MODULES: dict = (source)

Undocumented

Value
{(0, 0, 0): set(['tkinter.tix', 'fpectl']),
 (3, 2, 0): set(['optparse']),
 (3, 3, 0): set(['xml.etree.cElementTree']),
 (3, 4, 0): set(['imp']),
 (3, 5, 0): set(['formatter']),
 (3, 6, 0): set(['asynchat', 'asyncore', 'smtpd']),
 (3, 7, 0): set(['macpath']),
...

Undocumented

Value
{'E0401': ('Unable to import %s',
           'import-error',
           'Used when pylint has been unable to import a module.',
           {'old_names': [('F0401', 'old-import-error')]}),
 'E0402': ('Attempted relative import beyond top-level package',
           'relative-beyond-top-level',
           'Used when a relative import tries to access too many levels in the c
...
def _dependencies_graph(filename: str, dep_info: dict[str, set[str]]) -> str: (source)

Write dependencies as a dot (graphviz) file.

def _get_first_import(node: ImportNode, context: nodes.LocalsDictNodeNG, name: str, base: str|None, level: int|None, alias: str|None) -> tuple[(nodes.Import|nodes.ImportFrom)|None, str|None]: (source)

Return the node where [base.]<name> is imported or None if not found.

def _ignore_import_failure(node: ImportNode, modname: str|None, ignored_modules: Sequence[str]) -> bool: (source)

Undocumented

def _make_graph(filename: str, dep_info: dict[str, set[str]], sect: Section, gtype: str): (source)

Generate a dependencies graph and add some information about it in the report's section.

def _make_tree_defs(mod_files_list: ItemsView[str, set[str]]) -> _ImportTree: (source)

Get a list of 2-uple (module, list_of_files_which_import_this_module), it will return a dictionary to represent this as a tree.

def _qualified_names(modname: str|None) -> list[str]: (source)

Split the names of the given module into subparts. For example, _qualified_names('pylint.checkers.ImportsChecker') returns ['pylint', 'pylint.checkers', 'pylint.checkers.ImportsChecker']

def _repr_tree_defs(data: _ImportTree, indent_str: str|None = None) -> str: (source)

Return a string which represents imports as a tree.

_ImportTree = (source)

Undocumented

Value
Dict[str, Union[List[Dict[str, Any]], List[str]]]