Registry
gwmock_signal.registry
¶
Public source-type registry for gwmock-signal simulator backends.
list_registered_source_types()
¶
Return the registered source-type keys in sorted order.
Source code in src/gwmock_signal/registry.py
83 84 85 | |
register_simulator_backend(source_type, backend)
¶
Register a simulator backend class for a gwmock-pop source_type.
Registration is intentionally class-based rather than instance-based so the downstream lookup contract stays stable even when different backends require different constructor arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_type
|
str
|
gwmock-pop source-family key such as |
required |
backend
|
type[GWSimulator]
|
Concrete |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If backend is not a |
ValueError
|
If source_type is empty or already registered to a different backend. |
Source code in src/gwmock_signal/registry.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
resolve_simulator_backend(source_type)
¶
Resolve the registered simulator backend class for a source type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_type
|
str
|
gwmock-pop source-family key such as |
required |
Returns:
| Type | Description |
|---|---|
type[GWSimulator]
|
The registered concrete |
Raises:
| Type | Description |
|---|---|
KeyError
|
If no backend is registered for source_type. |
ValueError
|
If source_type is empty. |
Source code in src/gwmock_signal/registry.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
The built-in CBC backend is registered under the key bbh. For the simulator
classes returned by resolve_simulator_backend, see
Simulator.
For a short Python example of resolve_simulator_backend, see the
README
on the project home page.