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
| Name | Type | Required | |
|---|---|---|---|
type | Literal["module"] | The identifier of this documentation item. | |
name | str | The name of the module. | |
metadata | DocModuleMetadata | The metadata of the module. This metadata body is extracted from the top docstring. | |
is_package | bool | A flag marking whether the module is a package. | |
slang | str | The internal code identifying this module. | |
modules | list[DocModuleProp] | All submodules belongling to this module. In this case, the current module should be a package. | |
classes | list[DocModuleProp] | All classes defined in this module. | |
funcs | list[DocModuleProp] | All functions defined in this module. | |
types | list[DocModuleProp] | The types (type alias, typed dict, and protocol) defined in this module. | |
aliases | list[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
| Name | Type | Required | |
|---|---|---|---|
member | (DocModule | DocClass | DocDataClass | DocEnum | DocTypedDict | DocProtocol | DocTypeAlias | DocFunction) | The member to be added to this module. | |
is_alias | bool | A 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
| Name | Type | Required | |
|---|---|---|---|
renderer | ProtocolComponent | The renderer providing component rendering. |
Returns
| Name | Type | |
|---|---|---|
v_1 | str | The 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
| Name | Type | Required | |
|---|---|---|---|
renderer | ProtocolComponent | The renderer providing component rendering. | |
members | Sequence[DocModuleProp] | The list of members to be displayed in the table. | |
has_relink | bool | A flag. If specified, will render the first (name) column as relative links. | |
has_doc | bool | A flag. If specified, will display the docstring of the keyword-value. |
Returns
| Name | Type | |
|---|---|---|
v_1 | str | The 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.