Enums
CompressionType
Bases: IntEnum
Compression algorithms for ZipFile
BZIP2
class-attribute
instance-attribute
The numeric constant for the BZIP2 compression method. This requires the bz2 module.
DEFLATED
class-attribute
instance-attribute
The numeric constant for the usual ZIP compression method. This requires the zlib module.
LZMA
class-attribute
instance-attribute
The numeric constant for the LZMA compression method. This requires the lzma module.
STORED
class-attribute
instance-attribute
The numeric constant for an uncompressed archive member.
get
classmethod
get(key: str | int | None = None, default: Literal['stored', 'deflated', 'bzip2', 'lzma'] | str | int = 'stored') -> CompressionType
Get the CompressionType
by its name or number.
Return the default if the key is missing or invalid.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str | int
|
The key to retrieve. |
None
|
default |
Literal['stored', 'deflated', 'bzip2', 'lzma'] | str | int
|
The default value to return if the key is missing or invalid. |
'stored'
|
Returns:
Type | Description |
---|---|
CompressionType
|
The |