−repr
This commit is contained in:
parent
450e10e2f4
commit
b7eec788f7
4 changed files with 10 additions and 13 deletions
|
@ -1,5 +1,7 @@
|
||||||
"""Handle errors."""
|
"""Handle errors."""
|
||||||
|
|
||||||
|
from rwx import Class
|
||||||
|
|
||||||
class Error(Exception):
|
|
||||||
|
class Error(Class, Exception):
|
||||||
"""Parent class for all errors."""
|
"""Parent class for all errors."""
|
||||||
|
|
|
@ -2,10 +2,11 @@
|
||||||
|
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
|
|
||||||
|
from rwx import Class
|
||||||
from rwx.ps import Command
|
from rwx.ps import Command
|
||||||
|
|
||||||
|
|
||||||
class PM(ABC):
|
class PM(Class, ABC):
|
||||||
"""Package Manager."""
|
"""Package Manager."""
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
from rwx import Class
|
||||||
|
|
||||||
class Project:
|
|
||||||
|
class Project(Class):
|
||||||
"""Parent class for any type of project."""
|
"""Parent class for any type of project."""
|
||||||
|
|
||||||
def __init__(self, file: Path) -> None:
|
def __init__(self, file: Path) -> None:
|
||||||
|
@ -13,10 +15,6 @@ class Project:
|
||||||
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 __repr__(self) -> str:
|
|
||||||
"""Represent project."""
|
|
||||||
return f"Project(file={self.raw!r})"
|
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
"""Return file, root & name."""
|
"""Return file, root & name."""
|
||||||
return f"""\
|
return f"""\
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from rwx import txt
|
from rwx import Class, txt
|
||||||
|
|
||||||
|
|
||||||
class Command:
|
class Command(Class):
|
||||||
"""Command to run."""
|
"""Command to run."""
|
||||||
|
|
||||||
def __init__(self, *arguments: str | tuple[str, ...]) -> None:
|
def __init__(self, *arguments: str | tuple[str, ...]) -> None:
|
||||||
|
@ -13,10 +13,6 @@ class Command:
|
||||||
self.raw = arguments
|
self.raw = arguments
|
||||||
self.flat: list[str] = []
|
self.flat: list[str] = []
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
|
||||||
"""Represent command."""
|
|
||||||
return f"Command({self.raw!r})"
|
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
"""Return raw & flat."""
|
"""Return raw & flat."""
|
||||||
return f"""\
|
return f"""\
|
||||||
|
|
Loading…
Reference in a new issue