Skip to content

Commit

Permalink
Merge pull request #3689 from DimitriPapadopoulos/E
Browse files Browse the repository at this point in the history
STY: Apply ruff/pycodestyle rules (E)
  • Loading branch information
effigies authored Oct 7, 2024
2 parents d3cfb41 + e84ada2 commit ae12343
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion nipype/algorithms/modelgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
experiments.
"""
from copy import deepcopy
import csv, math, os
import csv
import math
import os

from nibabel import load
import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/base/tests/test_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_bunch_methods():
assert b.get("a") == 3
assert b.get("badkey", "otherthing") == "otherthing"
assert b != newb
assert type(dict()) == type(newb)
assert type(newb) is dict
assert newb["a"] == 3


Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/fsl/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_FSLCommand():
# testing the one item that is not.
cmd = fsl.FSLCommand(command="ls")
res = cmd.run()
assert type(res) == InterfaceResult
assert type(res) is InterfaceResult


@pytest.mark.skipif(no_fsl(), reason="fsl is not installed")
Expand Down
2 changes: 1 addition & 1 deletion nipype/pipeline/engine/tests/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_init():
with pytest.raises(TypeError):
pe.Workflow()
pipe = pe.Workflow(name="pipe")
assert type(pipe._graph) == nx.DiGraph
assert type(pipe._graph) is nx.DiGraph


def test_connect():
Expand Down
4 changes: 2 additions & 2 deletions nipype/pipeline/plugins/dagman.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self, **kwargs):
):
if (
"plugin_args" in kwargs
and not kwargs["plugin_args"] is None
and kwargs["plugin_args"] is not None
and id_ in kwargs["plugin_args"]
):
if id_ == "wrapper_cmd":
Expand All @@ -89,7 +89,7 @@ def __init__(self, **kwargs):
val = self._get_str_or_file(kwargs["plugin_args"][id_])
setattr(self, var, val)
# TODO remove after some time
if "plugin_args" in kwargs and not kwargs["plugin_args"] is None:
if "plugin_args" in kwargs and kwargs["plugin_args"] is not None:
plugin_args = kwargs["plugin_args"]
if "template" in plugin_args:
warn(
Expand Down
4 changes: 2 additions & 2 deletions nipype/scripts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ def add_args_options(arg_parser, interface):
if not spec.is_trait_type(traits.TraitCompound):
trait_type = type(spec.trait_type.default_value)
if trait_type in (bytes, str, int, float):
if trait_type == bytes:
if trait_type is bytes:
trait_type = str
args["type"] = trait_type
elif len(spec.inner_traits) == 1:
trait_type = type(spec.inner_traits[0].trait_type.default_value)
if trait_type == bytes:
if trait_type is bytes:
trait_type = str
if trait_type in (bytes, bool, str, int, float):
args["type"] = trait_type
Expand Down
2 changes: 1 addition & 1 deletion tools/checkspecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def test_specs(self, uri):
bad_specs.append(
[uri, c, "Inputs", traitname, "mandatory=False"]
)
if key == "usedefault" and trait.__dict__[key] == False:
if key == "usedefault" and trait.__dict__[key] is False:
bad_specs.append(
[uri, c, "Inputs", traitname, "usedefault=False"]
)
Expand Down

0 comments on commit ae12343

Please sign in to comment.