Skip to content

Commit fb6bdb5

Browse files
authored
Merge pull request #1796 from common-workflow-language/dependabot/pip/black-approx-eq-23.1
Update black requirement from ~=22.0 to ~=23.1
2 parents b40033f + b2b23e9 commit fb6bdb5

File tree

118 files changed

+640
-1695
lines changed

Some content is hidden

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

118 files changed

+640
-1695
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33

44
# upgrade to black 20.8b1
55
6fd6fdb381fe3f347627fd517a8f2dba7b0a7029
6+
7+
# upgrade to black 23.1, longer lines (100)
8+
7fe8c0739b0515d00daabc7db87bc5fad926d345

.github/workflows/ci-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ jobs:
2525
- py-ver-major: 3
2626
py-ver-minor: 6
2727
step: mypy
28+
- py-ver-major: 3
29+
py-ver-minor: 6
30+
step: lint
2831

2932
env:
3033
py-semver: ${{ format('{0}.{1}', matrix.py-ver-major, matrix.py-ver-minor) }}

cwltool.Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ RUN apk add --no-cache git gcc python3-dev libxml2-dev libxslt-dev libc-dev linu
44

55
WORKDIR /cwltool
66
COPY . .
7-
8-
RUN pip install toml -rmypy-requirements.txt -rrequirements.txt
9-
RUN CWLTOOL_USE_MYPYC=1 MYPYPATH=mypy-stubs pip wheel --no-binary schema-salad --wheel-dir=/wheels .[deps]
7+
RUN CWLTOOL_USE_MYPYC=1 MYPYPATH=mypy-stubs pip wheel --no-binary schema-salad \
8+
--wheel-dir=/wheels .[deps] # --verbose
109
RUN rm /wheels/schema_salad*
11-
RUN pip install black
10+
RUN pip install "black~=22.0"
11+
# galaxy-util 22.1.2 depends on packaging<22, but black 23.x needs packaging>22
1212
RUN SCHEMA_SALAD_USE_MYPYC=1 MYPYPATH=mypy-stubs pip wheel --no-binary schema-salad \
13-
$(grep schema.salad requirements.txt) black --wheel-dir=/wheels
14-
RUN pip install --force-reinstall --no-index --no-warn-script-location --root=/pythonroot/ /wheels/*.whl
13+
$(grep schema.salad requirements.txt) "black~=22.0" --wheel-dir=/wheels # --verbose
14+
RUN pip install --force-reinstall --no-index --no-warn-script-location \
15+
--root=/pythonroot/ /wheels/*.whl
1516
# --force-reinstall to install our new mypyc compiled schema-salad package
1617

1718
FROM python:3.11-alpine as module

cwltool/argparser.py

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,7 @@ def arg_parser() -> argparse.ArgumentParser:
126126
help="Path prefix for temporary directories. If --tmpdir-prefix is not "
127127
"provided, then the prefix for temporary directories is influenced by "
128128
"the value of the TMPDIR, TEMP, or TMP environment variables. Taking "
129-
"those into consideration, the current default is {}.".format(
130-
DEFAULT_TMP_PREFIX
131-
),
129+
"those into consideration, the current default is {}.".format(DEFAULT_TMP_PREFIX),
132130
default=DEFAULT_TMP_PREFIX,
133131
)
134132

@@ -318,12 +316,8 @@ def arg_parser() -> argparse.ArgumentParser:
318316
action="store_true",
319317
help="Combine components into single document and print.",
320318
)
321-
printgroup.add_argument(
322-
"--version", action="store_true", help="Print version and exit"
323-
)
324-
printgroup.add_argument(
325-
"--validate", action="store_true", help="Validate CWL document only."
326-
)
319+
printgroup.add_argument("--version", action="store_true", help="Print version and exit")
320+
printgroup.add_argument("--validate", action="store_true", help="Validate CWL document only.")
327321
printgroup.add_argument(
328322
"--print-supported-versions",
329323
action="store_true",
@@ -384,12 +378,8 @@ def arg_parser() -> argparse.ArgumentParser:
384378

385379
volumegroup = parser.add_mutually_exclusive_group()
386380
volumegroup.add_argument("--verbose", action="store_true", help="Default logging")
387-
volumegroup.add_argument(
388-
"--quiet", action="store_true", help="Only print warnings and errors."
389-
)
390-
volumegroup.add_argument(
391-
"--debug", action="store_true", help="Print even more logging"
392-
)
381+
volumegroup.add_argument("--quiet", action="store_true", help="Only print warnings and errors.")
382+
volumegroup.add_argument("--debug", action="store_true", help="Print even more logging")
393383

394384
parser.add_argument(
395385
"--write-summary",
@@ -494,12 +484,9 @@ def arg_parser() -> argparse.ArgumentParser:
494484
"Default root directory used by dependency resolvers configuration."
495485
)
496486
use_biocontainers_help = (
497-
"Use biocontainers for tools without an "
498-
"explicitly annotated Docker container."
499-
)
500-
conda_dependencies = (
501-
"Short cut to use Conda to resolve 'SoftwareRequirement' packages."
487+
"Use biocontainers for tools without an " "explicitly annotated Docker container."
502488
)
489+
conda_dependencies = "Short cut to use Conda to resolve 'SoftwareRequirement' packages."
503490

504491
parser.add_argument(
505492
"--beta-dependency-resolvers-configuration",
@@ -522,9 +509,7 @@ def arg_parser() -> argparse.ArgumentParser:
522509
action="store_true",
523510
)
524511

525-
parser.add_argument(
526-
"--tool-help", action="store_true", help="Print command line help for tool"
527-
)
512+
parser.add_argument("--tool-help", action="store_true", help="Print command line help for tool")
528513

529514
parser.add_argument(
530515
"--relative-deps",
@@ -537,8 +522,7 @@ def arg_parser() -> argparse.ArgumentParser:
537522
parser.add_argument(
538523
"--enable-dev",
539524
action="store_true",
540-
help="Enable loading and running unofficial development versions of "
541-
"the CWL standards.",
525+
help="Enable loading and running unofficial development versions of " "the CWL standards.",
542526
default=False,
543527
)
544528

@@ -647,8 +631,7 @@ def arg_parser() -> argparse.ArgumentParser:
647631
"--relax-path-checks",
648632
action="store_true",
649633
default=False,
650-
help="Relax requirements on path names to permit "
651-
"spaces and hash characters.",
634+
help="Relax requirements on path names to permit " "spaces and hash characters.",
652635
dest="relax_path_checks",
653636
)
654637

@@ -933,9 +916,7 @@ def add_argument(
933916
fieldtype,
934917
records,
935918
fielddescription,
936-
default=default.get(shortname(field["name"]), None)
937-
if default
938-
else None,
919+
default=default.get(shortname(field["name"]), None) if default else None,
939920
input_required=required,
940921
)
941922
return

cwltool/builder.py

Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,7 @@ def bind_input(
191191
bindings: List[MutableMapping[str, Union[str, List[int]]]] = []
192192
binding: Union[MutableMapping[str, Union[str, List[int]]], CommentedMap] = {}
193193
value_from_expression = False
194-
if "inputBinding" in schema and isinstance(
195-
schema["inputBinding"], MutableMapping
196-
):
194+
if "inputBinding" in schema and isinstance(schema["inputBinding"], MutableMapping):
197195
binding = CommentedMap(schema["inputBinding"].items())
198196

199197
bp = list(aslist(lead_pos))
@@ -303,8 +301,7 @@ def bind_input(
303301
else:
304302
schema["type"] = "record"
305303
schema["fields"] = [
306-
{"name": field_name, "type": "Any"}
307-
for field_name in datum.keys()
304+
{"name": field_name, "type": "Any"} for field_name in datum.keys()
308305
]
309306
elif isinstance(datum, list):
310307
schema["type"] = "array"
@@ -378,14 +375,10 @@ def _capture_files(f: CWLObjectType) -> CWLObjectType:
378375
debug,
379376
):
380377
try:
381-
with self.fs_access.open(
382-
cast(str, datum["location"]), "rb"
383-
) as f2:
378+
with self.fs_access.open(cast(str, datum["location"]), "rb") as f2:
384379
datum["contents"] = content_limit_respected_read(f2)
385380
except Exception as e:
386-
raise Exception(
387-
"Reading {}\n{}".format(datum["location"], e)
388-
) from e
381+
raise Exception("Reading {}\n{}".format(datum["location"], e)) from e
389382

390383
if "secondaryFiles" in schema:
391384
if "secondaryFiles" not in datum:
@@ -398,13 +391,8 @@ def _capture_files(f: CWLObjectType) -> CWLObjectType:
398391

399392
for num, sf_entry in enumerate(sf_schema):
400393
if "required" in sf_entry and sf_entry["required"] is not None:
401-
required_result = self.do_eval(
402-
sf_entry["required"], context=datum
403-
)
404-
if not (
405-
isinstance(required_result, bool)
406-
or required_result is None
407-
):
394+
required_result = self.do_eval(sf_entry["required"], context=datum)
395+
if not (isinstance(required_result, bool) or required_result is None):
408396
if sf_schema == schema["secondaryFiles"]:
409397
sf_item: Any = sf_schema[num]
410398
else:
@@ -425,9 +413,7 @@ def _capture_files(f: CWLObjectType) -> CWLObjectType:
425413
if "$(" in sf_entry["pattern"] or "${" in sf_entry["pattern"]:
426414
sfpath = self.do_eval(sf_entry["pattern"], context=datum)
427415
else:
428-
sfpath = substitute(
429-
cast(str, datum["basename"]), sf_entry["pattern"]
430-
)
416+
sfpath = substitute(cast(str, datum["basename"]), sf_entry["pattern"])
431417

432418
for sfname in aslist(sfpath):
433419
if not sfname:
@@ -438,8 +424,7 @@ def _capture_files(f: CWLObjectType) -> CWLObjectType:
438424
d_location = cast(str, datum["location"])
439425
if "/" in d_location:
440426
sf_location = (
441-
d_location[0 : d_location.rindex("/") + 1]
442-
+ sfname
427+
d_location[0 : d_location.rindex("/") + 1] + sfname
443428
)
444429
else:
445430
sf_location = d_location + sfname
@@ -462,9 +447,7 @@ def _capture_files(f: CWLObjectType) -> CWLObjectType:
462447
datum["secondaryFiles"],
463448
):
464449
if not d.get("basename"):
465-
d["basename"] = d["location"][
466-
d["location"].rindex("/") + 1 :
467-
]
450+
d["basename"] = d["location"][d["location"].rindex("/") + 1 :]
468451
if d["basename"] == sfbasename:
469452
found = True
470453

@@ -488,9 +471,7 @@ def addsf(
488471
),
489472
sfname,
490473
)
491-
elif discover_secondaryFiles and self.fs_access.exists(
492-
sf_location
493-
):
474+
elif discover_secondaryFiles and self.fs_access.exists(sf_location):
494475
addsf(
495476
cast(
496477
MutableSequence[CWLObjectType],
@@ -550,9 +531,7 @@ def addsf(
550531
).makeError(message)
551532
evaluated_format = cast(List[str], eval_format)
552533
else:
553-
raise SourceLine(
554-
schema, "format", WorkflowException, debug
555-
).makeError(
534+
raise SourceLine(schema, "format", WorkflowException, debug).makeError(
556535
"An expression in the 'format' field must "
557536
"evaluate to a string, or list of strings. "
558537
"However the type of the expression result was "
@@ -642,9 +621,7 @@ def generate_arg(self, binding: CWLObjectType) -> List[str]:
642621
WorkflowException,
643622
debug,
644623
):
645-
raise WorkflowException(
646-
"'separate' option can not be specified without prefix"
647-
)
624+
raise WorkflowException("'separate' option can not be specified without prefix")
648625

649626
argl: MutableSequence[CWLOutputType] = []
650627
if isinstance(value, MutableSequence):
@@ -653,9 +630,7 @@ def generate_arg(self, binding: CWLObjectType) -> List[str]:
653630
argl = [itemSeparator.join([self.tostr(v) for v in value])]
654631
elif binding.get("valueFrom"):
655632
value = [self.tostr(v) for v in value]
656-
return cast(List[str], ([prefix] if prefix else [])) + cast(
657-
List[str], value
658-
)
633+
return cast(List[str], ([prefix] if prefix else [])) + cast(List[str], value)
659634
elif prefix and value:
660635
return [prefix]
661636
else:

0 commit comments

Comments
 (0)