module documentation

Helpers to populate attributes of Class instances.

Class MRO Implements MRO resoling for pydocspec.Class instances.
Function constructor_method returns the __init__ method, i'm a bit dummy.
Function inherited_members provide inherited_members property
Function is_abstractclass Returns whether the given class is an abstract class.
Function is_exception must be set after resolved_bases
Function is_subclass_of Check if class ob is a subclass of any of the base classes in baseclasses. :returns: True if ob is derived from any of the base classes.
Function mro compute mro from apiobjects. must be set after resolved_bases
Function mro_from_astroid Compute MRO from astroid, this does not require pydocspec.Class.resolved_bases.
Function process_subclasses for all resolved_bases classes, add ob to the subclasses list
Function resolved_bases direct bases of this class, if the name cannot be resolved as an apiobject, fallback to expanded name str. uses name resolution.
Constant EXCEPTIONS_CLASSES Undocumented
Function _nested_bases Helper function to retreive the complete list of base classes chains (represented by tuples) for a given Class. A chain of classes is used to compute the member inheritence from the first element to the last element of the chain.
Function _unmasked_attrs Helper function to reteive the list of inherited children given a base classes chain (As yielded by nested_bases).
def constructor_method(ob): (source)

returns the __init__ method, i'm a bit dummy.

Parameters
ob:_model.ClassUndocumented
Returns
Optional[pydocspec.Function]Undocumented
def inherited_members(ob): (source)

provide inherited_members property

Parameters
ob:pydocspec.ClassUndocumented
Returns
List[pydocspec.ClassInheritedMember]Undocumented
def is_abstractclass(ob): (source)

Returns whether the given class is an abstract class.

Must be set after Class.inherited_members.

Parameters
ob:pydocspec.ClassUndocumented
Returns
boolUndocumented
def is_exception(ob): (source)

must be set after resolved_bases

Parameters
ob:pydocspec.ClassUndocumented
Returns
boolUndocumented
def is_subclass_of(ob, baseclasses): (source)

Check if class ob is a subclass of any of the base classes in baseclasses. :returns: True if ob is derived from any of the base classes.

False otherwise.
Parameters
ob:pydocspec.ClassUndocumented
baseclasses:Sequence[Union[str, pydocspec.Class]]Undocumented
Returns
boolUndocumented
def mro(ob): (source)

compute mro from apiobjects. must be set after resolved_bases

Parameters
ob:pydocspec.ClassUndocumented
Returns
List[pydocspec.Class]Undocumented
def mro_from_astroid(ob): (source)

Compute MRO from astroid, this does not require pydocspec.Class.resolved_bases.

Returns NotImplemented if the tree has not been built with astroid.

Parameters
ob:_model.ClassUndocumented
Returns
Union[List[pydocspec.Class], object]Undocumented
def process_subclasses(ob): (source)

for all resolved_bases classes, add ob to the subclasses list

Parameters
ob:pydocspec.ClassUndocumented
def resolved_bases(ob): (source)

direct bases of this class, if the name cannot be resolved as an apiobject, fallback to expanded name str. uses name resolution.

Parameters
ob:pydocspec.ClassUndocumented
Returns
List[Union[pydocspec.Class, str]]Undocumented
EXCEPTIONS_CLASSES: tuple[str, ...] = (source)

Undocumented

Value
('ArithmeticError',
 'AssertionError',
 'AttributeError',
 'BaseException',
 'BlockingIOError',
 'BrokenPipeError',
 'BufferError',
...
def _nested_bases(classobj): (source)

Helper function to retreive the complete list of base classes chains (represented by tuples) for a given Class. A chain of classes is used to compute the member inheritence from the first element to the last element of the chain.

The first yielded chain only contains the Class itself.

Then for each of the super-classes respecting the MRO:
  • the next yielded chain contains the super class and the class itself,
  • the the next yielded chain contains the super-super class, the super class and the class itself, etc...
Parameters
classobj:pydocspec.ClassUndocumented
Returns
Iterator[Tuple[pydocspec.Class, ...]]Undocumented
def _unmasked_attrs(baselist): (source)

Helper function to reteive the list of inherited children given a base classes chain (As yielded by nested_bases).

The returned members are inherited from the Class listed first in the chain to the Class listed last: they are not overriden in between.

Parameters
baselist:Sequence[pydocspec.Class]Undocumented
Returns
List[pydocspec.ApiObject]Undocumented