Skip to content

types

Public field aliases and helpers for common C-compatible scalar formats.

Functions:

  • c_char

    Annotated metadata for a char array of the given length. Returns Python bytes.

  • c_uuid

    Annotated metadata for a single UUID. Expects 16-byte char array.

Attributes:

  • Bool

    C format for a single bool.

  • ComplexDouble

    C format for a single complex double.

  • ComplexFloat

    C format for a single complex float.

  • Double

    C format for a single double.

  • Float

    C format for a single float.

  • Int

    C format for a single int.

  • Long

    C format for a single long.

  • LongLong

    C format for a single long long.

  • RawBytes

    Raw trailing bytes that consume all remaining data in the buffer.

  • SSizeT

    C format for a single ssize_t.

  • Short

    C format for a single short.

  • SignedChar

    C format for a single signed char.

  • UnsignedChar

    C format for a single unsigned char.

  • UnsignedInt

    C format for a single unsigned int.

  • UnsignedLong

    C format for a single unsigned long.

  • UnsignedLongLong

    C format for a single unsigned long long.

  • UnsignedShort

    C format for a single unsigned short.

  • Uuid

    C format for a single UUID.

  • c_bool

    Annotated metadata for one or more bools. count>1 represents a tuple of values.

  • c_complex_double

    Annotated metadata for one or more complex doubles. count>1 represents a tuple of values.

  • c_complex_float

    Annotated metadata for one or more complex floats. count>1 represents a tuple of values.

  • c_double

    Annotated metadata for one or more doubles. count>1 represents a tuple of values.

  • c_float

    Annotated metadata for one or more floats. count>1 represents a tuple of values.

  • c_int

    Annotated metadata for one or more ints. count>1 represents a tuple of values.

  • c_long

    Annotated metadata for one or more longs. count>1 represents a tuple of values.

  • c_long_long

    Annotated metadata for one or more long longs. count>1 represents a tuple of values.

  • c_short

    Annotated metadata for one or more shorts. count>1 represents a tuple of values.

  • c_signed_char

    Annotated metadata for one or more signed chars. count>1 represents a tuple of values.

  • c_size_t

    Annotated metadata for one or more size_t values. count>1 represents a tuple of values.

  • c_ssize_t

    Annotated metadata for one or more ssize_t values. count>1 represents a tuple of values.

  • c_unsigned_char

    Annotated metadata for one or more unsigned chars. count>1 represents a tuple of values.

  • c_unsigned_int

    Annotated metadata for one or more unsigned ints. count>1 represents a tuple of values.

  • c_unsigned_long

    Annotated metadata for one or more unsigned longs. count>1 represents a tuple of values.

  • c_unsigned_long_long

    Annotated metadata for unsigned long longs. count>1 represents a tuple of values.

  • c_unsigned_short

    Annotated metadata for one or more unsigned shorts. count>1 represents a tuple of values.

Bool module-attribute

Bool = Annotated[bool, c_bool(1)]

C format for a single bool.

ComplexDouble module-attribute

ComplexDouble = Annotated[complex, c_complex_double(1)]

C format for a single complex double.

ComplexFloat module-attribute

ComplexFloat = Annotated[complex, c_complex_float(1)]

C format for a single complex float.

Double module-attribute

Double = Annotated[float, c_double(1)]

C format for a single double.

Float module-attribute

Float = Annotated[float, c_float(1)]

C format for a single float.

Int module-attribute

Int = Annotated[int, c_int(1)]

C format for a single int.

Long module-attribute

Long = Annotated[int, c_long(1)]

C format for a single long.

LongLong module-attribute

LongLong = Annotated[int, c_long_long(1)]

C format for a single long long.

RawBytes module-attribute

RawBytes = Annotated[
    bytes,
    CEncoded(
        get_encoder=lambda e, s: CEncoderSchema[bytes](
            type="encoder",
            alignment=1,
            size=None,
            unpack=lambda buffer: read(),
            pack=lambda buffer, value: write(value),
            schema_equality_info=(__name__, "ByteArray"),
        )
    ),
]

Raw trailing bytes that consume all remaining data in the buffer.

