Edit on GitHub

agent_search_gateway.paths

Filesystem paths owned by the gateway runtime.

 1"""Filesystem paths owned by the gateway runtime."""
 2
 3from dataclasses import dataclass
 4from pathlib import Path
 5
 6
 7@dataclass(frozen=True, slots=True)
 8class RuntimePaths:
 9    config_file: Path
10    socket_file: Path
11    results_dir: Path
12
13    @property
14    def logs_dir(self) -> Path:
15        return self.socket_file.parent / "logs"
16
17    @property
18    def debug_log_file(self) -> Path:
19        return self.logs_dir / "debug.log"
20
21    @classmethod
22    def from_home(cls, home: Path) -> "RuntimePaths":
23        return cls(
24            config_file=home / ".config/agent-search-gateway-cli/config.toml",
25            socket_file=home / ".cache/agent-search-gateway-cli/daemon.sock",
26            results_dir=home / ".cache/agent-search-gateway-cli/results",
27        )
28
29    @classmethod
30    def default(cls) -> "RuntimePaths":
31        return cls.from_home(Path.home())
@dataclass(frozen=True, slots=True)
class RuntimePaths:
 8@dataclass(frozen=True, slots=True)
 9class RuntimePaths:
10    config_file: Path
11    socket_file: Path
12    results_dir: Path
13
14    @property
15    def logs_dir(self) -> Path:
16        return self.socket_file.parent / "logs"
17
18    @property
19    def debug_log_file(self) -> Path:
20        return self.logs_dir / "debug.log"
21
22    @classmethod
23    def from_home(cls, home: Path) -> "RuntimePaths":
24        return cls(
25            config_file=home / ".config/agent-search-gateway-cli/config.toml",
26            socket_file=home / ".cache/agent-search-gateway-cli/daemon.sock",
27            results_dir=home / ".cache/agent-search-gateway-cli/results",
28        )
29
30    @classmethod
31    def default(cls) -> "RuntimePaths":
32        return cls.from_home(Path.home())
RuntimePaths( config_file: pathlib.Path, socket_file: pathlib.Path, results_dir: pathlib.Path)
config_file: pathlib.Path
socket_file: pathlib.Path
results_dir: pathlib.Path
logs_dir: pathlib.Path
14    @property
15    def logs_dir(self) -> Path:
16        return self.socket_file.parent / "logs"
debug_log_file: pathlib.Path
18    @property
19    def debug_log_file(self) -> Path:
20        return self.logs_dir / "debug.log"
@classmethod
def from_home(cls, home: pathlib.Path) -> RuntimePaths:
22    @classmethod
23    def from_home(cls, home: Path) -> "RuntimePaths":
24        return cls(
25            config_file=home / ".config/agent-search-gateway-cli/config.toml",
26            socket_file=home / ".cache/agent-search-gateway-cli/daemon.sock",
27            results_dir=home / ".cache/agent-search-gateway-cli/results",
28        )
@classmethod
def default(cls) -> RuntimePaths:
30    @classmethod
31    def default(cls) -> "RuntimePaths":
32        return cls.from_home(Path.home())