module documentation

This module contains the classes for "scoped" node, i.e. which are opening a new local scope in the language definition : Module, ClassDef, FunctionDef (and Lambda, GeneratorExp, DictComp and SetComp to some extent).

Function clean_duplicates_mro Undocumented
Function clean_typing_generic_mro A class can inherit from typing.Generic directly, as base, and as base of bases. The merged MRO must however only contain the last entry. To prepare for _c3_merge, remove some typing.Generic entries from sequences if multiple are present.
Constant BUILTIN_DESCRIPTORS Undocumented
Constant EXCEPTION_BASE_CLASSES Undocumented
Constant ITER_METHODS Undocumented
Variable objects Undocumented
Function _c3_merge Merges MROs in *sequences* to a single MRO using the C3 algorithm.
Function _class_type return a ClassDef node type to differ metaclass and exception from 'regular' classes
Function _infer_decorator_callchain Detect decorator call chaining and see if the end result is a static or a classmethod.
Function _rec_get_names return a list of all argument names
Type Variable _T Undocumented
def clean_duplicates_mro(sequences, cls, context): (source)

Undocumented

def clean_typing_generic_mro(sequences: list[list[ClassDef]]): (source)

A class can inherit from typing.Generic directly, as base, and as base of bases. The merged MRO must however only contain the last entry. To prepare for _c3_merge, remove some typing.Generic entries from sequences if multiple are present. This method will check if Generic is in inferred_bases and also part of bases_mro. If true, remove it from inferred_bases as well as its entry the bases_mro. Format sequences: [[self]] + bases_mro + [inferred_bases]

BUILTIN_DESCRIPTORS = (source)

Undocumented

Value
frozenset(set(['classmethod',
               'staticmethod',
               'builtins.classmethod',
               'builtins.staticmethod']))
EXCEPTION_BASE_CLASSES = (source)

Undocumented

Value
frozenset(set(['Exception', 'BaseException']))
ITER_METHODS: tuple[str, ...] = (source)

Undocumented

Value
('__iter__', '__getitem__')

Undocumented

def _c3_merge(sequences, cls, context): (source)

Merges MROs in *sequences* to a single MRO using the C3 algorithm. Adapted from http://www.python.org/download/releases/2.3/mro/.

def _class_type(klass, ancestors=None): (source)

return a ClassDef node type to differ metaclass and exception from 'regular' classes

def _infer_decorator_callchain(node): (source)

Detect decorator call chaining and see if the end result is a static or a classmethod.

def _rec_get_names(args, names: list[str]|None = None) -> list[str]: (source)

return a list of all argument names

Undocumented

Value
TypeVar('_T')