raplan.utils
¶
RaPlan utilities.
convert_pascal_str
¶
Convert cased input string to a uniform representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
str
|
Input string to convert. |
required |
space
|
str
|
Character to use as a space. |
'_'
|
lowercase
|
bool
|
Whether to enforce lowercase output. |
True
|
Source code in src/raplan/utils.py
datetime_to_float_years
¶
Convert a datetime to a float.
Source code in src/raplan/utils.py
days_in_year
¶
float_years_to_datetime
¶
Convert a float of years into a datetime object (rounded down to given precision).
Source code in src/raplan/utils.py
gen_dataclass_columns
¶
gen_dataclass_columns(cls) -> Generator[str, None, None]
Yield fields and subfields from a class or object.
Source code in src/raplan/utils.py
gen_dataclass_types
¶
Yield fields and subfields from a class or object.
Source code in src/raplan/utils.py
gen_dataclass_values
¶
Yield all field and sub-field values in order of their dataclass field definition.
Source code in src/raplan/utils.py
gen_enum_collection_columns
¶
gen_enum_collection_columns(
cls,
) -> Generator[str, None, None]
Column names for toggles for an Enum.
Source code in src/raplan/utils.py
gen_enum_collection_toggles
¶
gen_enum_collection_toggles(
collection, cls
) -> Generator[bool, None, None]
Column boolean values for an Enum.
uuid4s_to_uuid5
¶
uuid4s_to_uuid5(
uuids: list[UUID], namespace: UUID = NAMESPACE_DNS
) -> UUID
Convert a list of V4 UUIDs to a single new UUIDv5.
with_uuid4s_to_uuid5
¶
with_uuid4s_to_uuid5(
with_uuids: list[Any], namespace: UUID = NAMESPACE_DNS
) -> UUID
Convert any objects a uuid field returning UUIDv4's to a single new UUIDv5.