Bethesda Structs Package¶
The following is the automatically built documentation for the entire bethesda_structs
package.
All objects that are considered to be handlers for a Bethesda file format are subclasses of BaseFiletype
.
Plugins
andArchives
adhere to the following naming conventions.{GAME_PREFIX}Plugin
-FNVPlugin
{TYPE_PREFIX}Archive
-BSAArchive
In some cases (such as BSAArchive
) this may seem repetitive (BSA[rchive]Archive
).
But, in this project, repetition is sacrificed for standardization.
Important
Common resources for each module (including submodules) are placed in a file named _common.py
for each module. Typically you will see abstract objects or module helper methods defined in these files.
They are important for contributors, but shouldn’t ever need to be seen by users.
-
class
bethesda_structs._common.
BaseFiletype
[source]¶ Bases:
abc.ABC
The base filetype for all supported file parsers.
-
classmethod
can_handle
(filepath)[source]¶ Determines if a given filepath can be handled by the archive.
Parameters: filepath (str) – The filepath to evaluate Raises: NotImplementedError
– Subclasses must implementReturn type: bool
-
classmethod
parse
(content, filepath=None)[source]¶ Create a
BaseFiletype
from a byte array.Parameters: Raises: NotImplementedError
– Subclasses must implementReturns: A filetype instance
Return type:
-
classmethod
parse_stream
(stream, filepath=None)[source]¶ Create a
BaseFiletype
from a file stream.Parameters: - stream (io.BufferedReader) – A file stream to read from.
- filepath (str, optional) – Defaults to None. Sets the filepath attribute for user’s reference.
Raises: ValueError
– If the given stream is not ofbytes
Returns: A filetype instance
Return type:
-
classmethod
parse_file
(filepath)[source]¶ Create a
BaseFiletype
from a given filepath.Parameters: filepath (str) – The filepath to read from Raises: FileNotFoundError
– If the given filepath does not existReturns: A filetype instance Return type: BaseFiletype
-
classmethod