Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STY: Apply ruff/pycodestyle rules (E) #3689

Merged
merged 5 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(dict()) is type(newb)
DimitriPapadopoulos marked this conversation as resolved.
Show resolved Hide resolved
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 @@
# 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/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