SingleZipReader
This class extends the standard zipfile.ZipFile to provide specialized handling for zip-compressed fixtures that must contain exactly one file. It validates the archive contents upon initialization and overrides the read method to automatically return the contents of the single internal file.
Constructor
Signature
def SingleZipReader(
*args: any,
**kwargs: any
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| *args | any | Variable length argument list passed to the parent ZipFile constructor. |
| **kwargs | any | Arbitrary keyword arguments passed to the parent ZipFile constructor. |
Signature
def SingleZipReader(
*args: any,
**kwargs: any
)
Parameters
| Name | Type | Description |
|---|---|---|
| *args | any | Positional arguments passed to the underlying zipfile.ZipFile constructor, such as the file path or file-like object. |
| **kwargs | any | Keyword arguments passed to the underlying zipfile.ZipFile constructor, such as the mode or compression type. |
Methods
read()
@classmethod
def read() - > bytes
Reads and returns the uncompressed content of the single file contained within the ZIP archive.
Returns
| Type | Description |
|---|---|
bytes | The raw byte content of the first and only file found in the ZIP archive. |