Skip to content

Commit bc0828a

Browse files
committed
bug: drop empty lines so there isn't a double semicolon
1 parent 1b3287a commit bc0828a

File tree

1 file changed

+11
-6
lines changed
  • nipype/interfaces

1 file changed

+11
-6
lines changed

nipype/interfaces/r.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,18 @@ def _format_arg(self, name, trait_spec, value):
9797
def _gen_r_command(self, argstr, script_lines):
9898
"""Generates commands and, if rfile specified, writes it to disk."""
9999
if not self.inputs.rfile:
100-
# replace newlines with ;, strip comments
100+
# replace newlines with ;
101101
script = "; ".join(
102-
[
103-
line
104-
for line in script_lines.split("\n")
105-
if not line.strip().startswith("#")
106-
]
102+
list(
103+
filter(
104+
None, # drop empty lines
105+
[
106+
line
107+
for line in script_lines.split("\n")
108+
if not line.strip().startswith("#") # strip comments
109+
],
110+
)
111+
)
107112
)
108113
# escape " and $
109114
script = script.replace('"', '\\"')

0 commit comments

Comments
 (0)