當前位置: 首頁>>代碼示例>>Python>>正文


Python Schedule.getstop方法代碼示例

本文整理匯總了Python中schedule.Schedule.getstop方法的典型用法代碼示例。如果您正苦於以下問題:Python Schedule.getstop方法的具體用法?Python Schedule.getstop怎麽用?Python Schedule.getstop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在schedule.Schedule的用法示例。


在下文中一共展示了Schedule.getstop方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: form

# 需要導入模塊: from schedule import Schedule [as 別名]
# 或者: from schedule.Schedule import getstop [as 別名]
def form(request) :
    sched = Schedule(DBSession)
    stop_id = request.matchdict.get("stop_id", "").upper()
    stop = sched.getstop(stop_id)
    q = sched.stop_form(stop_id)
    ret = calc_form(q)
    return {'stop': stop, 'date': date.today(), 'routedirs': ret['sd'], 'stops': ret['ss']}
開發者ID:philippechataignon,項目名稱:easytan,代碼行數:9,代碼來源:views.py

示例2: json_hor

# 需要導入模塊: from schedule import Schedule [as 別名]
# 或者: from schedule.Schedule import getstop [as 別名]
def json_hor(request):
    sched = Schedule(DBSession)
    stop_id = request.GET.get("stop_id").strip().upper()
    stop = sched.getstop(stop_id)
    if stop is None :
        data = {}
    else :
        if stop.is_station :
            liste_stops = stop.child_stations
        else :
            liste_stops = [stop]
        d = request.GET.get("date")
        if d is None :
            ddate = date.today()
        else :
            d = d.replace('-','')
            ddate = date(int(d[4:8]), int(d[2:4]), int(d[0:2]))
        routedir_id = request.GET.get("routedir_id")
        print "route:", routedir_id
        if routedir_id is None or routedir_id == 'ALL' :
            route_id = None
            direction_id = None
        else:
            route_id, direction_id = routedir_id.split('#')
        trips = sched.horaire(liste_stops, d=ddate, route_id=route_id, direction_id=direction_id)
        data = [{'heure': h.departure,
            'ligne': t.route.route_short_name,
            'sens': 'gauche' if t.direction_id == 1 else 'droite',
            'terminus': t.terminus.stop_name,
            'stop': h.stop_id,
            'trip_id': t.trip_id
            } for (h, t) in trips]
    head =['Heure', 'Ligne', 'Sens', 'Terminus', 'Arrêt']
    return {'head':head, 'data':data}
開發者ID:philippechataignon,項目名稱:easytan,代碼行數:36,代碼來源:views.py

示例3: accueil

# 需要導入模塊: from schedule import Schedule [as 別名]
# 或者: from schedule.Schedule import getstop [as 別名]
def accueil(request) :
    route = request.matched_route.name
    if route in ('index', 'accueil') :
        return {}
    else :
        sched = Schedule(DBSession)
        stop_id = request.matchdict.get("stop_id", "").upper()
        stop = sched.getstop(stop_id)
        return {'stop': stop}
開發者ID:philippechataignon,項目名稱:easytan,代碼行數:11,代碼來源:views.py

示例4: json_stop

# 需要導入模塊: from schedule import Schedule [as 別名]
# 或者: from schedule.Schedule import getstop [as 別名]
def json_stop(request):
    sched = Schedule(DBSession)
    stop_id = request.GET.get("stop_id")
    stop = sched.getstop(stop_id)
    if stop :
        return {'id':stop.stop_id, 'name':stop.stop_name, 'commune':stop.stop_desc,
                'location_type':stop.location_type, 'parent_station': stop.parent_station,
                'lat': stop.stop_lat, 'long': stop.stop_lon,
            }
    else :
        return {'id':None, 'name':None, 'commune':None,
                'location_type':None, 'parent_station': None,
                'lat': None, 'long': None,
            }
開發者ID:philippechataignon,項目名稱:easytan,代碼行數:16,代碼來源:views.py


注:本文中的schedule.Schedule.getstop方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。