Compare commits

..

No commits in common. "487d7cb9b2edd5d9d7f058da427c8e2db5a45176" and "26fea93bdb344a180bcf283435c489f81745e38c" have entirely different histories.

8 changed files with 14 additions and 32 deletions

View file

@ -33,7 +33,6 @@ path = "rwx/__init__.py"
[tool.pydoclint] [tool.pydoclint]
allow-init-docstring = true allow-init-docstring = true
quiet = true
skip-checking-short-docstrings = false skip-checking-short-docstrings = false
style = "sphinx" style = "sphinx"

View file

@ -52,7 +52,6 @@ A tiny framework to read, write & execute things.
### Task stack ### Task stack
* character constants for box drawing * character constants for box drawing
* common __str__ function
* parse pyproject.toml to write commands * parse pyproject.toml to write commands
* write classes for * write classes for
* steps bars to log * steps bars to log

View file

@ -1,20 +1,3 @@
"""Read Write eXecute.""" """Read Write eXecute."""
__version__ = "0.0.1" __version__ = "0.0.1"
class Class:
"""Root class."""
def __repr__(self) -> str:
"""Represent object variables.
:return: representation
:rtype: str
"""
name = self.__class__.__name__
attributes = [
f"{k}={v!r}" for k, v in vars(self).items() if not k.startswith("_")
]
arguments = ", ".join(attributes)
return f"{name}({arguments})"

View file

@ -1,7 +1,5 @@
"""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."""

View file

@ -3,10 +3,8 @@
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from pathlib import Path from pathlib import Path
from rwx import Class
class OS(ABC):
class OS(Class, ABC):
"""Operating System.""" """Operating System."""
def __init__(self, path: Path) -> None: def __init__(self, path: Path) -> None:

View file

@ -2,11 +2,10 @@
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(Class, ABC): class PM(ABC):
"""Package Manager.""" """Package Manager."""
def __init__(self) -> None: def __init__(self) -> None:

View file

@ -2,10 +2,8 @@
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:
@ -15,6 +13,10 @@ class Project(Class):
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"""\

View file

@ -2,10 +2,10 @@
import subprocess import subprocess
from rwx import Class, txt from rwx import txt
class Command(Class): class Command:
"""Command to run.""" """Command to run."""
def __init__(self, *arguments: str | tuple[str, ...]) -> None: def __init__(self, *arguments: str | tuple[str, ...]) -> None:
@ -13,6 +13,10 @@ class Command(Class):
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"""\