From e63fbc54779fb507843448d3a66f3e00dabd6fd7 Mon Sep 17 00:00:00 2001 From: Austin Appleby Date: Sun, 10 Mar 2024 23:20:37 -0700 Subject: [PATCH] lint & format --- hancho.py | 17 +++++++++++------ tests/test.py | 4 ---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/hancho.py b/hancho.py index 830653c..e7c9739 100755 --- a/hancho.py +++ b/hancho.py @@ -57,6 +57,7 @@ def swap_ext(name, new_ext): return Path(name).with_suffix(new_ext) return [swap_ext(n, new_ext) for n in flatten(name)] + def mtime(filename): """Gets the file's mtime and tracks how many times we called it""" this.mtime_calls += 1 @@ -89,6 +90,7 @@ def maybe_as_number(text): except ValueError: return text + ################################################################################ this.line_dirty = False @@ -251,6 +253,7 @@ async def async_main(): # The .hancho file loader does a small amount of work to keep track of the # stack of .hancho files that have been loaded. + def load(mod_path): """ Searches the loaded Hancho module stack for a module whose directory @@ -502,17 +505,19 @@ async def dispatch(self): # If they're already absolute, this does nothing. build_dir = Path(await expand_async(self, self.build_dir)) - build_dir = this.hancho_root / build_dir / self.abs_cwd.relative_to(this.hancho_root) - src_dir = this.hancho_root / self.abs_cwd.relative_to(this.hancho_root) + build_dir = ( + this.hancho_root / build_dir / self.abs_cwd.relative_to(this.hancho_root) + ) + src_dir = this.hancho_root / self.abs_cwd.relative_to(this.hancho_root) - self.abs_files_in = [(src_dir / f).absolute() for f in self.files_in] + self.abs_files_in = [(src_dir / f).absolute() for f in self.files_in] self.abs_files_out = [(build_dir / f).absolute() for f in self.files_out] - self.abs_deps = [(src_dir / f).absolute() for f in self.deps] + self.abs_deps = [(src_dir / f).absolute() for f in self.deps] # Strip hancho_root off the absolute paths to produce root-relative paths - self.files_in = [f.relative_to(this.hancho_root) for f in self.abs_files_in] + self.files_in = [f.relative_to(this.hancho_root) for f in self.abs_files_in] self.files_out = [f.relative_to(this.hancho_root) for f in self.abs_files_out] - self.deps = [f.relative_to(this.hancho_root) for f in self.abs_deps] + self.deps = [f.relative_to(this.hancho_root) for f in self.abs_deps] # Check for duplicate task outputs for file in self.abs_files_out: diff --git a/tests/test.py b/tests/test.py index 511f765..4f785ff 100755 --- a/tests/test.py +++ b/tests/test.py @@ -6,12 +6,8 @@ import subprocess import unittest import shutil -import sys from pathlib import Path -sys.path.append("..") -import hancho # pylint: disable=wrong-import-position, import-error - # tests still needed - # calling hancho in src dir # meta deps changed