Serializers¶
blake2signer.serializers
¶
Serializers: classes that implement the SerializerInterface.
JSONSerializer
¶
Bases: SerializerInterface
JSON serializer.
Source code in blake2signer/serializers.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
serialize(data, **kwargs)
¶
Serialize given data to JSON.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
typing.Any
|
Data to serialize. |
required |
Other Parameters:
Name | Type | Description |
---|---|---|
**kwargs |
typing.Any
|
Additional arguments for |
Returns:
Type | Description |
---|---|
bytes
|
Serialized data |
Source code in blake2signer/serializers.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
unserialize(data, **kwargs)
¶
Unserialize given JSON data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
bytes
|
Serialized data to unserialize. |
required |
Other Parameters:
Name | Type | Description |
---|---|---|
**kwargs |
typing.Any
|
Additional arguments for |
Returns:
Type | Description |
---|---|
typing.Any
|
Original data. |
Source code in blake2signer/serializers.py
28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
NullSerializer
¶
Bases: SerializerInterface
Null serializer that doesn't serializes anything.
Source code in blake2signer/serializers.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
serialize(data, **kwargs)
¶
Null serialize data (it just converts it to bytes).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
typing.Any
|
Data to serialize. |
required |
Other Parameters:
Name | Type | Description |
---|---|---|
**kwargs |
typing.Any
|
Ignored. |
Returns:
Type | Description |
---|---|
bytes
|
Serialized data |
Source code in blake2signer/serializers.py
46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
unserialize(data, **kwargs)
¶
Return given data as-is.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
bytes
|
Serialized data to unserialize. |
required |
Other Parameters:
Name | Type | Description |
---|---|---|
**kwargs |
typing.Any
|
Ignored. |
Returns:
Type | Description |
---|---|
typing.Any
|
Original data. |
Source code in blake2signer/serializers.py
60 61 62 63 64 65 66 67 68 69 70 71 72 |
|