Skip to content

MkModuleTable

Show source on GitHub

Node for a table containing formatted information about a module.

Example: Regular

Jinja

{{ ["mknodes.info"] | MkModuleTable }}

Python

MkModuleTable([mknodes.info])
Name DocStrings Members
mknodes.info Information/Metadata- related classes.
| Name | DocStrings | Members |
|--- | --- | --- |
| [mknodes.info](https://phil65.github.io/mknodes/) | Information/Metadata- related classes. |  |
<table>
<thead>
<tr>
<th>Name</th>
<th>DocStrings</th>
<th>Members</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://phil65.github.io/mknodes/">mknodes.info</a></td>
<td>Information/Metadata- related classes.</td>
<td></td>
</tr>
</tbody>
</table>

Bases: MkTemplateTable

Name Children Inherits
MkTemplateTable
mknodes.templatenodes.mktemplatetable
Node for a table showing dependencies for a package.
graph TD
  94854583067280["mkmoduletable.MkModuleTable"]
  94854583326864["mktemplatetable.MkTemplateTable"]
  94854582916880["mknode.MkNode"]
  94854582838576["node.Node"]
  140544995341632["builtins.object"]
  94854583326864 --> 94854583067280
  94854582916880 --> 94854583326864
  94854582838576 --> 94854582916880
  140544995341632 --> 94854582838576
/home/runner/work/mknodes/mknodes/mknodes/templatenodes/mkmoduletable/metadata.toml
[metadata]
icon = "mdi:view-module-outline"
name = "MkModuleTable"
group = "documentation"

[requirements.extension.tables]

[examples.regular]
title = "Regular"
jinja = """
{{ ["mknodes.info"] | MkModuleTable }}
"""

[layouts.default]
Name = """
{{ module | get_link }}
"""
DocStrings = """
{{ module | get_doc(fallback="*No docstrings defined.*", only_summary=True) }}
"""
Members = """
{% if module | hasattr("__all__") %}
{{ (module.__all__ | MkList(as_links=True, shorten_after=10)).to_html() }}
{% endif %}
"""
mknodes.templatenodes.mkmoduletable.MkModuleTable
class MkModuleTable(mktemplatetable.MkTemplateTable):
    """Node for a table containing formatted information about a module."""

    ICON = "material/view-module-outline"

    def __init__(
        self,
        modules: Sequence[types.ModuleType | str],
        **kwargs,
    ):
        self.modules = [classhelpers.to_module(i, return_none=False) for i in modules]
        super().__init__(**kwargs)

    def iter_items(self):
        yield from [
            dict(module=module, griffe_module=grifferegistry.get_module(module))
            for module in self.modules
        ]