Field

class Field(size: int, starting_position: int, value: Any | None = None)[source]

Class for representing an field for being read from and written in a file.

read(line: T) Any[source]

Generic method for reading a field from a given line of a file.

Parameters:

line (Union[str, bytes]) – The line read from the file

Returns:

The value read from the field

Return type:

Any

write(line: T) T[source]

Generic method for writing a field to a given line of a file.

Parameters:

line (Union[str, bytes]) – The line read from the file

Returns:

The value written to the field

Return type:

Union[str, bytes]