class documentation

Open a keyfile for reading.

Example

>>> with Reader("nwn_base.key") as rd:
...     data = rd.read_file("doortype.2da")
...     print(data)
Parameters
filenameThe name of the keyfile to open.
bif_directoryThe directory to search for BIF files in. If not provided, the directory containing the keyfile is used.
Raises
ValueErrorIf the keyfile is not valid.
FileNotFoundErrorIf the keyfile or a BIF file is not found.
Method __enter__ Undocumented
Method __exit__ Undocumented
Method __init__ Undocumented
Method close Closes the main file and all associated BIF files. You should call this method when you are done with the keyfile. It is also called automatically when the object is deleted (eg. via context manager).
Method filenames Returns all filenames in the keyfile.
Method read_file Reads the content of a file from the resource archive.
Property build_date The build date when this keyfile was created.
Class _BIFF Undocumented
Instance Variable _bif_files Undocumented
Instance Variable _build_day Undocumented
Instance Variable _build_year Undocumented
Instance Variable _file Undocumented
Instance Variable _resref_id_lookup Undocumented
def __enter__(self): (source)

Undocumented

def __exit__(self, exc_type, exc_value, traceback): (source)

Undocumented

def __init__(self, filename: str, bif_directory=None): (source)

Undocumented

def close(self): (source)

Closes the main file and all associated BIF files. You should call this method when you are done with the keyfile. It is also called automatically when the object is deleted (eg. via context manager).

def filenames(self) -> list[str]: (source)

Returns all filenames in the keyfile.

def read_file(self, filename: str) -> bytes: (source)

Reads the content of a file from the resource archive.

Parameters
filename:strThe name of the file to read, including extension.
Returns
bytesThe content of the file.
Raises
ValueErrorIf the internal state is invalid.
FileNotFoundErrorIf the file is not found in the archive.
@property
build_date: date = (source)

The build date when this keyfile was created.

_bif_files: list = (source)

Undocumented

_build_day = (source)

Undocumented

_build_year = (source)

Undocumented

Undocumented

_resref_id_lookup: dict = (source)

Undocumented