示例#1
0
        nameloc = namesize
        nameloc_for_name[name] = nameloc
        namesize += 1 + len(name)
    nameloc_for_idx.append(nameloc)
    if name not in stopnames:
        stopnames.add(name)
        cur.execute('INSERT INTO stops_fts VALUES (?,?)', (idx, name))
    idx += 1
nstops = idx
assert len(nameloc_for_idx) == idx
conn.commit()
conn.close()
del stopnames

print "building trip bundles"
all_routes = db.compile_trip_bundles(reporter=sys.stdout)  # slow call
# A route ("TripBundle") may have many service_ids, and often runs only some days or none at all.
# Throw out routes and trips that do not occur during this calendar period,
# and record active-days-bitmasks for each route, allowing us to filter out inactive routes on a specific search day.
route_mask_for_idx = [
]  # one active-days-bitmask for each route (bundle of trips)
route_for_idx = []
route_n_stops = []  # number of stops in each route
route_n_trips = []  # number of trips in each route
route_min_time = []
route_max_time = []
n_trips_total = 0
n_trips_removed = 0
n_routes_removed = 0
for route in all_routes:
    route_mask = 0
示例#2
0
文件: timetable.py 项目: Medusis/rrrr
        nameloc = namesize
        nameloc_for_name[name] = nameloc
        namesize += 1 + len(name)
    nameloc_for_idx.append(nameloc)
    if name not in stopnames:
        stopnames.add(name)
        cur.execute('INSERT INTO stops_fts VALUES (?,?)',(idx,name))
    idx += 1
nstops = idx
assert len(nameloc_for_idx) == idx
conn.commit()
conn.close()
del stopnames
    
print "building trip bundles"
all_routes = db.compile_trip_bundles(reporter=sys.stdout) # slow call
# A route ("TripBundle") may have many service_ids, and often runs only some days or none at all.
# Throw out routes and trips that do not occur during this calendar period,
# and record active-days-bitmasks for each route, allowing us to filter out inactive routes on a specific search day.
route_mask_for_idx = [] # one active-days-bitmask for each route (bundle of trips)
route_for_idx = []
route_n_stops = [] # number of stops in each route
route_n_trips = [] # number of trips in each route
route_min_time = []
route_max_time = []
n_trips_total = 0
n_trips_removed = 0
n_routes_removed = 0
for route in all_routes :
    route_mask = 0
    running_trip_ids = []