Skip to content

Commit 076a55b

Browse files
committed
Linting...
1 parent 20bc5a1 commit 076a55b

47 files changed

Lines changed: 411 additions & 244 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ dependencies = [
2525
[dependency-groups]
2626
dev = [
2727
"basedpyright>=1.39.0",
28+
"pyside6-stubs>=6.7.3.0",
2829
"pytest>=9.0.3",
2930
"pytest-cov>=7.1.0",
3031
]

pyrightconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
2-
"exclude": ["src/georeel/core/blender_scripts", "tests"],
2+
"exclude": [".venv", "**/node_modules", "**/__pycache__", "**/.*", "src/georeel/core/blender_scripts", "tests"],
33
"reportImplicitStringConcatenation": false,
44
"reportUnusedCallResult": false,
5+
"venvPath": ".",
6+
"venv": ".venv"
57
}

src/georeel/core/bounding_box.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import math
22
from dataclasses import dataclass
3+
from typing import override
34

45
_M_PER_DEG_LAT = 111_320.0
56

@@ -23,6 +24,7 @@ def expand(self, margin_m: float) -> "BoundingBox":
2324
max_lon=self.max_lon + lon_delta,
2425
)
2526

27+
@override
2628
def __str__(self) -> str:
2729
return (
2830
f"({self.min_lat:.5f}, {self.min_lon:.5f}) → "

src/georeel/core/camera_path.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ def _rss_mb() -> float:
4040
return float("nan")
4141

4242

43-
def _mem(label: str) -> None:
44-
_log.debug("[camera_path mem] %s — RSS %.0f MB", label, _rss_mb())
45-
4643
# Douglas-Peucker tolerance (metres). Points closer than this to the
4744
# straight line between their neighbours are removed.
4845
_DP_EPSILON_M = 20.0
@@ -471,25 +468,6 @@ def _douglas_peucker(pts: np.ndarray, epsilon: float) -> np.ndarray:
471468
# ------------------------------------------------------------------
472469

473470

474-
def _height_at(
475-
x: float,
476-
y: float,
477-
grid: ElevationGrid,
478-
bbox: BoundingBox,
479-
lat_m: float,
480-
lon_m: float,
481-
height_mode: str,
482-
height_offset: float,
483-
) -> float:
484-
lat = bbox.min_lat + y / lat_m * (bbox.max_lat - bbox.min_lat)
485-
lon = bbox.min_lon + x / lon_m * (bbox.max_lon - bbox.min_lon)
486-
if height_mode == "dem_smooth":
487-
elev = _smooth_elevation(grid, lat, lon)
488-
else:
489-
elev = grid.elevation_at(lat, lon)
490-
return elev + height_offset
491-
492-
493471
def _height_at_batch(
494472
xs: np.ndarray,
495473
ys: np.ndarray,
@@ -515,18 +493,6 @@ def _height_at_batch(
515493
return grid.elevation_at_batch(lats, lons)
516494

517495

518-
def _smooth_elevation(grid: ElevationGrid, lat: float, lon: float) -> float:
519-
"""Mean elevation over a 3×3 neighbourhood (1.5× grid spacing)."""
520-
dlat = (grid.max_lat - grid.min_lat) / (grid.rows - 1) * 1.5
521-
dlon = (grid.max_lon - grid.min_lon) / (grid.cols - 1) * 1.5
522-
samples = [
523-
grid.elevation_at(lat + r * dlat, lon + c * dlon)
524-
for r in (-1, 0, 1)
525-
for c in (-1, 0, 1)
526-
]
527-
return sum(samples) / len(samples)
528-
529-
530496
# ------------------------------------------------------------------
531497
# Orientation helpers
532498
# ------------------------------------------------------------------

src/georeel/core/dem_fetcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def _load(tile_lat: int, tile_lon: int) -> tuple[int, int, object]:
154154
futures = {pool.submit(_load, tlat, tlon): (tlat, tlon)
155155
for tlat, tlon in all_tiles}
156156
for future in as_completed(futures):
157-
tile_lat, tile_lon, geo_file = future.result()
157+
_, _, geo_file = future.result()
158158

159159
tiles_done += 1
160160
if progress_callback is not None:

src/georeel/core/frame_renderer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import threading
2323
from concurrent.futures import Future, ThreadPoolExecutor
2424
from pathlib import Path
25-
from typing import Any, Callable
25+
from typing import Any, Callable, final
2626

2727
from PIL import Image as _PILImage
2828

@@ -39,6 +39,7 @@ class FrameRenderError(Exception):
3939
pass
4040

4141

42+
@final
4243
class _CompressionServer:
4344
"""Listens on a localhost TCP port; Blender sends a PNG path (newline-
4445
terminated) after each frame is written. A thread pool re-compresses
@@ -205,7 +206,7 @@ def render_frames(
205206
n_segments = int(settings.get("render/n_segments", 1))
206207

207208
work_dir = temp_manager.make_temp_dir("georeel_frames_")
208-
pipeline._temp_dirs.append(work_dir)
209+
pipeline.temp_dirs.append(work_dir)
209210
kf_path = work_dir / "keyframes.json"
210211
out_dir = work_dir / "frames"
211212
out_dir.mkdir()

src/georeel/core/frustum.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def frustum_margin(height_m: float, tilt_deg: float,
2828
any direction along the track, so the margin is applied uniformly.
2929
"""
3030
# Vertical FOV for the 16:9 sensor/lens combination
31-
2 * math.atan(_SENSOR_W_MM / 2 / _FOCAL_MM)
3231
vfov = 2 * math.atan(_SENSOR_W_MM / _ASPECT / 2 / _FOCAL_MM)
3332

3433
# Angle below horizontal of the top edge of the frame

src/georeel/core/gpx_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def _fix_undeclared_namespaces(content: str) -> str:
4444
if not missing:
4545
return content
4646

47-
injections = []
47+
injections: list[str] = []
4848
for prefix in sorted(missing):
4949
uri = _KNOWN_NS.get(prefix, f"urn:unknown-ns:{prefix}")
5050
injections.append(f'xmlns:{prefix}="{uri}"')

src/georeel/core/photo_compositor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def composite_photos(
161161
out_w, out_h = _RESOLUTIONS.get(resolution, (1920, 1080))
162162

163163
comp_work_dir = temp_manager.make_temp_dir("georeel_comp_")
164-
pipeline._temp_dirs.append(comp_work_dir)
164+
pipeline.temp_dirs.append(comp_work_dir)
165165
out_dir = comp_work_dir / "frames"
166166
out_dir.mkdir()
167167

src/georeel/core/pipeline.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ class Pipeline:
7171
# Large intermediate dirs (frame sequences) are registered here so
7272
# they can be removed as soon as the job finishes or is cancelled.
7373
# ------------------------------------------------------------------ #
74-
_temp_dirs: list[Path] = field(default_factory=list, repr=False)
74+
temp_dirs: list[Path] = field(default_factory=list, repr=False)
7575

7676
def cleanup(self) -> None:
7777
"""Delete all registered temporary directories."""
78-
for d in list(self._temp_dirs):
78+
for d in list(self.temp_dirs):
7979
shutil.rmtree(d, ignore_errors=True)
80-
self._temp_dirs.clear()
80+
self.temp_dirs.clear()

0 commit comments

Comments
 (0)