[scripts/util] add 'trim()' helper

This commit is contained in:
Mike Fährmann
2025-08-05 21:55:05 +02:00
parent 3dd1372a0b
commit 253d498a4e
3 changed files with 7 additions and 7 deletions

View File

@@ -140,7 +140,7 @@ def main():
LOG.info("Collecting data for '%s'", args.url)
result = generate_test_result(args)
LOG.info("Writing '%s' results to '%s'", args.url, path)
LOG.info("Writing '%s' results to '%s'", args.url, util.trim(path))
insert_test_result(args, result, lines)
with util.lazy(path) as fp:

View File

@@ -60,7 +60,7 @@ def create_extractor_module(args):
category = args.category
path = util.path("gallery_dl", "extractor", f"{category}.py")
LOG.info("Creating '%s'", trim_path(path))
LOG.info("Creating '%s'", util.trim(path))
type = args.type
if type == "manga":
@@ -218,7 +218,7 @@ BASE_PATTERN = r"(?:https?://)?{subdomain}{re.escape(domain)}"
def create_test_results_file(args):
path = util.path("test", "results", f"{args.category}.py")
LOG.info("Creating '%s'", trim_path(path))
LOG.info("Creating '%s'", util.trim(path))
import_stmt = generate_test_result_import(args)
with util.open(path, "x") as fp:
@@ -311,10 +311,6 @@ def insert_into_supportedsites(args):
###############################################################################
# General #####################################################################
def trim_path(path):
return path[len(util.ROOTDIR)+1:]
def parse_args(args=None):
parser = argparse.ArgumentParser(args)

View File

@@ -19,6 +19,10 @@ def path(*segments):
return result
def trim(path):
return path[len(ROOTDIR)+1:]
def open(path, mode="r"):
return builtins.open(path, mode, encoding="utf-8", newline="\n")