More network 10 updates
[bus.git] / origin-src / transitfeed-1.2.5 / transitfeed / _transitfeed.pyc
1
maxious 2
3
4 Z
5 ddk Z ddk Z yddk ZWn#ej
6 oddklZnXddkZddkZddkZddkZddkZddkZdZdZdZdZd Zd
7
8
9 Do not import this module directly. Thanks to __init__.py you should do
10 something like:
11
12 import transitfeed
13 schedule = transitfeed.Schedule()
14 ...
15
16 This module is a library to help you create, read and write Google
17 Transit Feed files. Refer to the feed specification, available at
18 http://code.google.com/transit/spec/transit_feed_specification.htm, for a
19 complete description how the transit feed represents a transit schedule. This
20 library supports all required parts of the specification but does not yet
21 support all optional parts. Patches welcome!
22
23 The specification describes several tables such as stops, routes and trips.
24 In a feed file these are stored as comma separeted value files. This library
25 represents each row of these tables with a single Python object. This object has
26 attributes for each value on the row. For example, schedule.AddStop returns a
27 Stop object which has attributes such as stop_lat and stop_name.
28
29 Schedule: Central object of the parser
30 GenericGTFSObject: A base class for each of the objects below
31 Route: Represents a single route
32 Trip: Represents a single trip
33 Stop: Represents a single stop
34 ServicePeriod: Represents a single service, a set of dates
35 Agency: Represents the agency in this feed
36 Transfer: Represents a single transfer rule
37 TimeToSecondsSinceMidnight(): Convert HH:MM:SS into seconds since midnight.
38 FormatSecondsSinceMidnight(s): Formats number of seconds past midnight into a string
39
40 Optionally encode text and return it. The result should be safe to print.
41
42
43
44 an exception object for each problem. Subclasses must implement
45
46
47 Args:
48 file_name: string
49 row_num: int
50 row: list of strings
51 headers: list of column headers, its order corresponding to row's
52
53
54
55
56
57
58
59   c
60
61
62
63
64
65
66
67
68 __module__t__doc__R
69 RRR RRRRRRR R!R7R#R&R(R*R0R5R6RR;R@RARDRIRKRMRORURXR[R\R`(((sI/var/www/busstop/origin-src/transitfeed-1.2.5/transitfeed/_transitfeed.pyRfsF                
70
71 A word-wrap function that preserves existing line breaks
72 and most spaces in the text. Expects that existing line
73 breaks are posix newlines (
74 ).
75
76 Taken from:
77 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/148061
78
79 s
80 ii(tlentrfindtsplit(tlinetwordtwidth((sI/var/www/busstop/origin-src/transitfeed-1.2.5/transitfeed/_transitfeed.pyt<lambda>Ls!t (treduceRj(RRm((sI/var/www/busstop/origin-src/transitfeed-1.2.5/transitfeed/_transitfeed.pyRfBs
81
82 d
83
84 t|_dS(s?Initialize an exception object, saving all keyword arguments in self.
85 context and context2, if present, must be a tuple of (file_name, row_num,
86 row, headers). context2 comes from ProblemReporter.SetFileContext. context
87 was passed in with the keyword arguments. context2 is ignored if context
88 is present.RN(t ExceptionR
89 t__dict__tupdatetContextTupleToDictRt_typeR7(R RRtkwargs((sI/var/www/busstop/origin-src/transitfeed-1.2.5/transitfeed/_transitfeed.pyR
90
91
92
93
94 Args:
95 d: map returned by GetDictToFormat with with formatting added
96 R's%s
97
98
99
100
101 Subclasses should define this if exceptions should be listed in something
102 other than the order they are reported.
103
104 Args:
105 y: object to compare to self
106
107 Returns:
108 An int which is negative if self is more significant than y, 0 if they
109 are similar significance and positive if self is less significant than
110 y. Returning a float won't work.
111
112 Raises:
113 TypeError by default, meaning objects of the type can not be compared.
114
115
116
117
118
119
120
121
122
123
124 (RaRbtFalseR
125
126 startswith(turl((sI/var/www/busstop/origin-src/transitfeed-1.2.5/transitfeed/_transitfeed.pyt
127
128 s$Compute the brightness of an sRGB color using the formula from
129 http://www.w3.org/TR/2000/WD-AERT-20000426#color-contrast.
130
131 Args:
132 color: a string of six hex digits in the format verified by IsValidColor().
133
134 Returns:
135
136
137
138
139 For example "01:02:03" returns 3723. The leading zero of the hours may be
140
141
142
143
144 tdtiti|
145
146
147
148
149
150 s%Object with arbitrary attributes which may be added to a schedule.
151
152 This class should be used as the base class for GTFS objects which may
153 be stored in a Schedule. It defines some methods for reading and writing
154 attributes. If self._schedule is None than the object is not in a Schedule.
155
156 Subclasses must:
157 * define an __init__ method which sets the _schedule member to None or a
158 weakref to a Schedule
159 * Set the _TABLE_NAME class variable to a name such as 'stops', 'agency', ...
160 * define methods to validate objects of that type
161
162
163 This method is only called when name is not found in __dict__.
164
165
166
167
168
169
170
171 Callers may assign arbitrary values to instance attributes.
172 Stop.ParseAttributes validates attributes according to GTFS and converts some
173 into native types. ParseAttributes may delete invalid attributes.
174 Accessing an attribute that is a column in GTFS will return None if this
175 object does not have a value or it is ''.
176 A Stop object acts like a dict with string values.
177
178 Attributes:
179 stop_lat: a float representing the latitude of the stop
180 stop_lon: a float representing the longitude of the stop
181 All other attributes are strings.
182
183
184
185 Args:
186 field_dict: A dictionary mapping attribute name to unicode string
187 lat: a float, ignored when field_dict is present
188 lng: a float, ignored when field_dict is present
189 name: a string, ignored when field_dict is present
190 stop_id: a string, ignored when field_dict is present
191 stop_code: a string, ignored when field_dict is present
192
193
194
195
196 A trip may be in the list multiple times with different index.
197 stop_sequence is an integer.
198
199 Args:
200 schedule: Deprecated, do not use.
201
202
203
204 trip: a Trip object
205 index: an offset in trip.GetStopTimes()
206
207
208
209 time: an integer. It might be interpolated.
210 trip: a Trip object.
211 index: the offset of this stop in trip.GetStopTimes(), which may be
212 different from the stop_sequence.
213 is_timepoint: a bool
214 (RtGetTimeInterpolatedStopsR
215
216
217
218
219
220
221
222
223
224 If value is not valid call problems. Return a new value of the correct type
225 or None if value couldn't be converted.
226
227
228 This method is only called when name is not found in __dict__.
229
230</