class documentation

class LeftNibbleBCD(Converter): (source)

View In Hierarchy

Converter for 2-digit binary-coded decimal with a single extra nibble

A single byte contains two decimal digits as if they were hex digits. The extraneous nibble appears in the leftmost byte, left-padded with a single hex digit.

Class Method get Converts bytes -> int from 2-digit binary coded decimal with an extra nibble on the left
Class Method set Converts int -> bytes as 2-digit binary coded decimal with an extra nibble on the left
@classmethod
def get(cls, data: bytes, **kwargs) -> _T: (source)

Converts bytes -> int from 2-digit binary coded decimal with an extra nibble on the left

Parameters
data:bytesThe raw bytes to convert
**kwargsUndocumented
Returns
_TThe number stored in data
@classmethod
def set(cls, value: _T, *, current: bytes = None, **kwargs) -> bytes: (source)

Converts int -> bytes as 2-digit binary coded decimal with an extra nibble on the left

Parameters
value:_TThe value to convert
current:bytesThe current value of the data section
**kwargsUndocumented
Returns
bytesThe bytes representing value in BCD