CborSimpleValue

class cometa.cbor.cbor_simple_value.CborSimpleValue(value)[source]

Bases: IntEnum

Represents a CBOR simple value (major type 7).

These simple values are part of the CBOR data format as defined in RFC 7049, section 2.3, representing commonly used simple data items. This enumeration includes the simple values for ‘false’, ‘true’, ‘null’, and ‘undefined’, each of which has a specific role in the CBOR encoding and interpretation process.

FALSE = 20

Represents the value ‘false’. This value is used to represent the boolean false in CBOR-encoded data.

TRUE = 21

Represents the value ‘true’. This value is used to represent the boolean true in CBOR-encoded data.

NULL = 22

Represents the value ‘null’. This value signifies a null reference or the absence of data in CBOR-encoded data.

UNDEFINED = 23

Represents an undefined value. This value is used by an encoder as a substitute for a data item with an encoding problem, indicating the absence of meaningful or correct data.

to_string()[source]

Returns a human-readable string representation of this CBOR simple value.

Returns:

A string representation of the simple value.

Return type:

str

Example

>>> from cometa.cbor import CborSimpleValue
>>> value = CborSimpleValue.TRUE
>>> value.to_string()
'True'