class Section: (source)
Known subclasses: tivars.data.View
Constructor: Section(length, converter, class_attr)
Data section class which handles conversion between bytes and appropriate data types
A data section is given by its length and type converter. Their primary function is to permit the user to read and write data sections as their natural data types.
The sections are stored in the raw attribute of their class, which is an instance of a Raw container. A priori, a data section does not correspond to any one part of a var file. Individual sections are instead stitched together to yield a var file's contents via raw.bytes().
Distinct data sections are entirely independent, which is useful for sections which may vary in length.
To construct sections which point to a portion of another section, see the View
class.
Data sections can be declared by decorating methods:
@Section(length, Converter) def data_section(self) -> _T: ...
An optional second parameter can be passed, wherein the method is used as a pre-converter before Converter.set
.
Method | __copy__ |
Undocumented |
Method | __init__ |
Define a new data section given a length and type converter |
Property | length |
The length of this section |
Property | name |
The Raw class attribute name that this section stores to |
Method | __call__ |
Undocumented |
Method | __deepcopy__ |
Undocumented |
Method | __get__ |
Undocumented |
Method | __set__ |
Undocumented |
Method | __set |
Undocumented |
Method | _get |
Undocumented |
Method | _set |
Undocumented |
Instance Variable | _class |
Undocumented |
Instance Variable | _converter |
Undocumented |
Instance Variable | _get |
Undocumented |
Instance Variable | _length |
Undocumented |
Instance Variable | _name |
Undocumented |
Instance Variable | _set |
Undocumented |
int
= None, converter: type[ Converter]
= None, *, class_attr: bool
= False):
(source)
¶
tivars.data.View
Define a new data section given a length and type converter
Parameters | |
length:int | The length of the section (defaults to None, i.e. unbounded) |
converter:type[ | The type converter for the section (defaults to Bytes ) |
classbool | Whether the section should return a shadowed class attribute (defaults to False) |