56 </table> |
56 </table> |
57 <h3>Methods</h3> |
57 <h3>Methods</h3> |
58 <table> |
58 <table> |
59 <tr> |
59 <tr> |
60 <td><a href="#AsyncFile.__init__">AsyncFile</a></td> |
60 <td><a href="#AsyncFile.__init__">AsyncFile</a></td> |
61 <td>Constructor</td> |
61 <td>Constructor</td> |
62 </tr><tr> |
62 </tr><tr> |
63 <td><a href="#AsyncFile.__checkMode">__checkMode</a></td> |
63 <td><a href="#AsyncFile.__checkMode">__checkMode</a></td> |
64 <td>Private method to check the mode.</td> |
64 <td>Private method to check the mode.</td> |
65 </tr><tr> |
65 </tr><tr> |
66 <td><a href="#AsyncFile.__nWrite">__nWrite</a></td> |
66 <td><a href="#AsyncFile.__nWrite">__nWrite</a></td> |
67 <td>Private method to write a specific number of pending bytes.</td> |
67 <td>Private method to write a specific number of pending bytes.</td> |
68 </tr><tr> |
68 </tr><tr> |
69 <td><a href="#AsyncFile.close">close</a></td> |
69 <td><a href="#AsyncFile.close">close</a></td> |
70 <td>Public method to close the file.</td> |
70 <td>Public method to close the file.</td> |
71 </tr><tr> |
71 </tr><tr> |
72 <td><a href="#AsyncFile.fileno">fileno</a></td> |
72 <td><a href="#AsyncFile.fileno">fileno</a></td> |
73 <td>Public method returning the file number.</td> |
73 <td>Public method returning the file number.</td> |
74 </tr><tr> |
74 </tr><tr> |
75 <td><a href="#AsyncFile.flush">flush</a></td> |
75 <td><a href="#AsyncFile.flush">flush</a></td> |
76 <td>Public method to write all pending bytes.</td> |
76 <td>Public method to write all pending bytes.</td> |
77 </tr><tr> |
77 </tr><tr> |
78 <td><a href="#AsyncFile.isatty">isatty</a></td> |
78 <td><a href="#AsyncFile.isatty">isatty</a></td> |
79 <td>Public method to indicate whether a tty interface is supported.</td> |
79 <td>Public method to indicate whether a tty interface is supported.</td> |
80 </tr><tr> |
80 </tr><tr> |
81 <td><a href="#AsyncFile.pendingWrite">pendingWrite</a></td> |
81 <td><a href="#AsyncFile.pendingWrite">pendingWrite</a></td> |
82 <td>Public method that returns the number of bytes waiting to be written.</td> |
82 <td>Public method that returns the number of bytes waiting to be written.</td> |
83 </tr><tr> |
83 </tr><tr> |
84 <td><a href="#AsyncFile.read">read</a></td> |
84 <td><a href="#AsyncFile.read">read</a></td> |
85 <td>Public method to read bytes from this file.</td> |
85 <td>Public method to read bytes from this file.</td> |
86 </tr><tr> |
86 </tr><tr> |
87 <td><a href="#AsyncFile.read_p">read_p</a></td> |
87 <td><a href="#AsyncFile.read_p">read_p</a></td> |
88 <td>Public method to read bytes from this file.</td> |
88 <td>Public method to read bytes from this file.</td> |
89 </tr><tr> |
89 </tr><tr> |
90 <td><a href="#AsyncFile.readline">readline</a></td> |
90 <td><a href="#AsyncFile.readline">readline</a></td> |
91 <td>Public method to read one line from this file.</td> |
91 <td>Public method to read one line from this file.</td> |
92 </tr><tr> |
92 </tr><tr> |
93 <td><a href="#AsyncFile.readline_p">readline_p</a></td> |
93 <td><a href="#AsyncFile.readline_p">readline_p</a></td> |
94 <td>Public method to read a line from this file.</td> |
94 <td>Public method to read a line from this file.</td> |
95 </tr><tr> |
95 </tr><tr> |
96 <td><a href="#AsyncFile.readlines">readlines</a></td> |
96 <td><a href="#AsyncFile.readlines">readlines</a></td> |
97 <td>Public method to read all lines from this file.</td> |
97 <td>Public method to read all lines from this file.</td> |
98 </tr><tr> |
98 </tr><tr> |
99 <td><a href="#AsyncFile.seek">seek</a></td> |
99 <td><a href="#AsyncFile.seek">seek</a></td> |
100 <td>Public method to move the filepointer.</td> |
100 <td>Public method to move the filepointer.</td> |
101 </tr><tr> |
101 </tr><tr> |
102 <td><a href="#AsyncFile.tell">tell</a></td> |
102 <td><a href="#AsyncFile.tell">tell</a></td> |
103 <td>Public method to get the filepointer position.</td> |
103 <td>Public method to get the filepointer position.</td> |
104 </tr><tr> |
104 </tr><tr> |
105 <td><a href="#AsyncFile.truncate">truncate</a></td> |
105 <td><a href="#AsyncFile.truncate">truncate</a></td> |
106 <td>Public method to truncate the file.</td> |
106 <td>Public method to truncate the file.</td> |
107 </tr><tr> |
107 </tr><tr> |
108 <td><a href="#AsyncFile.write">write</a></td> |
108 <td><a href="#AsyncFile.write">write</a></td> |
109 <td>Public method to write a string to the file.</td> |
109 <td>Public method to write a string to the file.</td> |
110 </tr><tr> |
110 </tr><tr> |
111 <td><a href="#AsyncFile.writelines">writelines</a></td> |
111 <td><a href="#AsyncFile.writelines">writelines</a></td> |
112 <td>Public method to write a list of strings to the file.</td> |
112 <td>Public method to write a list of strings to the file.</td> |
113 </tr> |
113 </tr> |
114 </table> |
114 </table> |
115 <a NAME="AsyncFile.__init__" ID="AsyncFile.__init__"></a> |
115 <a NAME="AsyncFile.__init__" ID="AsyncFile.__init__"></a> |
116 <h4>AsyncFile (Constructor)</h4> |
116 <h4>AsyncFile (Constructor)</h4> |
117 <b>AsyncFile</b>(<i>sock, mode, name</i>) |
117 <b>AsyncFile</b>(<i>sock, mode, name</i>) |
118 <p> |
118 <p> |
119 Constructor |
119 Constructor |
120 </p><dl> |
120 </p><dl> |
121 <dt><i>sock</i></dt> |
121 <dt><i>sock</i></dt> |
122 <dd> |
122 <dd> |
123 the socket object being wrapped |
123 the socket object being wrapped |
124 </dd><dt><i>mode</i></dt> |
124 </dd><dt><i>mode</i></dt> |
125 <dd> |
125 <dd> |
126 mode of this file (string) |
126 mode of this file (string) |
127 </dd><dt><i>name</i></dt> |
127 </dd><dt><i>name</i></dt> |
128 <dd> |
128 <dd> |
129 name of this file (string) |
129 name of this file (string) |
130 </dd> |
130 </dd> |
131 </dl><a NAME="AsyncFile.__checkMode" ID="AsyncFile.__checkMode"></a> |
131 </dl><a NAME="AsyncFile.__checkMode" ID="AsyncFile.__checkMode"></a> |
132 <h4>AsyncFile.__checkMode</h4> |
132 <h4>AsyncFile.__checkMode</h4> |
133 <b>__checkMode</b>(<i>mode</i>) |
133 <b>__checkMode</b>(<i>mode</i>) |
134 <p> |
134 <p> |
135 Private method to check the mode. |
135 Private method to check the mode. |
136 </p><p> |
136 </p><p> |
137 This method checks, if an operation is permitted according to |
137 This method checks, if an operation is permitted according to |
138 the mode of the file. If it is not, an IOError is raised. |
138 the mode of the file. If it is not, an IOError is raised. |
139 </p><dl> |
139 </p><dl> |
140 <dt><i>mode</i></dt> |
140 <dt><i>mode</i></dt> |
141 <dd> |
141 <dd> |
142 the mode to be checked (string) |
142 the mode to be checked (string) |
143 </dd> |
143 </dd> |
144 </dl><a NAME="AsyncFile.__nWrite" ID="AsyncFile.__nWrite"></a> |
144 </dl><a NAME="AsyncFile.__nWrite" ID="AsyncFile.__nWrite"></a> |
145 <h4>AsyncFile.__nWrite</h4> |
145 <h4>AsyncFile.__nWrite</h4> |
146 <b>__nWrite</b>(<i>n</i>) |
146 <b>__nWrite</b>(<i>n</i>) |
147 <p> |
147 <p> |
148 Private method to write a specific number of pending bytes. |
148 Private method to write a specific number of pending bytes. |
149 </p><dl> |
149 </p><dl> |
150 <dt><i>n</i></dt> |
150 <dt><i>n</i></dt> |
151 <dd> |
151 <dd> |
152 the number of bytes to be written (int) |
152 the number of bytes to be written (int) |
153 </dd> |
153 </dd> |
154 </dl><a NAME="AsyncFile.close" ID="AsyncFile.close"></a> |
154 </dl><a NAME="AsyncFile.close" ID="AsyncFile.close"></a> |
155 <h4>AsyncFile.close</h4> |
155 <h4>AsyncFile.close</h4> |
156 <b>close</b>(<i>closeit=0</i>) |
156 <b>close</b>(<i>closeit=0</i>) |
157 <p> |
157 <p> |
158 Public method to close the file. |
158 Public method to close the file. |
159 </p><dl> |
159 </p><dl> |
160 <dt><i>closeit</i></dt> |
160 <dt><i>closeit</i></dt> |
161 <dd> |
161 <dd> |
162 flag to indicate a close ordered by the debugger code (boolean) |
162 flag to indicate a close ordered by the debugger code (boolean) |
163 </dd> |
163 </dd> |
164 </dl><a NAME="AsyncFile.fileno" ID="AsyncFile.fileno"></a> |
164 </dl><a NAME="AsyncFile.fileno" ID="AsyncFile.fileno"></a> |
165 <h4>AsyncFile.fileno</h4> |
165 <h4>AsyncFile.fileno</h4> |
166 <b>fileno</b>(<i></i>) |
166 <b>fileno</b>(<i></i>) |
167 <p> |
167 <p> |
168 Public method returning the file number. |
168 Public method returning the file number. |
169 </p><dl> |
169 </p><dl> |
170 <dt>Returns:</dt> |
170 <dt>Returns:</dt> |
171 <dd> |
171 <dd> |
172 file number (int) |
172 file number (int) |
173 </dd> |
173 </dd> |
174 </dl><a NAME="AsyncFile.flush" ID="AsyncFile.flush"></a> |
174 </dl><a NAME="AsyncFile.flush" ID="AsyncFile.flush"></a> |
175 <h4>AsyncFile.flush</h4> |
175 <h4>AsyncFile.flush</h4> |
176 <b>flush</b>(<i></i>) |
176 <b>flush</b>(<i></i>) |
177 <p> |
177 <p> |
178 Public method to write all pending bytes. |
178 Public method to write all pending bytes. |
179 </p><a NAME="AsyncFile.isatty" ID="AsyncFile.isatty"></a> |
179 </p><a NAME="AsyncFile.isatty" ID="AsyncFile.isatty"></a> |
180 <h4>AsyncFile.isatty</h4> |
180 <h4>AsyncFile.isatty</h4> |
181 <b>isatty</b>(<i></i>) |
181 <b>isatty</b>(<i></i>) |
182 <p> |
182 <p> |
183 Public method to indicate whether a tty interface is supported. |
183 Public method to indicate whether a tty interface is supported. |
184 </p><dl> |
184 </p><dl> |
185 <dt>Returns:</dt> |
185 <dt>Returns:</dt> |
186 <dd> |
186 <dd> |
187 always false |
187 always false |
188 </dd> |
188 </dd> |
189 </dl><a NAME="AsyncFile.pendingWrite" ID="AsyncFile.pendingWrite"></a> |
189 </dl><a NAME="AsyncFile.pendingWrite" ID="AsyncFile.pendingWrite"></a> |
190 <h4>AsyncFile.pendingWrite</h4> |
190 <h4>AsyncFile.pendingWrite</h4> |
191 <b>pendingWrite</b>(<i></i>) |
191 <b>pendingWrite</b>(<i></i>) |
192 <p> |
192 <p> |
193 Public method that returns the number of bytes waiting to be written. |
193 Public method that returns the number of bytes waiting to be written. |
194 </p><dl> |
194 </p><dl> |
195 <dt>Returns:</dt> |
195 <dt>Returns:</dt> |
196 <dd> |
196 <dd> |
197 the number of bytes to be written (int) |
197 the number of bytes to be written (int) |
198 </dd> |
198 </dd> |
199 </dl><a NAME="AsyncFile.read" ID="AsyncFile.read"></a> |
199 </dl><a NAME="AsyncFile.read" ID="AsyncFile.read"></a> |
200 <h4>AsyncFile.read</h4> |
200 <h4>AsyncFile.read</h4> |
201 <b>read</b>(<i>size=-1</i>) |
201 <b>read</b>(<i>size=-1</i>) |
202 <p> |
202 <p> |
203 Public method to read bytes from this file. |
203 Public method to read bytes from this file. |
204 </p><dl> |
204 </p><dl> |
205 <dt><i>size</i></dt> |
205 <dt><i>size</i></dt> |
206 <dd> |
206 <dd> |
207 maximum number of bytes to be read (int) |
207 maximum number of bytes to be read (int) |
208 </dd> |
208 </dd> |
209 </dl><dl> |
209 </dl><dl> |
210 <dt>Returns:</dt> |
210 <dt>Returns:</dt> |
211 <dd> |
211 <dd> |
212 the bytes read (any) |
212 the bytes read (any) |
213 </dd> |
213 </dd> |
214 </dl><a NAME="AsyncFile.read_p" ID="AsyncFile.read_p"></a> |
214 </dl><a NAME="AsyncFile.read_p" ID="AsyncFile.read_p"></a> |
215 <h4>AsyncFile.read_p</h4> |
215 <h4>AsyncFile.read_p</h4> |
216 <b>read_p</b>(<i>size=-1</i>) |
216 <b>read_p</b>(<i>size=-1</i>) |
217 <p> |
217 <p> |
218 Public method to read bytes from this file. |
218 Public method to read bytes from this file. |
219 </p><dl> |
219 </p><dl> |
220 <dt><i>size</i></dt> |
220 <dt><i>size</i></dt> |
221 <dd> |
221 <dd> |
222 maximum number of bytes to be read (int) |
222 maximum number of bytes to be read (int) |
223 </dd> |
223 </dd> |
224 </dl><dl> |
224 </dl><dl> |
225 <dt>Returns:</dt> |
225 <dt>Returns:</dt> |
226 <dd> |
226 <dd> |
227 the bytes read (any) |
227 the bytes read (any) |
228 </dd> |
228 </dd> |
229 </dl><a NAME="AsyncFile.readline" ID="AsyncFile.readline"></a> |
229 </dl><a NAME="AsyncFile.readline" ID="AsyncFile.readline"></a> |
230 <h4>AsyncFile.readline</h4> |
230 <h4>AsyncFile.readline</h4> |
231 <b>readline</b>(<i>sizehint=-1</i>) |
231 <b>readline</b>(<i>sizehint=-1</i>) |
232 <p> |
232 <p> |
233 Public method to read one line from this file. |
233 Public method to read one line from this file. |
234 </p><dl> |
234 </p><dl> |
235 <dt><i>sizehint</i></dt> |
235 <dt><i>sizehint</i></dt> |
236 <dd> |
236 <dd> |
237 hint of the numbers of bytes to be read (int) |
237 hint of the numbers of bytes to be read (int) |
238 </dd> |
238 </dd> |
239 </dl><dl> |
239 </dl><dl> |
240 <dt>Returns:</dt> |
240 <dt>Returns:</dt> |
241 <dd> |
241 <dd> |
242 one line read (string) |
242 one line read (string) |
243 </dd> |
243 </dd> |
244 </dl><a NAME="AsyncFile.readline_p" ID="AsyncFile.readline_p"></a> |
244 </dl><a NAME="AsyncFile.readline_p" ID="AsyncFile.readline_p"></a> |
245 <h4>AsyncFile.readline_p</h4> |
245 <h4>AsyncFile.readline_p</h4> |
246 <b>readline_p</b>(<i>size=-1</i>) |
246 <b>readline_p</b>(<i>size=-1</i>) |
247 <p> |
247 <p> |
248 Public method to read a line from this file. |
248 Public method to read a line from this file. |
249 </p><p> |
249 </p><p> |
250 <b>Note</b>: This method will not block and may return |
250 <b>Note</b>: This method will not block and may return |
251 only a part of a line if that is all that is available. |
251 only a part of a line if that is all that is available. |
252 </p><dl> |
252 </p><dl> |
253 <dt><i>size</i></dt> |
253 <dt><i>size</i></dt> |
254 <dd> |
254 <dd> |
255 maximum number of bytes to be read (int) |
255 maximum number of bytes to be read (int) |
256 </dd> |
256 </dd> |
257 </dl><dl> |
257 </dl><dl> |
258 <dt>Returns:</dt> |
258 <dt>Returns:</dt> |
259 <dd> |
259 <dd> |
260 one line of text up to size bytes (string) |
260 one line of text up to size bytes (string) |
261 </dd> |
261 </dd> |
262 </dl><a NAME="AsyncFile.readlines" ID="AsyncFile.readlines"></a> |
262 </dl><a NAME="AsyncFile.readlines" ID="AsyncFile.readlines"></a> |
263 <h4>AsyncFile.readlines</h4> |
263 <h4>AsyncFile.readlines</h4> |
264 <b>readlines</b>(<i>sizehint=-1</i>) |
264 <b>readlines</b>(<i>sizehint=-1</i>) |
265 <p> |
265 <p> |
266 Public method to read all lines from this file. |
266 Public method to read all lines from this file. |
267 </p><dl> |
267 </p><dl> |
268 <dt><i>sizehint</i></dt> |
268 <dt><i>sizehint</i></dt> |
269 <dd> |
269 <dd> |
270 hint of the numbers of bytes to be read (int) |
270 hint of the numbers of bytes to be read (int) |
271 </dd> |
271 </dd> |
272 </dl><dl> |
272 </dl><dl> |
273 <dt>Returns:</dt> |
273 <dt>Returns:</dt> |
274 <dd> |
274 <dd> |
275 list of lines read (list of strings) |
275 list of lines read (list of strings) |
276 </dd> |
276 </dd> |
277 </dl><a NAME="AsyncFile.seek" ID="AsyncFile.seek"></a> |
277 </dl><a NAME="AsyncFile.seek" ID="AsyncFile.seek"></a> |
278 <h4>AsyncFile.seek</h4> |
278 <h4>AsyncFile.seek</h4> |
279 <b>seek</b>(<i>offset, whence=0</i>) |
279 <b>seek</b>(<i>offset, whence=0</i>) |
280 <p> |
280 <p> |
281 Public method to move the filepointer. |
281 Public method to move the filepointer. |
282 </p><dl> |
282 </p><dl> |
283 <dt>Raises <b>IOError</b>:</dt> |
283 <dt>Raises <b>IOError</b>:</dt> |
284 <dd> |
284 <dd> |
285 This method is not supported and always raises an |
285 This method is not supported and always raises an |
286 IOError. |
286 IOError. |
287 </dd> |
287 </dd> |
288 </dl><a NAME="AsyncFile.tell" ID="AsyncFile.tell"></a> |
288 </dl><a NAME="AsyncFile.tell" ID="AsyncFile.tell"></a> |
289 <h4>AsyncFile.tell</h4> |
289 <h4>AsyncFile.tell</h4> |
290 <b>tell</b>(<i></i>) |
290 <b>tell</b>(<i></i>) |
291 <p> |
291 <p> |
292 Public method to get the filepointer position. |
292 Public method to get the filepointer position. |
293 </p><dl> |
293 </p><dl> |
294 <dt>Raises <b>IOError</b>:</dt> |
294 <dt>Raises <b>IOError</b>:</dt> |
295 <dd> |
295 <dd> |
296 This method is not supported and always raises an |
296 This method is not supported and always raises an |
297 IOError. |
297 IOError. |
298 </dd> |
298 </dd> |
299 </dl><a NAME="AsyncFile.truncate" ID="AsyncFile.truncate"></a> |
299 </dl><a NAME="AsyncFile.truncate" ID="AsyncFile.truncate"></a> |
300 <h4>AsyncFile.truncate</h4> |
300 <h4>AsyncFile.truncate</h4> |
301 <b>truncate</b>(<i>size=-1</i>) |
301 <b>truncate</b>(<i>size=-1</i>) |
302 <p> |
302 <p> |
303 Public method to truncate the file. |
303 Public method to truncate the file. |
304 </p><dl> |
304 </p><dl> |
305 <dt>Raises <b>IOError</b>:</dt> |
305 <dt>Raises <b>IOError</b>:</dt> |
306 <dd> |
306 <dd> |
307 This method is not supported and always raises an |
307 This method is not supported and always raises an |
308 IOError. |
308 IOError. |
309 </dd> |
309 </dd> |
310 </dl><a NAME="AsyncFile.write" ID="AsyncFile.write"></a> |
310 </dl><a NAME="AsyncFile.write" ID="AsyncFile.write"></a> |
311 <h4>AsyncFile.write</h4> |
311 <h4>AsyncFile.write</h4> |
312 <b>write</b>(<i>s</i>) |
312 <b>write</b>(<i>s</i>) |
313 <p> |
313 <p> |
314 Public method to write a string to the file. |
314 Public method to write a string to the file. |
315 </p><dl> |
315 </p><dl> |
316 <dt><i>s</i></dt> |
316 <dt><i>s</i></dt> |
317 <dd> |
317 <dd> |
318 bytes to be written (string) |
318 bytes to be written (string) |
319 </dd> |
319 </dd> |
320 </dl><a NAME="AsyncFile.writelines" ID="AsyncFile.writelines"></a> |
320 </dl><a NAME="AsyncFile.writelines" ID="AsyncFile.writelines"></a> |
321 <h4>AsyncFile.writelines</h4> |
321 <h4>AsyncFile.writelines</h4> |
322 <b>writelines</b>(<i>list</i>) |
322 <b>writelines</b>(<i>list</i>) |
323 <p> |
323 <p> |
324 Public method to write a list of strings to the file. |
324 Public method to write a list of strings to the file. |
325 </p><dl> |
325 </p><dl> |
326 <dt><i>list</i></dt> |
326 <dt><i>list</i></dt> |
327 <dd> |
327 <dd> |
328 the list to be written (list of string) |
328 the list to be written (list of string) |
329 </dd> |
329 </dd> |
330 </dl> |
330 </dl> |
331 <div align="right"><a href="#top">Up</a></div> |
331 <div align="right"><a href="#top">Up</a></div> |
332 <hr /><hr /> |
332 <hr /><hr /> |
333 <a NAME="AsyncPendingWrite" ID="AsyncPendingWrite"></a> |
333 <a NAME="AsyncPendingWrite" ID="AsyncPendingWrite"></a> |
334 <h2>AsyncPendingWrite</h2> |
334 <h2>AsyncPendingWrite</h2> |
335 <b>AsyncPendingWrite</b>(<i>file</i>) |
335 <b>AsyncPendingWrite</b>(<i>file</i>) |
336 <p> |
336 <p> |
337 Module function to check for data to be written. |
337 Module function to check for data to be written. |
338 </p><dl> |
338 </p><dl> |
339 <dt><i>file</i></dt> |
339 <dt><i>file</i></dt> |
340 <dd> |
340 <dd> |
341 The file object to be checked (file) |
341 The file object to be checked (file) |
342 </dd> |
342 </dd> |
343 </dl><dl> |
343 </dl><dl> |
344 <dt>Returns:</dt> |
344 <dt>Returns:</dt> |
345 <dd> |
345 <dd> |
346 Flag indicating if there is data wating (int) |
346 Flag indicating if there is data wating (int) |
347 </dd> |
347 </dd> |
348 </dl> |
348 </dl> |
349 <div align="right"><a href="#top">Up</a></div> |
349 <div align="right"><a href="#top">Up</a></div> |
350 <hr /> |
350 <hr /> |
351 </body></html> |
351 </body></html> |