Skip to main content

DocModule

ClassDataClassSource

DocModule(
type: Literal["module"] = "module",
name: str,
metadata: DocModuleMetadata = DocModuleMetadata(...),
is_package: bool = False,
slang: str = "",
modules: list[DocModuleProp] = [],
classes: list[DocModuleProp] = [],
funcs: list[DocModuleProp] = [],
types: list[DocModuleProp] = [],
aliases: list[DocModuleProp] = []
)

The docstring of a module.

Fields

NameTypeRequired
Description
typeLiteral["module"]The identifier of this documentation item.
namestrThe name of the module.
metadataDocModuleMetadataThe metadata of the module. This metadata body is extracted from the top docstring.
is_packageboolA flag marking whether the module is a package.
slangstrThe internal code identifying this module.
moduleslist[DocModuleProp]All submodules belongling to this module. In this case, the current module should be a package.
classeslist[DocModuleProp]All classes defined in this module.
funcslist[DocModuleProp]All functions defined in this module.
typeslist[DocModuleProp]The types (type alias, typed dict, and protocol) defined in this module.
aliaseslist[DocModuleProp]The items imported from the other modules/packages.

Methods

add_member

self.add_member(
member: (
DocModule
| DocClass
| DocDataClass
| DocEnum
| DocTypedDict
| DocProtocol
| DocTypeAlias
| DocFunction
),
is_alias: bool,
)

Add a member to this module.

Requires

NameTypeRequired
Description
member(DocModule | DocClass | DocDataClass | DocEnum | DocTypedDict | DocProtocol | DocTypeAlias | DocFunction)The member to be added to this module.
is_aliasboolA flag specifying whether the member added to this module is an alias.

as_md_text

v_1: str = self.as_md_text(renderer: ProtocolComponent)

Render as Markdown text.

Requires

NameTypeRequired
Description
rendererProtocolComponentThe renderer providing component rendering.

Returns

NameType
Description
v_1strThe Markdown text rendered from the module.

table_members

v_1: str = self.table_members(
renderer: ProtocolComponent,
members: Sequence[DocModuleProp],
has_relink: bool = True,
has_doc: bool = True,
)

Format the module properties as a table.

Requires

NameTypeRequired
Description
rendererProtocolComponentThe renderer providing component rendering.
membersSequence[DocModuleProp]The list of members to be displayed in the table.
has_relinkboolA flag. If specified, will render the first (name) column as relative links.
has_docboolA flag. If specified, will display the docstring of the keyword-value.

Returns

NameType
Description
v_1strThe Markdown table of the keywords.

Properties

descr

descr: str = self.descr

The docstring of the module, it is defined at the beginning of the file.


str_v2

str_v2: str = self.str_v2

Render as V2 string.

The V2 string of a module is the same as the default string.