class ImportsChecker(DeprecatedMixin, BaseChecker): (source)
BaseChecker for import statements. Checks for * external modules dependencies * relative / wildcard imports * cyclic imports * uses of deprecated modules * uses of modules instead of preferred modules
Method | __init__ |
Checker instances should have the linter as argument. |
Method | close |
Called before visiting project (i.e set of modules). |
Method | compute |
Undocumented |
Method | deprecated |
Callback returning the deprecated modules. |
Method | leave |
Undocumented |
Method | open |
Called before visiting project (i.e set of modules). |
Method | visit |
Undocumented |
Method | visit |
Triggered when an import statement is seen. |
Method | visit |
Triggered when a from statement is seen. |
Method | visit |
Store if current module is a package, i.e. an __init__ file. |
Class Variable | default |
Undocumented |
Class Variable | msgs |
Undocumented |
Class Variable | name |
Name of the provider. |
Class Variable | options |
Options provided by this provider. |
Instance Variable | import |
Undocumented |
Instance Variable | preferred |
Undocumented |
Instance Variable | reports |
Undocumented |
Static Method | _is |
Undocumented |
Method | _add |
Notify an imported module, used to analyze dependencies. |
Method | _check |
Undocumented |
Method | _check |
Checks imports of module `node` are grouped by category. |
Method | _check |
Undocumented |
Method | _check |
Check `node` import or importfrom node position is correct. |
Method | _check |
Check if the module has a preferred replacement. |
Method | _check |
Check if a module with the same name is already imported or aliased. |
Method | _check |
Undocumented |
Method | _check |
Check whether the import is made outside the module toplevel. |
Method | _check |
Undocumented |
Method | _external |
Return cached external dependencies information or build and cache them. |
Method | _filter |
Build the internal or the external dependency graph. |
Method | _get |
Undocumented |
Method | _import |
Undocumented |
Method | _internal |
Return cached internal dependencies information or build and cache them. |
Method | _record |
Record the package `node` imports from. |
Method | _report |
Write dependencies as a dot (graphviz) file. |
Method | _report |
Return a verbatim layout for displaying dependencies. |
Method | _wildcard |
Undocumented |
Instance Variable | _allow |
Undocumented |
Instance Variable | _allow |
Undocumented |
Instance Variable | _current |
Undocumented |
Instance Variable | _excluded |
Undocumented |
Instance Variable | _first |
Undocumented |
Instance Variable | _ignored |
Undocumented |
Instance Variable | _imports |
Undocumented |
Instance Variable | _module |
Undocumented |
Inherited from DeprecatedMixin
:
Method | check |
Checks if the class is deprecated. |
Method | check |
Checks if call the deprecated class. |
Method | check |
Executes the checker for the given node. |
Method | check |
Checks if the module is deprecated. |
Method | deprecated |
Callback returning the deprecated arguments of method/function. |
Method | deprecated |
Callback returning the deprecated classes of module. |
Method | deprecated |
Callback returning the deprecated decorators. |
Method | deprecated |
Callback returning the deprecated methods/functions. |
Method | visit |
Called when a :class:`nodes.Call` node is visited. |
Method | visit |
Triggered when a decorator statement is seen. |
Constant | DEPRECATED |
Undocumented |
Constant | DEPRECATED |
Undocumented |
Constant | DEPRECATED |
Undocumented |
Constant | DEPRECATED |
Undocumented |
Constant | DEPRECATED |
Undocumented |
Inherited from BaseChecker
(via DeprecatedMixin
):
Method | __eq__ |
Permit to assert Checkers are equal. |
Method | __gt__ |
Sorting of checkers. |
Method | __hash__ |
Make Checker hashable. |
Method | __repr__ |
Undocumented |
Method | __str__ |
This might be incomplete because multiple classes inheriting BaseChecker can have the same name. |
Method | add |
Undocumented |
Method | check |
Check the consistency of msgid. |
Method | create |
Undocumented |
Method | get |
Undocumented |
Method | get |
Undocumented |
Method | get |
Undocumented |
Method | reduce |
Undocumented |
Class Variable | enabled |
Undocumented |
Instance Variable | linter |
Undocumented |
Property | messages |
Undocumented |
Inherited from _ArgumentsProvider
(via DeprecatedMixin
, BaseChecker
):
Method | get |
DEPRECATED: Return the dictionary defining an option given its name. |
Method | level |
Undocumented |
Method | load |
DEPRECATED: Initialize the provider using default values. |
Method | option |
DEPRECATED: Get the config attribute corresponding to opt. |
Method | option |
DEPRECATED: Get the current value for the given option. |
Method | options |
DEPRECATED. |
Method | options |
DEPRECATED: Return an iterator on options grouped by section. |
Method | set |
DEPRECATED: Method called to set an option (registered in the options list). |
Class Variable | option |
Option groups of this provider and their descriptions. |
Property | config |
Undocumented |
Property | level |
Undocumented |
Instance Variable | _arguments |
The manager that will parse and register any options provided. |
Instance Variable | _level |
Undocumented |
pylint.checkers.BaseChecker.__init__
Checker instances should have the linter as argument.
((((((nodes.If|nodes.Expr)|nodes.Comprehension)|nodes.IfExp)|nodes.Assign)|nodes.AssignAttr)|nodes.TryExcept)|nodes.TryFinally
):
(source)
¶
Undocumented
((nodes.FunctionDef|nodes.While)|nodes.For)|nodes.ClassDef
):
(source)
¶
Undocumented
def _is_fallback_import(node:
ImportNode
, imports: list[ tuple[ ImportNode, str]]
) -> bool
:
(source)
¶
Undocumented
nodes.Module
) -> tuple[ list[ tuple[ ImportNode, str]], list[ tuple[ ImportNode, str]], list[ tuple[ ImportNode, str]]]
:
(source)
¶
Checks imports of module `node` are grouped by category. Imports must follow this order: standard, 3rd party, local
Check `node` import or importfrom node position is correct. Send a message if `node` comes before another instruction
ImportNode
, basename: str|None
= None, level: int|None
= None):
(source)
¶
Check if a module with the same name is already imported or aliased.
nodes.ImportFrom
, imported_module: nodes.Module|None
):
(source)
¶
Undocumented
def _external_dependencies_info(self) ->
defaultdict[ str, set[ str]]
:
(source)
¶
Return cached external dependencies information or build and cache them.
ImportNode
, modname: str|None
) -> nodes.Module|None
:
(source)
¶
Undocumented
def _internal_dependencies_info(self) ->
defaultdict[ str, set[ str]]
:
(source)
¶
Return cached internal dependencies information or build and cache them.
Section
, _: LinterStats
, _dummy: LinterStats|None
):
(source)
¶
Write dependencies as a dot (graphviz) file.
Section
, _: LinterStats
, _dummy: LinterStats|None
):
(source)
¶
Return a verbatim layout for displaying dependencies.