TagTuple
No overview available.
Attributes
| Attribute | Type | Description |
|---|---|---|
| key | str = " t" | This attribute stores the string " t" and is used as a key for tagging tuples during serialization and deserialization. |
Methods
check()
@classmethod
def check(
value: t.Any
) - > bool
Checks if the provided value is a tuple. This method is used to determine if a value can be handled by this tag.
Parameters
| Name | Type | Description |
|---|---|---|
| value | t.Any | The value to check for tuple type. |
Returns
| Type | Description |
|---|---|
bool | True if the value is a tuple, False otherwise. |
to_json()
@classmethod
def to_json(
value: t.Any
) - > t.Any
Converts a Python tuple into a JSON-serializable list, applying serialization to each item within the tuple. This prepares the tuple for storage or transmission in JSON format.
Parameters
| Name | Type | Description |
|---|---|---|
| value | t.Any | The Python tuple to convert to a JSON-compatible list. |
Returns
| Type | Description |
|---|---|
t.Any | A list where each item has been serialized for JSON compatibility. |
to_python()
@classmethod
def to_python(
value: t.Any
) - > t.Any
Converts a JSON-deserialized list back into a Python tuple. This method is used to reconstruct the original Python tuple from its JSON representation.
Parameters
| Name | Type | Description |
|---|---|---|
| value | t.Any | The JSON-deserialized list to convert back into a Python tuple. |
Returns
| Type | Description |
|---|---|
t.Any | A Python tuple created from the input list. |