|
|
@@ -179,8 +179,9 @@ class Config: |
|
|
|
|
|
|
|
If an integer is provided it is treated as bytes and is unchanged. |
|
|
|
|
|
|
|
String byte sizes can have a suffix of 'K' or `M`, representing kibibytes and |
|
|
|
mebibytes respectively. No suffix is understood as a plain byte count. |
|
|
|
String byte sizes can have a suffix of 'K', `M`, `G` or `T`, |
|
|
|
representing kibibytes, mebibytes, gibibytes and tebibytes respectively. |
|
|
|
No suffix is understood as a plain byte count. |
|
|
|
|
|
|
|
Raises: |
|
|
|
TypeError, if given something other than an integer or a string |
|
|
@@ -189,7 +190,7 @@ class Config: |
|
|
|
if type(value) is int: # noqa: E721 |
|
|
|
return value |
|
|
|
elif isinstance(value, str): |
|
|
|
sizes = {"K": 1024, "M": 1024 * 1024} |
|
|
|
sizes = {"K": 1024, "M": 1024 * 1024, "G": 1024**3, "T": 1024**4} |
|
|
|
size = 1 |
|
|
|
suffix = value[-1] |
|
|
|
if suffix in sizes: |
|
|
|