autodoc2.utils¶

Utility functions and types.

Module Contents¶

Classes¶

ItemData

A data item, for the results of the analysis.

WarningSubtypes

The subtypes of warnings for the extension.

Functions¶

yield_modules

Walk the given folder and yield all required modules.

Data¶

API¶

autodoc2.utils.PROPERTY_TYPE = None¶
autodoc2.utils.ARGS_TYPE = None¶
class autodoc2.utils.ItemData[source]¶

Bases: typing.TypedDict

A data item, for the results of the analysis.

Initialization

Initialize self. See help(type(self)) for accurate signature.

type: typing_extensions.Required[str] = None¶
full_name: typing_extensions.Required[str] = None¶
doc: typing_extensions.Required[str] = None¶
range: tuple[int, int] = None¶
file_path: None | str = None¶
encoding: str = None¶
all: None | list[str] = None¶
imports: list[tuple[str, str | None]] = None¶
value: None | str | Any = None¶
annotation: None | str = None¶
properties: list[autodoc2.utils.PROPERTY_TYPE] = None¶
args: autodoc2.utils.ARGS_TYPE = None¶
return_annotation: None | str = None¶
bases: list[str] = None¶
doc_inherited: str = None¶
inherited: str = None¶
class autodoc2.utils.WarningSubtypes[source]¶

Bases: enum.Enum

The subtypes of warnings for the extension.

CONFIG_ERROR = 'config_error'¶

Issue with configuration validation.

GIT_CLONE_FAILED = 'git_clone'¶

Failed to clone a git repository.

MISSING_MODULE = 'missing_module'¶

If the package file/folder does not exist.

DUPLICATE_ITEM = 'dup_item'¶

Duplicate fully qualified name found during package analysis.

RENDER_ERROR = 'render'¶

Generic rendering error.

ALL_MISSING = 'all_missing'¶

__all__ attribute missing or empty in a module.

ALL_RESOLUTION = 'all_resolve'¶

Issue with resolution of an item in a module’s __all__ attribute.

NAME_NOT_FOUND = 'missing'¶
autodoc2.utils.yield_modules(folder: str | pathlib.Path, *, root_module: str | None = None, extensions: Sequence[str] = ('.py', '.pyi'), exclude_dirs: Sequence[str] = ('__pycache__',), exclude_files: Sequence[str] = ()) Iterable[tuple[pathlib.Path, str]][source]¶

Walk the given folder and yield all required modules.

Parameters:
  • folder – The path to walk.

  • root_module – The name of the root module, otherwise the folder name is used.

  • extensions – The extensions to include. If multiple files with the same stem, only the first extension will be used.

  • exclude_dirs – Directory names to exclude (matched with fnmatch).

  • exclude_files – File names to exclude (matched with fnmatch).