main()   B
last analyzed

Complexity

Conditions 5

Size

Total Lines 28

Duplication

Lines 0
Ratio 0 %

Importance

Changes 12
Bugs 0 Features 0
Metric Value
cc 5
c 12
b 0
f 0
dl 0
loc 28
rs 8.0894
1
#!/usr/bin/env python3
2
3
import sys
4
import os
5
6
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
7
sys.path.append(parentdir)
8
9
import nsmaps
10
from nsmaps.station import StationType
11
12
DATA_DIR = './website/nsmaps-data'
13
14
MAX_STATIONS = 60
15
16
TRAVEL_DATETIME = "19-04-2017 08:00"
17
18
19
def main():
20
    stations = nsmaps.station.Stations(DATA_DIR, test=False)
21
22
    major_station_types = (
23
        StationType.megastation,
24
        StationType.knooppuntIntercitystation,
25
        StationType.intercitystation,
26
        StationType.knooppuntSneltreinstation,
27
        StationType.sneltreinstation,
28
        StationType.knooppuntStoptreinstation,
29
        StationType.stoptreinstation
30
    )
31
    stations_options = stations.get_stations_for_types(major_station_types)
32
33
    stations_todo = []
34
35
    n_stations = 0
36
    for station in stations_options:
37
        print(station.get_name())
38
        if n_stations >= MAX_STATIONS:
39
            break
40
        if not station.has_travel_time_data() and station.get_country_code() == 'NL':
41
            print(station.get_travel_time_filepath())
42
            stations_todo.append(station)
43
            n_stations += 1
44
            print(station)
45
46
    stations.create_traveltimes_data(stations_todo, TRAVEL_DATETIME)
47
    # stations.recreate_missing_destinations(timestamp, False)
48
49
if __name__ == "__main__":
50
    main()
51