module documentation

Astroid hooks for the Python standard library.

Function infer_enum Specific inference function for enum Call node.
Function infer_enum_class Specific inference for enums.
Function infer_func_form Specific inference function for namedtuple or Python 3 enum.
Function infer_named_tuple Specific inference function for namedtuple Call node.
Function infer_typing_namedtuple Infer a typing.NamedTuple(...) call.
Function infer_typing_namedtuple_class Infer a subclass of typing.NamedTuple.
Function infer_typing_namedtuple_function Starting with python3.9, NamedTuple is a function of the typing module. The class NamedTuple is build dynamically through a call to `type` during initialization of the `_NamedTuple` variable.
Constant ENUM_BASE_NAMES Undocumented
Constant ENUM_QNAME Undocumented
Constant INT_FLAG_ADDITION_METHODS Undocumented
Constant TYPING_NAMEDTUPLE_BASENAMES Undocumented
Constant TYPING_NAMEDTUPLE_QUALIFIED Undocumented
Function _check_namedtuple_attributes Undocumented
Function _find_func_form_arguments Undocumented
Function _get_namedtuple_fields Get and return fields of a NamedTuple in code-as-a-string.
Function _get_renamed_namedtuple_attributes Undocumented
Function _has_namedtuple_base Predicate for class inference tip.
Function _infer_first Undocumented
Function _is_enum_subclass Return whether cls is a subclass of an Enum.
Function _looks_like Undocumented
Variable _looks_like_enum Undocumented
Variable _looks_like_namedtuple Undocumented
Variable _looks_like_typing_namedtuple Undocumented

Specific inference function for enum Call node.

def infer_enum_class(node: nodes.ClassDef) -> nodes.ClassDef: (source)

Specific inference for enums.

def infer_func_form(node: nodes.Call, base_type: list[nodes.NodeNG], context: InferenceContext|None = None, enum: bool = False) -> tuple[nodes.ClassDef, str, list[str]]: (source)

Specific inference function for namedtuple or Python 3 enum.

def infer_named_tuple(node: nodes.Call, context: InferenceContext|None = None) -> Iterator[nodes.ClassDef]: (source)

Specific inference function for namedtuple Call node.

def infer_typing_namedtuple(node: nodes.Call, context: InferenceContext|None = None) -> Iterator[nodes.ClassDef]: (source)

Infer a typing.NamedTuple(...) call.

def infer_typing_namedtuple_class(class_node, context: InferenceContext|None = None): (source)

Infer a subclass of typing.NamedTuple.

def infer_typing_namedtuple_function(node, context: InferenceContext|None = None): (source)

Starting with python3.9, NamedTuple is a function of the typing module. The class NamedTuple is build dynamically through a call to `type` during initialization of the `_NamedTuple` variable.

ENUM_BASE_NAMES: set[str] = (source)

Undocumented

Value
set(['Enum', 'IntEnum', 'enum.Enum', 'enum.IntEnum', 'IntFlag', 'enum.IntFlag'])
ENUM_QNAME: str = (source)

Undocumented

Value
'enum.Enum'
INT_FLAG_ADDITION_METHODS: str = (source)

Undocumented

Value
'''
    def __or__(self, other):
        return {name}(self.value | other.value)
    def __and__(self, other):
        return {name}(self.value & other.value)
    def __xor__(self, other):
        return {name}(self.value ^ other.value)
...
TYPING_NAMEDTUPLE_BASENAMES: set[str] = (source)

Undocumented

Value
set(['NamedTuple', 'typing.NamedTuple', 'typing_extensions.NamedTuple'])
TYPING_NAMEDTUPLE_QUALIFIED: set[str] = (source)

Undocumented

Value
set(['typing.NamedTuple', 'typing_extensions.NamedTuple'])
def _check_namedtuple_attributes(typename, attributes, rename=False): (source)

Undocumented

def _find_func_form_arguments(node, context): (source)

Undocumented

def _get_namedtuple_fields(node: nodes.Call) -> str: (source)

Get and return fields of a NamedTuple in code-as-a-string. Because the fields are represented in their code form we can extract a node from them later on.

def _get_renamed_namedtuple_attributes(field_names): (source)

Undocumented

def _has_namedtuple_base(node): (source)

Predicate for class inference tip. :type node: ClassDef :rtype: bool

def _infer_first(node, context): (source)

Undocumented

def _is_enum_subclass(cls: astroid.ClassDef) -> bool: (source)

Return whether cls is a subclass of an Enum.

def _looks_like(node, name) -> bool: (source)

Undocumented

_looks_like_enum = (source)

Undocumented

_looks_like_namedtuple = (source)

Undocumented

_looks_like_typing_namedtuple = (source)

Undocumented