Skip to content

Commit 6e24d5c

Browse files
committed
Linter fixes
1 parent 1c7673c commit 6e24d5c

6 files changed

Lines changed: 31 additions & 30 deletions

File tree

alembic_task/versions/b3f8a2c91e04_add_auto_flag_review.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from typing import Sequence, Union
1010

1111
import sqlalchemy as sa
12-
1312
from alembic import op
1413

1514
revision: str = "b3f8a2c91e04"

api/src/osm/repository.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ async def getWorkspaceBBox(
3535

3636
return retVal
3737

38-
async def getChangesetAdiff(
39-
self,
40-
workspace_id: int,
41-
changeset_id: int
42-
) -> list:
38+
async def getChangesetAdiff(self, workspace_id: int, changeset_id: int) -> list:
4339
await self.session.execute(
4440
text(f"SET search_path TO 'workspace-{int(workspace_id)}', public")
4541
)

api/src/osm/routes.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ async def resolve_changeset(
6060
repository_osm: OSMRepository = Depends(get_osm_repo),
6161
current_user: UserInfo = Depends(validate_token),
6262
) -> None:
63-
if (not current_user.isWorkspaceLead(workspace_id)
64-
and not current_user.isWorkspaceValidator(workspace_id)):
63+
if not current_user.isWorkspaceLead(
64+
workspace_id
65+
) and not current_user.isWorkspaceValidator(workspace_id):
6566
raise HTTPException(
6667
status_code=status.HTTP_403_FORBIDDEN,
6768
detail="Only workspace leads and validators can resolve changesets",

api/src/workspaces/schemas.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,4 +320,3 @@ class Workspace(SQLModel, table=True):
320320
"cascade": "all, delete-orphan",
321321
}
322322
)
323-

scripts/fix-lint.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
# Auto-fix the formatting issues that scripts/ci.sh checks for.
3+
#
4+
# Runs isort then black in write mode over the repo (the same tools/config CI
5+
# enforces, minus the `--check`). Safe to run repeatedly; it only rewrites files
6+
# that are not already compliant. Does not touch pyright — type errors are not
7+
# auto-fixable.
8+
set -euo pipefail
9+
10+
cd "$(dirname "$0")/.."
11+
12+
echo "==> Sorting imports (isort)"
13+
uv run isort .
14+
15+
echo ""
16+
echo "==> Formatting code (black)"
17+
uv run black .
18+
19+
echo ""
20+
echo "Done. Review the changes with 'git diff', then re-run ./scripts/ci.sh."

tests/integration/test_audit_flow.py

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ async def test_lists_lifecycle_events_newest_first(
9090
):
9191
"""Project create → AOI upload → tasks → activate all appear in audit."""
9292
contributor = await extra_user_factory("contributor")
93-
pid = await _open_project_with_tasks(
94-
client, seeded_workspace_id, contributor
95-
)
93+
pid = await _open_project_with_tasks(client, seeded_workspace_id, contributor)
9694

9795
r = await client.get(f"{API.format(wid=seeded_workspace_id)}/{pid}/audit")
9896
assert r.status_code == 200, r.text
@@ -112,9 +110,7 @@ async def test_filter_by_event_type(
112110
):
113111
"""`event_type` query narrows results to one kind."""
114112
contributor = await extra_user_factory("contributor")
115-
pid = await _open_project_with_tasks(
116-
client, seeded_workspace_id, contributor
117-
)
113+
pid = await _open_project_with_tasks(client, seeded_workspace_id, contributor)
118114

119115
r = await client.get(
120116
f"{API.format(wid=seeded_workspace_id)}/{pid}/audit",
@@ -129,9 +125,7 @@ async def test_filter_by_actor(
129125
):
130126
"""`actor_user_id` filters to events emitted by that user only."""
131127
contributor = await extra_user_factory("contributor")
132-
pid = await _open_project_with_tasks(
133-
client, seeded_workspace_id, contributor
134-
)
128+
pid = await _open_project_with_tasks(client, seeded_workspace_id, contributor)
135129
r = await client.get(
136130
f"{API.format(wid=seeded_workspace_id)}/{pid}/audit",
137131
params={"actor_user_id": str(as_lead.user_uuid)},
@@ -145,9 +139,7 @@ async def test_pagination_clamps_and_total(
145139
):
146140
"""Page size of 1 still returns one row; total reflects the whole set."""
147141
contributor = await extra_user_factory("contributor")
148-
pid = await _open_project_with_tasks(
149-
client, seeded_workspace_id, contributor
150-
)
142+
pid = await _open_project_with_tasks(client, seeded_workspace_id, contributor)
151143
r = await client.get(
152144
f"{API.format(wid=seeded_workspace_id)}/{pid}/audit",
153145
params={"page_size": 1, "page": 1},
@@ -184,9 +176,7 @@ async def test_lists_task_events(
184176
# then we switch to that contributor to lock + unlock so we generate
185177
# task events.
186178
contributor = await extra_user_factory("contributor")
187-
pid = await _open_project_with_tasks(
188-
client, seeded_workspace_id, contributor
189-
)
179+
pid = await _open_project_with_tasks(client, seeded_workspace_id, contributor)
190180
override_user(contributor)
191181

192182
# Contributor locks task 1.
@@ -219,9 +209,7 @@ async def test_unknown_task_404(
219209
):
220210
"""A bogus task number on a real project returns 404."""
221211
contributor = await extra_user_factory("contributor")
222-
pid = await _open_project_with_tasks(
223-
client, seeded_workspace_id, contributor
224-
)
212+
pid = await _open_project_with_tasks(client, seeded_workspace_id, contributor)
225213
r = await client.get(
226214
f"{API.format(wid=seeded_workspace_id)}/{pid}/tasks/99/audit"
227215
)
@@ -240,9 +228,7 @@ async def test_deleted_project_hidden_by_default(
240228
):
241229
"""A soft-deleted project's audit returns 404 unless `include_deleted=true`."""
242230
contributor = await extra_user_factory("contributor")
243-
pid = await _open_project_with_tasks(
244-
client, seeded_workspace_id, contributor
245-
)
231+
pid = await _open_project_with_tasks(client, seeded_workspace_id, contributor)
246232

247233
# Project must be closed before delete.
248234
r = await client.post(f"{API.format(wid=seeded_workspace_id)}/{pid}/close")

0 commit comments

Comments
 (0)