ValueBlob

class dsviper.ValueBlob(initial_value=None)

Bases: Value

A value of type blob. Seamless with bytes, bytearray and base64_string.

Or use Value.create(Type.BLOB [, initial_value]).

The bytes are copied in, and a blob is read-only: its buffer hands them out without letting them be written, and encoded() returns a copy.

static base64_decode(base64_string: str) → ValueBlob

Return the blob base64_string decodes to.

base64_encode() → str

Return the base64 encoded string representation of this blob.

static cast(value: Value | _OutputValues) → ValueBlob

Return value as a blob, or raise if it is not one.

copy() → ValueBlob

Return a deep copy.

description(*, namespace: NameSpace | None = None) → str

Return the value written out, then its type, as <value>:<type>.

namespace qualifies the type name; representation() gives the value alone.

embed(name: str) → str

Return the blob as a C++ array declaration called name, to paste into a source file.

encoded() → bytes

Return a Python bytes.

hash() → int

Return the hash value.

representation() → str

Return the value written out: blob(<byte count>) - the bytes themselves are not written.

sha1() → str

Return the hexdigest (SHA1).

size() → int

Return the number of bytes the blob holds.

type() → Type

Return the Type this value is an instance of.

type_code() → str

Return the code naming this kind of value, such as “int32”, “struct” or “vector”.