sphinx_polyversion.utils

Helpers for the other modules.

Functions

async_all(awaitables)

Return True if all awaitables return True.

import_file(path)

Import a module from its location in the file system.

shift_path(src_anchor, dst_anchor, src)

Shift a path from one anchor (root) directory to another.

async sphinx_polyversion.utils.async_all(awaitables: Iterable[Awaitable[Any]]) bool[source]

Return True if all awaitables return True.

If the iterator is empty, True is returned. The awaitables may return any value. These values are converted to boolean.

Parameters:

awaitables (Iterator[Awaitable[Any]]) – The awaitables to check.

Returns:

Whether all awaitables returned True.

Return type:

bool

sphinx_polyversion.utils.import_file(path: Path) Any[source]

Import a module from its location in the file system.

Parameters:

path (Path) – The location of the python file to import.

Returns:

The imported module.

Return type:

Any

Raises:
  • OSError – The module spec couldn’t be created.

  • ImportError – No loader was found for the module.

sphinx_polyversion.utils.shift_path(src_anchor: PA, dst_anchor: PA, src: PA) PA[source]

Shift a path from one anchor (root) directory to another.

Parameters:
  • src_anchor (Path) – The anchor

  • dst_anchor (Path) – The destination

  • src (Path) – The path to shift

Returns:

The shifted path

Return type:

Path