diff --git a/.gitignore b/.gitignore index 4909e08..0800ae8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ __pycache__ /tmp -/.venv /.vscode /dist diff --git a/pyproject.toml b/pyproject.toml index 66a3933..ccd0aa1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,8 +32,4 @@ requires-python = ">= 3.10" path = "rwx/__init__.py" [tool.ruff] -line-length = 80 - -[tool.ruff.lint] -ignore = ["COM812", "D203", "D213", "ISC001"] select = ["ALL"] diff --git a/rwx/__init__.py b/rwx/__init__.py index a1c5ee6..a721b9a 100644 --- a/rwx/__init__.py +++ b/rwx/__init__.py @@ -1,3 +1,2 @@ """Read Write eXecute.""" - __version__ = "0.0.1" diff --git a/rwx/__main__.py b/rwx/__main__.py index f6276e4..519fb8e 100755 --- a/rwx/__main__.py +++ b/rwx/__main__.py @@ -1,11 +1,6 @@ #! /usr/bin/env python3 - -"""Entry point.""" - from pathlib import Path - import fs - if __name__ == "__main__": file_path = Path(__file__).resolve() root_path = file_path.parent diff --git a/rwx/cmd/squashfs/__init__.py b/rwx/cmd/squashfs/__init__.py index 322186c..343461e 100644 --- a/rwx/cmd/squashfs/__init__.py +++ b/rwx/cmd/squashfs/__init__.py @@ -6,14 +6,10 @@ rwx.cmd.need("mksquashfs") def mksquashfs(input_root: str, output_file: str): - ps.run( - [ - "mksquashfs", - input_root, - output_file, - "-comp", - "zstd", - "-Xcompression-level", - str(18), - ] - ) + ps.run([ + "mksquashfs", + input_root, + output_file, + "-comp", "zstd", + "-Xcompression-level", str(18), + ]) diff --git a/rwx/grub/__init__.py b/rwx/grub/__init__.py index cd016ab..57e313c 100644 --- a/rwx/grub/__init__.py +++ b/rwx/grub/__init__.py @@ -17,13 +17,8 @@ MODULES = { } -def make_image( - image_format: str, - image_path: str, - modules: list[str], - memdisk_path: str, - pubkey_path: str | None = None, -) -> None: +def make_image(image_format: str, image_path: str, modules: list[str], + memdisk_path: str, pubkey_path: str | None = None) -> None: args = [ ("grub-mkimage",), ("--compress", COMPRESSION), @@ -34,6 +29,6 @@ def make_image( if pubkey_path: args.append(("--pubkey", pubkey_path)) args.extend(modules) - if modules := MODULES.get(image_format): + if modules := MODULES.get(image_format, None): args.extend(modules) ps.run(*args) diff --git a/rwx/log/__init__.py b/rwx/log/__init__.py index 50048e5..3502ab5 100644 --- a/rwx/log/__init__.py +++ b/rwx/log/__init__.py @@ -16,17 +16,13 @@ def get_file_logger(name: str) -> logging.Logger: logger.setLevel(logging.INFO) # return logger - - -def get_stream_logger(level: int) -> logging.Logger: +def get_stream_logger() -> logging.Logger: out_handler = logging.StreamHandler(stream=sys.stdout) - out_handler.setLevel(level) + out_handler.setLevel(logging.INFO) # logger = logging.getLogger() logger.addHandler(out_handler) - logger.setLevel(level) + logger.setLevel(logging.INFO) # return logger - - -stream = get_stream_logger(logging.INFO) +stream = get_stream_logger() diff --git a/rwx/prj/sphinx.py b/rwx/prj/sphinx.py index b09d8ee..ccb8d0f 100644 --- a/rwx/prj/sphinx.py +++ b/rwx/prj/sphinx.py @@ -15,18 +15,12 @@ class SphinxProject(Project): wipe(output_root) arguments: list[str] = [ "-E", - "-j", - "2", - "-b", - "html", - "-D", - f"project={self.name}", - "-D", - "master_doc={}".format("index"), - "-D", - "html_theme={}".format("sphinx_rtd_theme"), - "-c", - self.root, + "-j", "2", + "-b", "html", + "-D", f"project={self.name}", + "-D", "master_doc={}".format("index"), + "-D", "html_theme={}".format("sphinx_rtd_theme"), + "-c", self.root, # "-C", path.join(self.root, self.name), path.join(output_root, self.name), diff --git a/rwx/ps/__init__.py b/rwx/ps/__init__.py index b66c21b..5b50456 100644 --- a/rwx/ps/__init__.py +++ b/rwx/ps/__init__.py @@ -14,9 +14,7 @@ def get_tuples_args(tuples) -> list[str]: def run(*tuples) -> subprocess.CompletedProcess: - return subprocess.run( - get_tuples_args(tuples), capture_output=False, check=True - ) + return subprocess.run(get_tuples_args(tuples), capture_output=False) def run_line(*tuples, charset: str = txt.CHARSET) -> str: @@ -25,8 +23,6 @@ def run_line(*tuples, charset: str = txt.CHARSET) -> str: def run_lines(*tuples, charset: str = txt.CHARSET) -> list[str]: - process = subprocess.run( - get_tuples_args(tuples), capture_output=True, check=True - ) + process = subprocess.run(get_tuples_args(tuples), capture_output=True) string = process.stdout.decode(charset) return string.rstrip().splitlines()