Skip to content

Commit

Permalink
Upgrade flake8 and subsequent fixes, in preparation for Python 3.12 (#…
Browse files Browse the repository at this point in the history
…2857)

Upcoming Python 3.12 (at least in python 3.12-rc1) requires a newer version
of flake8 as flake8 6.0.0 gets confused by things happening inside format
strings with Python 3.12-rc1.

This PR makes that upgrade.

Flake8 6.1.0 introduces a new rule to use is-equality, rather than
==-equality, when comparing types, and so this PR fixes violations of
that rule too. In theory this shouldn't change behaviour.
  • Loading branch information
benclifford authored Aug 11, 2023
1 parent abf1b96 commit eb7ffe9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions parsl/dataflow/memoization.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def id_for_memo_pickle(obj: object, output_ref: bool = False) -> bytes:

@id_for_memo.register(list)
def id_for_memo_list(denormalized_list: list, output_ref: bool = False) -> bytes:
if type(denormalized_list) != list:
if type(denormalized_list) is not list:
raise ValueError("id_for_memo_list cannot work on subclasses of list")

normalized_list = []
Expand All @@ -73,7 +73,7 @@ def id_for_memo_list(denormalized_list: list, output_ref: bool = False) -> bytes

@id_for_memo.register(tuple)
def id_for_memo_tuple(denormalized_tuple: tuple, output_ref: bool = False) -> bytes:
if type(denormalized_tuple) != tuple:
if type(denormalized_tuple) is not tuple:
raise ValueError("id_for_memo_tuple cannot work on subclasses of tuple")

normalized_list = []
Expand All @@ -91,7 +91,7 @@ def id_for_memo_dict(denormalized_dict: dict, output_ref: bool = False) -> bytes
When output_ref=True, the values are normalised as output refs, but
the keys are not.
"""
if type(denormalized_dict) != dict:
if type(denormalized_dict) is not dict:
raise ValueError("id_for_memo_dict cannot work on subclasses of dict")

keys = sorted(denormalized_dict)
Expand Down
2 changes: 1 addition & 1 deletion parsl/tests/integration/test_channels/test_ssh_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_error_1():
try:
connect_and_list("bad.url.gov", "ubuntu")
except Exception as e:
assert type(e) == SSHException, "Expected SSException, got: {0}".format(e)
assert type(e) is SSHException, "Expected SSException, got: {0}".format(e)


def test_error_2():
Expand Down
2 changes: 1 addition & 1 deletion parsl/tests/test_bash_apps/test_keyword_overlaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

@parsl.bash_app
def my_app(cache=7):
assert type(cache) == int
assert type(cache) is int
return "true"


Expand Down
2 changes: 1 addition & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
flake8==6.0.0
flake8==6.1.0
ipyparallel
pandas
pytest>=7.4.0,<8
Expand Down

0 comments on commit eb7ffe9

Please sign in to comment.