Skip to content

Commit e3f0704

Browse files
authored
Merge pull request #277 from common-workflow-language/dependabot/pip/black-approx-eq-24.1
Update black requirement from ~=23.12 to ~=24.1
2 parents b3f0a82 + c95e06a commit e3f0704

21 files changed

+158
-124
lines changed

.flake8

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
[flake8]
2-
ignore = E203,W503
32
max-line-length = 100
43
select = B,C,E,F,W,T4
54
exclude = cwltool/schemas
6-
extend-ignore = E501,B905
5+
extend-ignore = E203,E501,E704,B905,W503
76
# when Python 3.10 is the minimum version, re-enable check B905 for zip + strict
87
extend-select = B9

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
# black + isort
22
69e709fde4a3afada10d441cb9e0a85f8a95a3d4
3+
4+
# black 2024
5+
af096c2301d5ae81daa41bf0b96417cebda76d05

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ EXTRAS=
2929
PYSOURCES=$(filter-out $(MODULE)/parser/cwl_v%,$(shell find $(MODULE) -name "*.py")) \
3030
$(wildcard tests/*.py) create_cwl_from_objects.py load_cwl_by_path.py \
3131
${MODULE}/parser/cwl_v1_?_utils.py docs/conf.py
32-
DEVPKGS=build diff_cover pylint pep257 pydocstyle flake8 'tox<4' tox-pyenv \
33-
isort wheel autoflake pyupgrade bandit auto-walrus \
32+
DEVPKGS=build diff_cover pylint pep257 pydocstyle 'tox<4' tox-pyenv \
33+
wheel autoflake pyupgrade bandit auto-walrus \
3434
-rlint-requirements.txt -rtest-requirements.txt -rmypy-requirements.txt
3535
DEBDEVPKGS=pep8 python-autopep8 pylint python-coverage pydocstyle sloccount \
3636
python-flake8 python-mock shellcheck

cwl_utils/cwl_v1_0_expression_refactor.py

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -355,21 +355,27 @@ def generate_etool_from_expr(
355355
cwl.InputParameter(
356356
id="self",
357357
label=self_type.label if not isinstance(self_type, list) else None,
358-
secondaryFiles=self_type.secondaryFiles
359-
if not isinstance(self_type, list)
360-
else None,
361-
streamable=self_type.streamable
362-
if not isinstance(self_type, list)
363-
else None,
358+
secondaryFiles=(
359+
self_type.secondaryFiles
360+
if not isinstance(self_type, list)
361+
else None
362+
),
363+
streamable=(
364+
self_type.streamable if not isinstance(self_type, list) else None
365+
),
364366
doc=self_type.doc if not isinstance(self_type, list) else None,
365367
format=self_type.format if not isinstance(self_type, list) else None,
366368
type_=new_type,
367-
extension_fields=self_type.extension_fields
368-
if not isinstance(self_type, list)
369-
else None,
370-
loadingOptions=self_type.loadingOptions
371-
if not isinstance(self_type, list)
372-
else None,
369+
extension_fields=(
370+
self_type.extension_fields
371+
if not isinstance(self_type, list)
372+
else None
373+
),
374+
loadingOptions=(
375+
self_type.loadingOptions
376+
if not isinstance(self_type, list)
377+
else None
378+
),
373379
)
374380
)
375381
outputs = yaml.comments.CommentedSeq()
@@ -818,10 +824,10 @@ def process_workflow_reqs_and_hints(
818824
None,
819825
replace_etool,
820826
)
821-
iwdr.listing[
822-
index
823-
] = "$(inputs._iwdr_listing_{}".format(
824-
index
827+
iwdr.listing[index] = (
828+
"$(inputs._iwdr_listing_{}".format(
829+
index
830+
)
825831
)
826832
generated_iwdr_reqs.append(
827833
(etool_id, index)
@@ -859,9 +865,9 @@ def process_workflow_reqs_and_hints(
859865
None,
860866
replace_etool,
861867
)
862-
iwdr.listing[
863-
index
864-
] = f"$(inputs._iwdr_listing_{index}"
868+
iwdr.listing[index] = (
869+
f"$(inputs._iwdr_listing_{index}"
870+
)
865871
generated_iwdr_reqs.append((etool_id, index))
866872

867873
elif entry.entryname:
@@ -885,9 +891,9 @@ def process_workflow_reqs_and_hints(
885891
None,
886892
replace_etool,
887893
)
888-
iwdr.listing[
889-
index
890-
] = f"$(inputs._iwdr_listing_{index}"
894+
iwdr.listing[index] = (
895+
f"$(inputs._iwdr_listing_{index}"
896+
)
891897
generated_iwdr_reqs.append((etool_id, index))
892898
if generated_iwdr_reqs:
893899
prop_reqs += (cwl.InitialWorkDirRequirement,)
@@ -1413,9 +1419,9 @@ def traverse_CommandLineTool(
14131419
inp.linkMerge = None
14141420
if replace_etool:
14151421
processes = [parent]
1416-
final_etool: Union[
1417-
cwl.CommandLineTool, cwl.ExpressionTool
1418-
] = etool_to_cltool(etool, find_expressionLib(processes))
1422+
final_etool: Union[cwl.CommandLineTool, cwl.ExpressionTool] = (
1423+
etool_to_cltool(etool, find_expressionLib(processes))
1424+
)
14191425
else:
14201426
final_etool = etool
14211427
etool_step = cwl.WorkflowStep(

cwl_utils/cwl_v1_1_expression_refactor.py

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -353,21 +353,27 @@ def generate_etool_from_expr(
353353
cwl.WorkflowInputParameter(
354354
id="self",
355355
label=self_type.label if not isinstance(self_type, list) else None,
356-
secondaryFiles=self_type.secondaryFiles
357-
if not isinstance(self_type, list)
358-
else None,
359-
streamable=self_type.streamable
360-
if not isinstance(self_type, list)
361-
else None,
356+
secondaryFiles=(
357+
self_type.secondaryFiles
358+
if not isinstance(self_type, list)
359+
else None
360+
),
361+
streamable=(
362+
self_type.streamable if not isinstance(self_type, list) else None
363+
),
362364
doc=self_type.doc if not isinstance(self_type, list) else None,
363365
format=self_type.format if not isinstance(self_type, list) else None,
364366
type_=new_type,
365-
extension_fields=self_type.extension_fields
366-
if not isinstance(self_type, list)
367-
else None,
368-
loadingOptions=self_type.loadingOptions
369-
if not isinstance(self_type, list)
370-
else None,
367+
extension_fields=(
368+
self_type.extension_fields
369+
if not isinstance(self_type, list)
370+
else None
371+
),
372+
loadingOptions=(
373+
self_type.loadingOptions
374+
if not isinstance(self_type, list)
375+
else None
376+
),
371377
)
372378
)
373379
outputs = yaml.comments.CommentedSeq()
@@ -818,10 +824,10 @@ def process_workflow_reqs_and_hints(
818824
None,
819825
replace_etool,
820826
)
821-
iwdr.listing[
822-
index
823-
] = "$(inputs._iwdr_listing_{}".format(
824-
index
827+
iwdr.listing[index] = (
828+
"$(inputs._iwdr_listing_{}".format(
829+
index
830+
)
825831
)
826832
generated_iwdr_reqs.append(
827833
(etool_id, index)
@@ -859,9 +865,9 @@ def process_workflow_reqs_and_hints(
859865
None,
860866
replace_etool,
861867
)
862-
iwdr.listing[
863-
index
864-
] = f"$(inputs._iwdr_listing_{index}"
868+
iwdr.listing[index] = (
869+
f"$(inputs._iwdr_listing_{index}"
870+
)
865871
generated_iwdr_reqs.append((etool_id, index))
866872

867873
elif entry.entryname:
@@ -885,9 +891,9 @@ def process_workflow_reqs_and_hints(
885891
None,
886892
replace_etool,
887893
)
888-
iwdr.listing[
889-
index
890-
] = f"$(inputs._iwdr_listing_{index}"
894+
iwdr.listing[index] = (
895+
f"$(inputs._iwdr_listing_{index}"
896+
)
891897
generated_iwdr_reqs.append((etool_id, index))
892898
if generated_iwdr_reqs:
893899
prop_reqs += (cwl.InitialWorkDirRequirement,)
@@ -1413,9 +1419,9 @@ def traverse_CommandLineTool(
14131419
inp.linkMerge = None
14141420
if replace_etool:
14151421
processes = [parent]
1416-
final_etool: Union[
1417-
cwl.CommandLineTool, cwl.ExpressionTool
1418-
] = etool_to_cltool(etool, find_expressionLib(processes))
1422+
final_etool: Union[cwl.CommandLineTool, cwl.ExpressionTool] = (
1423+
etool_to_cltool(etool, find_expressionLib(processes))
1424+
)
14191425
else:
14201426
final_etool = etool
14211427
etool_step = cwl.WorkflowStep(

cwl_utils/cwl_v1_2_expression_refactor.py

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -353,21 +353,27 @@ def generate_etool_from_expr(
353353
cwl.WorkflowInputParameter(
354354
id="self",
355355
label=self_type.label if not isinstance(self_type, list) else None,
356-
secondaryFiles=self_type.secondaryFiles
357-
if not isinstance(self_type, list)
358-
else None,
359-
streamable=self_type.streamable
360-
if not isinstance(self_type, list)
361-
else None,
356+
secondaryFiles=(
357+
self_type.secondaryFiles
358+
if not isinstance(self_type, list)
359+
else None
360+
),
361+
streamable=(
362+
self_type.streamable if not isinstance(self_type, list) else None
363+
),
362364
doc=self_type.doc if not isinstance(self_type, list) else None,
363365
format=self_type.format if not isinstance(self_type, list) else None,
364366
type_=new_type,
365-
extension_fields=self_type.extension_fields
366-
if not isinstance(self_type, list)
367-
else None,
368-
loadingOptions=self_type.loadingOptions
369-
if not isinstance(self_type, list)
370-
else None,
367+
extension_fields=(
368+
self_type.extension_fields
369+
if not isinstance(self_type, list)
370+
else None
371+
),
372+
loadingOptions=(
373+
self_type.loadingOptions
374+
if not isinstance(self_type, list)
375+
else None
376+
),
371377
)
372378
)
373379
outputs = yaml.comments.CommentedSeq()
@@ -913,10 +919,10 @@ def process_workflow_reqs_and_hints(
913919
None,
914920
replace_etool,
915921
)
916-
iwdr.listing[
917-
index
918-
] = "$(inputs._iwdr_listing_{}".format(
919-
index
922+
iwdr.listing[index] = (
923+
"$(inputs._iwdr_listing_{}".format(
924+
index
925+
)
920926
)
921927
generated_iwdr_reqs.append(
922928
(etool_id, index)
@@ -954,9 +960,9 @@ def process_workflow_reqs_and_hints(
954960
None,
955961
replace_etool,
956962
)
957-
iwdr.listing[
958-
index
959-
] = f"$(inputs._iwdr_listing_{index}"
963+
iwdr.listing[index] = (
964+
f"$(inputs._iwdr_listing_{index}"
965+
)
960966
generated_iwdr_reqs.append((etool_id, index))
961967

962968
elif entry.entryname:
@@ -980,9 +986,9 @@ def process_workflow_reqs_and_hints(
980986
None,
981987
replace_etool,
982988
)
983-
iwdr.listing[
984-
index
985-
] = f"$(inputs._iwdr_listing_{index}"
989+
iwdr.listing[index] = (
990+
f"$(inputs._iwdr_listing_{index}"
991+
)
986992
generated_iwdr_reqs.append((etool_id, index))
987993
if generated_iwdr_reqs:
988994
prop_reqs += (cwl.InitialWorkDirRequirement,)
@@ -1508,9 +1514,9 @@ def traverse_CommandLineTool(
15081514
inp.linkMerge = None
15091515
if replace_etool:
15101516
processes = [parent]
1511-
final_etool: Union[
1512-
cwl.CommandLineTool, cwl.ExpressionTool
1513-
] = etool_to_cltool(etool, find_expressionLib(processes))
1517+
final_etool: Union[cwl.CommandLineTool, cwl.ExpressionTool] = (
1518+
etool_to_cltool(etool, find_expressionLib(processes))
1519+
)
15141520
else:
15151521
final_etool = etool
15161522
etool_step = cwl.WorkflowStep(

cwl_utils/docker_extract.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,22 @@ def run(args: argparse.Namespace) -> List[cwl.DockerRequirement]:
6969
image_puller: ImagePuller = SingularityImagePuller(
7070
req.dockerPull,
7171
args.dir,
72-
args.container_engine
73-
if args.container_engine is not None
74-
else "singularity",
72+
(
73+
args.container_engine
74+
if args.container_engine is not None
75+
else "singularity"
76+
),
7577
args.force_download,
7678
)
7779
else:
7880
image_puller = DockerImagePuller(
7981
req.dockerPull,
8082
args.dir,
81-
args.container_engine
82-
if args.container_engine is not None
83-
else "docker",
83+
(
84+
args.container_engine
85+
if args.container_engine is not None
86+
else "docker"
87+
),
8488
args.force_download,
8589
)
8690
image_puller.save_docker_image()

cwl_utils/expression.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -319,17 +319,19 @@ def do_eval(
319319
fullJS=fullJS,
320320
jslib=jslib,
321321
strip_whitespace=strip_whitespace,
322-
escaping_behavior=1
323-
if cwlVersion
324-
in (
325-
"v1.0",
326-
"v1.1.0-dev1",
327-
"v1.1",
328-
"v1.2.0-dev1",
329-
"v1.2.0-dev2",
330-
"v1.2.0-dev3",
331-
)
332-
else 2,
322+
escaping_behavior=(
323+
1
324+
if cwlVersion
325+
in (
326+
"v1.0",
327+
"v1.1.0-dev1",
328+
"v1.1",
329+
"v1.2.0-dev1",
330+
"v1.2.0-dev2",
331+
"v1.2.0-dev3",
332+
)
333+
else 2
334+
),
333335
**kwargs,
334336
)
335337

cwl_utils/expression_refactor.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ def refactor(args: argparse.Namespace) -> int:
121121
uri = Path(document).resolve().as_uri()
122122
if version == "v1.0":
123123
top = cwl_v1_0.load_document_by_yaml(result, uri)
124-
traverse: Callable[
125-
[Any, bool, bool, bool, bool], Tuple[Any, bool]
126-
] = cwl_v1_0_expression_refactor.traverse
124+
traverse: Callable[[Any, bool, bool, bool, bool], Tuple[Any, bool]] = (
125+
cwl_v1_0_expression_refactor.traverse
126+
)
127127
save: saveCWL = cwl_v1_0.save
128128
elif version == "v1.1":
129129
top = cwl_v1_1.load_document_by_yaml(result, uri)
@@ -152,9 +152,11 @@ def refactor(args: argparse.Namespace) -> int:
152152
if not isinstance(result, MutableSequence):
153153
result_json = save(
154154
result,
155-
base_url=result.loadingOptions.fileuri
156-
if result.loadingOptions.fileuri
157-
else "",
155+
base_url=(
156+
result.loadingOptions.fileuri
157+
if result.loadingOptions.fileuri
158+
else ""
159+
),
158160
)
159161
# ^^ Setting the base_url and keeping the default value
160162
# for relative_uris=True means that the IDs in the generated

0 commit comments

Comments
 (0)