MODULE

MKAPI.CORE.STRUCTURE

This module provides base class of Node and Module.

Classes
dataclass

mkapi.core.structure.Object(name='', prefix='', qualname='', kind='', signature=<factory>)

Object class represents an object.

Parameters
  • name (str, optional) Object name.
  • prefix (str, optional) Object prefix.
  • qualname (str, optional) Qualified name.
  • kind (str, optional) Object kind such as 'class', 'function', etc.
  • signature (Signature, optional) Signature if object is module or callable.
Attributes
  • callback (callable(Base: str), optional) Callback function to modify HTML output.
  • html (str) HTML output after conversion.
  • id (str) ID attribute of HTML.
  • kind (str) Object kind such as 'class', 'function', etc.
  • markdown (str) Markdown source.
  • module (str)
  • name (str) Object name.
  • prefix (str) Object prefix.
  • qualname (str) Qualified name.
  • signature (Signature) Signature if object is module or callable.
  • type (Type) Type for missing Returns and Yields sections.
Methods
method

__bool__() → bool

Returns True if name is not empty.

method

set_html(html)

Sets HTML output.

Parameters
  • html (str) HTML output.
method

copy()

Returns a copy of the Object instance.

generator

__iter__()Base

Yields self if markdown is not empty.

dataclass

mkapi.core.structure.Tree(obj)

Tree class. This class is the base class of Node and Module.

Parameters
  • obj (any) Object.
Attributes
  • docstring (Docstring) Docstring instance.
  • lineno (int) Line number.
  • members (list of any) Member instances.
  • obj (any) Object.
  • object (Object) Object instance.
  • parent (any) Parent instance.
  • sourcefile (str) Source file path.
Methods
method

__getitem__(index)

Returns a member Tree instance.

If index is str, a member Tree instance whose name is equal to index is returned.

Parameters
  • index (Union(int, str, list of str))
Raises
  • IndexError If no member found.
method

get_kind() → str

Returns kind of self.

method

get_members() → list of Tree

Returns a list of members.

method

get_markdown() → str

Returns a Markdown source for docstring of self.

generator

walk()Tree

Yields all members.