pyctr.type.base.typereader module
- pyctr.type.base.typereader.raise_if_closed(method)[source]
Wraps a method that raises an exception if the reader object is closed.
- Parameters:
method – The method to call if the file is not closed.
- Returns:
The wrapper method.
- exception pyctr.type.base.typereader.ReaderError[source]
Bases:
PyCTRErrorGeneric error for TypeReaderBase operations.
- exception pyctr.type.base.typereader.ReaderClosedError[source]
Bases:
ReaderErrorThe reader object is closed.
- class pyctr.type.base.typereader.TypeReaderBase(file, *, fs=None, closefd=None, mode='rb')[source]
Bases:
objectBase class for all reader classes.
This handles types that are based in a single file. Therefore not every class will use this, such as SDFilesystem.
- Parameters:
file (FilePathOrObject) – A file path or a file-like object with the type’s data.
closefd (bool | None) – Close the underlying file object when closed. Defaults to True for file paths, and False for file-like objects.
mode (str) – Mode to open the file with, passed to open. This is set by type readers internally. Only used if a file path was given.
fs (FS | None)
- class pyctr.type.base.typereader.TypeReaderCryptoBase(file, *, fs=None, closefd=None, mode='rb', crypto=None, dev=False)[source]
Bases:
TypeReaderBaseBase class for reader classes that use a
CryptoEngineobject..- Parameters:
file (FilePathOrObject) – A file path or a file-like object with the type’s data.
closefd (bool) – Close the underlying file object when closed. Defaults to True for file paths, and False for file-like objects.
crypto (CryptoEngine) – A custom
crypto.CryptoEngineobject to be used. Defaults to None, which causes a new one to be created. This typically only works directly on the type, not any subtypes that might be created (e.g.CIAReadercreatesNCCHReader).dev (bool) – Use devunit keys.
mode (str) – Mode to open the file with, passed to open. This is set by type readers internally. Only used if a file path was given.
fs (FS | None)