Compare commits
2 commits
487d7cb9b2
...
e5bb634cf4
Author | SHA1 | Date | |
---|---|---|---|
e5bb634cf4 | |||
8227524a7c |
5 changed files with 15 additions and 32 deletions
|
@ -2,14 +2,16 @@
|
||||||
|
|
||||||
__version__ = "0.0.1"
|
__version__ = "0.0.1"
|
||||||
|
|
||||||
|
from os import linesep
|
||||||
|
|
||||||
|
|
||||||
class Class:
|
class Class:
|
||||||
"""Root class."""
|
"""Root class."""
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
"""Represent object variables.
|
"""Return machine-readable state.
|
||||||
|
|
||||||
:return: representation
|
:return: state
|
||||||
:rtype: str
|
:rtype: str
|
||||||
"""
|
"""
|
||||||
name = self.__class__.__name__
|
name = self.__class__.__name__
|
||||||
|
@ -18,3 +20,14 @@ class Class:
|
||||||
]
|
]
|
||||||
arguments = ", ".join(attributes)
|
arguments = ", ".join(attributes)
|
||||||
return f"{name}({arguments})"
|
return f"{name}({arguments})"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
"""Return human-readable state.
|
||||||
|
|
||||||
|
:return: state
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
attributes = [
|
||||||
|
f"{k} = {v}" for k, v in vars(self).items() if not k.startswith("_")
|
||||||
|
]
|
||||||
|
return linesep.join(attributes)
|
||||||
|
|
|
@ -17,10 +17,3 @@ class OS(Class, ABC):
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_name(self) -> str:
|
def get_name(self) -> str:
|
||||||
"""Return mandatory name."""
|
"""Return mandatory name."""
|
||||||
|
|
||||||
def __str__(self) -> str:
|
|
||||||
"""Return root & name."""
|
|
||||||
return f"""\
|
|
||||||
root = {self.root}
|
|
||||||
name = {self.name}
|
|
||||||
"""
|
|
||||||
|
|
|
@ -21,10 +21,3 @@ class PM(Class, ABC):
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_install_command(self) -> Command:
|
def get_install_command(self) -> Command:
|
||||||
"""Command to install package(s)."""
|
"""Command to install package(s)."""
|
||||||
|
|
||||||
def __str__(self) -> str:
|
|
||||||
"""Return commands."""
|
|
||||||
return f"""\
|
|
||||||
clean = {self.clean}
|
|
||||||
install = {self.install}
|
|
||||||
"""
|
|
||||||
|
|
|
@ -14,12 +14,3 @@ class Project(Class):
|
||||||
self.file = self.raw.resolve()
|
self.file = self.raw.resolve()
|
||||||
self.root: Path = self.file.parent
|
self.root: Path = self.file.parent
|
||||||
self.name: str = self.root.name
|
self.name: str = self.root.name
|
||||||
|
|
||||||
def __str__(self) -> str:
|
|
||||||
"""Return file, root & name."""
|
|
||||||
return f"""\
|
|
||||||
raw = {self.raw}
|
|
||||||
file = {self.file}
|
|
||||||
root = {self.root}
|
|
||||||
name = {self.name}
|
|
||||||
"""
|
|
||||||
|
|
|
@ -13,13 +13,6 @@ class Command(Class):
|
||||||
self.raw = arguments
|
self.raw = arguments
|
||||||
self.flat: list[str] = []
|
self.flat: list[str] = []
|
||||||
|
|
||||||
def __str__(self) -> str:
|
|
||||||
"""Return raw & flat."""
|
|
||||||
return f"""\
|
|
||||||
raw = {self.raw}
|
|
||||||
flat = {self.flat}
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
def get_tuples_args(*items: str | tuple[str, ...]) -> list[str]:
|
def get_tuples_args(*items: str | tuple[str, ...]) -> list[str]:
|
||||||
"""Turn arguments tuples into an arguments list."""
|
"""Turn arguments tuples into an arguments list."""
|
||||||
|
|
Loading…
Reference in a new issue