parameter
parameter
¶
Generic parameter wrapper for Pydantic-based configuration.
Provides Parameter -- a generic dataclass wrapper that integrates with
Pydantic v2 core schemas so that configuration values carry metadata
(e.g. name) while remaining transparent to serialization and comparison.
Classes:
| Name | Description |
|---|---|
Parameter |
Generic wrapper for a single configuration value. |
Parameter(name=None, value=None)
dataclass
¶
Bases: Generic[DataT]
Generic wrapper for a single configuration value.
Wraps a primitive or sequence value so it can carry a name, participate
in Pydantic validation/serialization, and support rich comparisons against
both raw values and other Parameter instances.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Identifier used for logging and lookup (e.g. |
None
|
value
|
DataT | Sequence[DataT] | None
|
The wrapped configuration value. |
None
|
Example::
>>> param = Parameter[int](name="max_size", value=100)
>>> param.value
100
>>> param == 100
True
Methods:
| Name | Description |
|---|---|
ser_model |
Serialize to the bare value for Pydantic |
ser_model()
¶
Serialize to the bare value for Pydantic model_dump / model_dump_json.