nvflare.fuel.utils.fobs.decomposers.core_decomposers module

Decomposers for Python builtin objects.

class DatetimeDecomposer[source]

Bases: Decomposer

decompose(target: datetime) Any[source]

Decompose the target into types supported by msgpack or classes with decomposers registered.

Msgpack supports primitives, bytes, memoryview, lists, dicts.

Parameters

target – The instance to be serialized

Returns

The decomposed serializable objects

recompose(data: Any) datetime[source]

Reconstruct the object from decomposed components.

Parameters

data – The decomposed components

Returns

The reconstructed object

static supported_type()[source]

Returns the type/class supported by this decomposer.

Returns

The class (not instance) of supported type

class SetDecomposer[source]

Bases: Decomposer

decompose(target: set) Any[source]

Decompose the target into types supported by msgpack or classes with decomposers registered.

Msgpack supports primitives, bytes, memoryview, lists, dicts.

Parameters

target – The instance to be serialized

Returns

The decomposed serializable objects

recompose(data: Any) set[source]

Reconstruct the object from decomposed components.

Parameters

data – The decomposed components

Returns

The reconstructed object

static supported_type()[source]

Returns the type/class supported by this decomposer.

Returns

The class (not instance) of supported type

class TupleDecomposer[source]

Bases: Decomposer

decompose(target: tuple) Any[source]

Decompose the target into types supported by msgpack or classes with decomposers registered.

Msgpack supports primitives, bytes, memoryview, lists, dicts.

Parameters

target – The instance to be serialized

Returns

The decomposed serializable objects

recompose(data: Any) tuple[source]

Reconstruct the object from decomposed components.

Parameters

data – The decomposed components

Returns

The reconstructed object

static supported_type()[source]

Returns the type/class supported by this decomposer.

Returns

The class (not instance) of supported type