Skip to content

inventory ¤

Module responsible for the objects inventory.

Classes:

Inventory ¤

Inventory(
    items: list[InventoryItem] | None = None,
    project: str = "project",
    version: str = "0.0.0",
)

Bases: dict

Inventory of collected and rendered objects.

Parameters:

  • items ¤

    (list[InventoryItem] | None, default: None ) –

    A list of items.

  • project ¤

    (str, default: 'project' ) –

    The project name.

  • version ¤

    (str, default: '0.0.0' ) –

    The project version.

Methods:

  • format_sphinx

    Format this inventory as a Sphinx objects.inv file.

  • parse_sphinx

    Parse a Sphinx v2 inventory file and return an Inventory from it.

  • register

    Create and register an item.

format_sphinx ¤

format_sphinx() -> bytes

Format this inventory as a Sphinx objects.inv file.

Returns:

  • bytes

    The inventory as bytes.

parse_sphinx classmethod ¤

parse_sphinx(
    in_file: BinaryIO,
    *,
    domain_filter: Collection[str] = ()
) -> Inventory

Parse a Sphinx v2 inventory file and return an Inventory from it.

Parameters:

  • in_file ¤

    (BinaryIO) –

    The binary file-like object to read from.

  • domain_filter ¤

    (Collection[str], default: () ) –

    A collection of domain values to allow (and filter out all other ones).

Returns:

  • Inventory

    An inventory containing the collected items.

register ¤

register(
    name: str,
    domain: str,
    role: str,
    uri: str,
    priority: int = 1,
    dispname: str | None = None,
) -> None

Create and register an item.

Parameters:

  • name ¤

    (str) –

    The item name.

  • domain ¤

    (str) –

    The item domain, like 'python' or 'crystal'.

  • role ¤

    (str) –

    The item role, like 'class' or 'method'.

  • uri ¤

    (str) –

    The item URI.

  • priority ¤

    (int, default: 1 ) –

    The item priority. Only used internally by mkdocstrings and Sphinx.

  • dispname ¤

    (str | None, default: None ) –

    The item display name.

InventoryItem ¤

InventoryItem(
    name: str,
    domain: str,
    role: str,
    uri: str,
    priority: int = 1,
    dispname: str | None = None,
)

Inventory item.

Parameters:

  • name ¤

    (str) –

    The item name.

  • domain ¤

    (str) –

    The item domain, like 'python' or 'crystal'.

  • role ¤

    (str) –

    The item role, like 'class' or 'method'.

  • uri ¤

    (str) –

    The item URI.

  • priority ¤

    (int, default: 1 ) –

    The item priority. Only used internally by mkdocstrings and Sphinx.

  • dispname ¤

    (str | None, default: None ) –

    The item display name.

Methods:

  • format_sphinx

    Format this item as a Sphinx inventory line.

  • parse_sphinx

    Parse a line from a Sphinx v2 inventory file and return an InventoryItem from it.

format_sphinx ¤

format_sphinx() -> str

Format this item as a Sphinx inventory line.

Returns:

  • str

    A line formatted for an objects.inv file.

parse_sphinx classmethod ¤

parse_sphinx(line: str) -> InventoryItem

Parse a line from a Sphinx v2 inventory file and return an InventoryItem from it.