Update public source
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
CLIENT_DIRECTORIES = (
|
||||
"inbox",
|
||||
"pending",
|
||||
"jobs",
|
||||
"outbox",
|
||||
"logs",
|
||||
"archive",
|
||||
)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ClientPaths:
|
||||
root: Path
|
||||
inbox: Path
|
||||
pending: Path
|
||||
jobs: Path
|
||||
outbox: Path
|
||||
logs: Path
|
||||
archive: Path
|
||||
|
||||
@classmethod
|
||||
def from_root(cls, root: Path) -> "ClientPaths":
|
||||
root = root.resolve()
|
||||
|
||||
return cls(
|
||||
root=root,
|
||||
inbox=root / "inbox",
|
||||
pending=root / "pending",
|
||||
jobs=root / "jobs",
|
||||
outbox=root / "outbox",
|
||||
logs=root / "logs",
|
||||
archive=root / "archive",
|
||||
)
|
||||
|
||||
def initialize(self) -> None:
|
||||
for name in CLIENT_DIRECTORIES:
|
||||
(self.root / name).mkdir(
|
||||
parents=True,
|
||||
exist_ok=True,
|
||||
)
|
||||
Reference in New Issue
Block a user