style(scripts): fix ruff lint errors in 5 small .gitea/scripts #1802

Closed
agent-dev-a wants to merge 1 commits from fix/ruff-lint-small-scripts into main
3 changed files with 13 additions and 5 deletions
+5 -2
View File
@@ -71,7 +71,10 @@ from typing import Any, Iterable
try:
import yaml
except ImportError:
print("::error::PyYAML is required. Install with: pip install PyYAML", file=sys.stderr)
print(
"::error::PyYAML is required. Install with: pip install PyYAML",
file=sys.stderr,
)
sys.exit(2)
@@ -198,7 +201,7 @@ USES_CROSS_REPO_RE = re.compile(
(?P<owner>[A-Za-z0-9_.\-]+)
/
(?P<repo>[A-Za-z0-9_.\-]+)
/ # mandatory subpath separator => cross-repo composite/reusable
/ # mandatory subpath separator => cross-repo composite/reusable
(?P<path>[^@\s]+)
@
(?P<ref>\S+)
+2 -1
View File
@@ -618,7 +618,8 @@ def close_open_red_issues_for_other_shas(
"`feedback_no_such_thing_as_flakes`."
)
if dry_run:
print(f"::notice::[dry-run] would close issue #{num} ({issue.get('title')})")
title = issue.get("title", "")
print(f"::notice::[dry-run] would close issue #{num} ({title})")
closed += 1
continue
# Comment first, then close. Order matters: a closed issue can
+6 -2
View File
@@ -125,7 +125,9 @@ OWNER, NAME = (REPO.split("/", 1) + [""])[:2] if REPO else ("", "")
API = f"https://{GITEA_HOST}/api/v1" if GITEA_HOST else ""
API_TIMEOUT_SEC = int(_env("STATUS_REAPER_API_TIMEOUT_SEC", default="30") or "30")
API_RETRIES = int(_env("STATUS_REAPER_API_RETRIES", default="3") or "3")
API_RETRY_SLEEP_SEC = float(_env("STATUS_REAPER_API_RETRY_SLEEP_SEC", default="2") or "2")
API_RETRY_SLEEP_SEC = float(
_env("STATUS_REAPER_API_RETRY_SLEEP_SEC", default="2") or "2"
)
# Compensating-status description prefix. Used as the marker so a human
# auditing commit statuses can tell at a glance that the green was
@@ -506,7 +508,9 @@ def reap(
successful_contexts = {
(s.get("context") or "")
for s in statuses
if isinstance(s, dict) and (s.get("status") or s.get("state") or "") == "success"
if isinstance(s, dict) and (
s.get("status") or s.get("state") or ""
) == "success"
}
for s in statuses:
if not isinstance(s, dict):