-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransitfeed.py.patch
68 lines (65 loc) · 2.71 KB
/
transitfeed.py.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
--- /usr/local/lib/python2.7/dist-packages/transitfeed.py 2014-06-23 18:15:16.000000000 -0400
+++ /home/matt/.local/lib/python2.7/site-packages/transitfeed.py 2014-07-07 13:35:30.533357137 -0400
@@ -737,7 +737,7 @@
class Trip(object):
_REQUIRED_FIELD_NAMES = ['route_id', 'service_id', 'trip_id']
_FIELD_NAMES = _REQUIRED_FIELD_NAMES + [
- 'trip_headsign', 'direction_id', 'block_id', 'shape_id'
+ 'trip_headsign', 'direction_id', 'block_id', 'shape_id', 'trip_short_name'
]
_FIELD_NAMES_HEADWAY = ['trip_id', 'start_time', 'end_time', 'headway_secs']
@@ -754,9 +754,10 @@
self.service_period = service_period
self.direction_id = None
self.block_id = None
+ self.trip_short_name = None
if field_list:
(self.route_id, self.service_id, self.trip_id, self.trip_headsign,
- self.direction_id, self.block_id, self.shape_id) = field_list
+ self.direction_id, self.block_id, self.shape_id, self.trip_short_name) = field_list
def GetFieldValuesTuple(self):
return [getattr(self, fn) or '' for fn in Trip._FIELD_NAMES]
@@ -1485,11 +1486,13 @@
elif (value != u'0') and (value != '1'):
problems.InvalidValue(field_name, value)
index += 1
+ """
if (True not in self.day_of_week and
1 not in self.date_exceptions.values()):
problems.OtherProblem('Service period with service_id "%s" '
'doesn\'t have service on any days '
'of the week.' % self.service_id)
+ """
for date in self.date_exceptions:
if not self._IsValidDate(date):
problems.InvalidValue('date', date)
@@ -2291,7 +2294,7 @@
continue
try:
seq = int(seq)
- if seq < 1:
+ if seq < 0:
self._problems.InvalidValue('shape_pt_sequence', seq,
'Value should be a number (1 or higher)')
except (TypeError, ValueError):
@@ -2306,7 +2309,7 @@
for shape_id, points in shapes.items():
shape = Shape(shape_id)
points.sort()
- last_seq = 0
+ last_seq = -1 if points[0][0] == 0 else 0
for (seq, lat, lon, dist) in points:
if (seq == last_seq):
self._problems.InvalidValue('shape_pt_sequence', seq,
@@ -2435,10 +2438,12 @@
(trip_id, sequence[-1][0]))
expected_sequence = 1
for stop_sequence, stoptime in sequence:
+ """
if expected_sequence != stop_sequence:
self._problems.OtherProblem(
'Bad stop_sequence. Expected %i, found %i in trip_id "%s"' %
(expected_sequence, stop_sequence, trip_id))
+ """
trip.AddStopTimeObject(stoptime, problems=self._problems)
expected_sequence = stop_sequence + 1