Type

class dsviper.Type

Bases: object

A utility class to handle type representation.

Note: Not directly instantiable.

ANY = any
ANY_CONCEPT = any_concept
BLOB = blob
BLOB_ID = blob_id
BOOL = bool
COMMIT_ID = commit_id
DOUBLE = double
FLOAT = float
INT16 = int16
INT32 = int32
INT64 = int64
INT8 = int8
STRING = string
UINT16 = uint16
UINT32 = uint32
UINT64 = uint64
UINT8 = uint8
UUID = uuid
VOID = void
static decode(blob: ValueBlob, definitions: DefinitionsConst, *, stream_codec_instancing: StreamCodecInstancing | None = None) Type

Return a type by decoding the blob with a StreamBinaryCodec if not specified.

static encode(type: Type, *, stream_codec_instancing: StreamCodecInstancing | None = None) ValueBlob

Return a blob that encodes the type with a StreamBinaryCodec if not specified.

static hexdigest(type: Type, *, hashing: Hashing | None = None) str

Return the hexa digest of the type computed with the hashing interface if specified else use SHA1.

static is_sized(type: Type) bool

Return True if the type has a fixed size.

static read(stream_reading: StreamReading, definitions: DefinitionsConst) Type

Read and return a type.

static size_of(type: Type, stream_sizing: StreamSizing) int

Return the fixed size of the type or raise.

static use_blob_id(type: Type) bool

Return True if the type uses the type blob_id.

static write(type: Type, stream_writing: StreamWriting) None

Write a type.