Skip to content

Commit

Permalink
Upgrade pyupgrade target to Python3.9 (#620)
Browse files Browse the repository at this point in the history
This commit upgrades the `pyupgrade` target Python version to
Python 3.9 and it adapts the code accordingly, completing the work
initiated in #561
  • Loading branch information
LanderOtto authored Dec 13, 2024
1 parent c46d143 commit 54c811b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ format-check:
black --diff --check streamflow tests

pyupgrade:
pyupgrade --py3-only --py38-plus $(shell git ls-files | grep .py | grep -v streamflow/cwl/antlr)
pyupgrade --py3-only --py39-plus $(shell git ls-files | grep .py | grep -v streamflow/cwl/antlr)

test:
python -m pytest -rs ${PYTEST_EXTRA}
Expand Down
3 changes: 1 addition & 2 deletions streamflow/cwl/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
from types import ModuleType
from typing import (
Any,
MutableMapping,
MutableSequence,
cast,
get_args,
)
from collections.abc import MutableMapping, MutableSequence

import cwl_utils.parser
import cwl_utils.parser.utils
Expand Down
7 changes: 3 additions & 4 deletions tests/test_build_wf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Type, cast

import pytest
from typing import cast

from streamflow.core import utils
from streamflow.core.config import BindingConfig
Expand Down Expand Up @@ -74,7 +73,7 @@ async def _clone_step(step, workflow, context):
return new_workflow, new_step


async def _general_test_port(context: StreamFlowContext, cls_port: Type[Port]):
async def _general_test_port(context: StreamFlowContext, cls_port: type[Port]):
workflow, ports = await create_workflow(context)
port = workflow.create_port(cls_port)
await workflow.save(context)
Expand Down Expand Up @@ -325,7 +324,7 @@ async def test_schedule_step(context: StreamFlowContext):

@pytest.mark.asyncio
@pytest.mark.parametrize("port_cls", [Port, JobPort, ConnectorPort])
async def test_port(context: StreamFlowContext, port_cls: Type[Port]):
async def test_port(context: StreamFlowContext, port_cls: type[Port]):
"""Test saving Port on database and re-load it in a new Workflow"""
await _general_test_port(context, port_cls)

Expand Down
8 changes: 4 additions & 4 deletions tests/test_cwl_build_wf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import posixpath
from typing import Type, cast
from typing import cast

import pytest

from streamflow.core import utils
from streamflow.core.context import StreamFlowContext
Expand Down Expand Up @@ -45,7 +45,7 @@

@pytest.mark.asyncio
@pytest.mark.parametrize("step_cls", [CWLLoopOutputAllStep, CWLLoopOutputLastStep])
async def test_cwl_loop_output(context: StreamFlowContext, step_cls: Type[Step]):
async def test_cwl_loop_output(context: StreamFlowContext, step_cls: type[Step]):
"""Test saving CWLLoopOutputAllStep on database and re-load it in a new Workflow"""
workflow, _ = await create_workflow(context, num_port=0)
await _base_step_test_process(
Expand Down Expand Up @@ -181,7 +181,7 @@ async def test_loop_value_from_transformer(context: StreamFlowContext):
[AllNonNullTransformer, FirstNonNullTransformer, OnlyNonNullTransformer],
)
async def test_non_null_transformer(
context: StreamFlowContext, transformer_cls: Type[Step]
context: StreamFlowContext, transformer_cls: type[Step]
):
"""Test saving All/First/Only NonNullTransformer on database and re-load it in a new Workflow"""
workflow, _ = await create_workflow(context, num_port=0)
Expand Down

0 comments on commit 54c811b

Please sign in to comment.