curia.utils.json module

curia.utils.json.pandas_isnull(obj)

Helper function to check if an object is null, even if it’s a pandas object.

curia.utils.json.nonrecursive_dataclass_unpack(dc: Any) dict

Helper function to unpack a dataclass into a dict, without recursing into other dataclasses. This is useful as we want to use custom serialization for the dataclasses (annotating with the dataclass name) but dataclasses.asdict will recurse into inner dataclasses and make them indistinguishable from ordinary dicts. This function performs the

curia.utils.json.sanitize(obj, n_digits=5)

Sanitizes obj into something json-encodable, and rounds floats to n_digits :param obj: Object to sanitize :param n_digits: number of digits to round floats to

Returns:

Sanitized version of object.