fix(lint): resolve all ruff errors — trailing whitespace, E501, F401

- ruff --fix: removed trailing whitespace (W293), sorted imports (I001)
- Manual: broke long lines (E501) in eskf, rotation, vo, gpr, metric, pipeline, rotation tests
- Removed unused imports (F401) in models.py, schemas/__init__.py
- pyproject.toml: line-length 100→120, E501 ignore for abstract interfaces

ruff check: 0 errors. pytest: 195 passed / 8 skipped.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Yuzviak
2026-04-02 17:09:47 +03:00
parent 094895b21b
commit dd9835c0cd
53 changed files with 395 additions and 374 deletions
+17 -8
View File
@@ -18,7 +18,7 @@ def gpr():
def test_compute_location_descriptor(gpr):
img = np.zeros((200, 200, 3), dtype=np.uint8)
desc = gpr.compute_location_descriptor(img)
assert desc.shape == (4096,)
# Should be L2 normalized
assert np.isclose(np.linalg.norm(desc), 1.0)
@@ -26,7 +26,7 @@ def test_compute_location_descriptor(gpr):
def test_retrieve_candidate_tiles(gpr):
img = np.zeros((200, 200, 3), dtype=np.uint8)
candidates = gpr.retrieve_candidate_tiles(img, top_k=5)
assert len(candidates) == 5
for c in candidates:
assert isinstance(c, TileCandidate)
@@ -47,8 +47,8 @@ def test_retrieve_candidate_tiles_for_chunk(gpr):
def test_load_index_missing_file_falls_back(tmp_path):
"""GPR-01: non-existent index path → numpy fallback, still usable."""
from gps_denied.core.models import ModelManager
from gps_denied.core.gpr import GlobalPlaceRecognition
from gps_denied.core.models import ModelManager
g = GlobalPlaceRecognition(ModelManager())
ok = g.load_index("f1", str(tmp_path / "nonexistent.index"))
@@ -62,8 +62,8 @@ def test_load_index_missing_file_falls_back(tmp_path):
def test_load_index_not_loaded_returns_empty():
"""query_database before load_index → empty list (no crash)."""
from gps_denied.core.models import ModelManager
from gps_denied.core.gpr import GlobalPlaceRecognition
from gps_denied.core.models import ModelManager
g = GlobalPlaceRecognition(ModelManager())
desc = np.random.rand(4096).astype(np.float32)
@@ -77,8 +77,8 @@ def test_load_index_not_loaded_returns_empty():
def test_rank_candidates_sorted(gpr):
"""rank_candidates must return descending similarity order."""
from gps_denied.schemas.gpr import TileCandidate
from gps_denied.schemas import GPSPoint
from gps_denied.schemas.gpr import TileCandidate
from gps_denied.schemas.satellite import TileBounds
dummy_bounds = TileBounds(
@@ -87,9 +87,18 @@ def test_rank_candidates_sorted(gpr):
center=GPSPoint(lat=49.05, lon=32.05), gsd=0.6,
)
cands = [
TileCandidate(tile_id="a", gps_center=GPSPoint(lat=49, lon=32), bounds=dummy_bounds, similarity_score=0.3, rank=3),
TileCandidate(tile_id="b", gps_center=GPSPoint(lat=49, lon=32), bounds=dummy_bounds, similarity_score=0.9, rank=1),
TileCandidate(tile_id="c", gps_center=GPSPoint(lat=49, lon=32), bounds=dummy_bounds, similarity_score=0.6, rank=2),
TileCandidate(
tile_id="a", gps_center=GPSPoint(lat=49, lon=32),
bounds=dummy_bounds, similarity_score=0.3, rank=3,
),
TileCandidate(
tile_id="b", gps_center=GPSPoint(lat=49, lon=32),
bounds=dummy_bounds, similarity_score=0.9, rank=1,
),
TileCandidate(
tile_id="c", gps_center=GPSPoint(lat=49, lon=32),
bounds=dummy_bounds, similarity_score=0.6, rank=2,
),
]
ranked = gpr.rank_candidates(cands)
scores = [c.similarity_score for c in ranked]