diff --git a/rwx/os/__init__.py b/rwx/os/__init__.py index 3dfa782..75a0bc9 100644 --- a/rwx/os/__init__.py +++ b/rwx/os/__init__.py @@ -1,30 +1,15 @@ """Control Operating Systems.""" -from __future__ import annotations - -from abc import ABC, abstractmethod from os import sep from pathlib import Path +from .abstract import OS from .debian import Debian -class OS(ABC): - """Operating System.""" - - def __init__(self, path: Path) -> None: - """Set root.""" - self.root = path - self.name = self.get_name() - - @abstractmethod - def get_name(self) -> str: - """Return mandatory name.""" - - @staticmethod - def from_path(path: Path) -> OS: - """Initialize from an already existing path.""" - return Debian(path) +def from_path(path: Path) -> OS: + """Initialize from an already existing path.""" + return Debian(path) -os = OS.from_path(Path(sep)) +up = from_path(Path(sep)) diff --git a/rwx/os/abstract.py b/rwx/os/abstract.py new file mode 100644 index 0000000..2d86f7e --- /dev/null +++ b/rwx/os/abstract.py @@ -0,0 +1,17 @@ +"""Abstract Operating System.""" + +from abc import ABC, abstractmethod +from pathlib import Path + + +class OS(ABC): + """Operating System.""" + + def __init__(self, path: Path) -> None: + """Set root.""" + self.root = path + self.name = self.get_name() + + @abstractmethod + def get_name(self) -> str: + """Return mandatory name.""" diff --git a/rwx/os/debian.py b/rwx/os/debian.py index dbaaabb..98c8928 100644 --- a/rwx/os/debian.py +++ b/rwx/os/debian.py @@ -1,6 +1,6 @@ """Debian operating system.""" -from . import OS +from .abstract import OS class Debian(OS):