hyperion.typeutils¶
hyperion.typeutils
¶
Stdlib type-utility helpers.
.. deprecated::
The pandera/polars dtype-mapping helpers (:data:PANDERA_TO_POLARS_MAPPING,
:data:POLARS_SCHEMA_COPY_ATTRIBUTES, :data:PolarsUTCDateTime,
:func:map_pandera_dtype_to_polars) moved to :mod:hyperion.data.typeutils
(F5 / DDD refactor Step 2). Import them from there. This module keeps them
importable (with a :class:DeprecationWarning, resolved lazily so the
import does not pull the data stack) for the whole hyperion-sdk 1.x line.
dataclass_asdict
¶
Convert a dataclass instance to a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataclass
|
DataclassInstance
|
Dataclass instance to convert. |
required |
exclude
|
Sequence[str]
|
Fields to exclude. Defaults to None. |
None
|
include
|
Sequence[str]
|
Fields to include. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: Converted dictionary. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If include and exclude overlap. |
ValueError
|
If include field is not found in dataclass. |