aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-03-21 00:49:50 +0100
committerMartin Czygan <martin.czygan@gmail.com>2021-03-21 00:49:50 +0100
commita7e0cf191ebf8fb499e0ab9a3b6cae45727f1286 (patch)
tree7c527d06c773125dcfca5c6dbf6f3939c8f93092 /python
parent677b7671dbc747649c9443f140bf7923f60dfe7e (diff)
downloadrefcat-a7e0cf191ebf8fb499e0ab9a3b6cae45727f1286.tar.gz
refcat-a7e0cf191ebf8fb499e0ab9a3b6cae45727f1286.zip
clearer naming
Diffstat (limited to 'python')
-rw-r--r--python/refcat/cli.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/python/refcat/cli.py b/python/refcat/cli.py
index ca1cab7..076c71f 100644
--- a/python/refcat/cli.py
+++ b/python/refcat/cli.py
@@ -86,9 +86,9 @@ def cat(*args):
"""
if len(args) == 0:
raise ValueError("ls failed: task name required")
- task = find_task(args[0])
+ task_class = find_task_class(args[0])
try:
- filename = task().output().path
+ filename = task_class().output().path
if filename.endswith(".zst"):
subprocess.run(["zstdcat", "-T0", filename])
elif filename.endswith(".gz"):
@@ -107,8 +107,8 @@ def ls(*args):
"""
if len(args) == 0:
raise ValueError("ls failed: task name required")
- task = find_task(args[0])
- print(task().output().path)
+ task_class = find_task_class(args[0])
+ print(task_class().output().path)
def ll(*args):
@@ -117,9 +117,9 @@ def ll(*args):
"""
if len(args) == 0:
raise ValueError("ls failed: task name required")
- task = find_task(args[0])
+ task_class = find_task_class(args[0])
try:
- filename = task().output().path
+ filename = task_class().output().path
subprocess.run(["ls", "-lah", filename])
except FileNotFoundError:
print("file not found: {}".format(filename), file=sys.stderr)
@@ -133,8 +133,8 @@ def deps(*args):
"""
if len(args) == 0:
raise ValueError("deps failed: task name required")
- task = find_task(args[0])
- dump_deps(task())
+ task_class = find_task_class(args[0])
+ dump_deps(task_class())
def config():
@@ -180,16 +180,16 @@ complete -F _refcat_completion "refcat"
print(snippet)
-def find_task(name):
+def find_task_class(name):
"""
Note: return task class, not instance.
"""
- task = globals().get(name)
- if task is None:
+ task_class = globals().get(name)
+ if task_class is None:
raise RuntimeError("no such task: {}".format(name))
- if not isinstance(task(), luigi.Task):
+ if not isinstance(task_class(), luigi.Task):
raise RuntimeError("not a task: {}".format(name))
- return task
+ return task_class
def main():