MODULE

MKAPI.CORE.ATTRIBUTE

This module provides functions that inspect attributes from source code.

Functions
  • get_attributes(obj) (dict(str: (any, str))) Returns a dictionary that maps attribute name to a tuple of (type, description).</>
  • get_class_attributes(cls) (dict(str: (any, str))) Returns a dictionary that maps attribute name to a tuple of (type, description).</>
  • get_dataclass_attributes(cls) (dict(str: (any, str))) Returns a dictionary that maps attribute name to a tuple of (type, description).</>
  • get_module_attributes(module) (dict(str: (any, str))) Returns a dictionary that maps attribute name to a tuple of (type, description).</>
function

mkapi.core.attribute.get_class_attributes(cls) → dict(str: (any, str))

Returns a dictionary that maps attribute name to a tuple of (type, description).

Parameters
  • cls Class object.
Examples
>>> from examples.google_style import ExampleClass
>>> attrs = get_class_attributes(ExampleClass)
>>> attrs['a'][0] is str
True
>>> attrs['a'][1]
'The first attribute. Comment *inline* with attribute.'
>>> attrs['b'][0] == Dict[str, int]
True
>>> attrs['c'][0] is None
True
function

mkapi.core.attribute.get_dataclass_attributes(cls) → dict(str: (any, str))

Returns a dictionary that maps attribute name to a tuple of (type, description).

Parameters
  • cls Dataclass object.
Examples
>>> from mkapi.core.base import Item, Type, Inline
>>> attrs = get_dataclass_attributes(Item)
>>> attrs['type'][0] is Type
True
>>> attrs['description'][0] is Inline
True
function

mkapi.core.attribute.get_module_attributes(module) → dict(str: (any, str))

Returns a dictionary that maps attribute name to a tuple of (type, description).

Parameters
  • module Module object.
Examples
>>> from mkapi.core import renderer
>>> attrs = get_module_attributes(renderer)
>>> attrs['renderer'][0] is renderer.Renderer
True
function

mkapi.core.attribute.get_attributes(obj) → dict(str: (any, str))

Returns a dictionary that maps attribute name to a tuple of (type, description).

Parameters
  • obj Object.