geo-activity-playground 0.29.0__tar.gz → 0.29.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/PKG-INFO +1 -1
  2. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/core/activities.py +3 -6
  3. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/core/time_conversion.py +1 -1
  4. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/explorer/tile_visits.py +2 -2
  5. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/importers/activity_parsers.py +28 -17
  6. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/importers/csv_parser.py +1 -2
  7. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/importers/directory.py +2 -1
  8. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/explorer/controller.py +2 -2
  9. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/settings/blueprint.py +2 -0
  10. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/settings/controller.py +4 -3
  11. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/square_planner/controller.py +2 -0
  12. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/pyproject.toml +1 -1
  13. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/LICENSE +0 -0
  14. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/__init__.py +0 -0
  15. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/__main__.py +0 -0
  16. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/core/__init__.py +0 -0
  17. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/core/config.py +0 -0
  18. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/core/coordinates.py +0 -0
  19. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/core/enrichment.py +0 -0
  20. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/core/heart_rate.py +0 -0
  21. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/core/heatmap.py +0 -0
  22. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/core/paths.py +0 -0
  23. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/core/privacy_zones.py +0 -0
  24. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/core/similarity.py +0 -0
  25. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/core/tasks.py +0 -0
  26. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/core/test_tiles.py +0 -0
  27. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/core/test_time_conversion.py +0 -0
  28. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/core/tiles.py +0 -0
  29. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/explorer/__init__.py +0 -0
  30. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/explorer/grid_file.py +0 -0
  31. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/explorer/video.py +0 -0
  32. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/importers/__init__.py +0 -0
  33. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/importers/strava_api.py +0 -0
  34. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/importers/strava_checkout.py +0 -0
  35. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/importers/test_csv_parser.py +0 -0
  36. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/importers/test_directory.py +0 -0
  37. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/importers/test_strava_api.py +0 -0
  38. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/__init__.py +0 -0
  39. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/activity/__init__.py +0 -0
  40. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/activity/blueprint.py +0 -0
  41. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/activity/controller.py +0 -0
  42. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/activity/templates/activity/day.html.j2 +0 -0
  43. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/activity/templates/activity/lines.html.j2 +0 -0
  44. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/activity/templates/activity/name.html.j2 +0 -0
  45. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/activity/templates/activity/show.html.j2 +0 -0
  46. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/app.py +0 -0
  47. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/auth/blueprint.py +0 -0
  48. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/auth/templates/auth/index.html.j2 +0 -0
  49. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/authenticator.py +0 -0
  50. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/calendar/__init__.py +0 -0
  51. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/calendar/blueprint.py +0 -0
  52. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/calendar/controller.py +0 -0
  53. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/calendar/templates/calendar/index.html.j2 +0 -0
  54. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/calendar/templates/calendar/month.html.j2 +0 -0
  55. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/eddington/__init__.py +0 -0
  56. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/eddington/blueprint.py +0 -0
  57. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/eddington/controller.py +0 -0
  58. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/eddington/templates/eddington/index.html.j2 +0 -0
  59. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/entry_controller.py +0 -0
  60. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/equipment/__init__.py +0 -0
  61. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/equipment/blueprint.py +0 -0
  62. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/equipment/controller.py +0 -0
  63. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/equipment/templates/equipment/index.html.j2 +0 -0
  64. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/explorer/__init__.py +0 -0
  65. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/explorer/blueprint.py +0 -0
  66. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/explorer/templates/explorer/index.html.j2 +0 -0
  67. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/heatmap/__init__.py +0 -0
  68. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/heatmap/blueprint.py +0 -0
  69. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/heatmap/heatmap_controller.py +0 -0
  70. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/heatmap/templates/heatmap/index.html.j2 +0 -0
  71. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/plot_util.py +0 -0
  72. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/search/blueprint.py +0 -0
  73. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/search/templates/search/index.html.j2 +0 -0
  74. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/settings/templates/settings/admin-password.html.j2 +0 -0
  75. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/settings/templates/settings/color-schemes.html.j2 +0 -0
  76. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/settings/templates/settings/equipment-offsets.html.j2 +0 -0
  77. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/settings/templates/settings/heart-rate.html.j2 +0 -0
  78. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/settings/templates/settings/index.html.j2 +0 -0
  79. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/settings/templates/settings/kinds-without-achievements.html.j2 +0 -0
  80. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/settings/templates/settings/metadata-extraction.html.j2 +0 -0
  81. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/settings/templates/settings/privacy-zones.html.j2 +0 -0
  82. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/settings/templates/settings/sharepic.html.j2 +0 -0
  83. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/settings/templates/settings/strava.html.j2 +0 -0
  84. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/square_planner/__init__.py +0 -0
  85. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/square_planner/blueprint.py +0 -0
  86. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/square_planner/templates/square_planner/index.html.j2 +0 -0
  87. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/static/android-chrome-192x192.png +0 -0
  88. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/static/android-chrome-384x384.png +0 -0
  89. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/static/android-chrome-512x512.png +0 -0
  90. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/static/apple-touch-icon.png +0 -0
  91. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/static/bootstrap-dark-mode.js +0 -0
  92. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/static/browserconfig.xml +0 -0
  93. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/static/favicon-16x16.png +0 -0
  94. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/static/favicon-32x32.png +0 -0
  95. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/static/favicon.ico +0 -0
  96. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/static/mstile-150x150.png +0 -0
  97. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/static/safari-pinned-tab.svg +0 -0
  98. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/static/site.webmanifest +0 -0
  99. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/summary/__init__.py +0 -0
  100. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/summary/blueprint.py +0 -0
  101. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/summary/controller.py +0 -0
  102. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/summary/templates/summary/index.html.j2 +0 -0
  103. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/templates/home.html.j2 +0 -0
  104. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/templates/page.html.j2 +0 -0
  105. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/tile/__init__.py +0 -0
  106. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/tile/blueprint.py +0 -0
  107. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/tile/controller.py +0 -0
  108. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/upload/__init__.py +0 -0
  109. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/upload/blueprint.py +0 -0
  110. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/upload/controller.py +0 -0
  111. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/upload/templates/upload/index.html.j2 +0 -0
  112. {geo_activity_playground-0.29.0 → geo_activity_playground-0.29.1}/geo_activity_playground/webui/upload/templates/upload/reload.html.j2 +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: geo-activity-playground
