Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 8255967

Browse files
zaniebdesertaxle
andauthored
Upgrade pre-commit tooling (#247)
Co-authored-by: Alexander Streed <[email protected]>
1 parent 2960762 commit 8255967

10 files changed

+48
-62
lines changed

Diff for: .pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ repos:
55
- id: isort
66
language_version: python3
77
- repo: https://github.com/psf/black
8-
rev: 22.3.0
8+
rev: 23.3.0
99
hooks:
1010
- id: black
1111
language_version: python3
1212
args: [
1313
'--preview'
1414
]
1515
- repo: https://github.com/pycqa/flake8
16-
rev: 4.0.1
16+
rev: 6.0.0
1717
hooks:
1818
- id: flake8
1919
- repo: https://github.com/econchick/interrogate
@@ -23,7 +23,7 @@ repos:
2323
args: [-vv]
2424
pass_filenames: false
2525
- repo: https://github.com/fsouza/autoflake8
26-
rev: v0.3.2
26+
rev: v0.4.0
2727
hooks:
2828
- id: autoflake8
2929
language_version: python3

Diff for: docs/gen_blocks_catalog.py

+4-12
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ def insert_blocks_catalog(generated_file):
3535
module_blocks = find_module_blocks()
3636
if len(module_blocks) == 0:
3737
return
38-
generated_file.write(
39-
dedent(
40-
f"""
38+
generated_file.write(dedent(f"""
4139
Below is a list of Blocks available for registration in
4240
`prefect-aws`.
4341
@@ -49,9 +47,7 @@ def insert_blocks_catalog(generated_file):
4947
```bash
5048
prefect block register -m {COLLECTION_SLUG}
5149
```
52-
""" # noqa
53-
)
54-
)
50+
""")) # noqa
5551
generated_file.write(
5652
"Note, to use the `load` method on Blocks, you must already have a block document " # noqa
5753
"[saved through code](https://docs.prefect.io/concepts/blocks/#saving-blocks) " # noqa
@@ -74,9 +70,7 @@ def insert_blocks_catalog(generated_file):
7470
generated_file.write(
7571
f"[{block_name}][{module_path}.{block_name}]\n\n{block_description}\n\n"
7672
)
77-
generated_file.write(
78-
dedent(
79-
f"""
73+
generated_file.write(dedent(f"""
8074
To load the {block_name}:
8175
```python
8276
from prefect import flow
@@ -88,9 +82,7 @@ def my_flow():
8882
8983
my_flow()
9084
```
91-
"""
92-
)
93-
)
85+
"""))
9486
generated_file.write(
9587
f"For additional examples, check out the [{module_title} Module]"
9688
f"(../examples_catalog/#{module_nesting[-1]}-module) "

Diff for: docs/gen_examples_catalog.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,11 @@ def get_code_examples(obj: Union[ModuleType, Callable]) -> Set[str]:
9999

100100
examples_catalog_path = Path("examples_catalog.md")
101101
with mkdocs_gen_files.open(examples_catalog_path, "w") as generated_file:
102-
generated_file.write(
103-
dedent(
104-
"""
102+
generated_file.write(dedent("""
105103
# Examples Catalog
106104
107105
Below is a list of examples for `prefect-aws`.
108-
"""
109-
)
110-
)
106+
"""))
111107
for module_name, code_examples in code_examples_grouping.items():
112108
if len(code_examples) == 0:
113109
continue

Diff for: prefect_aws/client_parameters.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ def deprecated_verify_cert_path(cls, values: Dict[str, Any]) -> Dict[str, Any]:
8585
# so the UI looks nicer
8686
if verify is not None and not isinstance(verify, bool):
8787
warnings.warn(
88-
"verify should be a boolean. "
89-
"If you want to use a CA cert bundle, use verify_cert_path instead.",
88+
(
89+
"verify should be a boolean. "
90+
"If you want to use a CA cert bundle, use verify_cert_path instead."
91+
),
9092
DeprecationWarning,
9193
)
9294
return values

Diff for: prefect_aws/ecs.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -392,15 +392,15 @@ class ECSTask(Infrastructure):
392392
)
393393

394394
# Task run settings
395-
launch_type: Optional[
396-
Literal["FARGATE", "EC2", "EXTERNAL", "FARGATE_SPOT"]
397-
] = Field(
398-
default="FARGATE",
399-
description=(
400-
"The type of ECS task run infrastructure that should be used. Note that"
401-
" 'FARGATE_SPOT' is not a formal ECS launch type, but we will configure"
402-
" the proper capacity provider stategy if set here."
403-
),
395+
launch_type: Optional[Literal["FARGATE", "EC2", "EXTERNAL", "FARGATE_SPOT"]] = (
396+
Field(
397+
default="FARGATE",
398+
description=(
399+
"The type of ECS task run infrastructure that should be used. Note that"
400+
" 'FARGATE_SPOT' is not a formal ECS launch type, but we will configure"
401+
" the proper capacity provider stategy if set here."
402+
),
403+
)
404404
)
405405
vpc_id: Optional[str] = Field(
406406
title="VPC ID",
@@ -1182,8 +1182,10 @@ def _stream_available_logs(
11821182
response = logs_client.get_log_events(**request)
11831183
except Exception:
11841184
self.logger.error(
1185-
f"{self._log_prefix}: Failed to read log events with request "
1186-
f"{request}",
1185+
(
1186+
f"{self._log_prefix}: Failed to read log events with request "
1187+
f"{request}"
1188+
),
11871189
exc_info=True,
11881190
)
11891191
return last_log_timestamp

Diff for: prefect_aws/secrets_manager.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,9 @@ def example_delete_secret_with_recovery_window():
332332

333333
delete_secret_kwargs: Dict[str, Union[str, int, bool]] = dict(SecretId=secret_name)
334334
if force_delete_without_recovery:
335-
delete_secret_kwargs[
336-
"ForceDeleteWithoutRecovery"
337-
] = force_delete_without_recovery
335+
delete_secret_kwargs["ForceDeleteWithoutRecovery"] = (
336+
force_delete_without_recovery
337+
)
338338
else:
339339
delete_secret_kwargs["RecoveryWindowInDays"] = recovery_window_in_days
340340

Diff for: prefect_aws/workers/ecs_worker.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -361,15 +361,15 @@ class ECSVariables(BaseVariables):
361361
"field will be slugified to match AWS character requirements."
362362
),
363363
)
364-
launch_type: Optional[
365-
Literal["FARGATE", "EC2", "EXTERNAL", "FARGATE_SPOT"]
366-
] = Field(
367-
default=ECS_DEFAULT_LAUNCH_TYPE,
368-
description=(
369-
"The type of ECS task run infrastructure that should be used. Note that"
370-
" 'FARGATE_SPOT' is not a formal ECS launch type, but we will configure"
371-
" the proper capacity provider stategy if set here."
372-
),
364+
launch_type: Optional[Literal["FARGATE", "EC2", "EXTERNAL", "FARGATE_SPOT"]] = (
365+
Field(
366+
default=ECS_DEFAULT_LAUNCH_TYPE,
367+
description=(
368+
"The type of ECS task run infrastructure that should be used. Note that"
369+
" 'FARGATE_SPOT' is not a formal ECS launch type, but we will configure"
370+
" the proper capacity provider stategy if set here."
371+
),
372+
)
373373
)
374374
image: Optional[str] = Field(
375375
default=None,

Diff for: tests/projects/test_steps.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@ def tmp_files(tmp_path: Path):
2727
"testdir2/testfile5.txt",
2828
]
2929

30-
(tmp_path / ".prefectignore").write_text(
31-
"""
30+
(tmp_path / ".prefectignore").write_text("""
3231
testdir1/*
3332
.prefectignore
34-
"""
35-
)
33+
""")
3634

3735
for file in files:
3836
filepath = tmp_path / file
@@ -206,14 +204,12 @@ def test_prefectignore_with_comments_and_empty_lines(
206204
folder = "my-project"
207205

208206
# Update the .prefectignore file with comments and empty lines
209-
(tmp_files / ".prefectignore").write_text(
210-
"""
207+
(tmp_files / ".prefectignore").write_text("""
211208
# This is a comment
212209
testdir1/*
213210
214211
.prefectignore
215-
"""
216-
)
212+
""")
217213

218214
os.chdir(tmp_files)
219215

Diff for: tests/test_ecs.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1506,12 +1506,10 @@ async def test_task_definition_arn_with_overrides_requiring_copy_shows_diff(
15061506

15071507
assert "Enable DEBUG level logs to see the difference." not in caplog.text
15081508

1509-
expected_diff = textwrap.dedent(
1510-
"""
1509+
expected_diff = textwrap.dedent("""
15111510
- 'image': 'prefecthq/prefect:2.1.0-python3.8',
15121511
+ 'image': 'foobar',
1513-
"""
1514-
)
1512+
""")
15151513
assert expected_diff in caplog.text
15161514

15171515

@@ -1549,7 +1547,9 @@ async def test_task_definition_arn_with_overrides_that_do_not_require_copy(
15491547
create_test_ecs_cluster(ecs_client, overrides["cluster"])
15501548
add_ec2_instance_to_ecs_cluster(session, overrides["cluster"])
15511549

1552-
task_definition_arn = ecs_client.register_task_definition(**BASE_TASK_DEFINITION,)[
1550+
task_definition_arn = ecs_client.register_task_definition(
1551+
**BASE_TASK_DEFINITION,
1552+
)[
15531553
"taskDefinition"
15541554
]["taskDefinitionArn"]
15551555

Diff for: versioneer.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,7 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=
421421
return stdout, process.returncode
422422

423423

424-
LONG_VERSION_PY[
425-
"git"
426-
] = r'''
424+
LONG_VERSION_PY["git"] = r'''
427425
# This file helps to compute a version number in source trees obtained from
428426
# git-archive tarball (such as those provided by githubs download-from-tag
429427
# feature). Distribution tarballs (built by setup.py sdist) and build

0 commit comments

Comments
 (0)