PyTransportNSWv2 0.5.4__tar.gz → 0.5.6__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.
- {PyTransportNSWv2-0.5.4 → PyTransportNSWv2-0.5.6}/PKG-INFO +1 -1
- {PyTransportNSWv2-0.5.4 → PyTransportNSWv2-0.5.6}/PyTransportNSWv2.egg-info/PKG-INFO +1 -1
- {PyTransportNSWv2-0.5.4 → PyTransportNSWv2-0.5.6}/TransportNSWv2/TransportNSWv2.py +4 -18
- {PyTransportNSWv2-0.5.4 → PyTransportNSWv2-0.5.6}/setup.py +1 -1
- {PyTransportNSWv2-0.5.4 → PyTransportNSWv2-0.5.6}/LICENSE +0 -0
- {PyTransportNSWv2-0.5.4 → PyTransportNSWv2-0.5.6}/PyTransportNSWv2.egg-info/SOURCES.txt +0 -0
- {PyTransportNSWv2-0.5.4 → PyTransportNSWv2-0.5.6}/PyTransportNSWv2.egg-info/dependency_links.txt +0 -0
- {PyTransportNSWv2-0.5.4 → PyTransportNSWv2-0.5.6}/PyTransportNSWv2.egg-info/requires.txt +0 -0
- {PyTransportNSWv2-0.5.4 → PyTransportNSWv2-0.5.6}/PyTransportNSWv2.egg-info/top_level.txt +0 -0
- {PyTransportNSWv2-0.5.4 → PyTransportNSWv2-0.5.6}/README.md +0 -0
- {PyTransportNSWv2-0.5.4 → PyTransportNSWv2-0.5.6}/TransportNSWv2/__init__.py +0 -0
- {PyTransportNSWv2-0.5.4 → PyTransportNSWv2-0.5.6}/setup.cfg +0 -0
@@ -134,7 +134,6 @@ class TransportNSWv2(object):
|
|
134
134
|
exit
|
135
135
|
|
136
136
|
retrieved_journeys = len(result['journeys'])
|
137
|
-
print ("retrieved_journeys = " + str(retrieved_journeys))
|
138
137
|
|
139
138
|
# Loop through the results applying filters where required, and generate the appropriate JSON output including an array of in-scope trips
|
140
139
|
json_output=''
|
@@ -142,26 +141,22 @@ class TransportNSWv2(object):
|
|
142
141
|
no_valid_journeys = False
|
143
142
|
|
144
143
|
for current_journey_index in range (0, retrieved_journeys, 1):
|
145
|
-
print(current_journey_index)
|
146
144
|
if transport_type == 0:
|
147
145
|
# Just grab the next trip
|
148
146
|
journey = result['journeys'][current_journey_index]
|
149
147
|
next_journey_index = current_journey_index + 1
|
150
148
|
else:
|
151
149
|
# Look for a trip with a matching class filter in at least one of its legs. Either ANY, or the first leg, depending on how strict we're being
|
152
|
-
print ("transport_type = " + str(transport_type))
|
153
150
|
journey, next_journey_index = self.find_next_journey(result['journeys'], current_journey_index, transport_type, strict_transport_type)
|
154
|
-
if (journey is None):
|
155
|
-
print ("Just called find_next_journey")
|
156
|
-
print ("journey is None")
|
157
151
|
|
158
152
|
if ((journey is None) or (journey['legs']) is None):
|
159
|
-
|
160
|
-
|
153
|
+
pass
|
161
154
|
else:
|
162
155
|
legs = journey['legs']
|
163
156
|
first_leg = self.find_first_leg(legs, transport_type, strict_transport_type)
|
164
|
-
|
157
|
+
|
158
|
+
#Executive decision - don't be strict on the last leg, there's often some walking (transport type 100) involved.
|
159
|
+
last_leg = self.find_last_leg(legs, transport_type, False)
|
165
160
|
changes = self.find_changes(legs, transport_type)
|
166
161
|
|
167
162
|
origin = first_leg['origin']
|
@@ -231,7 +226,6 @@ class TransportNSWv2(object):
|
|
231
226
|
|
232
227
|
# Unfortunately we need to do some mucking about for train-based trip_ids
|
233
228
|
# Define the appropriate regular expression to search for - usually just the full text
|
234
|
-
print ( feed.entity[0] )
|
235
229
|
bFindLocation = True
|
236
230
|
|
237
231
|
if origin_mode == 'Train':
|
@@ -308,21 +302,16 @@ class TransportNSWv2(object):
|
|
308
302
|
def find_next_journey(self, journeys, start_journey_index, journeytype, strict):
|
309
303
|
# Fnd the next journey that has a leg of the requested type
|
310
304
|
journey_count = len(journeys)
|
311
|
-
print ("(find_next_journey): start_journey_index = " + str(start_journey_index))
|
312
|
-
print ("(find_next_journey): journey_count = " + str(journey_count))
|
313
305
|
|
314
306
|
# Some basic error checking
|
315
307
|
if start_journey_index > journey_count:
|
316
|
-
print ("None, None")
|
317
308
|
return None, None
|
318
309
|
|
319
310
|
for journey_index in range (start_journey_index, journey_count, 1):
|
320
311
|
leg = self.find_first_leg(journeys[journey_index]['legs'], journeytype, strict)
|
321
312
|
if leg is not None:
|
322
|
-
print ("leg is not None")
|
323
313
|
return journeys[journey_index], journey_index + 1
|
324
314
|
else:
|
325
|
-
print ("leg is None, None")
|
326
315
|
return None, None
|
327
316
|
|
328
317
|
# Hmm, we didn't find one
|
@@ -332,10 +321,8 @@ class TransportNSWv2(object):
|
|
332
321
|
def find_first_leg(self, legs, legtype, strict):
|
333
322
|
# Find the first leg of the requested type
|
334
323
|
leg_count = len(legs)
|
335
|
-
print ("leg_count = " + str(leg_count))
|
336
324
|
for leg_index in range (0, leg_count, 1):
|
337
325
|
leg_class = legs[leg_index]['transportation']['product']['class']
|
338
|
-
print("leg_class = " + str(leg_class))
|
339
326
|
# We've got a filter, and the leg type matches it, so return that leg
|
340
327
|
if legtype != 0 and leg_class == legtype:
|
341
328
|
return legs[leg_index]
|
@@ -349,7 +336,6 @@ class TransportNSWv2(object):
|
|
349
336
|
return None
|
350
337
|
|
351
338
|
# Hmm, we didn't find one
|
352
|
-
print ("Fell through to None")
|
353
339
|
return None
|
354
340
|
|
355
341
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
5
5
|
|
6
6
|
setuptools.setup(
|
7
7
|
name="PyTransportNSWv2",
|
8
|
-
version="0.5.
|
8
|
+
version="0.5.6",
|
9
9
|
author="andystewart999",
|
10
10
|
description="Get detailed per-trip transport information from TransportNSW",
|
11
11
|
long_description=long_description,
|
File without changes
|
File without changes
|
{PyTransportNSWv2-0.5.4 → PyTransportNSWv2-0.5.6}/PyTransportNSWv2.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|