-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into master
- Loading branch information
Showing
3 changed files
with
22 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
from enum import Enum | ||
|
||
|
||
class ZipCompression(Enum): | ||
class ZipCompression: | ||
STORE = 0 | ||
DEFLATE = 8 | ||
MAP = {'STORE': 0, 'DEFLATE': 8} | ||
|
||
@classmethod | ||
def _missing_(cls, value): | ||
@staticmethod | ||
def get(value: str) -> int: | ||
try: | ||
return cls[value.upper()] | ||
return ZipCompression.MAP[value.upper()] | ||
except KeyError: | ||
pass | ||
|
||
raise ValueError("%r is not a valid %s" % (value, cls.__name__)) | ||
raise ValueError("%s is not a valid key" % value.upper()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters