cyclic
This commit is contained in:
parent
6f9ba7f8f7
commit
0ad5cc9701
3 changed files with 23 additions and 21 deletions
|
@ -1,30 +1,15 @@
|
||||||
"""Control Operating Systems."""
|
"""Control Operating Systems."""
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from abc import ABC, abstractmethod
|
|
||||||
from os import sep
|
from os import sep
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
from .abstract import OS
|
||||||
from .debian import Debian
|
from .debian import Debian
|
||||||
|
|
||||||
|
|
||||||
class OS(ABC):
|
def from_path(path: Path) -> OS:
|
||||||
"""Operating System."""
|
"""Initialize from an already existing path."""
|
||||||
|
return Debian(path)
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
os = OS.from_path(Path(sep))
|
up = from_path(Path(sep))
|
||||||
|
|
17
rwx/os/abstract.py
Normal file
17
rwx/os/abstract.py
Normal file
|
@ -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."""
|
|
@ -1,6 +1,6 @@
|
||||||
"""Debian operating system."""
|
"""Debian operating system."""
|
||||||
|
|
||||||
from . import OS
|
from .abstract import OS
|
||||||
|
|
||||||
|
|
||||||
class Debian(OS):
|
class Debian(OS):
|
||||||
|
|
Loading…
Reference in a new issue