srctools.types
This module contains various shared type definitions used by other modules.
File Protocols
Most operations acting on file objects only need a subset of the possible methods. These protocols indicate the current expected API.
- abstract class srctools.types.FileR[AnyStr]
A readable file. Context manager support is expected.
- abstract class srctools.types.FileWBinary
A writable binary file.
- abstract class srctools.types.FileSeek
A seekable file.
- seek(self, pos: int, whence: 0 | 1 | 2 = 0, /) ...
The whence values correspond to
os.SEEK_SET,SEEK_CURandSEEK_END
These protocols then combine the above with seekability:
- abstract class srctools.types.FileRSeek[AnyStr](FileR[AnyStr], FileSeek)
- abstract class srctools.types.FileWBinarySeek(FileWBinary, FileSeek)
Combination of
FileWBinaryandFileSeek.