class documentation

Base class for TI files

Class Method get_type Gets the subclass corresponding to file magic if one is registered
Class Method open Creates a new file given a filename
Class Method register Registers a subtype with this class for coercion
Method __bool__ No summary
Method __bytes__ No summary
Method __copy__ No summary
Method __eq__ Determines if two files are identical
Method __format__ Undocumented
Method __init__ Creates an empty file with a specified name
Method __len__ No summary
Method bytes No summary
Method get_extension Determines the file extension for a targeted model based on its contents
Method get_filename Determines the filename based on the instance name and targeted model
Method load_bytes Loads a byte string or bytestream into this file
Method load_file Loads this file from a file pointer
Method save Saves this file given a filename
Method summary No summary
Method supported_by Determines whether this file supports a given model
Method targets Determines whether this file targets a given model
Class Variable magics Undocumented
Instance Variable name Undocumented
Property checksum The checksum for the file
Property is_empty Whether this file is empty
Method __init_subclass__ Undocumented
Class Variable _magics Undocumented

Inherited from Dock:

Method load Loads data into an instance by delegating to Loader methods based on the input's type
Class Variable loaders Undocumented
def get_type(cls, magic: str) -> type[TIFile] | None: (source)

Gets the subclass corresponding to file magic if one is registered

Parameters
magic:strThe file magic to search by
Returns
type[TIFile] | NoneA subclass of TIFile with corresponding file magic or None
def open(cls, filename: str) -> TIFile: (source)

Creates a new file given a filename

Parameters
filename:strA filename to open
Returns
TIFileThe file
def register(cls, file_type: type[TIFile]): (source)

Registers a subtype with this class for coercion

Parameters
file_type:type[TIFile]The TIFile subtype to register
def __bool__(self) -> bool: (source)
overridden in tivars.var.TIVarFile
Returns
boolWhether this file is empty
def __bytes__(self) -> bytes: (source)
Returns
bytesThe bytes contained in this file
def __copy__(self) -> TIFile: (source)
Returns
TIFileA copy of this var
def __eq__(self, other): (source)

Determines if two files are identical

Parameters
otherThe file to check against
Returns
Whether this file is equal to other
def __format__(self, format_spec: str) -> str: (source)

Undocumented

def __init__(self, *, name: str = 'UNNAMED', data: bytes = None): (source)

Creates an empty file with a specified name

Parameters
name:strThe name of the file (defaults to UNNAMED)
data:bytesThe file's data (defaults to empty)
def __len__(self): (source)
Returns
The total length of this file in bytes
def bytes(self) -> bytes: (source)
Returns
bytesThe bytes contained in this file
def get_extension(self, model: TIModel = TI_84PCE) -> str: (source)

Determines the file extension for a targeted model based on its contents

Parameters
model:TIModelThe model to target (defaults to this file's minimum supported model)
Returns
strThe file's extension
def get_filename(self, model: TIModel = TI_84PCE): (source)

Determines the filename based on the instance name and targeted model

The filename is the concatenation of the name and extension (see .get_extension).

Parameters
model:TIModelThe model to target (defaults to this file's minimum supported model)
Returns
The filename
def load_bytes(self, data: bytes | BytesIO): (source)

Loads a byte string or bytestream into this file

Parameters
data:bytes | BytesIOThe bytes to load
def load_file(self, file: BinaryIO): (source)

Loads this file from a file pointer

Parameters
file:BinaryIOA binary file to read from
def save(self, filename: str = None, *, model: TIModel = TI_84PCE): (source)
overridden in tivars.var.TIVarFile

Saves this file given a filename

Parameters
filename:strA filename to save to (defaults to the file's name and extension)
model:TIModelThe model to target (defaults to TI_84PCE)
def summary(self) -> str: (source)
Returns
strA text summary of this file
def supported_by(self, model: TIModel) -> bool: (source)

Determines whether this file supports a given model

See .targets to check models this file explicitly targets.

Parameters
model:TIModelThe model to check support for
Returns
boolWhether model supports this file
def targets(self, model: TIModel) -> bool: (source)

Determines whether this file targets a given model

See .supported_by to check models this file _can_ be sent to.

Parameters
model:TIModelThe model to check as a target
Returns
boolWhether model is targeted by this file

Undocumented

The checksum for the file

Whether this file is empty

def __init_subclass__(cls, /, register=False, **kwargs): (source)

Undocumented

Undocumented