Skip to content

Commit

Permalink
Fix pyupgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadair committed Mar 22, 2024
1 parent 0ba3eb9 commit 0677b69
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
1 change: 0 additions & 1 deletion .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ select = [
"E",
"W",
"UP",
"I",
"C4",
"PT",
]
Expand Down
2 changes: 1 addition & 1 deletion dkist/dataset/tests/test_load_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def single_asdf_in_folder_str(single_asdf_in_folder):

@pytest.fixture
def fixture_finder(request):
if isinstance(request.param, (list, tuple)):
if isinstance(request.param, list | tuple):
return [request.getfixturevalue(i) for i in request.param]
return request.getfixturevalue(request.param)

Expand Down
8 changes: 2 additions & 6 deletions dkist/io/asdf/converters/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,12 @@ def select_tag(self, obj, tags, ctx):

if isinstance(
obj,
(VaryingCelestialTransform,
VaryingCelestialTransform2D,
VaryingCelestialTransform3D)
VaryingCelestialTransform | VaryingCelestialTransform2D | VaryingCelestialTransform3D
):
return "asdf://dkist.nso.edu/tags/varying_celestial_transform-1.1.0"
elif isinstance(
obj,
(InverseVaryingCelestialTransform,
InverseVaryingCelestialTransform2D,
InverseVaryingCelestialTransform3D)
InverseVaryingCelestialTransform | InverseVaryingCelestialTransform2D | InverseVaryingCelestialTransform3D
):
return "asdf://dkist.nso.edu/tags/inverse_varying_celestial_transform-1.1.0"
else:
Expand Down
2 changes: 1 addition & 1 deletion dkist/net/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def transfer_complete_datasets(datasets: str | Iterable[str] | QueryResponseRow
# Avoid circular import
from dkist.net import conf

if isinstance(datasets, (DKISTQueryResponseTable, QueryResponseRow)):
if isinstance(datasets, DKISTQueryResponseTable | QueryResponseRow):
# These we don't have to pre-process
pass

Expand Down
8 changes: 4 additions & 4 deletions dkist/net/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,19 @@ def test_length_0_qr(empty_query_response):
@settings(suppress_health_check=[HealthCheck.too_slow])
@given(dst.query_and())
def test_apply_and(s):
assert isinstance(s, (attr.AttrAnd, attr.DataAttr))
assert isinstance(s, attr.AttrAnd | attr.DataAttr)


@settings(suppress_health_check=[HealthCheck.too_slow])
@given(dst.query_or())
def test_apply_or(s):
assert isinstance(s, (attr.AttrOr, attr.DataAttr))
assert isinstance(s, attr.AttrOr | attr.DataAttr)


@settings(suppress_health_check=[HealthCheck.too_slow])
@given(dst.query_or_composite())
def test_apply_or_and(s):
assert isinstance(s, (attr.AttrOr, attr.DataAttr, attr.AttrAnd))
assert isinstance(s, attr.AttrOr | attr.DataAttr | attr.AttrAnd)


@settings(suppress_health_check=[HealthCheck.too_slow, HealthCheck.function_scoped_fixture],
Expand Down Expand Up @@ -227,7 +227,7 @@ def test_fido_valid(mocker, mocked_client, query):
Fido.search(query)
assert mocked_search.called

if isinstance(query, (attr.DataAttr, attr.AttrAnd)):
if isinstance(query, attr.DataAttr | attr.AttrAnd):
assert mocked_search.call_count == 1

if isinstance(query, attr.AttrOr):
Expand Down

0 comments on commit 0677b69

Please sign in to comment.