Example #1
0
def v4plus(list):
    """At V4 we turned the direction of pt defiance around"""
    newlist = []
    for x in list:
        if x.name in ("pt defiance-vashon", "vashon-pt defiance"):
            newlist.append(CurrentSchedule.schedule(x.name, "w" if x.direction == "e" else "e", x.dow, x.text))
        else:
            newlist.append(x)
    return newlist
Example #2
0
def getSpecial(version):
    """Return a schedule just for today.  Originally this feature only returned special schedules
	on holidays, but now we return today's schedule every day, which allows us to correctly show times
	for non-canonical days."""
    # Further note: we could check whether today's schedule really is special (is different from the canonical)
    # but why bother?  We just return it.

    dow = date.today().weekday()
    holidayRoutes = CurrentSchedule.holidayRoutes()
    specialList = []
    for x in CurrentSchedule.CurrentSchedule:
        if x.name in holidayRoutes:  # for holiday routes, use the Sunday schedule
            if x.dow == 6:
                specialList.append(x)
        elif x.dow == dow:
            specialList.append(x)

    return textify(versionify(specialList, version), False)
Example #3
0
import CurrentSchedule
import CalcSchedule

# I tried using unittest, wasn't working probably due to python version issues.
# rather than debug, just manually hack together sufficient for now
# TODO: convert to real testing platform, stop overwriting global vars in other files...

# two schedule items, one weekday one weekend, one east one west
smallist = (CurrentSchedule.schedule('bainbridge','e',6,'320,425,525,575,625'), CurrentSchedule.schedule('edmonds','w',0,'335,380,430'))
# ditto, with pt defiance
ptdeflist = (CurrentSchedule.schedule('vashon-pt defiance','w',6,'380,430'), CurrentSchedule.schedule('pt defiance-vashon','e',0,'305,355'))
# bigger list with complete dow for two routes
biglist = (
    CurrentSchedule.schedule('bainbridge','w',0,'330,370,425'),
    CurrentSchedule.schedule('bainbridge','w',1,'475,525,575'),
    CurrentSchedule.schedule('bainbridge','w',2,'575,640'),
    CurrentSchedule.schedule('bainbridge','w',3,'640,685,740'),
    CurrentSchedule.schedule('bainbridge','w',4,'790,845,900'),
    CurrentSchedule.schedule('bainbridge','w',5,'900,945,1000'),
    CurrentSchedule.schedule('bainbridge','w',6,'1000,1050,1100'),
    CurrentSchedule.schedule('bainbridge','e',0,'285,320,380'),
    CurrentSchedule.schedule('bainbridge','e',1,'425,475'),
    CurrentSchedule.schedule('bainbridge','e',2,'525,580,625'),
    CurrentSchedule.schedule('bainbridge','e',3,'625,690'),
    CurrentSchedule.schedule('bainbridge','e',4,'740,790'),
    CurrentSchedule.schedule('bainbridge','e',5,'790,845,895,950'),
    CurrentSchedule.schedule('bainbridge','e',6,'995,1050,1110'),
    CurrentSchedule.schedule('edmonds','w',0,'335,380,430'),
    CurrentSchedule.schedule('edmonds','w',1,'475,530,580'),
    CurrentSchedule.schedule('edmonds','w',2,'630,670'),
    CurrentSchedule.schedule('edmonds','w',3,'725,760,820'),
Example #4
0
def v2interpolate(list):
    """V2 clients leave off the first two times, so put dummy ones in"""
    return [CurrentSchedule.schedule(x.name, x.direction, x.dow, "200,201," + x.text) for x in list]