diff --git a/pyproject.toml b/pyproject.toml index 462a1d5..756a434 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,11 +31,6 @@ requires-python = ">= 3.11" [tool.hatch.version] path = "rwx/__init__.py" -[tool.pydoclint] -allow-init-docstring = true -skip-checking-short-docstrings = false -style = "sphinx" - [tool.ruff] line-length = 80 diff --git a/rwx/arg/__init__.py b/rwx/arg/__init__.py index a35dd4f..71ce0a7 100644 --- a/rwx/arg/__init__.py +++ b/rwx/arg/__init__.py @@ -4,10 +4,6 @@ import sys def split() -> tuple[str, list[str]]: - """Split command & actual arguments. - - :return: both - :rtype: tuple[str, list[str]] - """ + """Split command & actual arguments.""" command, *arguments = sys.argv return command, arguments diff --git a/rwx/os/__init__.py b/rwx/os/__init__.py index 75a0bc9..70ca05c 100644 --- a/rwx/os/__init__.py +++ b/rwx/os/__init__.py @@ -1,15 +1,11 @@ """Control Operating Systems.""" -from os import sep from pathlib import Path -from .abstract import OS -from .debian import Debian +class OS: + """Operating System.""" -def from_path(path: Path) -> OS: - """Initialize from an already existing path.""" - return Debian(path) - - -up = from_path(Path(sep)) + def __init__(self, path: str) -> None: + """Set root.""" + self.root = Path(path) diff --git a/rwx/os/abstract.py b/rwx/os/abstract.py deleted file mode 100644 index e985dc5..0000000 --- a/rwx/os/abstract.py +++ /dev/null @@ -1,24 +0,0 @@ -"""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.""" - - def __str__(self) -> str: - """Return root & name.""" - return f"""\ -root = {self.root} -name = {self.name} -""" diff --git a/rwx/os/debian.py b/rwx/os/debian.py deleted file mode 100644 index 98c8928..0000000 --- a/rwx/os/debian.py +++ /dev/null @@ -1,11 +0,0 @@ -"""Debian operating system.""" - -from .abstract import OS - - -class Debian(OS): - """Debian operating system.""" - - def get_name(self) -> str: - """Return name.""" - return "Debian" diff --git a/rwx/os/pm/__init__.py b/rwx/os/pm/__init__.py deleted file mode 100644 index d248e47..0000000 --- a/rwx/os/pm/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -"""Package Manager.""" - -from abc import ABC, abstractmethod - -from rwx.ps import Command - - -class PM(ABC): - """Package Manager.""" - - def __init__(self) -> None: - """Set commands.""" - self.clean = self.get_clean_command() - self.install = self.get_install_command() - - @abstractmethod - def get_clean_command(self) -> Command: - """Command to clean packages cache.""" - - @abstractmethod - def get_install_command(self) -> Command: - """Command to install package(s).""" - - def __str__(self) -> str: - """Return commands.""" - return f"""\ - clean = {self.clean} -install = {self.install} -""" diff --git a/rwx/os/pm/apt.py b/rwx/os/pm/apt.py deleted file mode 100644 index 03217b8..0000000 --- a/rwx/os/pm/apt.py +++ /dev/null @@ -1,16 +0,0 @@ -"""Advanced Package Tool.""" - -from rwx.os.pm import PM -from rwx.ps import Command - - -class APT(PM): - """Advanced Package Tool.""" - - def get_clean_command(self) -> Command: - """Return clean command.""" - return Command() - - def get_install_command(self) -> Command: - """Return install command.""" - return Command() diff --git a/rwx/prj/__init__.py b/rwx/prj/__init__.py index f4a8acb..36dab99 100644 --- a/rwx/prj/__init__.py +++ b/rwx/prj/__init__.py @@ -6,22 +6,8 @@ from pathlib import Path class Project: """Parent class for any type of project.""" - def __init__(self, file: Path) -> None: + def __init__(self, file_path: str) -> None: """Set file, root & name.""" - self.raw = file - self.file = self.raw.resolve() + self.file: Path = Path(file_path).resolve() 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"""\ - raw = {self.raw} -file = {self.file} -root = {self.root} -name = {self.name} -""" diff --git a/rwx/prj/sphinx.py b/rwx/prj/sphinx.py index 592e6dd..be207ef 100644 --- a/rwx/prj/sphinx.py +++ b/rwx/prj/sphinx.py @@ -2,18 +2,22 @@ from typing import TYPE_CHECKING +if TYPE_CHECKING: + from pathlib import Path + from sphinx.cmd.build import build_main from rwx.fs import wipe from rwx.prj import Project -if TYPE_CHECKING: - from pathlib import Path - class SphinxProject(Project): """Child class for a project based on Sphinx.""" + def __init__(self, file_path: str) -> None: + """Call the parent constructor.""" + super().__init__(file_path) + def build(self) -> None: """Build the project.""" output_root: Path = self.root / "out" @@ -27,9 +31,9 @@ class SphinxProject(Project): "-D", f"project={self.name}", "-D", - "master_doc=index", + "master_doc={}".format("index"), "-D", - "html_theme=sphinx_rtd_theme", + "html_theme={}".format("sphinx_rtd_theme"), "-c", str(self.root), # "-C", diff --git a/rwx/ps/__init__.py b/rwx/ps/__init__.py index 54d58cf..0bbab9c 100644 --- a/rwx/ps/__init__.py +++ b/rwx/ps/__init__.py @@ -5,26 +5,6 @@ import subprocess from rwx import txt -class Command: - """Command to run.""" - - def __init__(self, *arguments: str | tuple[str, ...]) -> None: - """Set raw & flat arguments.""" - 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"""\ - raw = {self.raw} -flat = {self.flat} -""" - - def get_tuples_args(*items: str | tuple[str, ...]) -> list[str]: """Turn arguments tuples into an arguments list.""" args: list[str] = []