class documentation

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_name__ Undocumented
Method _get_raw Undocumented
Method _set_raw Undocumented
Instance Variable _class_attr Undocumented
Instance Variable _converter Undocumented
Instance Variable _get Undocumented
Instance Variable _length Undocumented
Instance Variable _name Undocumented
Instance Variable _set Undocumented
def __copy__(self) -> Section: (source)

Undocumented

def __init__(self, length: int = None, converter: type[Converter] = None, *, class_attr: bool = False): (source)
overridden in tivars.data.View

Define a new data section given a length and type converter

Parameters
length:intThe length of the section (defaults to None, i.e. unbounded)
converter:type[Converter]The type converter for the section (defaults to Bytes)
class_attr:boolWhether the section should return a shadowed class attribute (defaults to False)

The length of this section

The Raw class attribute name that this section stores to

def __call__(self, func: Callable) -> Section: (source)

Undocumented

def __deepcopy__(self, memo) -> Section: (source)

Undocumented

def __get__(self, instance, owner: type = None) -> _T: (source)

Undocumented

def __set__(self, instance, value: _T): (source)
overridden in tivars.data.View

Undocumented

def __set_name__(self, owner, name: str): (source)

Undocumented

def _get_raw(self, instance) -> bytes: (source)
overridden in tivars.data.View

Undocumented

def _set_raw(self, instance, value: _T) -> _T: (source)

Undocumented

_class_attr = (source)

Undocumented

_converter = (source)

Undocumented

Undocumented

overridden in tivars.data.View

Undocumented

Undocumented

Undocumented