module documentation

Try to find more bugs in the code using astroid inference capabilities.

Class IterableChecker Checks for non-iterables used in an iterable context.
Class TypeChecker Try to find bugs in the code using type inference.
Class VERSION_COMPATIBLE_OVERLOAD Undocumented
Function register Undocumented
Constant ASYNCIO_COROUTINE Undocumented
Constant BUILTIN_TUPLE Undocumented
Constant MSGS Undocumented
Constant SEQUENCE_TYPES Undocumented
Constant STR_FORMAT Undocumented
Constant TYPE_ANNOTATION_NODES_TYPES Undocumented
Constant VERSION_COMPATIBLE_OVERLOAD_SENTINEL Undocumented
Type Alias CallableObjects Undocumented
Function _ Undocumented
Function _determine_callable Undocumented
Function _emit_no_member Try to see if no-member should be emitted for the given owner.
Function _enum_has_attribute Undocumented
Function _flatten_container Undocumented
Function _get_all_attribute_assignments Undocumented
Function _has_parent_of_type Check if the given node has a parent of the given type.
Function _infer_from_metaclass_constructor Try to infer what the given *func* constructor is building.
Function _is_c_extension Undocumented
Function _is_invalid_isinstance_type Undocumented
Function _is_invalid_metaclass Undocumented
Function _is_owner_ignored Check if the given owner should be ignored.
Function _missing_member_hint Undocumented
Function _no_context_variadic Verify if the given call node has variadic nodes without context.
Function _no_context_variadic_keywords Undocumented
Function _no_context_variadic_positional Undocumented
Function _node_names Undocumented
Function _similar_names Given an owner and a name, try to find similar names.
Function _string_distance Undocumented
Function _unflatten Undocumented
Type Variable _T Undocumented
def register(linter: PyLinter): (source)

Undocumented

ASYNCIO_COROUTINE: str = (source)

Undocumented

Value
'asyncio.coroutines.coroutine'
BUILTIN_TUPLE: str = (source)

Undocumented

Value
'builtins.tuple'

Undocumented

Value
{'E1101': ('%s %r has no %r member%s',
           'no-member',
           'Used when a variable is accessed for a nonexistent member.',
           {'old_names': [('E1103', 'maybe-no-member')]}),
 'I1101': ('%s %r has no %r member%s, but source is unavailable. Consider adding
 this module to extension-pkg-allow-list if you want to perform analysis based o
n run-time introspection of living objects.',
...
SEQUENCE_TYPES: set[str] = (source)

Undocumented

Value
set(['str',
     'unicode',
     'list',
     'tuple',
     'bytearray',
     'xrange',
     'range',
...
STR_FORMAT: set[str] = (source)

Undocumented

Value
set(['builtins.str.format'])
TYPE_ANNOTATION_NODES_TYPES = (source)

Undocumented

Value
(nodes.AnnAssign, nodes.Arguments, nodes.FunctionDef)
VERSION_COMPATIBLE_OVERLOAD_SENTINEL = (source)

Undocumented

Value
VERSION_COMPATIBLE_OVERLOAD()
CallableObjects = (source)

Undocumented

Value
Union[bases.BoundMethod, bases.UnboundMethod, nodes.FunctionDef, nodes.Lambda, nodes.ClassDef
]
@_node_names.register(nodes.ClassDef)
@_node_names.register(astroid.Instance)
def _(node: nodes.ClassDef|bases.Instance) -> Iterable[str]: (source)

Undocumented

def _determine_callable(callable_obj: nodes.NodeNG) -> tuple[CallableObjects, int, str]: (source)

Undocumented

def _emit_no_member(node: (nodes.Attribute|nodes.AssignAttr)|nodes.DelAttr, owner: InferenceResult, owner_name: str|None, mixin_class_rgx: Pattern[str], ignored_mixins: bool = True, ignored_none: bool = True) -> bool: (source)

Try to see if no-member should be emitted for the given owner. The following cases are ignored: * the owner is a function and it has decorators. * the owner is an instance and it has __getattr__, __getattribute__ implemented * the module is explicitly ignored from no-member checks * the owner is a class and the name can be found in its metaclass. * The access node is protected by an except handler, which handles AttributeError, Exception or bare except. * The node is guarded behind and `IF` or `IFExp` node

def _enum_has_attribute(owner: astroid.Instance|nodes.ClassDef, node: nodes.Attribute) -> bool: (source)

Undocumented

def _flatten_container(iterable: Iterable[_T]) -> Iterator[_T]: (source)

Undocumented

def _get_all_attribute_assignments(node: nodes.FunctionDef, name: str|None = None) -> set[str]: (source)

Undocumented

def _has_parent_of_type(node: nodes.Call, node_type: nodes.Keyword|nodes.Starred, statement: nodes.Statement) -> bool: (source)

Check if the given node has a parent of the given type.

def _infer_from_metaclass_constructor(cls: nodes.ClassDef, func: nodes.FunctionDef) -> InferenceResult|None: (source)

Try to infer what the given *func* constructor is building. :param astroid.FunctionDef func: A metaclass constructor. Metaclass definitions can be functions, which should accept three arguments, the name of the class, the bases of the class and the attributes. The function could return anything, but usually it should be a proper metaclass. :param astroid.ClassDef cls: The class for which the *func* parameter should generate a metaclass. :returns: The class generated by the function or None, if we couldn't infer it. :rtype: astroid.ClassDef

def _is_c_extension(module_node: InferenceResult) -> bool: (source)

Undocumented

def _is_invalid_isinstance_type(arg: nodes.NodeNG) -> bool: (source)

Undocumented

def _is_invalid_metaclass(metaclass: nodes.ClassDef) -> bool: (source)

Undocumented

def _is_owner_ignored(owner: SuccessfulInferenceResult, attrname: str|None, ignored_classes: Iterable[str], ignored_modules: Iterable[str]) -> bool: (source)

Check if the given owner should be ignored. This will verify if the owner's module is in *ignored_modules* or the owner's module fully qualified name is in *ignored_modules* or if the *ignored_modules* contains a pattern which catches the fully qualified name of the module. Also, similar checks are done for the owner itself, if its name matches any name from the *ignored_classes* or if its qualified name can be found in *ignored_classes*.

def _missing_member_hint(owner: SuccessfulInferenceResult, attrname: str|None, distance_threshold: int, max_choices: int) -> str: (source)

Undocumented

def _no_context_variadic(node: nodes.Call, variadic_name: str|None, variadic_type: nodes.Keyword|nodes.Starred, variadics: list[nodes.Keyword|nodes.Starred]) -> bool: (source)

Verify if the given call node has variadic nodes without context. This is a workaround for handling cases of nested call functions which don't have the specific call context at hand. Variadic arguments (variable positional arguments and variable keyword arguments) are inferred, inherently wrong, by astroid as a Tuple, respectively a Dict with empty elements. This can lead pylint to believe that a function call receives too few arguments.

def _no_context_variadic_keywords(node: nodes.Call, scope: nodes.Lambda) -> bool: (source)

Undocumented

def _no_context_variadic_positional(node: nodes.Call, scope: nodes.Lambda) -> bool: (source)

Undocumented

def _similar_names(owner: SuccessfulInferenceResult, attrname: str|None, distance_threshold: int, max_choices: int) -> list[str]: (source)

Given an owner and a name, try to find similar names. The similar names are searched given a distance metric and only a given number of choices will be returned.

def _string_distance(seq1: str, seq2: str) -> int: (source)

Undocumented

def _unflatten(iterable: Iterable[_T]) -> Iterator[_T]: (source)

Undocumented

Undocumented

Value
TypeVar('_T')