本文整理汇总了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']}
示例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}
示例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}
示例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,
}