style: apply ruff formatting sweep

Co-authored-by: Copilot App <[email protected]>
This commit is contained in:
Jim Lancaster
2026-08-23 18:13:38 -05:00
co-authored by Copilot App
parent 4aaa9bd581
commit 2a56365847
37 changed files with 141 additions and 230 deletions
+4 -15
View File
@@ -55,10 +55,7 @@ def _uniqueness_already_enforced(connection: Connection) -> bool:
if any(constraint.get("name") == UNIQUE_NAME for constraint in unique_constraints):
return True
indexes = inspector.get_indexes("job_source")
return any(
index.get("name") == UNIQUE_NAME and index.get("unique") is True
for index in indexes
)
return any(index.get("name") == UNIQUE_NAME and index.get("unique") is True for index in indexes)
def _choose_keeper(
@@ -100,11 +97,7 @@ def deduplicate_job_source_membership(connection: Connection, *, dry_run: bool)
job_source.c.source_id,
func.max(execution_attempt.c.created_at).label("latest_attempt_at"),
)
.select_from(
job_source.outerjoin(
execution_attempt, execution_attempt.c.job_source_id == job_source.c.id
)
)
.select_from(job_source.outerjoin(execution_attempt, execution_attempt.c.job_source_id == job_source.c.id))
.group_by(job_source.c.id, job_source.c.job_id, job_source.c.source_id)
)
.mappings()
@@ -150,13 +143,9 @@ def add_job_source_uniqueness(connection: Connection, *, dry_run: bool) -> None:
dialect = connection.dialect.name
if dialect == "postgresql":
statement = text(
f'alter table "job_source" add constraint "{UNIQUE_NAME}" unique ("job_id", "source_id")'
)
statement = text(f'alter table "job_source" add constraint "{UNIQUE_NAME}" unique ("job_id", "source_id")')
else:
statement = text(
f'create unique index "{UNIQUE_NAME}" on "job_source" ("job_id", "source_id")'
)
statement = text(f'create unique index "{UNIQUE_NAME}" on "job_source" ("job_id", "source_id")')
print(f" applying {UNIQUE_NAME}")
if not dry_run:
connection.execute(statement)