Should be the last field in a model, as it reads from the current position to the end of the buffer.

SSizeT module-attribute

SSizeT = Annotated[int, c_ssize_t(1)]

C format for a single ssize_t.

Short module-attribute

Short = Annotated[int, c_short(1)]

C format for a single short.

SignedChar module-attribute

SignedChar = Annotated[int, c_signed_char(1)]

C format for a single signed char.

UnsignedChar module-attribute

UnsignedChar = Annotated[int, c_unsigned_char(1)]

C format for a single unsigned char.

UnsignedInt module-attribute

UnsignedInt = Annotated[int, c_unsigned_int(1)]

C format for a single unsigned int.

UnsignedLong module-attribute

UnsignedLong = Annotated[int, c_unsigned_long(1)]

C format for a single unsigned long.

UnsignedLongLong module-attribute

UnsignedLongLong = Annotated[int, c_unsigned_long_long(1)]

C format for a single unsigned long long.

UnsignedShort module-attribute

UnsignedShort = Annotated[int, c_unsigned_short(1)]

C format for a single unsigned short.

Uuid module-attribute

Uuid = Annotated[UUID, c_uuid()]

C format for a single UUID.

c_bool module-attribute

c_bool = _make_one_or_many(bool, '?')

Annotated metadata for one or more bools. count>1 represents a tuple of values.

c_complex_double module-attribute

c_complex_double = _make_one_or_many(complex, 'D')

Annotated metadata for one or more complex doubles. count>1 represents a tuple of values.

c_complex_float module-attribute

c_complex_float = _make_one_or_many(complex, 'F')

Annotated metadata for one or more complex floats. count>1 represents a tuple of values.

c_double module-attribute

c_double = _make_one_or_many(float, 'd')

Annotated metadata for one or more doubles. count>1 represents a tuple of values.

c_float module-attribute

c_float = _make_one_or_many(float, 'f')

Annotated metadata for one or more floats. count>1 represents a tuple of values.

c_int module-attribute

c_int = _make_one_or_many(int, 'i')

Annotated metadata for one or more ints. count>1 represents a tuple of values.

c_long module-attribute

c_long = _make_one_or_many(int, 'l')

Annotated metadata for one or more longs. count>1 represents a tuple of values.

c_long_long module-attribute

c_long_long = _make_one_or_many(int, 'q')

Annotated metadata for one or more long longs. count>1 represents a tuple of values.

c_short module-attribute

c_short = _make_one_or_many(int, 'h')

Annotated metadata for one or more shorts. count>1 represents a tuple of values.

c_signed_char module-attribute

c_signed_char = _make_one_or_many(int, 'b')

Annotated metadata for one or more signed chars. count>1 represents a tuple of values.

c_size_t module-attribute

c_size_t = _make_one_or_many(int, 'N')

Annotated metadata for one or more size_t values. count>1 represents a tuple of values.

c_ssize_t module-attribute

c_ssize_t = _make_one_or_many(int, 'n')

Annotated metadata for one or more ssize_t values. count>1 represents a tuple of values.

c_unsigned_char module-attribute

c_unsigned_char = _make_one_or_many(int, 'B')

Annotated metadata for one or more unsigned chars. count>1 represents a tuple of values.

c_unsigned_int module-attribute

c_unsigned_int = _make_one_or_many(int, 'I')

Annotated metadata for one or more unsigned ints. count>1 represents a tuple of values.

c_unsigned_long module-attribute

c_unsigned_long = _make_one_or_many(int, 'L')

Annotated metadata for one or more unsigned longs. count>1 represents a tuple of values.

c_unsigned_long_long module-attribute

c_unsigned_long_long = _make_one_or_many(int, 'Q')

Annotated metadata for unsigned long longs. count>1 represents a tuple of values.

c_unsigned_short module-attribute

c_unsigned_short = _make_one_or_many(int, 'H')

Annotated metadata for one or more unsigned shorts. count>1 represents a tuple of values.

c_char

c_char(count: int) -> CFormat

Annotated metadata for a char array of the given length. Returns Python bytes.

c_uuid

c_uuid() -> CFormat[UUID]

Annotated metadata for a single UUID. Expects 16-byte char array.