From eda963ba49a395c538756024e77ae48f7ad596ef Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 14 Sep 2024 00:33:55 +0200 Subject: [PATCH] mypy/project,util --- spcd/project.py | 2 +- spcd/util.py | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/spcd/project.py b/spcd/project.py index de8b164..709d554 100644 --- a/spcd/project.py +++ b/spcd/project.py @@ -41,7 +41,7 @@ class Project: # root for variable in ROOT: if value := projects.environment.get(variable, None): - self.root = value + self.root = Path(value) # url self.url = add_url_path(projects.url, self.name) diff --git a/spcd/util.py b/spcd/util.py index 9ea9dca..2dd7718 100644 --- a/spcd/util.py +++ b/spcd/util.py @@ -16,7 +16,7 @@ def add_url_path(url: str, extra_path: str) -> str: return urlunparse(parts) -def browse(root: str) -> None: +def browse(root: Path) -> None: """Frame the browsing of a root directory in the log output.""" paths = [] for directory, _, files in os.walk(root): @@ -24,17 +24,19 @@ def browse(root: str) -> None: absolute_path = Path(directory) / file relative_path = os.path.relpath(absolute_path, start=root) paths.append(relative_path) - frame(root) + text = str(root) + frame(text) for path in sorted(paths): log.info(path) - shut(root) + shut(text) -def cat(file: str) -> None: +def cat(file: Path) -> None: """Frame the content of a file in the log output.""" - frame(file) + text = str(file) + frame(text) log.info(fs.read_file_text(file).rstrip()) - shut(file) + shut(text) def frame(text: str) -> None: