diff --git a/pypeflow/do_task.py b/pypeflow/do_task.py index 3fa9ef7..03235d9 100644 --- a/pypeflow/do_task.py +++ b/pypeflow/do_task.py @@ -142,9 +142,10 @@ def __getattr__(self, name): result = self.kwds.itervalues() else: result = [str(self.kwds[name])] - return ' '.join(quote(v) for v in result) - def __init__(self, kwds): + return ' '.join(self.quote(v) for v in result) + def __init__(self, kwds, quote=quote): self.kwds = kwds + self.quote = quote def sub(bash_template, myinputs, myoutputs, parameters): # Set substitution dict @@ -154,9 +155,9 @@ def sub(bash_template, myinputs, myoutputs, parameters): assert 'output' not in parameters # input/output/params are the main values substituted in the subset of # snakemake which we support. - var_dict['input'] = Attrs(myinputs) #Attrs(**value_quoted(myinputs)) - var_dict['output'] = Attrs(myoutputs) #Attrs(**value_quoted(myoutputs)) - var_dict['params'] = Attrs(valid_parameters) #Attrs(**valid_parameters) + var_dict['input'] = Attrs(myinputs) + var_dict['output'] = Attrs(myoutputs) + var_dict['params'] = Attrs(valid_parameters, quote=lambda x:x) fmtr = string.Formatter() return fmtr.vformat(bash_template, [], var_dict) diff --git a/test/test_do_task.py b/test/test_do_task.py index 6a28ee7..80a833d 100644 --- a/test/test_do_task.py +++ b/test/test_do_task.py @@ -11,7 +11,7 @@ echo hello """), # simple subs (with quoting) - ({'ii': 'II'}, {'oo': 'O O'}, {'pp': 'PP'}, + ({'ii': 'II'}, {'oo': 'O O'}, {'pp': 'PP DO NOT QUOTE'}, """\ echo {input.ii} echo {output.oo} @@ -20,7 +20,7 @@ """\ echo II echo 'O O' -echo PP +echo PP DO NOT QUOTE """), # input.ALL ({'ii': 'II', 'ij': 'IJ'}, {'oo': 'OO'}, {'pp': 'PP'},