Input and output data from Network 10
[bus.git] / origin-src / transitfeed-1.2.5 / transitfeed / _transitfeed.pyc
1
maxious 2
3 Z
4 ddk Z ddk Z yddk ZWn#ej
5 oddklZnXddkZddkZddkZddkZddkZddkZdZdZdZdZd Zd
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 t|_dS(s?Initialize an exception object, saving all keyword arguments in self.
84 context and context2, if present, must be a tuple of (file_name, row_num,
85 row, headers). context2 comes from ProblemReporter.SetFileContext. context
86 was passed in with the keyword arguments. context2 is ignored if context
87 is present.RN(t ExceptionR
88 t__dict__tupdatetContextTupleToDictRt_typeR7(R RRtkwargs((sE/var/www/bus/origin-src/transitfeed-1.2.5/transitfeed/_transitfeed.pyR
89
90
91
92
93 Args:
94 d: map returned by GetDictToFormat with with formatting added
95 R's%s
96
97
98
99
100 Subclasses should define this if exceptions should be listed in something
101 other than the order they are reported.
102
103 Args:
104 y: object to compare to self
105
106 Returns:
107 An int which is negative if self is more significant than y, 0 if they
108 are similar significance and positive if self is less significant than
109 y. Returning a float won't work.
110
111 Raises:
112 TypeError by default, meaning objects of the type can not be compared.
113
114
115
116
117
118
119
120
121
122
123 (RaRbtFalseR
124
125 startswith(turl((sE/var/www/bus/origin-src/transitfeed-1.2.5/transitfeed/_transitfeed.pyt
126
127 s$Compute the brightness of an sRGB color using the formula from
128 http://www.w3.org/TR/2000/WD-AERT-20000426#color-contrast.
129
130 Args:
131 color: a string of six hex digits in the format verified by IsValidColor().
132
133 Returns:
134
135
136
137
138 For example "01:02:03" returns 3723. The leading zero of the hours may be
139
140
141
142
143 tdtiti|
144
145
146
147
148
149 s%Object with arbitrary attributes which may be added to a schedule.
150
151 This class should be used as the base class for GTFS objects which may
152 be stored in a Schedule. It defines some methods for reading and writing
153 attributes. If self._schedule is None than the object is not in a Schedule.
154
155 Subclasses must:
156 * define an __init__ method which sets the _schedule member to None or a
157 weakref to a Schedule
158 * Set the _TABLE_NAME class variable to a name such as 'stops', 'agency', ...
159 * define methods to validate objects of that type
160
161
162 This method is only called when name is not found in __dict__.
163
164
165
166
167
168
169
170 Callers may assign arbitrary values to instance attributes.
171 Stop.ParseAttributes validates attributes according to GTFS and converts some
172 into native types. ParseAttributes may delete invalid attributes.
173 Accessing an attribute that is a column in GTFS will return None if this
174 object does not have a value or it is ''.
175 A Stop object acts like a dict with string values.
176
177 Attributes:
178 stop_lat: a float representing the latitude of the stop
179 stop_lon: a float representing the longitude of the stop
180 All other attributes are strings.
181
182
183
184 Args:
185 field_dict: A dictionary mapping attribute name to unicode string
186 lat: a float, ignored when field_dict is present
187 lng: a float, ignored when field_dict is present
188 name: a string, ignored when field_dict is present
189 stop_id: a string, ignored when field_dict is present
190 stop_code: a string, ignored when field_dict is present
191
192
193
194
195 A trip may be in the list multiple times with different index.
196 stop_sequence is an integer.
197
198 Args:
199 schedule: Deprecated, do not use.
200
201
202
203 trip: a Trip object
204 index: an offset in trip.GetStopTimes()
205
206
207
208 time: an integer. It might be interpolated.
209 trip: a Trip object.
210 index: the offset of this stop in trip.GetStopTimes(), which may be
211 different from the stop_sequence.
212 is_timepoint: a bool
213 (RtGetTimeInterpolatedStopsR
214
215
216
217
218
219
220
221
222
223 If value is not valid call problems. Return a new value of the correct type
224 or None if value couldn't be converted.
225
226
227 This method is only called when name is not found in __dict__.
228
229 q
230