anod.loader
===========

.. py:module:: anod.loader


Attributes
----------

.. autoapisummary::

   anod.loader.logger


Classes
-------

.. autoapisummary::

   anod.loader.SpecConfig
   anod.loader.AnodSpecRepository
   anod.loader.AnodModule


Functions
---------

.. autoapisummary::

   anod.loader.spec


Module Contents
---------------

.. py:data:: logger

.. py:class:: SpecConfig

   Contain specification files configuration.

   :ivar spec_dir: path to the anod specs
   :ivar repositories: dict containing the list of repositories metadata
       (content of config/repositories)


   .. py:attribute:: spec_dir
      :value: ''



   .. py:attribute:: repositories
      :type:  dict[str, Any]


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

   Anod spec repository.

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

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


   .. py:attribute:: spec_dir


   .. py:attribute:: specs


   .. py:attribute:: repos
      :type:  dict[str, dict[str, str]]


   .. py:attribute:: prolog_dict


   .. py:method:: __contains__(item: str) -> bool

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

      :return: True if present, False otherwise



   .. py:method:: load_all(ignore_errors: bool = False) -> None

      Load all the specs present in the repository.

      :param ignore_errors: if True don't stop on error.



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

      Load an anod spec and return the corresponding Anod class.

      :param name: name of the spec to load



.. py:class:: AnodModule(name: str, path: str, data: list[str])

   .. py:attribute:: name


   .. py:attribute:: data


   .. py:attribute:: path


   .. py:attribute:: module
      :type:  types.ModuleType | None
      :value: None



   .. py:attribute:: anod_class
      :type:  collections.abc.Callable[Ellipsis, e3.anod.spec.Anod] | None
      :value: None



   .. py:attribute:: checksum


   .. py:property:: is_loaded
      :type: bool


      Check if a spec is already loaded.

      :return: True if the spec is already loaded, False otherwise



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

      Load an anod specification and return the corresponding Anod class.

      :param repository: the anod spec repository of the spec file
      :raise SandBoxError: in case of failure



.. py:function:: 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


