aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ionite34 <[email protected]>2022-11-18 13:33:36 -0500
committerGravatar ionite34 <[email protected]>2022-11-18 13:33:36 -0500
commit7d1e04e301e632ffa0ca550c23e64cf747cc7cc0 (patch)
tree0274689fde53680407f578ed92833c66b3185b98
parentRemove unused supported mimes (diff)
Reorder `mkdir` function
-rw-r--r--snekbox/memfs.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/snekbox/memfs.py b/snekbox/memfs.py
index abc10ad..8d0841b 100644
--- a/snekbox/memfs.py
+++ b/snekbox/memfs.py
@@ -78,13 +78,6 @@ class MemFS:
"""Path to /dev/shm."""
return Path(self.path, "dev", "shm") if self.path else None
- def mkdir(self, path: str, chmod: int = 0o777) -> Path:
- """Create a directory in the tempdir."""
- folder = Path(self.path, path)
- folder.mkdir(parents=True, exist_ok=True)
- folder.chmod(chmod)
- return folder
-
def __enter__(self) -> MemFS:
# Generates a uuid tempdir
with self.assignment_lock:
@@ -109,6 +102,13 @@ class MemFS:
) -> None:
self.cleanup()
+ def mkdir(self, path: Path | str, chmod: int = 0o777) -> Path:
+ """Create a directory in the tempdir."""
+ folder = Path(self.path, path)
+ folder.mkdir(parents=True, exist_ok=True)
+ folder.chmod(chmod)
+ return folder
+
@contextmanager
def allow_write(self) -> None:
"""Temporarily allow writes to the root tempdir."""