Skip to content

Commit 71ca3e0

Browse files
committed
moving old parsing style out, adding tests for the new style
1 parent bb223e9 commit 71ca3e0

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

ssim/regexes.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,14 @@
128128
'\s'
129129
'(?P<days_of_operation>\d{7}){0,1}'
130130
'\s'
131-
'(?P<number_of_seats>\d{3})*'
131+
'(?P<seats>\d{3})*'
132132
'(?P<aircraft_type>\w{3})'
133133
'\s'
134134
'(?P<origin_station>[A-Z0-9]{3}){0,1}'
135135
'(?P<previous_station>[A-Z0-9]{3})'
136-
'(?P<scheduled_time_of_arrival>\d{4})*'
136+
'(?P<scheduled_time_of_arrival_utc>\d{4})*'
137137
'\s'
138-
'(?P<scheduled_time_of_departure>\d{4})*'
138+
'(?P<scheduled_time_of_departure_utc>\d{4})*'
139139
'(?P<overnight_indicator>[0-6]){0,1}'
140140
'(?P<next_station>[A-Z0-9]{3})'
141141
'(?P<destination_station>[A-Z0-9]{3}){0,1}'
@@ -158,12 +158,12 @@
158158
'(?P<days_of_operation>\d{7}){0,1}'
159159
'\s'
160160
'){0,1}'
161-
'(?P<number_of_seats>\d{3})*'
161+
'(?P<seats>\d{3})*'
162162
'(?P<aircraft_type>\w{3})'
163163
'\s'
164164
'(?P<origin_station>[A-Z0-9]{3}){0,1}'
165165
'(?P<previous_station>[A-Z0-9]{3})'
166-
'(?P<scheduled_time_of_arrival>\d{4})*'
166+
'(?P<scheduled_time_of_arrival_utc>\d{4})*'
167167
'\s'
168168
'(?P<arrival_service_type>[A-Z])'
169169
'(?P<frequency_rate>\d){0,1}'
@@ -183,10 +183,10 @@
183183
'(?P<days_of_operation>\d{7})'
184184
'\s'
185185
'){0,1}'
186-
'(?P<number_of_seats>\d{3})*'
186+
'(?P<seats>\d{3})*'
187187
'(?P<aircraft_type>\w{3})'
188188
'\s'
189-
'(?P<scheduled_time_of_departure>\d{4})*'
189+
'(?P<scheduled_time_of_departure_utc>\d{4})*'
190190
'(?P<next_station>[A-Z0-9]{3})'
191191
'(?P<destination_station>[A-Z0-9]{3}){0,1}'
192192
'\s'

ssim/ssim.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,13 @@ def _uniformize_sir(slot):
184184
'service_type': slot['arrival_service_type'],
185185
'days_of_operation': slot['days_of_operation'],
186186
'frequency_rate': slot['frequency_rate'],
187-
'number_of_seats': slot['number_of_seats'],
187+
'seats': slot['seats'],
188188
'second_station': slot['origin_station'],
189189
'period_of_operation_from': slot['period_of_operation_from'],
190190
'period_of_operation_to': slot['period_of_operation_to'],
191191
'station': slot['previous_station'],
192192
'raw': slot['raw'],
193-
'scheduled_time': slot['scheduled_time_of_arrival']})
193+
'scheduled_time': slot['scheduled_time_of_arrival_utc']})
194194

195195
if 'departure_airline_designator' in slot:
196196
uniform_slots.append({
@@ -206,11 +206,11 @@ def _uniformize_sir(slot):
206206
'second_station': slot['destination_station'],
207207
'frequency_rate': slot['frequency_rate'],
208208
'station': slot['next_station'],
209-
'number_of_seats': slot['number_of_seats'],
209+
'seats': slot['seats'],
210210
'period_of_operation_from': slot['period_of_operation_from'],
211211
'period_of_operation_to': slot['period_of_operation_to'],
212212
'raw': slot['raw'],
213-
'scheduled_time': slot['scheduled_time_of_departure']})
213+
'scheduled_time': slot['scheduled_time_of_departure_utc']})
214214

215215
return uniform_slots
216216

@@ -456,4 +456,4 @@ def _explode_aircraft_configuration_string(aircraft_configuration_string: str, r
456456
log_text += '\n Raw slot line: ' + raw_line
457457
logging.warning(log_text)
458458

459-
return acv_info
459+
return acv_info

0 commit comments

Comments
 (0)