Skip to content

Commit 05af6c1

Browse files
committed
Drop Python 3.8
1 parent 83def6a commit 05af6c1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+541
-778
lines changed

.github/workflows/ci-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
strategy:
3333
matrix:
3434
py-ver-major: [3]
35-
py-ver-minor: [8, 9, 10, 11, 12, 13]
35+
py-ver-minor: [9, 10, 11, 12, 13]
3636
step: [lint, unit, bandit, mypy]
3737

3838
env:

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ MODULE=cwltool
2424

2525
# `SHELL=bash` doesn't work for some, so don't use BASH-isms like
2626
# `[[` conditional expressions.
27-
PYSOURCES=$(wildcard ${MODULE}/**.py cwltool/cwlprov/*.py tests/*.py) setup.py
27+
PYSOURCES=$(wildcard ${MODULE}/**.py cwltool/cwlprov/*.py tests/*.py tests/cwl-conformance/*.py) setup.py
2828
DEVPKGS=diff_cover pylint pep257 pydocstyle 'tox<4' tox-pyenv auto-walrus \
2929
isort wheel autoflake pyupgrade bandit -rlint-requirements.txt\
3030
-rtest-requirements.txt -rmypy-requirements.txt -rdocs/requirements.txt
@@ -190,7 +190,7 @@ shellcheck: FORCE
190190
cwltool-in-docker.sh
191191

192192
pyupgrade: $(PYSOURCES)
193-
pyupgrade --exit-zero-even-if-changed --py38-plus $^
193+
pyupgrade --exit-zero-even-if-changed --py39-plus $^
194194
auto-walrus $^
195195

196196
release-test: FORCE

cwltool/argparser.py

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,8 @@
33
import argparse
44
import os
55
import urllib
6-
from typing import (
7-
Any,
8-
Callable,
9-
Dict,
10-
List,
11-
MutableMapping,
12-
MutableSequence,
13-
Optional,
14-
Sequence,
15-
Type,
16-
Union,
17-
cast,
18-
)
6+
from collections.abc import MutableMapping, MutableSequence, Sequence
7+
from typing import Any, Callable, Optional, Union, cast
198

209
from .loghandler import _logger
2110
from .process import Process, shortname
@@ -718,7 +707,7 @@ def arg_parser() -> argparse.ArgumentParser:
718707
return parser
719708

720709

721-
def get_default_args() -> Dict[str, Any]:
710+
def get_default_args() -> dict[str, Any]:
722711
"""Get default values of cwltool's command line options."""
723712
ap = arg_parser()
724713
args = ap.parse_args([])
@@ -732,7 +721,7 @@ class FSAction(argparse.Action):
732721

733722
def __init__(
734723
self,
735-
option_strings: List[str],
724+
option_strings: list[str],
736725
dest: str,
737726
nargs: Any = None,
738727
urljoin: Callable[[str, str], str] = urllib.parse.urljoin,
@@ -770,7 +759,7 @@ class FSAppendAction(argparse.Action):
770759

771760
def __init__(
772761
self,
773-
option_strings: List[str],
762+
option_strings: list[str],
774763
dest: str,
775764
nargs: Any = None,
776765
urljoin: Callable[[str, str], str] = urllib.parse.urljoin,
@@ -827,7 +816,7 @@ class AppendAction(argparse.Action):
827816

828817
def __init__(
829818
self,
830-
option_strings: List[str],
819+
option_strings: list[str],
831820
dest: str,
832821
nargs: Any = None,
833822
**kwargs: Any,
@@ -859,7 +848,7 @@ def add_argument(
859848
toolparser: argparse.ArgumentParser,
860849
name: str,
861850
inptype: Any,
862-
records: List[str],
851+
records: list[str],
863852
description: str = "",
864853
default: Any = None,
865854
input_required: bool = True,
@@ -888,9 +877,9 @@ def add_argument(
888877
return None
889878

890879
ahelp = description.replace("%", "%%")
891-
action: Optional[Union[Type[argparse.Action], str]] = None
880+
action: Optional[Union[type[argparse.Action], str]] = None
892881
atype: Optional[Any] = None
893-
typekw: Dict[str, Any] = {}
882+
typekw: dict[str, Any] = {}
894883

895884
if inptype == "File":
896885
action = FileAction
@@ -962,8 +951,8 @@ def add_argument(
962951
def generate_parser(
963952
toolparser: argparse.ArgumentParser,
964953
tool: Process,
965-
namemap: Dict[str, str],
966-
records: List[str],
954+
namemap: dict[str, str],
955+
records: list[str],
967956
input_required: bool = True,
968957
urljoin: Callable[[str, str], str] = urllib.parse.urljoin,
969958
base_uri: str = "",

cwltool/builder.py

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,9 @@
33
import copy
44
import logging
55
import math
6+
from collections.abc import MutableMapping, MutableSequence
67
from decimal import Decimal
7-
from typing import (
8-
IO,
9-
TYPE_CHECKING,
10-
Any,
11-
Callable,
12-
Dict,
13-
List,
14-
MutableMapping,
15-
MutableSequence,
16-
Optional,
17-
Type,
18-
Union,
19-
cast,
20-
)
8+
from typing import IO, TYPE_CHECKING, Any, Callable, Optional, Union, cast
219

2210
from cwl_utils import expression
2311
from cwl_utils.file_formats import check_format
@@ -55,7 +43,7 @@
5543
)
5644
from .pathmapper import PathMapper
5745

58-
INPUT_OBJ_VOCAB: Dict[str, str] = {
46+
INPUT_OBJ_VOCAB: dict[str, str] = {
5947
"Any": "https://w3id.org/cwl/salad#Any",
6048
"File": "https://w3id.org/cwl/cwl#File",
6149
"Directory": "https://w3id.org/cwl/cwl#Directory",
@@ -107,16 +95,16 @@ class Builder(HasReqsHints):
10795
def __init__(
10896
self,
10997
job: CWLObjectType,
110-
files: List[CWLObjectType],
111-
bindings: List[CWLObjectType],
98+
files: list[CWLObjectType],
99+
bindings: list[CWLObjectType],
112100
schemaDefs: MutableMapping[str, CWLObjectType],
113101
names: Names,
114-
requirements: List[CWLObjectType],
115-
hints: List[CWLObjectType],
116-
resources: Dict[str, Union[int, float]],
102+
requirements: list[CWLObjectType],
103+
hints: list[CWLObjectType],
104+
resources: dict[str, Union[int, float]],
117105
mutation_manager: Optional[MutationManager],
118106
formatgraph: Optional[Graph],
119-
make_fs_access: Type[StdFsAccess],
107+
make_fs_access: type[StdFsAccess],
120108
fs_access: StdFsAccess,
121109
job_script_provider: Optional[DependenciesConfiguration],
122110
timeout: float,
@@ -172,19 +160,19 @@ def __init__(
172160
self.find_default_container: Optional[Callable[[], str]] = None
173161
self.container_engine = container_engine
174162

175-
def build_job_script(self, commands: List[str]) -> Optional[str]:
163+
def build_job_script(self, commands: list[str]) -> Optional[str]:
176164
if self.job_script_provider is not None:
177165
return self.job_script_provider.build_job_script(self, commands)
178166
return None
179167

180168
def bind_input(
181169
self,
182170
schema: CWLObjectType,
183-
datum: Union[CWLObjectType, List[CWLObjectType]],
171+
datum: Union[CWLObjectType, list[CWLObjectType]],
184172
discover_secondaryFiles: bool,
185-
lead_pos: Optional[Union[int, List[int]]] = None,
186-
tail_pos: Optional[Union[str, List[int]]] = None,
187-
) -> List[MutableMapping[str, Union[str, List[int]]]]:
173+
lead_pos: Optional[Union[int, list[int]]] = None,
174+
tail_pos: Optional[Union[str, list[int]]] = None,
175+
) -> list[MutableMapping[str, Union[str, list[int]]]]:
188176
"""
189177
Bind an input object to the command line.
190178
@@ -200,8 +188,8 @@ def bind_input(
200188
if lead_pos is None:
201189
lead_pos = []
202190

203-
bindings: List[MutableMapping[str, Union[str, List[int]]]] = []
204-
binding: Union[MutableMapping[str, Union[str, List[int]]], CommentedMap] = {}
191+
bindings: list[MutableMapping[str, Union[str, list[int]]]] = []
192+
binding: Union[MutableMapping[str, Union[str, list[int]]], CommentedMap] = {}
205193
value_from_expression = False
206194
if "inputBinding" in schema and isinstance(schema["inputBinding"], MutableMapping):
207195
binding = CommentedMap(schema["inputBinding"].items())
@@ -324,7 +312,7 @@ def bind_input(
324312

325313
if schema["type"] == "record":
326314
datum = cast(CWLObjectType, datum)
327-
for f in cast(List[CWLObjectType], schema["fields"]):
315+
for f in cast(list[CWLObjectType], schema["fields"]):
328316
name = cast(str, f["name"])
329317
if name in datum and datum[name] is not None:
330318
bindings.extend(
@@ -372,7 +360,7 @@ def _capture_files(f: CWLObjectType) -> CWLObjectType:
372360
self.files.append(datum)
373361

374362
loadContents_sourceline: Union[
375-
None, MutableMapping[str, Union[str, List[int]]], CWLObjectType
363+
None, MutableMapping[str, Union[str, list[int]]], CWLObjectType
376364
] = None
377365
if binding and binding.get("loadContents"):
378366
loadContents_sourceline = binding
@@ -513,7 +501,7 @@ def addsf(
513501
if "format" in schema:
514502
eval_format: Any = self.do_eval(schema["format"])
515503
if isinstance(eval_format, str):
516-
evaluated_format: Union[str, List[str]] = eval_format
504+
evaluated_format: Union[str, list[str]] = eval_format
517505
elif isinstance(eval_format, MutableSequence):
518506
for index, entry in enumerate(eval_format):
519507
message = None
@@ -541,7 +529,7 @@ def addsf(
541529
raise SourceLine(
542530
schema["format"], index, WorkflowException, debug
543531
).makeError(message)
544-
evaluated_format = cast(List[str], eval_format)
532+
evaluated_format = cast(list[str], eval_format)
545533
else:
546534
raise SourceLine(schema, "format", WorkflowException, debug).makeError(
547535
"An expression in the 'format' field must "
@@ -586,8 +574,8 @@ def addsf(
586574
# Position to front of the sort key
587575
if binding:
588576
for bi in bindings:
589-
bi["position"] = cast(List[int], binding["position"]) + cast(
590-
List[int], bi["position"]
577+
bi["position"] = cast(list[int], binding["position"]) + cast(
578+
list[int], bi["position"]
591579
)
592580
bindings.append(binding)
593581

@@ -618,7 +606,7 @@ def tostr(self, value: Union[MutableMapping[str, str], Any]) -> str:
618606
else:
619607
return str(value)
620608

621-
def generate_arg(self, binding: CWLObjectType) -> List[str]:
609+
def generate_arg(self, binding: CWLObjectType) -> list[str]:
622610
value = binding.get("datum")
623611
debug = _logger.isEnabledFor(logging.DEBUG)
624612
if "valueFrom" in binding:
@@ -648,7 +636,7 @@ def generate_arg(self, binding: CWLObjectType) -> List[str]:
648636
argl = [itemSeparator.join([self.tostr(v) for v in value])]
649637
elif binding.get("valueFrom"):
650638
value = [self.tostr(v) for v in value]
651-
return cast(List[str], ([prefix] if prefix else [])) + cast(List[str], value)
639+
return cast(list[str], ([prefix] if prefix else [])) + cast(list[str], value)
652640
elif prefix and value:
653641
return [prefix]
654642
else:

0 commit comments

Comments
 (0)