mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-21 14:57:42 +00:00
Partial fix for mypy issues
This commit is contained in:
@@ -37,12 +37,12 @@ class SpotProvider:
|
||||
# off to SSE listeners.
|
||||
spots = sorted(spots, key=lambda s: s.time if s and s.time else 0)
|
||||
for spot in spots:
|
||||
if datetime.fromtimestamp(spot.time, pytz.UTC) > self.last_spot_time:
|
||||
if datetime.fromtimestamp(spot.time or 0, pytz.UTC) > self.last_spot_time:
|
||||
# Fill in any blanks and add to the list
|
||||
spot.infer_missing()
|
||||
self._add_spot(spot)
|
||||
if spots:
|
||||
self.last_spot_time = datetime.fromtimestamp(max(s.time for s in spots), pytz.UTC)
|
||||
self.last_spot_time = datetime.fromtimestamp(max(s.time or 0 for s in spots), pytz.UTC)
|
||||
|
||||
def _submit(self, spot: Spot) -> None:
|
||||
"""Submit a single spot retrieved from the provider. This will be added to the list regardless of its age. Spots
|
||||
@@ -52,9 +52,10 @@ class SpotProvider:
|
||||
# Fill in any blanks and add to the list
|
||||
spot.infer_missing()
|
||||
self._add_spot(spot)
|
||||
self.last_spot_time = datetime.fromtimestamp(spot.time, pytz.UTC)
|
||||
self.last_spot_time = datetime.fromtimestamp(spot.time or 0, pytz.UTC)
|
||||
|
||||
def _add_spot(self, spot: Spot) -> None:
|
||||
assert spot.id is not None, "infer_missing() always assigns an id"
|
||||
if not spot.expired():
|
||||
self._spots.set(spot.id, spot)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user