@@ -5,29 +5,11 @@ def parse_route_id(feed, route_id, trip_id, otp_data):
5
5
if len (route_id ) > 5 and (route_id [- 5 :] == "47374" or route_id [- 5 :] == "56920" ):
6
6
return route_id [0 :- 5 ]
7
7
return route_id [0 :- 4 ]
8
- elif feed == "OULU" :
9
- feed_scoped_id = "OULU:" + trip_id
10
- if otp_data == None or feed_scoped_id not in otp_data :
11
- return ""
12
- return otp_data [feed_scoped_id ]["route" ]["gtfsId" ].split (':' )[1 ]
13
8
return route_id
14
9
15
- def parse_direction_id (feed , direction_id , trip_id , otp_data ):
16
- if feed == "OULU" :
17
- feed_scoped_id = "OULU:" + trip_id
18
- if otp_data == None or feed_scoped_id not in otp_data :
19
- return ""
20
- return str (otp_data [feed_scoped_id ]["pattern" ]["directionId" ])
21
- return direction_id
22
-
23
10
def parse_short_name (feed , trip_id , route_id , otp_data ):
24
11
if otp_data == None :
25
12
return ""
26
- elif feed == "OULU" :
27
- feed_scoped_id = "OULU:" + trip_id
28
- if feed_scoped_id not in otp_data :
29
- return ""
30
- return otp_data [feed_scoped_id ]["route" ]["shortName" ]
31
13
32
14
feed_scoped_id = feed + ":" + route_id
33
15
if feed_scoped_id not in otp_data :
@@ -37,11 +19,6 @@ def parse_short_name(feed, trip_id, route_id, otp_data):
37
19
def parse_color (feed , trip_id , route_id , otp_data ):
38
20
if otp_data == None :
39
21
return ""
40
- elif feed == "OULU" :
41
- feed_scoped_id = "OULU:" + trip_id
42
- if feed_scoped_id not in otp_data :
43
- return ""
44
- return otp_data [feed_scoped_id ]["route" ]["color" ] or ""
45
22
46
23
feed_scoped_id = feed + ":" + route_id
47
24
if feed_scoped_id not in otp_data :
@@ -51,44 +28,21 @@ def parse_color(feed, trip_id, route_id, otp_data):
51
28
def parse_mode (feed , trip_id , route_id , otp_data ):
52
29
if otp_data == None :
53
30
return ""
54
- elif feed == "OULU" :
55
- feed_scoped_id = "OULU:" + trip_id
56
- if feed_scoped_id not in otp_data :
57
- return ""
58
- return otp_data [feed_scoped_id ]["route" ]["mode" ] or ""
59
31
60
32
feed_scoped_id = feed + ":" + route_id
61
33
if feed_scoped_id not in otp_data :
62
34
return ""
63
35
return otp_data [feed + ":" + route_id ]["mode" ] or ""
64
36
65
37
def get_OTP_query (feed ):
66
- if feed == "OULU" :
67
- return """
68
- {
69
- trips(feeds: [\" OULU\" ]) {
70
- route {
71
- shortName
72
- gtfsId
73
- color
74
- mode
75
- }
76
- gtfsId
77
- pattern {
78
- directionId
79
- }
80
- }
81
- }
82
- """
83
- else :
84
- return """
85
- {
86
- routes(feeds: [\" %s\" ]) {
87
- gtfsId
88
- shortName
89
- color
90
- mode
91
- }
38
+ return """
39
+ {
40
+ routes(feeds: [\" %s\" ]) {
41
+ gtfsId
42
+ shortName
43
+ color
44
+ mode
92
45
}
93
- """ % feed
46
+ }
47
+ """ % feed
94
48
0 commit comments