Variables checkers for Python code.
Class |
|
A simple class to handle consumed, to consume and scope type info of node locals. |
Class |
|
Store nodes and their consumption states. |
Class |
|
BaseChecker for variables. |
Class |
|
Reported by _check_consumer() and its sub-methods to determine the subsequent action to take in _undefined_and_used_before_checker(). |
Function | overridden |
Get overridden method if any. |
Function | register |
Undocumented |
Constant | BUILTIN |
Undocumented |
Constant | DICT |
Undocumented |
Constant | FUTURE |
Undocumented |
Constant | IGNORED |
Undocumented |
Constant | METACLASS |
Undocumented |
Constant | MSGS |
Undocumented |
Constant | NODES |
Undocumented |
Constant | SPECIAL |
Undocumented |
Constant | TYPING |
Undocumented |
Constant | TYPING |
Undocumented |
Function | _assigned |
Checks if name_node has corresponding assign statement in same scope. |
Function | _detect |
Detect that the given frames share a global scope. |
Function | _find |
Detect imports in the frame, with the required *name*. |
Function | _fix |
Try to fix imports with multiple dots, by returning a dictionary with the import names expanded. |
Function | _flattened |
Undocumented |
Function | _get |
Return extra information to add to the message for unpacking-non-sequence and unbalanced-tuple/dict-unpacking errors. |
Function | _has |
Undocumented |
Function | _import |
Undocumented |
Function | _infer |
Undocumented |
Function | _is |
Check if the name is a future import from another module. |
def overridden_method(klass:
nodes.LocalsDictNodeNG
, name: str|None
) -> nodes.FunctionDef|None
:
(source)
¶
Get overridden method if any.
Undocumented
Value |
|
Undocumented
Value |
|
Undocumented
Value |
|
Undocumented
Value |
|
nodes.Name
, frame: nodes.LocalsDictNodeNG
, defframe: nodes.LocalsDictNodeNG
) -> bool
:
(source)
¶
Detect that the given frames share a global scope. Two frames share a global scope when neither of them are hidden under a function scope, as well as any parent scope of them, until the root scope. In this case, depending from something defined later on will only work if guarded by a nested function definition. Example: class A: # B has the same global scope as `C`, leading to a NameError. # Return True to indicate a shared scope. class B(C): ... class C: ... Whereas this does not lead to a NameError: class A: def guard(): # Return False to indicate no scope sharing. class B(C): ... class C: ...
Detect imports in the frame, with the required *name*. Such imports can be considered assignments if they are not globals. Returns True if an import for the given name was found.
dict[ str, list[ nodes.NodeNG]]
) -> list[ tuple[ str, _base_nodes.ImportNode]]
:
(source)
¶
Try to fix imports with multiple dots, by returning a dictionary with the import names expanded. The function unflattens root imports, like 'xml' (when we have both 'xml.etree' and 'xml.sax'), to 'xml.etree' and 'xml.sax' respectively.
Return extra information to add to the message for unpacking-non-sequence and unbalanced-tuple/dict-unpacking errors.
nodes.Global|_base_nodes.ImportNode
, global_names: set[ str]
) -> bool
:
(source)
¶
Undocumented
nodes.Import
, name: str
) -> Generator[ InferenceResult, None, None]
:
(source)
¶
Undocumented