diff --git a/nipype/algorithms/modelgen.py b/nipype/algorithms/modelgen.py index 38b5e47549..78083cb628 100644 --- a/nipype/algorithms/modelgen.py +++ b/nipype/algorithms/modelgen.py @@ -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 diff --git a/nipype/interfaces/base/tests/test_support.py b/nipype/interfaces/base/tests/test_support.py index 3997a88280..52770e476c 100644 --- a/nipype/interfaces/base/tests/test_support.py +++ b/nipype/interfaces/base/tests/test_support.py @@ -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 diff --git a/nipype/interfaces/fsl/tests/test_base.py b/nipype/interfaces/fsl/tests/test_base.py index 2b07381e81..1a76d0f6a5 100644 --- a/nipype/interfaces/fsl/tests/test_base.py +++ b/nipype/interfaces/fsl/tests/test_base.py @@ -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") diff --git a/nipype/pipeline/engine/tests/test_workflows.py b/nipype/pipeline/engine/tests/test_workflows.py index 9b06eb56bb..12d56de285 100644 --- a/nipype/pipeline/engine/tests/test_workflows.py +++ b/nipype/pipeline/engine/tests/test_workflows.py @@ -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(): diff --git a/nipype/pipeline/plugins/dagman.py b/nipype/pipeline/plugins/dagman.py index ad8e4ec733..55f3f03bee 100644 --- a/nipype/pipeline/plugins/dagman.py +++ b/nipype/pipeline/plugins/dagman.py @@ -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( diff --git a/nipype/scripts/utils.py b/nipype/scripts/utils.py index 77e7231bea..8d8dc52627 100644 --- a/nipype/scripts/utils.py +++ b/nipype/scripts/utils.py @@ -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 diff --git a/tools/checkspecs.py b/tools/checkspecs.py index 959acef0e0..7c9ebf4157 100644 --- a/tools/checkspecs.py +++ b/tools/checkspecs.py @@ -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"] )