tts_tower.inputs
Submodules
tts_tower.inputs.input_client
- class tts_tower.inputs.input_client.FailedClient(*args, **kwargs)
Bases:
InputClientDummy class that higher-level processes can use to clearly identify Inputs which are not available
Initializes the FailedClient with error details.
- Parameters:
name – The name of the client that failed.
exception – The exception that caused the failure.
- class tts_tower.inputs.input_client.IC_STATE(*values)
Bases:
IntEnumEnumeration defining the lifecycle states of an InputClient.
- Attributes:
ERROR: Indicates an error occurred during initialization or population. INIT_START: Indicates initialization has started. INIT_END: Indicates initialization has completed successfully. POP_START: Indicates population has started. POP_END: Indicates population has completed successfully. UNLOCKED: Indicates the client is explicitly unlocked for attribute modification.
- ERROR = 1
- INIT_END = 3
- INIT_START = 2
- POP_END = 5
- POP_START = 4
- UNLOCKED = 6
- class tts_tower.inputs.input_client.InputClient(*args, **kwargs)
Bases:
ABCBasic structure for Inputs to the Rulechecking process Defines a couple of interfaces used by the InputManager to structure input population and supply to checkers
The init method sets the initial state to INIT_START, identifies any dependencies (other InputClients) passed in args or kwargs, calls the concrete implementation’s _impl_init, and updates the state to INIT_END upon success.
- Parameters:
args – Positional arguments passed to _impl_init. Any InputClient instances are tracked as sub-clients.
kwargs – Keyword arguments passed to _impl_init. Any InputClient values are tracked as sub-clients.
- get_state()
Retrieves the current lifecycle state of the client.
- Returns:
The current IC_STATE.
- populate()
To be called by InputManager. Takes no input, input should be managed and validated during Init
This method transitions the state to POP_START, checks for failed sub-clients, calls the concrete _impl_populate method, and finally transitions to POP_END.
tts_tower.inputs.input_manager
- class tts_tower.inputs.input_manager.InputManager
Bases:
objectPrimary manager of all Inputs to the Rulechecking process.
Handles initializing, populating, and distributing Inputs to any Checkers that request them. Contains exception handling to catch and prevent Exceptions from bringing down the whole script.
Manager is set to read-only by default
- add_client(name, cls_const, args, kwargs_dict=None)
Add a new InputClient with all associated logic.
- Parameters:
name (str) – Unique identifier for the input client.
cls_const (type) – The InputClient class (not an instance) to be instantiated.
args (list) – List of positional arguments to pass to the client’s
__init__.kwargs_dict (dict, optional) – Dictionary of keyword arguments to pass to the client’s
__init__.
- add_state(name, value)
Add a simple state value (StateClient) to the Inputs list.
- Parameters:
name (str) – Unique identifier for the state.
value (Any) – The value to be stored in the state.
- get(name)
Check if this manager has a particular Input (or State) by name and return if it does.
- Parameters:
name (str) – The name of the input to retrieve.
- Returns:
The requested InputClient instance.
- Return type:
- Raises:
ValueError – If no Input Client with the specified name is found.
- get_run_info()
Aggregates run information (metadata) from all registered input clients.
Merges dictionaries returned by each client’s
_get_run_infomethod.- Returns:
A dictionary containing merged run information from all clients.
- Return type:
dict
- has_input(name)
Basic check whether a particular Input (or State) has been added with a specific name.
- Parameters:
name (str) – The name of the input to check.
- Returns:
True if the input exists, False otherwise.
- Return type:
bool
- iter_all_clients(skip_failed=False)
Provide a generator for Inputs (or States), optionally skipping Failed clients.
- Parameters:
skip_failed (bool) – If True, skips clients that failed to initialize or populate. Defaults to False.
- Yield:
A tuple containing the client name and the client instance.
- Return type:
Iterator[tuple[str, InputClient]]
- populate_all_clients()
Run population routines for all InputClients safely.
Catches exceptions during population, logs them, and replaces the client with a FailedClient.
- class tts_tower.inputs.input_manager.input_get(name)
Bases:
objectSimple wrapper class to identify InputClient names to pass as input to other InputClients
- tts_tower.inputs.input_manager.log_step_exception(name, step, e)
Logs an exception that occurred during a specific step of an InputClient’s lifecycle.
- Parameters:
name (str) – The identifier of the InputClient.
step (str) – The lifecycle step where the error occurred (e.g., ‘initialization’, ‘population’).
e (Exception) – The exception instance caught.
tts_tower.inputs.state
- class tts_tower.inputs.state.StateClient(*args, **kwargs)
Bases:
InputClientA simple InputClient implementation designed to hold a static state or configuration value.
This client allows for the injection of known variables, environment flags, or run-specific parameters into the InputManager context, making them available to checkers and reports without requiring external data fetching.