Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 7a6380e

Browse files
authored
Reformat with ruff>=0.9 (#996)
1 parent 78ce991 commit 7a6380e

10 files changed

Lines changed: 23 additions & 24 deletions

File tree

database/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ def read_timeout(self):
8383

8484
def __set_name__(self, owner, name):
8585
# Validate that the owner class has the methods we need
86-
assert issubclass(
87-
owner, ArchiveFieldInterface
88-
), "Missing some required methods to use AchiveField"
86+
assert issubclass(owner, ArchiveFieldInterface), (
87+
"Missing some required methods to use AchiveField"
88+
)
8989
self.public_name = name
9090
self.db_field_name = "_" + name
9191
self.archive_field_name = "_" + name + "_storage_path"

services/ai_pr_review.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def preprocessed(self) -> str:
8989
[line_id] (where line_id is just a unique integer)
9090
"""
9191
return "\n".join(
92-
[f"[{i+1}] {line}" for i, line in enumerate(self._diff.split("\n"))]
92+
[f"[{i + 1}] {line}" for i, line in enumerate(self._diff.split("\n"))]
9393
)
9494

9595
def line_info(self, line_id: int) -> LineInfo:

services/notification/notifiers/gitter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class GitterNotifier(RequestsYamlBasedNotifier):
1212
# TODO (Thiago): Fix base message
1313
BASE_MESSAGE = " ".join(
1414
[
15-
"Coverage " "{comparison_string}on `{head_branch}` is `{head_totals_c}%`",
15+
"Coverage {comparison_string}on `{head_branch}` is `{head_totals_c}%`",
1616
"via {head_url}",
1717
]
1818
)

services/notification/notifiers/mixins/message/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def create_message(
7979
self._possibly_write_install_app(comparison, write)
8080

8181
# Write Header
82-
write(f'## [Codecov]({links["pull"]}?dropdown=coverage&src=pr&el=h1) Report')
82+
write(f"## [Codecov]({links['pull']}?dropdown=coverage&src=pr&el=h1) Report")
8383

8484
repo = comparison.head.commit.repository
8585
owner: Owner = repo.owner

services/report/languages/bullseye.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def from_xml(xml: Element, report_builder_session: ReportBuilderSession) -> None
3535
element = file
3636
while element.getparent().tag == "{https://www.bullseye.com/covxml}folder":
3737
element = element.getparent()
38-
filepath = f'{element.attrib.get("name")}/{filepath}'
38+
filepath = f"{element.attrib.get('name')}/{filepath}"
3939
filepath += file.attrib.get("name")
4040

4141
_file = report_builder_session.create_coverage_file(filepath)

services/report/languages/cobertura.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ def from_xml(xml: Element, report_builder_session: ReportBuilderSession) -> None
6767
if not filename:
6868
continue
6969
_file = report_builder_session.create_coverage_file(filename, do_fix_path=False)
70-
assert (
71-
_file is not None
72-
), "`create_coverage_file` with pre-fixed path is infallible"
70+
assert _file is not None, (
71+
"`create_coverage_file` with pre-fixed path is infallible"
72+
)
7373

7474
for line in _class.iter("line"):
7575
_line = line.attrib

services/report/languages/jacoco.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ def try_to_fix_path(path: str) -> str | None:
101101
_file = report_builder_session.create_coverage_file(
102102
filename, do_fix_path=False
103103
)
104-
assert (
105-
_file is not None
106-
), "`create_coverage_file` with pre-fixed path is infallible"
104+
assert _file is not None, (
105+
"`create_coverage_file` with pre-fixed path is infallible"
106+
)
107107

108108
for line in source.iter("line"):
109109
attr = line.attrib

tasks/cache_test_rollups.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def run_impl_within_lock(self, repoid: int, branch: str):
165165
"interval_start": f"{interval_start} days",
166166
# SQL `BETWEEN` syntax is equivalent to `<= end`, with an inclusive end date,
167167
# thats why we do a `+1` here:
168-
"interval_end": f"{interval_end+1 if interval_end else 0} days",
168+
"interval_end": f"{interval_end + 1 if interval_end else 0} days",
169169
}
170170

171171
cursor.execute(ROLLUP_QUERY, query_params)

tasks/status_set_pending.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ def run_impl(
4242

4343
# check that repo is in beta
4444
redis_connection = get_redis_connection()
45-
assert redis_connection.sismember(
46-
"beta.pending", repoid
47-
), "Pending disabled. Please request to be in beta."
45+
assert redis_connection.sismember("beta.pending", repoid), (
46+
"Pending disabled. Please request to be in beta."
47+
)
4848

4949
commits = db_session.query(Commit).filter(
5050
Commit.repoid == repoid, Commit.commitid == commitid
@@ -69,17 +69,17 @@ def run_impl(
6969
context,
7070
("/" + key if key != "default" else ""),
7171
)
72-
assert match(
73-
config.get("branches"), branch or ""
74-
), "Ignore setting pending status on branch"
72+
assert match(config.get("branches"), branch or ""), (
73+
"Ignore setting pending status on branch"
74+
)
7575
assert (
7676
on_a_pull_request
7777
if config.get("only_pulls", False)
7878
else True
7979
), "Set pending only on pulls"
80-
assert config.get(
81-
"set_pending", True
82-
), "Pending status disabled in YAML"
80+
assert config.get("set_pending", True), (
81+
"Pending status disabled in YAML"
82+
)
8383
assert title not in statuses, "Pending status already set"
8484

8585
async_to_sync(repo_service.set_commit_status)(

tasks/tests/unit/test_sync_repos_task.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,6 @@ def repo_obj(service_id, name, language, private, branch, using_integration):
592592
assert user.permission == [] # there were no private repos
593593
for repo in repos:
594594
assert repo.using_integration is True
595-
ghapp.repository_service_ids = ["159089634" "164948070" "213786132" "555555555"]
596595

597596
@respx.mock
598597
@reuse_cassette(

0 commit comments

Comments
 (0)