Skip to content

yggdrasil.pickle.ser.logicals

logicals

DecimalSerialized dataclass module-attribute

DecimalSerialized = get_class(DECIMAL) or DecimalSerialized
Decimal payload

payload = 3 x signed int64: coefficient precision scale

Notes
  • coefficient is the signed integer formed from the decimal digits
  • precision is the number of digits
  • scale is the number of fractional decimal digits

DatetimeSerialized dataclass module-attribute

DatetimeSerialized = get_class(DATETIME) or DatetimeSerialized
Datetime payload

payload = big-endian int64 epoch integer metadata: u = s|ms|us|ns z = optional timezone text

DateSerialized dataclass module-attribute

DateSerialized = get_class(DATE) or DateSerialized
Date payload

payload = signed int32 days since epoch

TimeSerialized dataclass module-attribute

TimeSerialized = get_class(TIME) or TimeSerialized
Time payload

payload = unsigned int64 offset from midnight metadata: u = s|ms|us|ns z = optional timezone text

TimedeltaSerialized dataclass module-attribute

TimedeltaSerialized = get_class(TIMEDELTA) or TimedeltaSerialized
Timedelta payload

payload = signed int64 duration metadata: u = s|ms|us|ns

TimezoneSerialized dataclass module-attribute

TimezoneSerialized = get_class(TIMEZONE) or TimezoneSerialized
Timezone payload

payload = utf-8 timezone text metadata: k = tz

UUIDSerialized dataclass module-attribute

UUIDSerialized = get_class(UUID) or UUIDSerialized
UUID payload

payload = 16 raw bytes

ComplexNumberSerialized dataclass module-attribute

ComplexNumberSerialized = get_class(COMPLEX) or ComplexNumberSerialized
Complex payload

payload = float64(real) + float64(imag)

BytesSerialized dataclass module-attribute

BytesSerialized = get_class(BYTES) or BytesSerialized

Enhanced bytes payload: also handles bytearray and memoryview.

payload = raw bytes
metadata:
    k = b | ba | mv

PathSerialized dataclass module-attribute

PathSerialized = get_class(PATH) or PathSerialized

Path payload modes:

  1. path mode
  2. metadata: pm = p po = source os family
  3. payload: utf-8 string path
  4. decode: rebuild path for current OS semantics

  5. file mode

  6. metadata: pm = f fn = original filename po = source os family
  7. payload: raw file bytes
  8. decode: write to a temp file and return that path

  9. inline zipped directory mode

  10. metadata: pm = dz dn = original directory name po = source os family
  11. payload: zip bytes
  12. decode: extract to temp dir and return that path

Directory embedding is only used when total file bytes are below MAX_INLINE_DIR_BYTES.

IPAddressSerialized dataclass module-attribute

IPAddressSerialized = get_class(IPADDRESS) or IPAddressSerialized
IP payload

payload = canonical utf-8 string metadata: k = 4a | 6a | 4i | 6i | 4n | 6n

URLSerialized dataclass module-attribute

URLSerialized = get_class(URL) or URLSerialized
URL payload

payload = utf-8 URL string

LogicalSerialized dataclass

LogicalSerialized(head: Header, data: IO)

Bases: Serialized[T], Generic[T]

Base class for compact logical / semantic Python payloads.

Strategy: - use compact, fixed-width payload bytes whenever possible - use short metadata keys - keep decoding logic explicit and boring

module_and_name staticmethod

module_and_name(obj: Any, *, fallback: str = '') -> tuple[str, str]

Return (module, qualname) for obj.

Robust across Python objects, including many C-extension / PyArrow objects where module may be missing or misleading.