Compare commits

..

4 commits

Author SHA1 Message Date
487d7cb9b2
str 2024-09-16 12:04:43 +02:00
b7eec788f7
−repr 2024-09-16 11:35:29 +02:00
450e10e2f4
class,os 2024-09-16 11:14:40 +02:00
ca88e5bc1d
doc/quiet 2024-09-16 01:17:55 +02:00
8 changed files with 32 additions and 14 deletions

View file

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

View file

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

View file

@ -1,3 +1,20 @@
"""Read Write eXecute."""
__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,5 +1,7 @@
"""Handle errors."""
from rwx import Class
class Error(Exception):
class Error(Class, Exception):
"""Parent class for all errors."""

View file

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

View file

@ -2,10 +2,11 @@
from abc import ABC, abstractmethod
from rwx import Class
from rwx.ps import Command
class PM(ABC):
class PM(Class, ABC):
"""Package Manager."""
def __init__(self) -> None:

View file

@ -2,8 +2,10 @@
from pathlib import Path
from rwx import Class
class Project:
class Project(Class):
"""Parent class for any type of project."""
def __init__(self, file: Path) -> None:
@ -13,10 +15,6 @@ class Project:
self.root: Path = self.file.parent
self.name: str = self.root.name
def __repr__(self) -> str:
"""Represent project."""
return f"Project(file={self.raw!r})"
def __str__(self) -> str:
"""Return file, root & name."""
return f"""\

View file

@ -2,10 +2,10 @@
import subprocess
from rwx import txt
from rwx import Class, txt
class Command:
class Command(Class):
"""Command to run."""
def __init__(self, *arguments: str | tuple[str, ...]) -> None:
@ -13,10 +13,6 @@ class Command:
self.raw = arguments
self.flat: list[str] = []
def __repr__(self) -> str:
"""Represent command."""
return f"Command({self.raw!r})"
def __str__(self) -> str:
"""Return raw & flat."""
return f"""\