diff options
| author | Markus Heiser <markus.heiser@darmarit.de> | 2025-10-30 12:25:43 +0100 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarIT.de> | 2025-11-01 09:46:47 +0100 |
| commit | 0245327fc5b5d3b953c7169f58bad989eb54e552 (patch) | |
| tree | 456f1d83294cdb95714f7b1c7759378f27769987 /searx/weather.py | |
| parent | b155e66fe5572e743c745380ace3416783c5963b (diff) | |
Revert "[fix] !weather crashes - cls.TURN .. (#5309)"
This reverts HOTFIX from commit fc7d8b8b [1]
[1] https://github.com/searxng/searxng/pull/5309
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/weather.py')
| -rw-r--r-- | searx/weather.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/searx/weather.py b/searx/weather.py index af47a8844..5627cd0db 100644 --- a/searx/weather.py +++ b/searx/weather.py @@ -511,14 +511,15 @@ class Compass(msgspec.Struct): return self.val raise ValueError(f"unknown unit: {unit}") - def point(self, azimuth: float | int) -> CompassPoint: + @classmethod + def point(cls, azimuth: float | int) -> CompassPoint: """Returns the compass point to an azimuth value.""" - azimuth = azimuth % self.TURN + azimuth = azimuth % cls.TURN # The angle sector of a compass point starts 1/2 sector range before # and after compass point (example: "N" goes from -11.25° to +11.25°) - azimuth = azimuth - self.RANGE / 2 - idx = int(azimuth // self.RANGE) - return self.POINTS[idx] + azimuth = azimuth - cls.RANGE / 2 + idx = int(azimuth // cls.RANGE) + return cls.POINTS[idx] def l10n( self, |