3
- Version: 0.29.0
3
+ Version: 0.29.1
4
4
  Summary: Analysis of geo data activities like rides, runs or hikes.
5
5
  License: MIT
6
6
  Author: Martin Ueding
@@ -2,6 +2,7 @@ import datetime
2
2
  import functools
3
3
  import logging
4
4
  import pickle
5
+ from typing import Any
5
6
  from typing import Iterator
6
7
  from typing import Optional
7
8
  from typing import TypedDict
@@ -103,7 +104,7 @@ def build_activity_meta() -> None:
103
104
 
104
105
  class ActivityRepository:
105
106
  def __init__(self) -> None:
106
- self.meta = None
107
+ self.meta = pd.DataFrame()
107
108
 
108
109
  def __len__(self) -> int:
109
110
  return len(self.meta)
@@ -116,10 +117,6 @@ class ActivityRepository:
116
117
  if activity_id in self.meta["id"]:
117
118
  return True
118
119
 
119
- for activity_meta in self._loose_activities:
120
- if activity_meta["id"] == activity_id:
121
- return True
122
-
123
120
  return False
124
121
 
125
122
  def last_activity_date(self) -> Optional[datetime.datetime]:
@@ -198,7 +195,7 @@ def make_geojson_color_line(time_series: pd.DataFrame) -> str:
198
195
  return geojson.dumps(feature_collection)
199
196
 
200
197
 
201
- def make_speed_color_bar(time_series: pd.DataFrame) -> dict[str, str]:
198
+ def make_speed_color_bar(time_series: pd.DataFrame) -> dict[str, Any]:
202
199
  speed_without_na = time_series["speed"].dropna()
203
200
  low = min(speed_without_na)
204
201
  high = max(speed_without_na)
@@ -2,7 +2,7 @@ import numpy as np
2
2
  import pandas as pd
3
3
 
4
4
 
5
- def convert_to_datetime_ns(date) -> np.datetime64:
5
+ def convert_to_datetime_ns(date) -> np.datetime64 | pd.Series:
6
6
  if isinstance(date, pd.Series):
7
7
  ts = pd.to_datetime(date)
8
8
  ts = ts.dt.tz_localize(None)
@@ -59,7 +59,7 @@ class TileEvolutionState:
59
59
  class TileState(TypedDict):
