anod.loader

Module Contents

Classes

SpecConfig

Contain specification files configuration.

AnodSpecRepository

Anod spec repository.

AnodModule

Functions

spec(→ collections.abc.Callable[Ellipsis, ...)

Load an Anod spec class.

Attributes

logger

anod.loader.logger
class anod.loader.SpecConfig

Contain specification files configuration.

Variables:
  • spec_dir – path to the anod specs

  • repositories – dict containing the list of repositories metadata (content of config/repositories)

class anod.loader.AnodSpecRepository(spec_dir: str, spec_config: Any = None, extra_repositories_config: dict | None = None)

Anod spec repository.

Variables:

specs (dict[e3.anod.loader.AnodModule]) – A dictionary of AnodModule objects, indexed by spec name (without the spec filename’s extension).

The object represent a set of anod specifications along with their data files.

__contains__(item: str) bool

Check by name if a spec is present in the repository.

Returns:

True if present, False otherwise

load_all(ignore_errors: bool = False) None

Load all the specs present in the repository.

Parameters:

ignore_errors – if True don’t stop on error.

load(name: str) collections.abc.Callable[Ellipsis, e3.anod.spec.Anod]

Load an anod spec and return the corresponding Anod class.

Parameters:

name – name of the spec to load

class anod.loader.AnodModule(name: str, path: str, data: list[str])
property is_loaded: bool

Check if a spec is already loaded.

Returns:

True if the spec is already loaded, False otherwise

load(repository: AnodSpecRepository) collections.abc.Callable[Ellipsis, e3.anod.spec.Anod]

Load an anod specification and return the corresponding Anod class.

Parameters:

repository – the anod spec repository of the spec file

Raises:

SandBoxError – in case of failure

anod.loader.spec(name: str) collections.abc.Callable[Ellipsis, e3.anod.spec.Anod]

Load an Anod spec class.

Obsolete: keep until all from e3.anod.loader import spec are removed from the specs.

Note that two spec having the same name cannot be loaded in the same process as e3 keeps a cache of loaded spec using the spec basename as a key. :param name: name of the spec to load