Skip to content

Commit

Permalink
Merge pull request #20 from TransitApp/jsteelz/None-for-stop-shape-Flex
Browse files Browse the repository at this point in the history
Stops without lat/lon are valid, return None for lat/lon getter instead of throwing
  • Loading branch information
jsteelz authored Oct 1, 2024
2 parents f25d510 + dcefc89 commit 054c927
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions gtfs_loader/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -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',
Expand Down

0 comments on commit 054c927

Please sign in to comment.