Skip to content

Commit

Permalink
STY: Apply ruff/pycodestyle rule E721
Browse files Browse the repository at this point in the history
E721 Use `is` and `is not` for type comparisons,
     or `isinstance()` for isinstance checks
  • Loading branch information
DimitriPapadopoulos committed Oct 6, 2024
1 parent 5f6d492 commit 3bc9c58
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
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(dict()) is type(newb)
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

Check warning on line 40 in nipype/interfaces/fsl/tests/test_base.py

View check run for this annotation

Codecov / codecov/patch

nipype/interfaces/fsl/tests/test_base.py#L40

Added line #L40 was not covered by tests


@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/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

0 comments on commit 3bc9c58

Please sign in to comment.