commonpower.benchmark.benchmark.TimedeltaHandler
- class TimedeltaHandler(context)[source]
Bases:
BaseHandlerA custom handler for serializing and deserializing timedelta objects to and from JSON.
This handler is used by the jsonpickle library to handle serialization and deserialization of timedelta objects.
- None
- Usage:
This handler should be registered with the jsonpickle library to enable serialization and deserialization of timedelta objects.
Initialize a new handler to handle a registered type.
- Parameters:
context: reference to pickler/unpickler
Methods
Flatten obj into a json-friendly form and write result to data.
handlesRegister this handler for the given class. Suitable as a decorator, e.g.::.
Restore an object of the registered type from the json-friendly representation obj and return it.