Skip to content
This repository has been archived by the owner on Mar 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #55 in SAT/pypeflow from bugfix/SE-2388-quoting to…
Browse files Browse the repository at this point in the history
… develop

* commit 'ae315896a6f1763cbb4c0f59fb09f4c12771c18f':
  Do not quote parameters
  • Loading branch information
Christopher Dunn committed Apr 23, 2019
2 parents 37df83c + ae31589 commit 169af8b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions pypeflow/do_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions test/test_do_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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'},
Expand Down

0 comments on commit 169af8b

Please sign in to comment.