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 | __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 | targets |
Determines which model(s) this header can target |
Instance Variable | raw |
Undocumented |
TIModel
= None, *, magic: str
= None, extra: bytes
= b'\x1a\n', product_id: int
= None, comment: str
= 'Created with tivars_lib_py v0.9.2', data: bytes
= None):
(source)
¶
Creates an empty header which targets a specified model
Parameters | |
model:TIModel | A minimum TIModel to target (defaults to TI_83P) |
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 which model(s) this header can target
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.
If the header contains malformed magic, an error will be raised. If the header contains a malformed product ID, it will be ignored.
Returns | |
set[ | A set of models that this header can target |