MODULE

MKAPI.CORE.NODE

This modules provides Node class that has tree structure.

Classes
  • Node Node class represents an object.</>
Functions
  • get_node(name, sourcefile_index) (Node) Returns a Node instace by name or object.</>
  • is_member(obj, name, sourcefiles) (int) Returns an integer thats indicates if obj is a member or not.</>
dataclass

mkapi.core.node.Node(obj, sourcefile_index=0)

Node class represents an object.

Parameters
  • obj (any) Object.
  • sourcefile_index (int, optional) If obj is a member of class, this value is the index of unique source files given by mro() of the class. Otherwise, 0.
Attributes
  • docstring (Docstring) Docstring instance.
  • lineno (int) Line number.
  • members (list of Node) Member Node instances.
  • obj (any) Object.
  • object (Object) Object instance.
  • parent (Node, optional) Parent Node instance.
  • sourcefile (str) Source file path.
  • sourcefile_index (int) If obj is a member of class, this value is the index of unique source files given by mro() of the class. Otherwise, 0.
Methods
method

__getitem__(index)

Returns a member Node 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.
generator

walk()Tree

Yields all members.

method

get_kind() → str

Returns kind of self.

method

get_members() → list of Node

Returns a list of members.

method

get_markdown(level=0, callback=None) → str

Returns a Markdown source for docstring of this object.

Parameters
  • level (int, optional) Heading level. If 0, <div> tags are used.
  • callback (callable(Base: str), optional) To modify Markdown source.
method

set_html(html)

Sets HTML to Base instances recursively.

Parameters
  • html (str) HTML that is provided by a Markdown converter.
method

get_html(filters=None) → str

Renders and returns HTML.

Parameters
  • filters (list of str, optional)
function

mkapi.core.node.is_member(obj, name='', sourcefiles=None) → int

Returns an integer thats indicates if obj is a member or not.

  • -1 : Is not a member.
  • >0 : Is a member. If the value is larger than 0, obj is defined in different file and the value is corresponding to the index of unique source files of superclasses.
Parameters
  • obj (any) Object
  • name (str, optional) Object name.
  • sourcefiles (list of str, optional) Parent source files. If the parent is a class, those of the superclasses should be included in the order of mro().
function

mkapi.core.node.get_node(name, sourcefile_index=0)Node

Returns a Node instace by name or object.

Parameters
  • name Object name or object itself.
  • sourcefile_index (int, optional) If obj is a member of class, this value is the index of unique source files given by mro() of the class. Otherwise, 0.