Skip to content

Commit 5883eb6

Browse files
authored
chore: update ruff version (#4138)
1 parent 73480ba commit 5883eb6

9 files changed

Lines changed: 20 additions & 22 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ dev = [
8383
"pytest-xdist",
8484
"pytz",
8585
"redshift_connector",
86-
"ruff~=0.7.0",
86+
"ruff~=0.11.0",
8787
"snowflake-connector-python[pandas,secure-local-storage]>=3.0.2",
8888
"sqlalchemy-stubs",
8989
"trino",

sqlmesh/core/config/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def init(cursor: duckdb.DuckDBPyConnection) -> None:
279279
'database with name "memory" already exists' in str(e)
280280
and path_options == ":memory:"
281281
)
282-
and f"""database with name "{path_options.path.replace('md:', '')}" already exists"""
282+
and f"""database with name "{path_options.path.replace("md:", "")}" already exists"""
283283
not in str(e)
284284
):
285285
raise e

sqlmesh/core/console.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def _limit_model_names(self, tree: Tree, verbosity: Verbosity = Verbosity.DEFAUL
395395
):
396396
tree.children = [
397397
tree.children[0],
398-
Tree(f".... {modified_length-2} more ...."),
398+
Tree(f".... {modified_length - 2} more ...."),
399399
tree.children[-1],
400400
]
401401
return tree
@@ -1985,9 +1985,9 @@ def _get_snapshot_change_category(
19851985
snapshot, plan_builder.environment_naming_info, default_catalog
19861986
)
19871987
response = self._prompt(
1988-
"\n".join([f"[{i+1}] {choice}" for i, choice in enumerate(choices.values())]),
1988+
"\n".join([f"[{i + 1}] {choice}" for i, choice in enumerate(choices.values())]),
19891989
show_choices=False,
1990-
choices=[f"{i+1}" for i in range(len(choices))],
1990+
choices=[f"{i + 1}" for i in range(len(choices))],
19911991
)
19921992
choice = list(choices)[int(response) - 1]
19931993
plan_builder.set_choice(snapshot, choice)
@@ -2476,7 +2476,7 @@ def show_model_difference_summary(
24762476
and list_length > self.INDIRECTLY_MODIFIED_DISPLAY_THRESHOLD
24772477
):
24782478
self._print(added_models[0])
2479-
self._print(f"- `.... {list_length-2} more ....`\n")
2479+
self._print(f"- `.... {list_length - 2} more ....`\n")
24802480
self._print(added_models[-1])
24812481
else:
24822482
for snapshot in added_models:
@@ -2503,7 +2503,7 @@ def show_model_difference_summary(
25032503
and list_length > self.INDIRECTLY_MODIFIED_DISPLAY_THRESHOLD
25042504
):
25052505
self._print(removed_models[0])
2506-
self._print(f"- `.... {list_length-2} more ....`\n")
2506+
self._print(f"- `.... {list_length - 2} more ....`\n")
25072507
self._print(removed_models[-1])
25082508
else:
25092509
for snapshot_table_info in removed_models:
@@ -2551,7 +2551,7 @@ def show_model_difference_summary(
25512551
):
25522552
self._print(
25532553
f"- `{indirectly_modified[0].display_name(environment_naming_info, default_catalog if self.verbosity < Verbosity.VERY_VERBOSE else None, dialect=self.dialect)}`\n"
2554-
f"- `.... {modified_length-2} more ....`\n"
2554+
f"- `.... {modified_length - 2} more ....`\n"
25552555
f"- `{indirectly_modified[-1].display_name(environment_naming_info, default_catalog if self.verbosity < Verbosity.VERY_VERBOSE else None, dialect=self.dialect)}`"
25562556
)
25572557
else:
@@ -2597,7 +2597,7 @@ def _show_missing_dates(self, plan: Plan, default_catalog: t.Optional[str]) -> N
25972597
and length > self.INDIRECTLY_MODIFIED_DISPLAY_THRESHOLD
25982598
):
25992599
self._print(snapshots[0])
2600-
self._print(f"- `.... {length-2} more ....`\n")
2600+
self._print(f"- `.... {length - 2} more ....`\n")
26012601
self._print(snapshots[-1])
26022602
else:
26032603
for snap in snapshots:

