hyrax.verbs.verb_registry
=========================

.. py:module:: hyrax.verbs.verb_registry


Attributes
----------

.. autoapisummary::

   hyrax.verbs.verb_registry.logger
   hyrax.verbs.verb_registry.VERB_REGISTRY


Classes
-------

.. autoapisummary::

   hyrax.verbs.verb_registry.Verb


Functions
---------

.. autoapisummary::

   hyrax.verbs.verb_registry.hyrax_verb
   hyrax.verbs.verb_registry.all_verbs
   hyrax.verbs.verb_registry.all_class_verbs
   hyrax.verbs.verb_registry.is_verb_class
   hyrax.verbs.verb_registry.fetch_verb_class


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

.. py:data:: logger

.. py:class:: Verb(config)

   Bases: :py:obj:`abc.ABC`


   Base class for all hyrax verbs

   .. py:method:: __init__

   Overall initialization for all verbs that saves the config


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


   .. py:attribute:: REQUIRED_DATA_GROUPS
      :type:  tuple[str, Ellipsis]
      :value: ()



   .. py:attribute:: OPTIONAL_DATA_GROUPS
      :type:  tuple[str, Ellipsis]
      :value: ()



   .. py:attribute:: cli_name
      :value: 'VERB'



   .. py:attribute:: description
      :value: ''



   .. py:attribute:: config


   .. py:method:: information()
      :classmethod:


      Returns a string describing this verb. Includes the following:
      - Name of the verb
      - Required Data Groups
      - Optional Data Groups
      - One line description of what this verb does

      If a data group is empty then it will be printed as an empty tuple.

      :returns: <name>: Data Groups: Req. (<req1>, <req2>, ...), Opt. (<opt1>, <opt2>, ...). <Description>
      :rtype: str



   .. py:method:: validate_data_request() -> None

      Validate the data_request configuration for this verb's known groups.

      Reads ``data_request`` from the verb's config and checks:

      1. All groups listed in ``REQUIRED_DATA_GROUPS`` are present.
      2. Cross-group split_fraction constraints (sum ≤ 1.0, consistency) hold
         for the active groups only — groups outside
         ``REQUIRED_DATA_GROUPS + OPTIONAL_DATA_GROUPS`` are ignored so that
         unrelated groups in a shared config do not cause false failures.

      Verbs that define neither ``REQUIRED_DATA_GROUPS`` nor
      ``OPTIONAL_DATA_GROUPS`` skip validation entirely.

      :raises RuntimeError: If a required group is absent, or if cross-group split_fraction
          constraints are violated for the active groups.



.. py:data:: VERB_REGISTRY
   :type:  dict[str, type[Verb] | None]

.. py:function:: hyrax_verb(cls: type[Verb]) -> type[Verb]

   Decorator to register a hyrax verb


.. py:function:: all_verbs() -> list[str]

   Returns all verbs that are currently registered


.. py:function:: all_class_verbs() -> list[str]

   Returns all verbs that are currently registered with a class-based implementation


.. py:function:: is_verb_class(cli_name: str) -> bool

   Returns true if the verb has a class based implementation

   :param cli_name: The name of the verb on the command line interface
   :type cli_name: str

   :returns: True if the verb has a class-based implementation
   :rtype: bool


.. py:function:: fetch_verb_class(cli_name: str) -> type[Verb] | None

   Gives the class object for the named verb

   :param cli_name: The name of the verb on the command line interface
   :type cli_name: str

   :returns: The verb class or None if no such verb class exists.
   :rtype: Optional[type[Verb]]


