Skip to content

Commit db84034

Browse files
authored
[ruff] 0.3.0 -> 0.3.4 (#20753)
## Summary & Motivation Internal companion PR: dagster-io/internal#8961 Bump ruff from 0.3.0 -> 0.3.4. The major change here is a more aggressive UP032, which automatically converts some str.format() calls to f-strings. ## How I Tested These Changes Existing test suite.
1 parent e4c2b64 commit db84034

File tree

62 files changed

+202
-472
lines changed

Some content is hidden

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

62 files changed

+202
-472
lines changed

.buildkite/dagster-buildkite/dagster_buildkite/steps/test_project.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,8 @@ def build_test_project_steps() -> List[GroupStep]:
6666
"docker push $${TEST_PROJECT_IMAGE}",
6767
)
6868
.on_python_image(
69-
"buildkite-build-test-project-image:py{python_version}-{image_version}".format(
70-
python_version=AvailablePythonVersion.V3_8, # py version can be bumped when rebuilt
71-
image_version=BUILDKITE_BUILD_TEST_PROJECT_IMAGE_IMAGE_VERSION,
72-
),
69+
# py version can be bumped when rebuilt
70+
f"buildkite-build-test-project-image:py{AvailablePythonVersion.V3_8}-{BUILDKITE_BUILD_TEST_PROJECT_IMAGE_IMAGE_VERSION}",
7371
[
7472
"AIRFLOW_HOME",
7573
"AWS_ACCOUNT_ID",

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/charliermarsh/ruff-pre-commit
3-
rev: v0.3.0
3+
rev: v0.3.4
44
hooks:
55
- id: ruff
66
args: [--fix, --exit-non-zero-on-fix]

examples/deploy_docker/tests/test_deploy_docker.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,7 @@ def test_deploy_docker():
169169
}
170170

171171
launch_res = requests.post(
172-
"http://{webserver_host}:3000/graphql?query={query_string}&variables={variables}".format(
173-
webserver_host=webserver_host,
174-
query_string=LAUNCH_PIPELINE_MUTATION,
175-
variables=json.dumps(variables),
176-
)
172+
f"http://{webserver_host}:3000/graphql?query={LAUNCH_PIPELINE_MUTATION}&variables={json.dumps(variables)}"
177173
).json()
178174

179175
assert launch_res["data"]["launchPipelineExecution"]["__typename"] == "LaunchRunSuccess"
@@ -198,11 +194,7 @@ def test_deploy_docker():
198194
}
199195

200196
launch_res = requests.post(
201-
"http://{webserver_host}:3000/graphql?query={query_string}&variables={variables}".format(
202-
webserver_host=webserver_host,
203-
query_string=LAUNCH_PIPELINE_MUTATION,
204-
variables=json.dumps(variables),
205-
)
197+
f"http://{webserver_host}:3000/graphql?query={LAUNCH_PIPELINE_MUTATION}&variables={json.dumps(variables)}"
206198
).json()
207199

208200
assert launch_res["data"]["launchPipelineExecution"]["__typename"] == "LaunchRunSuccess"
@@ -226,11 +218,7 @@ def test_deploy_docker():
226218
}
227219

228220
launch_res = requests.post(
229-
"http://{webserver_host}:3000/graphql?query={query_string}&variables={variables}".format(
230-
webserver_host=webserver_host,
231-
query_string=LAUNCH_PIPELINE_MUTATION,
232-
variables=json.dumps(variables),
233-
)
221+
f"http://{webserver_host}:3000/graphql?query={LAUNCH_PIPELINE_MUTATION}&variables={json.dumps(variables)}"
234222
).json()
235223

236224
assert launch_res["data"]["launchPipelineExecution"]["__typename"] == "LaunchRunSuccess"

examples/docs_snippets/docs_snippets/intro_tutorial/basics/testing/custom_types_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ def less_simple_data_frame_type_check(_, value):
2727
row = value[i]
2828
if not isinstance(row, dict):
2929
raise Failure(
30-
"LessSimpleDataFrame should be a list of dicts, got {type_} for row"
31-
" {idx}".format(type_=type(row), idx=(i + 1))
30+
f"LessSimpleDataFrame should be a list of dicts, got {type(row)} for row"
31+
f" {i + 1}"
3232
)
3333
row_fields = [field for field in row.keys()]
3434
if fields != row_fields:

integration_tests/python_modules/dagster-k8s-test-infra/dagster_k8s_test_infra/cluster.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def _cluster_provider(request):
6868
client = docker.from_env()
6969
client.images.get(docker_image)
7070
print(
71-
"Found existing image tagged {image}, skipping image build. To rebuild,"
72-
" first run: docker rmi {image}".format(image=docker_image)
71+
f"Found existing image tagged {docker_image}, skipping image build. To rebuild,"
72+
f" first run: docker rmi {docker_image}"
7373
)
7474
except docker.errors.ImageNotFound:
7575
build_and_tag_test_image(docker_image)

integration_tests/test_suites/celery-k8s-test-suite/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ def dagster_docker_image():
2727
client = docker.from_env()
2828
client.images.get(docker_image)
2929
print( # noqa: T201
30-
"Found existing image tagged {image}, skipping image build. To rebuild, first run: "
31-
"docker rmi {image}".format(image=docker_image)
30+
f"Found existing image tagged {docker_image}, skipping image build. To rebuild, first run: "
31+
f"docker rmi {docker_image}"
3232
)
3333
except docker.errors.ImageNotFound:
3434
build_and_tag_test_image(docker_image)

integration_tests/test_suites/k8s-test-suite/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ def dagster_docker_image() -> str:
5151
client = docker.from_env()
5252
client.images.get(docker_image)
5353
print( # noqa: T201
54-
"Found existing image tagged {image}, skipping image build. To rebuild, first run: "
55-
"docker rmi {image}".format(image=docker_image)
54+
f"Found existing image tagged {docker_image}, skipping image build. To rebuild, first run: "
55+
f"docker rmi {docker_image}"
5656
)
5757
except docker.errors.ImageNotFound:
5858
build_and_tag_test_image(docker_image)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ extend-exclude = [
110110
line-length = 100
111111

112112
# Fail if Ruff is not running this version.
113-
required-version = "0.3.0"
113+
required-version = "0.3.4"
114114

115115
[tool.ruff.lint]
116116

python_modules/dagster-graphql/dagster_graphql/implementation/execution/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,7 @@ def terminate_pipeline_execution(
132132
if not valid_status:
133133
return GrapheneTerminateRunFailure(
134134
run=graphene_run,
135-
message="Run {run_id} could not be terminated due to having status {status}.".format(
136-
run_id=run.run_id, status=run.status.value
137-
),
135+
message=f"Run {run.run_id} could not be terminated due to having status {run.status.value}.",
138136
)
139137

140138
if force_mark_as_canceled:

python_modules/dagster-graphql/dagster_graphql/implementation/execution/backfill.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,7 @@ def create_and_launch_partition_backfill(
134134

135135
if len(matches) != 1:
136136
raise DagsterInvariantViolationError(
137-
"Partition set names must be unique: found {num} matches for {partition_set_name}".format(
138-
num=len(matches), partition_set_name=partition_set_name
139-
)
137+
f"Partition set names must be unique: found {len(matches)} matches for {partition_set_name}"
140138
)
141139
external_partition_set = next(iter(matches))
142140

0 commit comments

Comments
 (0)