60
60
  tile_visits: dict[int, dict[tuple[int, int], TileInfo]]
61
61
  tile_history: dict[int, pd.DataFrame]
62
- activities_per_tile: dict[int, set[int]]
62
+ activities_per_tile: dict[int, dict[tuple[int, int], set[int]]]
63
63
  processed_activities: set[int]
64
64
  evolution_state: dict[int, TileEvolutionState]
65
65
  version: int
@@ -165,7 +165,7 @@ def _process_activity(
165
165
  for zoom in reversed(range(20)):
166
166
  activities_per_tile = tile_state["activities_per_tile"][zoom]
167
167
 
168
- new_tile_history_soa = {
168
+ new_tile_history_soa: dict[str, list] = {
169
169
  "activity_id": [],
170
170
  "time": [],
171
171
  "tile_x": [],
@@ -3,10 +3,10 @@ import gzip
3
3
  import logging
4
4
  import pathlib
5
5
  import xml
6
+ from collections.abc import Iterator
6
7
 
7
8
  import charset_normalizer
8
9
  import dateutil.parser
9
- import fitdecode
10
10
  import fitdecode.exceptions
11
11
  import gpxpy
12
12
  import pandas as pd
@@ -246,26 +246,37 @@ def read_kml_activity(path: pathlib.Path, opener) -> pd.DataFrame:
246
246
  with opener(path, "rb") as f:
247
247
  kml_dict = xmltodict.parse(f)
248
248
  doc = kml_dict["kml"]["Document"]
249
- keypoint_folder = doc["Folder"]
250
- placemark = keypoint_folder["Placemark"]
251
- track = placemark["gx:Track"]
252
249
  rows = []
253
- for when, where in zip(track["when"], track["gx:coord"]):
254
- time = dateutil.parser.parse(when)
255
- time = convert_to_datetime_ns(time)
256
- parts = where.split(" ")
257
- if len(parts) == 2:
258
- lon, lat = parts
259
- alt = None
260
- if len(parts) == 3:
261
- lon, lat, alt = parts
262
- row = {"time": time, "latitude": float(lat), "longitude": float(lon)}
263
- if alt is not None:
264
- row["altitude"] = float(alt)
265
- rows.append(row)
250
+ for keypoint_folder in _list_or_scalar(doc["Folder"]):
251
+ for placemark in _list_or_scalar(keypoint_folder["Placemark"]):
252
+ for track in _list_or_scalar(placemark.get("gx:Track", [])):
253
+ for when, where in zip(track["when"], track["gx:coord"]):
254
+ time = dateutil.parser.parse(when)
255
+ time = convert_to_datetime_ns(time)
256
+ parts = where.split(" ")
257
+ if len(parts) == 2:
258
+ lon, lat = parts
259
+ alt = None
260
+ if len(parts) == 3:
261
+ lon, lat, alt = parts
262
+ row = {
263
+ "time": time,
264
+ "latitude": float(lat),
265
+ "longitude": float(lon),
266
+ }
267
+ if alt is not None:
268
+ row["altitude"] = float(alt)
269
+ rows.append(row)
266
270
  return pd.DataFrame(rows)
267
271
 
268
272
 
273
+ def _list_or_scalar(thing) -> Iterator:
274
+ if isinstance(thing, list):
275
+ yield from thing
276
+ else:
277
+ yield thing
278
+
279
+
269
280
  def read_simra_activity(path: pathlib.Path, opener) -> pd.DataFrame:
270
281
  data = pd.read_csv(path, header=1)
271
282
  data["time"] = data["timeStamp"].apply(
@@ -20,9 +20,8 @@ This module implements a "recursive descent parser" that parses this grammar.
20
20
 
21
21
  def parse_csv(text: str) -> list[list]:
22
22
  text = text.strip() + "\n"
23
- result = {}
24
23
  index = 0
25
- result = []
24
+ result: list[list] = []
26
25
  while index < len(text):
27
26
  line, index = _parse_line(text, index)
28
27
  result.append(line)
@@ -126,11 +126,12 @@ def _cache_single_file(path: pathlib.Path) -> Optional[tuple[pathlib.Path, str]]
126
126
  raise
127
127
 
128
128
  if len(timeseries) == 0:
129
- return
129
+ return None
130
130
 
131
131
  timeseries.to_parquet(timeseries_path)
132
132
  with open(file_metadata_path, "wb") as f:
133
133
  pickle.dump(activity_meta_from_file, f)
134
+ return None
134
135
 
135
136
 
136
137
  def get_file_hash(path: pathlib.Path) -> int:
@@ -95,7 +95,7 @@ class ExplorerController:
95
95
  x2, y2 = compute_tile(south, east, zoom)
96
96
  tile_bounds = Bounds(x1, y1, x2 + 2, y2 + 2)
97
97
 
98
- tile_histories = self._tile_visit_accessor.histories
98
+ tile_histories = self._tile_visit_accessor.tile_state["tile_history"]
99
99
  tiles = tile_histories[zoom]
100
100
  points = get_border_tiles(tiles, zoom, tile_bounds)
101
101
  if suffix == "geojson":
@@ -108,7 +108,7 @@ class ExplorerController:
108
108
  x2, y2 = compute_tile(south, east, zoom)
109
109
  tile_bounds = Bounds(x1, y1, x2 + 2, y2 + 2)
110
110
 
111
- tile_visits = self._tile_visit_accessor.visits
111
+ tile_visits = self._tile_visit_accessor.tile_state["tile_visits"]
112
112
  tiles = tile_visits[zoom]
113
113
  points = make_grid_points(
114
114
  (tile for tile in tiles.keys() if tile_bounds.contains(*tile)), zoom
@@ -19,6 +19,8 @@ def int_or_none(s: str) -> Optional[int]:
19
19
  return int(s)
20
20
  except ValueError as e:
21
21
  flash(f"Cannot parse integer from {s}: {e}", category="danger")
22
+ else:
23
+ return None
22
24
 
23
25
 
24
26
  def make_settings_blueprint(
@@ -1,6 +1,7 @@
1
1
  import json
2
2
  import re
3
3
  import urllib.parse
4
+ from typing import Any
4
5
  from typing import Optional
5
6
 
6
7
  from flask import flash
@@ -70,7 +71,7 @@ class SettingsController:
70
71
  flash("Updated equipment offsets.", category="success")
71
72
 
72
73
  def render_heart_rate(self) -> dict:
73
- result = {
74
+ result: dict[str, Any] = {
74
75
  "birth_year": self._config_accessor().birth_year,
75
76
  "heart_rate_resting": self._config_accessor().heart_rate_resting,
76
77
  "heart_rate_maximum": self._config_accessor().heart_rate_maximum,
@@ -90,7 +91,7 @@ class SettingsController:
90
91
  heart_rate_maximum: Optional[int],
91
92
  ) -> None:
92
93
  self._config_accessor().birth_year = birth_year
93
- self._config_accessor().heart_rate_resting = heart_rate_resting
94
+ self._config_accessor().heart_rate_resting = heart_rate_resting or 0
94
95
  self._config_accessor().heart_rate_maximum = heart_rate_maximum
95
96
  self._config_accessor.save()
96
97
  flash("Updated heart rate data.", category="success")
@@ -251,7 +252,7 @@ class SettingsController:
251
252
  return f"https://www.strava.com/oauth/authorize?{arg_string}"
252
253
 
253
254
  def save_strava_code(self, code: str) -> None:
254
- self._config_accessor().strava_client_id = self._strava_client_id
255
+ self._config_accessor().strava_client_id = int(self._strava_client_id)
255
256
  self._config_accessor().strava_client_secret = self._strava_client_secret
256
257
  self._config_accessor().strava_client_code = code
257
258
  self._config_accessor.save()
@@ -79,6 +79,8 @@ class SquarePlannerController:
79
79
  return make_grid_file_geojson(points)
80
80
  elif suffix == "gpx":
81
81
  return make_grid_file_gpx(points)
82
+ else:
83
+ raise RuntimeError(f"Unsupported suffix {suffix}.")
82
84
 
83
85
  def _get_explored_tiles(self, zoom: int) -> set[tuple[int, int]]:
84
86
  return set(self._tile_visits[zoom].keys())
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "geo-activity-playground"
3
- version = "0.29.0"
3
+ version = "0.29.1"
4
4
  description = "Analysis of geo data activities like rides, runs or hikes."
5
5
  authors = ["Martin Ueding <mu@martin-ueding.de>"]
6
6
  license = "MIT"