autodoc2.render.base
#
Convert the database items into documentation.
Module Contents#
Classes#
The base renderer. |
API#
- class autodoc2.render.base.RendererBase(db: autodoc2.db.Database, config: autodoc2.config.Config, *, warn: Callable[[str, autodoc2.utils.WarningSubtypes], None] | None = None, all_resolver: autodoc2.resolve_all.AllResolver | None = None, standalone: bool = True)[source]#
Bases:
abc.ABC
The base renderer.
Initialization
Initialise the renderer.
- Parameters:
db – The database to obtain objects from.
config – The configuration.
warn – The function to use to log warnings.
all_resolver – The resolver to use, for following __all__ children.
standalone – If True, this renderer is being used to create a standalone document
Cache for the is_hidden function: full_name -> bool.
- property config: autodoc2.config.Config#
The configuration.
- warn(msg: str, type_: autodoc2.utils.WarningSubtypes = WarningSubtypes.RENDER_ERROR) None [source]#
Warn the user.
- get_item(full_name: str) autodoc2.utils.ItemData | None [source]#
Get an item from the database, by full_name.
- get_children(item: autodoc2.utils.ItemData, types: None | set[str] = None, *, omit_hidden: bool = True) Iterable[autodoc2.utils.ItemData] [source]#
Get the children of this item, sorted according to the config.
If module and full_name in module_all_regexes, it will use the __all__ list instead of the children.
- Parameters:
item – The item to get the children of.
types – If given, only return items of these types.
omit_hidden – If True, omit hidden items.
Whether this object should be displayed in documentation.
Based on configuration regarding:
does i match a hidden regex pattern
does it have documentation
is it a dunder, i.e. __name__
is it a private member, i.e. starts with _, but not a dunder
is it an inherited member of a class
- is_module_deprecated(item: autodoc2.utils.ItemData) bool [source]#
Whether this module is deprecated.
- no_index(item: autodoc2.utils.ItemData) bool [source]#
Whether this item should be excluded from search engines.
- show_module_summary(item: autodoc2.utils.ItemData) bool [source]#
Whether to show a summary for this module/package.
- show_class_inheritance(item: autodoc2.utils.ItemData) bool [source]#
Whether to show the inheritance for this class.
- show_annotations(item: autodoc2.utils.ItemData) bool [source]#
Whether to show type annotations.
- show_docstring(item: autodoc2.utils.ItemData) bool [source]#
Whether to show the docstring.
- format_args(args_info: autodoc2.utils.ARGS_TYPE, include_annotations: bool = True, ignore_self: None | str = None) str [source]#
Format the arguments of a function or method.