dlt.common.libs.hexbytes
HexBytes Objects
class HexBytes(bytes)
HexBytes is a custom library that replaces the hexbytes library to ensure compatibility with the rest of the codebase. It has these changes:
- It always appends 0x prefix to the hex string.
- The representation at console (repr) is 0x-prefixed
hex
def hex(sep: Union[str, bytes] = None,
bytes_per_sep: "SupportsIndex" = 1) -> str
Output hex-encoded bytes, with an "0x" prefix.
Everything following the "0x" is output exactly like :meth:bytes.hex
.
fromhex
@classmethod
def fromhex(cls, hexstr: str) -> "HexBytes"
Create HexBytes from hex string, handling optional 0x prefix.
Arguments:
hexstr
- Hex string with or without 0x/0X prefix
Returns:
HexBytes instance