module documentation
(source)

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 No summary
Constant BUILTIN​_DESCRIPTORS Undocumented
Constant EXCEPTION​_BASE​_CLASSES Undocumented
Constant ITER​_METHODS Undocumented
Constant T Undocumented
Variable objects Undocumented
Class _​List​Comp Class representing an ast.ListComp node.
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
def clean_duplicates_mro(sequences, cls, context): (source)

Undocumented

def clean_typing_generic_mro(sequences): (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]

Parameters
sequences:List[List[ClassDef]]Undocumented
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

Value
TypeVar('T')
objects = (source)

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=None): (source)
return a list of all argument names