hyrax.verbs.verb_registry#

Attributes#

Classes#

Verb

Base class for all hyrax verbs

Functions#

hyrax_verb(→ type[Verb])

Decorator to register a hyrax verb

all_verbs(→ list[str])

Returns all verbs that are currently registered

all_class_verbs(→ list[str])

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

is_verb_class(→ bool)

Returns true if the verb has a class based implementation

fetch_verb_class(→ type[Verb] | None)

Gives the class object for the named verb

Module Contents#

logger[source]#
class Verb(config)[source]#

Bases: abc.ABC

Base class for all hyrax verbs

__init__()[source]#

Overall initialization for all verbs that saves the config

add_parser_kwargs: dict[str, str][source]#
REQUIRED_DATA_GROUPS: tuple[str, Ellipsis] = ()[source]#
OPTIONAL_DATA_GROUPS: tuple[str, Ellipsis] = ()[source]#
cli_name = 'VERB'[source]#
description = ''[source]#
config[source]#
classmethod information()[source]#

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>

Return type:

str

validate_data_request() None[source]#

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

Reads data_request (or the deprecated model_inputs) 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.

VERB_REGISTRY: dict[str, type[Verb] | None][source]#
hyrax_verb(cls: type[Verb]) type[Verb][source]#

Decorator to register a hyrax verb

all_verbs() list[str][source]#

Returns all verbs that are currently registered

all_class_verbs() list[str][source]#

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

is_verb_class(cli_name: str) bool[source]#

Returns true if the verb has a class based implementation

Parameters:

cli_name (str) – The name of the verb on the command line interface

Returns:

True if the verb has a class-based implementation

Return type:

bool

fetch_verb_class(cli_name: str) type[Verb] | None[source]#

Gives the class object for the named verb

Parameters:

cli_name (str) – The name of the verb on the command line interface

Returns:

The verb class or None if no such verb class exists.

Return type:

Optional[type[Verb]]