sqlmesh/core/test/result.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ def log_test_report(self, test_duration: float) -> None:
112112
# Output final report
113113
stream.writeln(unittest.TextTestResult.separator2)
114114
stream.writeln(
115-
f'Ran {tests_run} {"tests" if tests_run > 1 else "test"} in {test_duration:.3f}s \n'
115+
f"Ran {tests_run} {'tests' if tests_run > 1 else 'test'} in {test_duration:.3f}s \n"
116116
)
117117
stream.writeln(
118-
f'{"OK" if is_success else "FAILED"}{" (" + ", ".join(infos) + ")" if infos else ""}'
118+
f"{'OK' if is_success else 'FAILED'}{' (' + ', '.join(infos) + ')' if infos else ''}"
119119
)

sqlmesh/utils/metaprogramming.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ def format_evaluated_code_exception(
544544

545545
error_match = re.search("^.*?Error: ", error_line)
546546
if error_match:
547-
tb.append(f"{indent*2} {error_line}")
547+
tb.append(f"{indent * 2} {error_line}")
548548
continue
549549

550550
eval_code_match = re.search('File "<string>", line (.*), in (.*)', error_line)

tests/core/engine_adapter/integration/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def get_table_comment(
290290
WHERE
291291
n.nspname = '{schema_name}'
292292
AND pgc.relname = '{table_name}'
293-
AND pgc.relkind = '{'v' if table_kind == "VIEW" else 'r'}'
293+
AND pgc.relkind = '{"v" if table_kind == "VIEW" else "r"}'
294294
;
295295
"""
296296
elif self.dialect in ["mysql", "snowflake"]:
@@ -362,7 +362,7 @@ def get_table_comment(
362362
WHERE
363363
c.relname = '{table_name}'
364364
AND n.nspname= '{schema_name}'
365-
AND c.relkind = '{'v' if table_kind == "VIEW" else 'r'}'
365+
AND c.relkind = '{"v" if table_kind == "VIEW" else "r"}'
366366
;
367367
"""
368368

@@ -405,7 +405,7 @@ def get_column_comments(
405405
WHERE
406406
n.nspname = '{schema_name}'
407407
AND pgc.relname = '{table_name}'
408-
AND pgc.relkind = '{'v' if table_kind == "VIEW" else 'r'}'
408+
AND pgc.relkind = '{"v" if table_kind == "VIEW" else "r"}'
409409
;
410410
"""
411411
elif self.dialect in ["mysql", "snowflake", "trino"]:
@@ -471,7 +471,7 @@ def get_column_comments(
471471
WHERE
472472
n.nspname = '{schema_name}'
473473
AND c.relname = '{table_name}'
474-
AND c.relkind = '{'v' if table_kind == "VIEW" else 'r'}'
474+
AND c.relkind = '{"v" if table_kind == "VIEW" else "r"}'
475475
;
476476
"""
477477

tests/dbt/test_transformation.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -881,9 +881,7 @@ def test_modules(sushi_test_project: Project):
881881
assert context.render("{{ modules.re.search('(?<=abc)def', 'abcdef').group(0) }}") == "def"
882882

883883
# itertools
884-
itertools_jinja = (
885-
"{% for num in modules.itertools.accumulate([5]) %}" "{{ num }}" "{% endfor %}"
886-
)
884+
itertools_jinja = "{% for num in modules.itertools.accumulate([5]) %}{{ num }}{% endfor %}"
887885
assert context.render(itertools_jinja) == "5"
888886

889887

@@ -920,7 +918,7 @@ def test_column(sushi_test_project: Project):
920918
assert context.render("{{ api.Column }}") == "<class 'dbt.adapters.base.column.Column'>"
921919

922920
jinja = (
923-
"{% set col = api.Column('foo', 'integer') %}" "{{ col.is_integer() }} {{ col.is_string()}}"
921+
"{% set col = api.Column('foo', 'integer') %}{{ col.is_integer() }} {{ col.is_string()}}"
924922
)
925923

926924
assert context.render(jinja) == "True False"

tests/schedulers/airflow/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def test_apply_plan(mocker: MockerFixture, snapshot: Snapshot):
107107
"clustered_by": [],
108108
"cron": "@daily",
109109
"dialect": "spark",
110-
"pre_statements": ["@DEF(key, " "'value')"],
110+
"pre_statements": ["@DEF(key, 'value')"],
111111
"kind": {
112112
"name": "INCREMENTAL_BY_TIME_RANGE",
113113
"time_column": {"column": "`ds`"},

tests/utils/test_dag.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def test_sorted_with_cycles():
8282

8383
expected_error_message = (
8484
"Last nodes added to the DAG: c\n"
85-
"Possible candidates to check for circular references: b, d"
85+
+ "Possible candidates to check for circular references: b, d"
8686
)
8787

8888
assert expected_error_message in str(ex.value)

0 commit comments

Comments
 (0)