MODULE
MKAPI.CORE.NODE
This modules provides Node class that has tree structure.
dataclass
mkapi.core.node.
Node
(
obj
, sourcefile_index=0
)
Node class represents an object.
Parameters
obj
(any) — Object.sourcefile_index
(int, optional) — Ifobj
is a member of class, this value is the index of unique source files given bymro()
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) — Ifobj
is a member of class, this value is the index of unique source files given bymro()
of the class. Otherwise, 0.
Methods
__getitem__
(
index
)
— Returns a member Node instance.</>get_html
(
filters
)
(str) — Renders and returns HTML.</>get_kind
(
)
(str) — Returns kind of self.</>get_markdown
(
level
,callback
)
(str) — Returns a Markdown source for docstring of this object.</>get_members
(
)
(list of Node) — Returns a list of members.</>set_html
(
html
)
— Sets HTML to Base instances recursively.</>walk
(
)
(Tree) — Yields all members.</>
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.
method
get_kind
(
)
→ str
Returns kind of self.
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) — Objectname
(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 ofmro()
.
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) — Ifobj
is a member of class, this value is the index of unique source files given bymro()
of the class. Otherwise, 0.