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