module documentation

Token stream decoder

Function decode Decodes a byte stream into a string of tokens and its minimum supported OS version
def decode(bytestream: bytes, *, tokens: Tokens = None, lang: str = 'en', mode: str = 'display') -> tuple[str | bytes, OsVersion]: (source)

Decodes a byte stream into a string of tokens and its minimum supported OS version

Each token is represented using one of three different representations formats, dictated by mode:
  • display: Represents the tokens with Unicode characters matching the calculator's display
  • accessible: Represents the tokens with ASCII-only equivalents, often requiring multi-character glyphs
  • ti_ascii: Represents the tokens with their internal font indices (returns a bytes object)
Parameters
bytestream:bytesThe token bytes to decode
tokens:TokensThe Tokens object to use for decoding (defaults to the TI-84+CE tokens)
lang:strThe language used in string (defaults to English, en)
mode:strThe form of token representation to use for output (defaults to display)
Returns
tuple[str | bytes, OsVersion]A tuple of a string of token representations and a minimum OsVersion