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
Changes from all 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
@@ -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
2 changes: 1 addition & 1 deletion nipype/interfaces/base/tests/test_support.py
Original file line number Diff line number Diff line change
@@ -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


2 changes: 1 addition & 1 deletion nipype/interfaces/fsl/tests/test_base.py
Original file line number Diff line number Diff line change
@@ -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

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")
2 changes: 1 addition & 1 deletion nipype/pipeline/engine/tests/test_workflows.py
Original file line number Diff line number Diff line change
@@ -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():
4 changes: 2 additions & 2 deletions nipype/pipeline/plugins/dagman.py
Original file line number Diff line number Diff line change
@@ -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":
@@ -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(
4 changes: 2 additions & 2 deletions nipype/scripts/utils.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion tools/checkspecs.py
Original file line number Diff line number Diff line change
@@ -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"]
)