Skip to content

Utilities

General utility functions.


Utils

Utility functions for the steer-core package.

Functions:

is_plotly_trace

is_plotly_trace(obj: object) -> bool

Return True if obj is a Plotly trace object.

round_dict_recursive

round_dict_recursive(obj: Any, precision: Optional[int] = 2, unit_conversion: float = 1.0) -> Any

Recursively round values in a nested dictionary.

PARAMETER DESCRIPTION
obj

Dictionary or numeric value to round.

TYPE: Any

precision

Number of decimal places, by default 2. If None, apply unit_conversion only and do not round.

TYPE: Optional[int] DEFAULT: 2

unit_conversion

Multiplicative factor applied before rounding, by default 1.0.

TYPE: float DEFAULT: 1.0

RETURNS DESCRIPTION
Any

Rounded dictionary or value (scaled if precision is None).