laila.entry.compdata.transformation¶
laila.entry.compdata.transformation
¶
Transformation sub-package re-exporting all transformations and the pipeline.
Base64
¶
Bases: _data_transformation
Reversible Base64 encoding transformation.
Forward encodes binary data to a Base64 UTF-8 string; backward decodes it back to raw bytes.
Source code in entry/compdata/transformation/base64/base64.py
model_post_init(__context)
¶
Build standalone backward recovery code.
Source code in entry/compdata/transformation/base64/base64.py
forward(data)
¶
Encode binary data -> Base64 UTF-8 string.
Source code in entry/compdata/transformation/base64/base64.py
backward(payload)
¶
Decode Base64 (str/bytes/bytearray/memoryview) -> raw bytes.
Source code in entry/compdata/transformation/base64/base64.py
Zlib
¶
Bases: _data_transformation
Reversible zlib compression transformation.
Forward compresses a UTF-8 string to a Base64-encoded compressed string; backward decompresses it.
Source code in entry/compdata/transformation/compression/zlib.py
model_post_init(__context)
¶
Build standalone backward recovery code.
Source code in entry/compdata/transformation/compression/zlib.py
forward(data)
¶
Compress a UTF-8 string and return a Base64-encoded result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
str
|
Plain-text UTF-8 string. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Base64-encoded compressed bytes. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If data is not a |
Source code in entry/compdata/transformation/compression/zlib.py
backward(data)
¶
Decompress a Base64-encoded compressed string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
str
|
Base64-encoded compressed payload. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Original UTF-8 string. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If data is not a |
Source code in entry/compdata/transformation/compression/zlib.py
FernetEncryption
¶
Bases: _data_transformation
Reversible Fernet symmetric encryption transformation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str or bytes
|
Fernet-compatible encryption key. |
required |
Source code in entry/compdata/transformation/encryption/encryption.py
model_post_init(__context)
¶
Initialise the Fernet encryptor and build backward recovery code.
Source code in entry/compdata/transformation/encryption/encryption.py
forward(data)
¶
Encrypt a UTF-8 string and return the Fernet token as a string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
str
|
Plain-text string to encrypt. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Fernet token. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If data is not a |
Source code in entry/compdata/transformation/encryption/encryption.py
backward(data)
¶
Decrypt a Fernet token back to the original string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
str
|
Fernet token string. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Original plain-text string. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If data is not a |
ValueError
|
If the token is invalid or TTL has expired. |
Source code in entry/compdata/transformation/encryption/encryption.py
PickleSerializer
¶
Bases: _data_transformation
Reversible pickle serialiser for arbitrary Python objects.
Source code in entry/compdata/transformation/serialization/pickle.py
model_post_init(__context)
¶
Build backward_code dynamically after model creation.
Source code in entry/compdata/transformation/serialization/pickle.py
forward(inp)
¶
Serialize a Python object into bytes using pickle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
Any
|
Object to serialize. |
required |
Returns:
| Type | Description |
|---|---|
bytes
|
Pickled bytes. |
Source code in entry/compdata/transformation/serialization/pickle.py
backward(inp)
¶
Deserialize bytes back into a Python object using pickle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
bytes
|
Pickled bytes. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
Unpickled Python object. |
Source code in entry/compdata/transformation/serialization/pickle.py
MsgpackSerializer
¶
Bases: _data_transformation
Reversible msgpack serialiser for Python objects.
Source code in entry/compdata/transformation/serialization/msgpack.py
model_post_init(__context)
¶
Build backward_code dynamically after model creation.
Source code in entry/compdata/transformation/serialization/msgpack.py
forward(inp)
¶
Serialize a Python object into bytes using msgpack.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
Any
|
Object to serialize. |
required |
Returns:
| Type | Description |
|---|---|
bytes
|
Msgpack-encoded bytes. |
Source code in entry/compdata/transformation/serialization/msgpack.py
backward(inp)
¶
Deserialize bytes back into a Python object using msgpack.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
bytes
|
Msgpack-encoded bytes. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
Deserialized Python object. |
Source code in entry/compdata/transformation/serialization/msgpack.py
NumpySerializer
¶
Bases: _data_transformation
Reversible NumPy serialiser using np.save / np.load.
Source code in entry/compdata/transformation/serialization/numpy.py
model_post_init(__context)
¶
Build backward_code dynamically after model creation.
Source code in entry/compdata/transformation/serialization/numpy.py
forward(inp)
¶
Serialize a NumPy array into bytes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
ndarray
|
Array to serialize. |
required |
Returns:
| Type | Description |
|---|---|
bytes
|
|
Source code in entry/compdata/transformation/serialization/numpy.py
backward(inp)
¶
Deserialize bytes back into a NumPy array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
bytes
|
Bytes produced by :meth: |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Reconstructed array. |
Source code in entry/compdata/transformation/serialization/numpy.py
TorchSerializer
¶
Bases: _data_transformation
Reversible PyTorch serialiser using torch.save / torch.load.
Source code in entry/compdata/transformation/serialization/torch.py
model_post_init(__context)
¶
Build backward_code dynamically after model creation.
Source code in entry/compdata/transformation/serialization/torch.py
forward(inp)
¶
Serialize a PyTorch tensor into bytes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
Tensor
|
Tensor to serialize. |
required |
Returns:
| Type | Description |
|---|---|
bytes
|
|
Source code in entry/compdata/transformation/serialization/torch.py
backward(inp)
¶
Deserialize bytes back into a PyTorch tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inp
|
bytes
|
Bytes produced by :meth: |
required |
Returns:
| Type | Description |
|---|---|
Any
|
Reconstructed tensor. |
Source code in entry/compdata/transformation/serialization/torch.py
JsonString
¶
Bases: _data_transformation
Reversible JSON string transformation.
Forward serialises a Python object to a compact JSON string; backward parses it back.
Source code in entry/compdata/transformation/jsonstring/jsonstring.py
model_post_init(__context)
¶
Build standalone backward recovery code.
Source code in entry/compdata/transformation/jsonstring/jsonstring.py
forward(data)
¶
Serialize data to a compact JSON string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
JSON-serialisable Python object. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Compact JSON string. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If data is not JSON-serialisable. |
Source code in entry/compdata/transformation/jsonstring/jsonstring.py
backward(data)
¶
Deserialize a JSON string back to a Python object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
str
|
JSON string. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
Parsed Python object. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If data is not a string or contains invalid JSON. |