diff --git a/src/stpipe/function_wrapper.py b/src/stpipe/function_wrapper.py index 9aeecd9..e103892 100644 --- a/src/stpipe/function_wrapper.py +++ b/src/stpipe/function_wrapper.py @@ -11,7 +11,6 @@ class FunctionWrapper(Step): """ spec = """ - output_ext = string(default="fits") """ def __init__(self, func, *args, **kwargs): diff --git a/src/stpipe/hooks.py b/src/stpipe/hooks.py index 4c9f892..a9175d7 100644 --- a/src/stpipe/hooks.py +++ b/src/stpipe/hooks.py @@ -32,6 +32,9 @@ def hook_from_string(step, hooktype, num, command): step_class = None step_func = None + # transfer output_ext to hooks + kwargs = dict(output_ext=step.output_ext) + # hook is a string of the fully-qualified name of a class or function if isinstance(command, str): try: @@ -52,7 +55,9 @@ def hook_from_string(step, hooktype, num, command): # Then convert rest of string to args and instantiate the class kwargs_string = params.strip(")") expr = ast.parse(f"dict({kwargs_string}\n)", mode="eval") - kwargs = {kw.arg: ast.literal_eval(kw.value) for kw in expr.body.keywords} + kwargs.update( + {kw.arg: ast.literal_eval(kw.value) for kw in expr.body.keywords} + ) return step_class(**kwargs) except TypeError: # String points to a function @@ -60,12 +65,12 @@ def hook_from_string(step, hooktype, num, command): else: if step_class.class_alias is not None: name = step_class.class_alias - return step_class(name, parent=step, config_file=step.config_file) + return step_class(name, parent=step, config_file=step.config_file, **kwargs) # hook is a string of the fully-qualified name of a function if step_func is not None: return function_wrapper.FunctionWrapper( - step_func, parent=step, config_file=step.config_file + step_func, parent=step, config_file=step.config_file, **kwargs ) # hook is an already-imported Step subclass @@ -73,7 +78,7 @@ def hook_from_string(step, hooktype, num, command): step_class = command if step_class.class_alias is not None: name = step_class.class_alias - return step_class(name, parent=step, config_file=step.config_file) + return step_class(name, parent=step, config_file=step.config_file, **kwargs) # hook is an instance of a Step subclass if isinstance(command, Step): @@ -86,7 +91,7 @@ def hook_from_string(step, hooktype, num, command): # hook is a command-line script or system call from .subproc import SystemCall - return SystemCall(name, parent=step, command=command) + return SystemCall(name, parent=step, command=command, **kwargs) def get_hook_objects(step, hooktype, hooks): diff --git a/src/stpipe/subproc.py b/src/stpipe/subproc.py index b9c0ad0..cdf9dbd 100644 --- a/src/stpipe/subproc.py +++ b/src/stpipe/subproc.py @@ -22,7 +22,6 @@ class SystemCall(Step): log_stderr = boolean(default=True) # Do we want to log STDERR? exitcode_as_exception = boolean(default=True) # Should a non-zero exit code be converted into an exception? failure_as_exception = boolean(default=True) # If subprocess fails to run at all, should that be an exception? - output_ext = string(default="fits") """ # noqa: E501 def process(self, *args):