class TIHeader: (source)
Constructors: TIHeader.open(filename), TIHeader(model, magic, extra, product_id, ...)
Parser for var file headers
All var files require a header which includes a number of magic bytes, data lengths, and a customizable comment.
| Class | |
Raw bytes container for TIHeader |
| Class Method | open |
Creates a new header from a file given a filename |
| Method | __bytes__ |
No summary |
| Method | __copy__ |
No summary |
| Method | __eq__ |
Determines if two headers have the same bytes |
| Method | __format__ |
Undocumented |
| Method | __init__ |
Creates an empty header which targets a specified model |
| Method | __len__ |
No summary |
| Method | __or__ |
Constructs a var by concatenating this header with a list of entries |
| Method | bytes |
No summary |
| Method | comment |
The comment attached to the var |
| Method | extra |
Extra export bytes for the var |
| Method | load |
Loads a byte string or bytestream into the header |
| Method | load |
Loads this header from a file given a file pointer |
| Method | magic |
The file magic for the var |
| Method | product |
The product ID for the var |
| Method | summary |
No summary |
| Method | supported |
Determines whether this header supports a given model |
| Method | targets |
Determines whether this header targets a given model |
| Class Variable | length |
Undocumented |
| Class Variable | magics |
Undocumented |
| Instance Variable | raw |
Undocumented |
Determines if two headers have the same bytes
| Parameters | |
| other | The header to check against |
| Returns | |
bool | Whether this header is equal to other |
TIModel = TI_84PCE, *, magic: str = None, extra: bytes = b'\x1a\n', product_id: int = None, comment: str = 'Created with tivars_lib_py v1.1.0', data: bytes = None):
(source)
¶
Creates an empty header which targets a specified model
| Parameters | |
model:TIModel | A minimum TIModel to target (defaults to TI_84PCE) |
magic:str | File magic at the start of the header (default to the model's magic) |
extra:bytes | Extra export bytes for the header (defaults to $1a0a) |
productint | The targeted model's product ID (defaults to $00) |
comment:str | A comment to include in the header (defaults to a simple lib message) |
data:bytes | This header's data (defaults to empty) |
Extra export bytes for the var
The exact meaning and interpretation of these bytes is not yet determined. These bytes are set by different export tools and can often be "incorrect" without causing issues.
The product ID for the var
While used to identify the model the var was created on, it has no actual functional ramifications. Furthermore, it does not constitute a 1-to-1 mapping to distinct models.
Determines whether this header supports a given model
See TIHeader.targets to check models this header explicitly targets.
| Parameters | |
model:TIModel | The model to check support for |
| Returns | |
bool | Whether model supports this header |
Determines whether this header targets a given model
The header contains no reference to a model to target, which permits sharing across models where possible. This method derives a set of valid models from the header's file magic and product ID.
See TIHeader.supported_by to check models this header _can_ be sent be to.
| Parameters | |
model:TIModel | The model to check as a target |
| Returns | |
bool | Whether model is targeted by this header |