From 8cfbb810c82dc6765d026823f3a1ca5af36ba36a Mon Sep 17 00:00:00 2001 From: Jeremy Steele Date: Mon, 30 Sep 2024 16:06:54 -0400 Subject: [PATCH 1/2] Stops without lat/lon are valid, return None for lat/lon getter instead of throwing --- gtfs_loader/schema.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gtfs_loader/schema.py b/gtfs_loader/schema.py index b80d760..8ebcaf7 100644 --- a/gtfs_loader/schema.py +++ b/gtfs_loader/schema.py @@ -211,7 +211,7 @@ class Stop(Entity): @cached_property def location(self): if self.stop_lat is None or self.stop_lon is None: - raise ValueError(f'Stop {self.stop_id} missing location') + return None return LatLon(self.stop_lat, self.stop_lon) @@ -285,8 +285,11 @@ def last_stop_time(self): @property def stop_shape(self): - return tuple(self._gtfs.stops[st.stop_id].location - for st in self._gtfs.stop_times[self.trip_id]) + locations = tuple(self._gtfs.stops[st.stop_id].location for st in self._gtfs.stop_times[self.trip_id]) + + if None in locations: + return None + return locations @cached_property def shift_days(self): From dcefc891c4f96808177288d43d04e931e0d4bf5e Mon Sep 17 00:00:00 2001 From: Jeremy Steele Date: Tue, 1 Oct 2024 09:55:54 -0400 Subject: [PATCH 2/2] bump version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0fe3478..c97d12b 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages setup(name='py-gtfs-loader', - version='0.1.13', + version='0.1.14', description='Load GTFS', url='https://github.com/TransitApp/py-gtfs-loader', author='Nicholas Paun, Jonathan Milot',