| Home | Trees | Index | Help |
|
|---|
| Module flightCal |
|
flightCal -- make hCalendar from text flight info
Note: we use str.rsplit() which is new in python2.4
Run a la:
python2.4 title <flightinfo.txt >flightinfo.html
where flightinfo.txt is a text flight itinerary in a format produced, I think, by sabre.
The examples in the docstrings below are executable doctest unit tests. Check them a la:
python flightCal.py --test
This module is documented in rst format for use with epydoc.
Version:
$Revision: 1.1 $ of $Date: 2006/03/08 06:50:28 $
Author:
Copyright:
W3C Open Source License Share and enjoy.
| Function Summary | |
|---|---|
| |
convert(lines,
w)
| |
endDoc(w)
| |
eventRow(w,
when,
arlv,
fltinfo)
| |
| |
| |
| |
split lines in to (ddmmyy, day, daylines) tuples | |
split daylines into AR/LV events | |
startDoc(w,
title)
| |
note: we assume post-y2k dates and local time | |
| Variable Summary | |
|---|---|
str |
__version__ = '$Id: flightCal.py,v 1.8 2006/03/08 05:50:...
|
str |
TestData = '\n 25 FEB 06 - SATURDAY\n AIR AMERICA...
|
| Function Details |
|---|
arLine(ln)
>>> arLine("AR CHICAGO OHARE 645P NON-STOP")
('AR', 'CHICAGO OHARE', '645P', 'NON-STOP')
|
flightLine(ln)
>>> flightLine("AIR AMERICAN AIRLINES FLT:1557 ECONOMY")
('AMERICAN AIRLINES', 'FLT:1557', 'ECONOMY')
>>> flightLine("AIR AMERICAN AIRLINES FLT:98 ECONOMY MULTI MEALS")
('AMERICAN AIRLINES', 'FLT:98', 'ECONOMY MULTI MEALS')
|
fltlink(carrier, num)
>>> fltlink('AMERICAN AIRLINES', '1557')
'https://bwi.flightview.com/fvSabreVT/fvCPL.exe?vthost=1W&acid=1557&qtype=htm&AL=AA&Find1=Track+Flight'
|
lvLine(ln)
>>> lvLine("LV KANSAS CITY INTL 512P EQP: MD-80")
('LV', 'KANSAS CITY INTL', '512P', 'MD-80')
|
splitDays(lines)split lines in to (ddmmyy, day, daylines) tuples
>>> len(list(splitDays(TestData.split("\n"))))
2
>>> len(splitDays(TestData.split("\n")).next()[2])
10
>>> splitDays(TestData.split("\n")).next()[0]
'25 FEB 06'
>>> i = splitDays(TestData.split("\n")); dummy=i.next(); i.next()[0]
'26 FEB 06'
|
splitEvents(ddmmyy, day, lines, carrier=None, flt=None, cls=None)split daylines into AR/LV events
>>> days = splitDays(TestData.split("\n")); \
... ddmmyy, day, lines = days.next(); \
... events = splitEvents(ddmmyy, day, lines); \
... events.next()[3]
('AMERICAN AIRLINES', 'FLT:1557', 'ECONOMY', None, None)
>>> days = splitDays(TestData.split("\n")); \
... ddmmyy, day, lines = days.next(); \
... events = splitEvents(ddmmyy, day, lines); \
... d=events.next(),events.next(); events.next()[3]
('AMERICAN AIRLINES', 'FLT:98', 'ECONOMY MULTI MEALS', None, None)
|
whenElt(ddmmyy, hhmm, elt='abbr', prop='dtstart')
>>> whenElt("04 MAR 06", "423P")
"<abbr class='dtstart' title='2006-03-04T16:23:00'>423P</abbr>"
note: we assume post-y2k dates and local time |
| Variable Details |
|---|
__version__
|
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 2.1 on Wed Mar 8 00:49:20 2006 | http://epydoc.sf.net |