agent0.utils.conversions

Conversion for hyperdrivetypes to fixedpoint

Functions

camel_to_snake(→ str)

Convert camel case string to snake case string.

snake_to_camel(→ str)

Convert snake case string to camel case string.

dataclass_to_dict(→ dict[str, Any])

Convert a state dataclass into a dictionary.

Module Contents

agent0.utils.conversions.camel_to_snake(camel_string: str) str

Convert camel case string to snake case string.

Parameters:

camel_string (str) – The string to convert.

Returns:

The snake case string.

Return type:

str

agent0.utils.conversions.snake_to_camel(snake_string: str) str

Convert snake case string to camel case string.

Parameters:

snake_string (str) – The string to convert.

Returns:

The camel case string.

Return type:

str

agent0.utils.conversions.dataclass_to_dict(cls: hyperdrivetypes.types.IHyperdrive.PoolInfo | hyperdrivetypes.types.IHyperdrive.PoolConfig | hyperdrivetypes.types.IHyperdrive.Checkpoint) dict[str, Any]

Convert a state dataclass into a dictionary.

Parameters:

cls (PoolInfo | PoolInfoFP | PoolConfig | PoolConfigFP | Checkpoint | CheckpointFP) – The dataclass to convert

Returns:

The corresponding dictionary

Return type:

dict[str, Any]