Skip to main content

TagTuple

No overview available.

Attributes

AttributeTypeDescription
keystr = " 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

NameTypeDescription
valuet.AnyThe value to check for tuple type.

Returns

TypeDescription
boolTrue 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

NameTypeDescription
valuet.AnyThe Python tuple to convert to a JSON-compatible list.

Returns

TypeDescription
t.AnyA 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

NameTypeDescription
valuet.AnyThe JSON-deserialized list to convert back into a Python tuple.

Returns

TypeDescription
t.AnyA Python tuple created from the input list.