aboutsummaryrefslogtreecommitdiffstats
path: root/snekbox/filesystem.py
diff options
context:
space:
mode:
authorGravatar ionite34 <[email protected]>2022-11-28 15:49:29 +0800
committerGravatar ionite34 <[email protected]>2022-11-28 15:49:29 +0800
commit34db29512e0064b17c6358a2296f9815838420bd (patch)
tree133d84f561a17fdc495345fe86a224bb961ecc7f /snekbox/filesystem.py
parentAdd new file system info to README (diff)
Change Size to IntEnum, change usage in tests
Diffstat (limited to '')
-rw-r--r--snekbox/filesystem.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/snekbox/filesystem.py b/snekbox/filesystem.py
index 0cdfbf5..9f0634a 100644
--- a/snekbox/filesystem.py
+++ b/snekbox/filesystem.py
@@ -20,13 +20,13 @@ libc.mount.argtypes = (
libc.umount2.argtypes = (ctypes.c_char_p, ctypes.c_int)
-class Size(int):
- """Size in bytes."""
+class Size(IntEnum):
+ """Size multipliers for bytes."""
- @classmethod
- def from_mb(cls, mb: int) -> Size:
- """Create a Size from mebibytes."""
- return cls(mb * 1024 * 1024)
+ KB = 1024
+ MB = 1024**2
+ GB = 1024**3
+ TB = 1024**4
class UnmountFlags(IntEnum):