diff --git a/pasch/modules/files.py b/pasch/modules/files.py index 777c5ba..d806878 100644 --- a/pasch/modules/files.py +++ b/pasch/modules/files.py @@ -113,7 +113,7 @@ class Files(Module): ) -> None: super().__init__(orchestrator) self._files: dict[str, bytes] = {} - self._file_db = FileDb(self.orchestrator.state_dir / file_db_name) + self._file_db = FileDb(self.o.state_dir / file_db_name) self._root = root or Path.home() def _read_path(self, path: Path | str) -> Path: diff --git a/pasch/modules/pacman.py b/pasch/modules/pacman.py index 9f9fe43..12f256c 100644 --- a/pasch/modules/pacman.py +++ b/pasch/modules/pacman.py @@ -80,7 +80,7 @@ class Pacman(Module): return self._resolve_packages(groups, packages) def _install_packages(self, packages: set[str]) -> None: - if self.orchestrator.dry_run: + if self.o.dry_run: return if packages: @@ -88,7 +88,7 @@ class Pacman(Module): self._pacman_execute("-D", "--asexplicit", *sorted(packages)) def _uninstall_packages(self, packages: set[str]) -> None: - if self.orchestrator.dry_run: + if self.o.dry_run: return if packages: diff --git a/pasch/orchestrator.py b/pasch/orchestrator.py index 917ee87..138721b 100644 --- a/pasch/orchestrator.py +++ b/pasch/orchestrator.py @@ -13,9 +13,9 @@ from xdg_base_dirs import xdg_state_home class Module(ABC): def __init__(self, orchestrator: Orchestrator) -> None: - self.orchestrator = orchestrator - self.orchestrator.register(self) - self.c = self.orchestrator.console + self.o = orchestrator + self.o.register(self) + self.c = self.o.c @abstractmethod def realize(self) -> None: ... @@ -29,19 +29,14 @@ def _snake_to_camel(s: str) -> str: def module[**P]( func: Callable[Concatenate[Orchestrator, P], None], ) -> Callable[Concatenate[Orchestrator, P], None]: - def __init__( - self, - orchestrator: Orchestrator, - *args: P.args, - **kwargs: P.kwargs, - ) -> None: - super(self.__class__, self).__init__(orchestrator) + def __init__(self, o: Orchestrator, *args: P.args, **kwargs: P.kwargs) -> None: + super(self.__class__, self).__init__(o) self.args = args self.kwargs = kwargs def realize(self) -> None: # pyrefly: ignore - return func(self.orchestrator, *self.args, **self.kwargs) + return func(self.o, *self.args, **self.kwargs) # pyrefly: ignore return type( @@ -57,7 +52,7 @@ class Orchestrator: self.dry_run = dry_run self.state_dir = xdg_state_home() / self.name - self.console = Console(highlight=False) + self.c = Console(highlight=False) self.user = getpass.getuser() self.host = socket.gethostname()