Example #1
0
route_ids_for_idx = []
route_attributes = []
agency_offsets = []
shortname_offsets = []
headsign_offsets = []
productcategory_offsets = []
idx_for_agency = {}
loc_for_headsign = {}
headsigncount = 0
idx_for_shortname = {}
idx_for_productcategory = {}
for route in route_for_idx:
    exemplar_trip = route.trip_ids[0]
    #  executemany
    productcategory = ''
    rid, headsign, agency, short_name, long_name, mode = db.tripinfo(
        exemplar_trip)
    if (headsign is None):
        headsign = ''
    route_ids_for_idx.append(rid)
    route_attributes.append(1 << mode)

    agency = agency or '__DEFAULT__'
    headsign = headsign or ''
    short_name = short_name or ''
    productcategory = productcategory or ''
    if agency in idx_for_agency:
        agency_offset = idx_for_agency[agency]
    else:
        agency_offset = len(idx_for_agency)
        idx_for_agency[agency] = agency_offset
    agency_offsets.append(agency_offset)
Example #2
0
route_ids_for_idx = []
route_attributes = []
agency_offsets = []
shortname_offsets = []
headsign_offsets = []
productcategory_offsets = []
idx_for_agency = {}
loc_for_headsign = {}
headsigncount = 0
idx_for_shortname = {}
idx_for_productcategory = {}
for route in route_for_idx :
    exemplar_trip = route.trip_ids[0]
    #  executemany
    productcategory = ''
    rid, headsign, agency, short_name, long_name, mode = db.tripinfo(exemplar_trip)
    if (headsign is None) :
        headsign = ''
    route_ids_for_idx.append(rid)
    route_attributes.append(1 << mode)

    agency = agency or '__DEFAULT__'
    headsign = headsign or ''
    short_name = short_name or ''
    productcategory = productcategory or ''
    if agency in idx_for_agency:
        agency_offset = idx_for_agency[agency]
    else:
        agency_offset = len(idx_for_agency)
        idx_for_agency[agency] = agency_offset
    agency_offsets.append(agency_offset)