Skip to content

Commit 52e1a98

Browse files
committed
ran black .
1 parent 7f92f63 commit 52e1a98

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

nipype/interfaces/r.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ def get_r_command():
2121
if "NIPYPE_NO_R" in os.environ:
2222
return None
2323
r_cmd = os.getenv("RCMD", default="R")
24-
24+
2525
return r_cmd if which(r_cmd) else None
2626

2727

2828
no_r = get_r_command() is None
2929

3030

3131
class RInputSpec(CommandLineInputSpec):
32-
""" Basic expected inputs to R interface """
32+
"""Basic expected inputs to R interface"""
3333

3434
script = traits.Str(
3535
argstr='-e "%s"', desc="R code to run", mandatory=True, position=-1
@@ -39,7 +39,7 @@ class RInputSpec(CommandLineInputSpec):
3939
script_file = File(
4040
"pyscript.R", usedefault=True, desc="Name of file to write R code to"
4141
)
42-
42+
4343

4444
class RCommand(CommandLine):
4545
"""Interface that runs R code
@@ -69,7 +69,7 @@ def set_default_r_cmd(self, r_cmd):
6969
"""Set the default R command line for R classes.
7070
7171
This method is used to set values for all R
72-
subclasses.
72+
subclasses.
7373
"""
7474
self._cmd = r_cmd
7575

@@ -95,17 +95,19 @@ def _format_arg(self, name, trait_spec, value):
9595
return super(RCommand, self)._format_arg(name, trait_spec, value)
9696

9797
def _gen_r_command(self, argstr, script_lines):
98-
""" Generates commands and, if rfile specified, writes it to disk."""
98+
"""Generates commands and, if rfile specified, writes it to disk."""
9999
if not self.inputs.rfile:
100100
# replace newlines with ;, strip comments
101-
script = "; ".join([
102-
line
103-
for line in script_lines.split("\n")
104-
if not line.strip().startswith("#")
105-
])
101+
script = "; ".join(
102+
[
103+
line
104+
for line in script_lines.split("\n")
105+
if not line.strip().startswith("#")
106+
]
107+
)
106108
# escape " and $
107-
script = script.replace('"','\\"')
108-
script = script.replace('$','\\$')
109+
script = script.replace('"', '\\"')
110+
script = script.replace("$", "\\$")
109111
else:
110112
script_path = os.path.join(os.getcwd(), self.inputs.script_file)
111113
with open(script_path, "wt") as rfile:

nipype/interfaces/tests/test_r.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@
88

99
no_r = r.no_r
1010

11+
1112
@pytest.mark.skipif(no_r, reason="R is not available")
1213
def test_cmdline(tmp_path):
1314
default_script_file = str(tmp_path / "testscript")
1415
ri = r.RCommand(script="1 + 1", script_file=default_script_file, rfile=False)
1516
r_cmd = r.get_r_command()
1617

17-
assert ri.cmdline == r_cmd + (
18-
' -e "1 + 1"'
19-
)
18+
assert ri.cmdline == r_cmd + (' -e "1 + 1"')
2019

2120
assert ri.inputs.script == "1 + 1"
2221
assert ri.inputs.script_file == default_script_file
@@ -49,7 +48,6 @@ def test_run_interface(tmpdir):
4948
cwd.chdir()
5049

5150

52-
5351
@pytest.mark.skipif(no_r, reason="R is not available")
5452
def test_set_rcmd(tmpdir):
5553
cwd = tmpdir.chdir()

0 commit comments

Comments
 (0)