Skip to content

Commit

Permalink
Reformat with ruff>=0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Swatinem committed Jan 9, 2025
1 parent 9fdd3e4 commit 26dae42
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 24 deletions.
6 changes: 3 additions & 3 deletions database/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def read_timeout(self):

def __set_name__(self, owner, name):
# Validate that the owner class has the methods we need
assert issubclass(
owner, ArchiveFieldInterface
), "Missing some required methods to use AchiveField"
assert issubclass(owner, ArchiveFieldInterface), (
"Missing some required methods to use AchiveField"
)
self.public_name = name
self.db_field_name = "_" + name
self.archive_field_name = "_" + name + "_storage_path"
Expand Down
2 changes: 1 addition & 1 deletion services/ai_pr_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def preprocessed(self) -> str:
[line_id] (where line_id is just a unique integer)
"""
return "\n".join(
[f"[{i+1}] {line}" for i, line in enumerate(self._diff.split("\n"))]
[f"[{i + 1}] {line}" for i, line in enumerate(self._diff.split("\n"))]
)

def line_info(self, line_id: int) -> LineInfo:
Expand Down
2 changes: 1 addition & 1 deletion services/notification/notifiers/gitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class GitterNotifier(RequestsYamlBasedNotifier):
# TODO (Thiago): Fix base message
BASE_MESSAGE = " ".join(
[
"Coverage " "{comparison_string}on `{head_branch}` is `{head_totals_c}%`",
"Coverage {comparison_string}on `{head_branch}` is `{head_totals_c}%`",
"via {head_url}",
]
)
Expand Down
2 changes: 1 addition & 1 deletion services/notification/notifiers/mixins/message/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def create_message(
self._possibly_write_install_app(comparison, write)

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

repo = comparison.head.commit.repository
owner: Owner = repo.owner
Expand Down
2 changes: 1 addition & 1 deletion services/report/languages/bullseye.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def from_xml(xml: Element, report_builder_session: ReportBuilderSession) -> None
element = file
while element.getparent().tag == "{https://www.bullseye.com/covxml}folder":
element = element.getparent()
filepath = f'{element.attrib.get("name")}/{filepath}'
filepath = f"{element.attrib.get('name')}/{filepath}"
filepath += file.attrib.get("name")

_file = report_builder_session.create_coverage_file(filepath)
Expand Down
6 changes: 3 additions & 3 deletions services/report/languages/cobertura.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def from_xml(xml: Element, report_builder_session: ReportBuilderSession) -> None
if not filename:
continue
_file = report_builder_session.create_coverage_file(filename, do_fix_path=False)
assert (
_file is not None
), "`create_coverage_file` with pre-fixed path is infallible"
assert _file is not None, (
"`create_coverage_file` with pre-fixed path is infallible"
)

for line in _class.iter("line"):
_line = line.attrib
Expand Down
6 changes: 3 additions & 3 deletions services/report/languages/jacoco.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ def try_to_fix_path(path: str) -> str | None:
_file = report_builder_session.create_coverage_file(
filename, do_fix_path=False
)
assert (
_file is not None
), "`create_coverage_file` with pre-fixed path is infallible"
assert _file is not None, (
"`create_coverage_file` with pre-fixed path is infallible"
)

for line in source.iter("line"):
attr = line.attrib
Expand Down
2 changes: 1 addition & 1 deletion tasks/cache_test_rollups.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def run_impl_within_lock(self, repoid: int, branch: str):
"interval_start": f"{interval_start} days",
# SQL `BETWEEN` syntax is equivalent to `<= end`, with an inclusive end date,
# thats why we do a `+1` here:
"interval_end": f"{interval_end+1 if interval_end else 0} days",
"interval_end": f"{interval_end + 1 if interval_end else 0} days",
}

cursor.execute(ROLLUP_QUERY, query_params)
Expand Down
18 changes: 9 additions & 9 deletions tasks/status_set_pending.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ def run_impl(

# check that repo is in beta
redis_connection = get_redis_connection()
assert redis_connection.sismember(
"beta.pending", repoid
), "Pending disabled. Please request to be in beta."
assert redis_connection.sismember("beta.pending", repoid), (
"Pending disabled. Please request to be in beta."
)

commits = db_session.query(Commit).filter(
Commit.repoid == repoid, Commit.commitid == commitid
Expand All @@ -69,17 +69,17 @@ def run_impl(
context,
("/" + key if key != "default" else ""),
)
assert match(
config.get("branches"), branch or ""
), "Ignore setting pending status on branch"
assert match(config.get("branches"), branch or ""), (
"Ignore setting pending status on branch"
)
assert (
on_a_pull_request
if config.get("only_pulls", False)
else True
), "Set pending only on pulls"
assert config.get(
"set_pending", True
), "Pending status disabled in YAML"
assert config.get("set_pending", True), (
"Pending status disabled in YAML"
)
assert title not in statuses, "Pending status already set"

async_to_sync(repo_service.set_commit_status)(
Expand Down
1 change: 0 additions & 1 deletion tasks/tests/unit/test_sync_repos_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,6 @@ def repo_obj(service_id, name, language, private, branch, using_integration):
assert user.permission == [] # there were no private repos
for repo in repos:
assert repo.using_integration is True
ghapp.repository_service_ids = ["159089634" "164948070" "213786132" "555555555"]

@respx.mock
@reuse_cassette(
Expand Down

0 comments on commit 26dae42

Please sign in to comment.