Fix style issues with latest versions of tools (#39422)

This commit is contained in:
Massimiliano Culpo 2023-08-14 18:38:59 +02:00 committed by GitHub
parent 1fff0241f2
commit 6e31676b29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 21 additions and 27 deletions

View File

@ -780,7 +780,7 @@ def __enter__(self):
raise RuntimeError("file argument must be set by __init__ ")
# Open both write and reading on logfile
if type(self.logfile) == io.StringIO:
if isinstance(self.logfile, io.StringIO):
self._ioflag = True
# cannot have two streams on tempfile, so we must make our own
sys.stdout = self.logfile

View File

@ -430,7 +430,7 @@ def file_scopes(self) -> List[ConfigScope]:
return [
s
for s in self.scopes.values()
if (type(s) == ConfigScope or type(s) == SingleFileScope)
if (type(s) is ConfigScope or type(s) is SingleFileScope)
]
def highest_precedence_scope(self) -> ConfigScope:

View File

@ -236,7 +236,7 @@ def install(self, prefix):
# Create a multimethod with this name if there is not one already
original_method = MultiMethodMeta._locals.get(method.__name__)
if not type(original_method) == SpecMultiMethod:
if not isinstance(original_method, SpecMultiMethod):
original_method = SpecMultiMethod(original_method)
if self.spec is not None:

View File

@ -54,7 +54,7 @@ def test_pickle(tmpdir):
with tmpdir.as_cwd():
build_env("--pickle", _out_file, "zlib")
environment = pickle.load(open(_out_file, "rb"))
assert type(environment) == dict
assert isinstance(environment, dict)
assert "PATH" in environment

View File

@ -134,7 +134,7 @@ def test_get_item(self, library_list):
assert a == "/dir1/liblapack.%s" % plat_static_ext
b = library_list[:]
assert type(b) == type(library_list)
assert type(b) is type(library_list)
assert library_list == b
assert library_list is not b
@ -152,8 +152,8 @@ def test_add(self, library_list):
assert both == both + both
# Always produce an instance of LibraryList
assert type(library_list + pylist) == type(library_list)
assert type(pylist + library_list) == type(library_list)
assert type(library_list + pylist) is type(library_list)
assert type(pylist + library_list) is type(library_list)
class TestHeaderList:
@ -219,7 +219,7 @@ def test_get_item(self, header_list):
assert a == "/dir1/Python.h"
b = header_list[:]
assert type(b) == type(header_list)
assert type(b) is type(header_list)
assert header_list == b
assert header_list is not b
@ -237,8 +237,8 @@ def test_add(self, header_list):
assert h == h + h
# Always produce an instance of HeaderList
assert type(header_list + pylist) == type(header_list)
assert type(pylist + header_list) == type(header_list)
assert type(header_list + pylist) is type(header_list)
assert type(pylist + header_list) is type(header_list)
#: Directory where the data for the test below is stored

View File

@ -53,7 +53,6 @@
php_line_patched = "<?php #!/this/" + ("x" * too_long) + "/is/php\n"
php_line_patched2 = "?>\n"
sbang_line = "#!/bin/sh %s/bin/sbang\n" % spack.store.STORE.unpadded_root
last_line = "last!\n"

View File

@ -515,10 +515,10 @@ def test_dep_index(self):
s.normalize()
assert s["callpath"] == s
assert type(s["dyninst"]) == Spec
assert type(s["libdwarf"]) == Spec
assert type(s["libelf"]) == Spec
assert type(s["mpi"]) == Spec
assert isinstance(s["dyninst"], Spec)
assert isinstance(s["libdwarf"], Spec)
assert isinstance(s["libelf"], Spec)
assert isinstance(s["mpi"], Spec)
assert s["dyninst"].name == "dyninst"
assert s["libdwarf"].name == "libdwarf"

View File

@ -525,13 +525,13 @@ def test_yaml_entry(self):
def test_from_node_dict():
a = MultiValuedVariant.from_node_dict("foo", ["bar"])
assert type(a) == MultiValuedVariant
assert type(a) is MultiValuedVariant
a = MultiValuedVariant.from_node_dict("foo", "bar")
assert type(a) == SingleValuedVariant
assert type(a) is SingleValuedVariant
a = MultiValuedVariant.from_node_dict("foo", "true")
assert type(a) == BoolValuedVariant
assert type(a) is BoolValuedVariant
class TestVariant:

View File

@ -68,7 +68,7 @@ def syaml_type(obj):
"""
for syaml_t, t in syaml_types.items():
if type(obj) is not bool and isinstance(obj, t):
return syaml_t(obj) if type(obj) != syaml_t else obj
return syaml_t(obj) if type(obj) is not syaml_t else obj
return obj

View File

@ -5,7 +5,7 @@
def comma_list(sequence, article=""):
if type(sequence) != list:
if type(sequence) is not list:
sequence = list(sequence)
if not sequence:

View File

@ -34,11 +34,7 @@ class PyJax(PythonPackage):
depends_on("py-scipy@1.2.1:", type=("build", "run"))
# See _minimum_jaxlib_version in jax/version.py
jax_to_jaxlib = {
"0.4.3": "0.4.2",
"0.3.23": "0.3.15",
"0.2.25": "0.1.69",
}
jax_to_jaxlib = {"0.4.3": "0.4.2", "0.3.23": "0.3.15", "0.2.25": "0.1.69"}
for jax, jaxlib in jax_to_jaxlib.items():
depends_on(f"py-jaxlib@{jaxlib}:", when=f"@{jax}", type=("build", "run"))

View File

@ -8,7 +8,7 @@
import xml.etree.ElementTree
from typing import Optional
url = None # type: Optional[str]
url: Optional[str] = None
url = "https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/index.xml"
if url is not None:
document = urllib.request.urlopen(url).read()

View File

@ -13,7 +13,6 @@ class Turbine(AutotoolsPackage):
homepage = "http://swift-lang.org/Swift-T"
url = "https://swift-lang.github.io/swift-t-downloads/spack/turbine-1.3.0.tar.gz"
git = "https://github.com/swift-lang/swift-t.git"
configure_directory = "turbine/code"
version("master", branch="master")
version("1.3.0", sha256="9709e5dada91a7dce958a7967d6ff2bd39ccc9e7da62d05a875324b5089da393")