136 <h4>AsyncFile (Constructor)</h4> |
133 <h4>AsyncFile (Constructor)</h4> |
137 <b>AsyncFile</b>(<i>sock, mode, name</i>) |
134 <b>AsyncFile</b>(<i>sock, mode, name</i>) |
138 <p> |
135 <p> |
139 Constructor |
136 Constructor |
140 </p><dl> |
137 </p><dl> |
141 <dt><i>sock</i></dt> |
138 <dt><i>sock</i> (socket)</dt> |
142 <dd> |
139 <dd> |
143 the socket object being wrapped |
140 the socket object being wrapped |
144 </dd><dt><i>mode</i></dt> |
141 </dd><dt><i>mode</i> (str)</dt> |
145 <dd> |
142 <dd> |
146 mode of this file (string) |
143 mode of this file |
147 </dd><dt><i>name</i></dt> |
144 </dd><dt><i>name</i> (str)</dt> |
148 <dd> |
145 <dd> |
149 name of this file (string) |
146 name of this file |
150 </dd> |
147 </dd> |
151 </dl><a NAME="AsyncFile.__checkMode" ID="AsyncFile.__checkMode"></a> |
148 </dl><a NAME="AsyncFile.__checkMode" ID="AsyncFile.__checkMode"></a> |
152 <h4>AsyncFile.__checkMode</h4> |
149 <h4>AsyncFile.__checkMode</h4> |
153 <b>__checkMode</b>(<i>mode</i>) |
150 <b>__checkMode</b>(<i>mode</i>) |
154 <p> |
151 <p> |
155 Private method to check the mode. |
152 Private method to check the mode. |
156 </p><p> |
153 </p><p> |
157 This method checks, if an operation is permitted according to |
154 This method checks, if an operation is permitted according to |
158 the mode of the file. If it is not, an IOError is raised. |
155 the mode of the file. If it is not, an IOError is raised. |
159 </p><dl> |
156 </p><dl> |
160 <dt><i>mode</i></dt> |
157 <dt><i>mode</i> (string)</dt> |
161 <dd> |
158 <dd> |
162 the mode to be checked (string) |
159 the mode to be checked |
163 </dd> |
160 </dd> |
164 </dl><dl> |
161 </dl><dl> |
165 <dt>Raises <b>IOError</b>:</dt> |
162 <dt>Raises <b>IOError</b>:</dt> |
166 <dd> |
163 <dd> |
167 raised to indicate a bad file descriptor |
164 raised to indicate a bad file descriptor |
168 </dd> |
|
169 </dl><a NAME="AsyncFile.__nWrite" ID="AsyncFile.__nWrite"></a> |
|
170 <h4>AsyncFile.__nWrite</h4> |
|
171 <b>__nWrite</b>(<i>n</i>) |
|
172 <p> |
|
173 Private method to write a specific number of pending bytes. |
|
174 </p><dl> |
|
175 <dt><i>n</i></dt> |
|
176 <dd> |
|
177 the number of bytes to be written (int) |
|
178 </dd> |
165 </dd> |
179 </dl><a NAME="AsyncFile.close" ID="AsyncFile.close"></a> |
166 </dl><a NAME="AsyncFile.close" ID="AsyncFile.close"></a> |
180 <h4>AsyncFile.close</h4> |
167 <h4>AsyncFile.close</h4> |
181 <b>close</b>(<i>closeit=False</i>) |
168 <b>close</b>(<i>closeit=False</i>) |
182 <p> |
169 <p> |
183 Public method to close the file. |
170 Public method to close the file. |
184 </p><dl> |
171 </p><dl> |
185 <dt><i>closeit</i></dt> |
172 <dt><i>closeit</i> (bool)</dt> |
186 <dd> |
173 <dd> |
187 flag to indicate a close ordered by the debugger code |
174 flag to indicate a close ordered by the debugger code |
188 (boolean) |
|
189 </dd> |
175 </dd> |
190 </dl><a NAME="AsyncFile.fileno" ID="AsyncFile.fileno"></a> |
176 </dl><a NAME="AsyncFile.fileno" ID="AsyncFile.fileno"></a> |
191 <h4>AsyncFile.fileno</h4> |
177 <h4>AsyncFile.fileno</h4> |
192 <b>fileno</b>(<i></i>) |
178 <b>fileno</b>(<i></i>) |
193 <p> |
179 <p> |
194 Public method returning the file number. |
180 Public method returning the file number. |
195 </p><dl> |
181 </p><dl> |
196 <dt>Returns:</dt> |
182 <dt>Returns:</dt> |
197 <dd> |
183 <dd> |
198 file number (int) |
184 file number |
|
185 </dd> |
|
186 </dl><dl> |
|
187 <dt>Return Type:</dt> |
|
188 <dd> |
|
189 int |
199 </dd> |
190 </dd> |
200 </dl><a NAME="AsyncFile.flush" ID="AsyncFile.flush"></a> |
191 </dl><a NAME="AsyncFile.flush" ID="AsyncFile.flush"></a> |
201 <h4>AsyncFile.flush</h4> |
192 <h4>AsyncFile.flush</h4> |
202 <b>flush</b>(<i></i>) |
193 <b>flush</b>(<i></i>) |
203 <p> |
194 <p> |
204 Public method to write all pending bytes. |
195 Public method to write all pending entries. |
205 </p><a NAME="AsyncFile.isatty" ID="AsyncFile.isatty"></a> |
196 </p><a NAME="AsyncFile.isatty" ID="AsyncFile.isatty"></a> |
206 <h4>AsyncFile.isatty</h4> |
197 <h4>AsyncFile.isatty</h4> |
207 <b>isatty</b>(<i></i>) |
198 <b>isatty</b>(<i></i>) |
208 <p> |
199 <p> |
209 Public method to indicate whether a tty interface is supported. |
200 Public method to indicate whether a tty interface is supported. |
210 </p><dl> |
201 </p><dl> |
211 <dt>Returns:</dt> |
202 <dt>Returns:</dt> |
212 <dd> |
203 <dd> |
213 always false |
204 always false |
214 </dd> |
205 </dd> |
|
206 </dl><dl> |
|
207 <dt>Return Type:</dt> |
|
208 <dd> |
|
209 bool |
|
210 </dd> |
215 </dl><a NAME="AsyncFile.pendingWrite" ID="AsyncFile.pendingWrite"></a> |
211 </dl><a NAME="AsyncFile.pendingWrite" ID="AsyncFile.pendingWrite"></a> |
216 <h4>AsyncFile.pendingWrite</h4> |
212 <h4>AsyncFile.pendingWrite</h4> |
217 <b>pendingWrite</b>(<i></i>) |
213 <b>pendingWrite</b>(<i></i>) |
218 <p> |
214 <p> |
219 Public method that returns the number of bytes waiting to be written. |
215 Public method that returns the number of strings waiting to be written. |
220 </p><dl> |
216 </p><dl> |
221 <dt>Returns:</dt> |
217 <dt>Returns:</dt> |
222 <dd> |
218 <dd> |
223 the number of bytes to be written (int) |
219 the number of strings to be written |
|
220 </dd> |
|
221 </dl><dl> |
|
222 <dt>Return Type:</dt> |
|
223 <dd> |
|
224 int |
224 </dd> |
225 </dd> |
225 </dl><a NAME="AsyncFile.read" ID="AsyncFile.read"></a> |
226 </dl><a NAME="AsyncFile.read" ID="AsyncFile.read"></a> |
226 <h4>AsyncFile.read</h4> |
227 <h4>AsyncFile.read</h4> |
227 <b>read</b>(<i>size=-1</i>) |
228 <b>read</b>(<i>size=-1</i>) |
228 <p> |
229 <p> |
229 Public method to read bytes from this file. |
230 Public method to read bytes from this file. |
230 </p><dl> |
231 </p><dl> |
231 <dt><i>size</i></dt> |
232 <dt><i>size</i> (int)</dt> |
232 <dd> |
233 <dd> |
233 maximum number of bytes to be read (int) |
234 maximum number of bytes to be read |
234 </dd> |
235 </dd> |
235 </dl><dl> |
236 </dl><dl> |
236 <dt>Returns:</dt> |
237 <dt>Returns:</dt> |
237 <dd> |
238 <dd> |
238 the bytes read (any) |
239 the bytes read |
|
240 </dd> |
|
241 </dl><dl> |
|
242 <dt>Return Type:</dt> |
|
243 <dd> |
|
244 str |
239 </dd> |
245 </dd> |
240 </dl><a NAME="AsyncFile.read_p" ID="AsyncFile.read_p"></a> |
246 </dl><a NAME="AsyncFile.read_p" ID="AsyncFile.read_p"></a> |
241 <h4>AsyncFile.read_p</h4> |
247 <h4>AsyncFile.read_p</h4> |
242 <b>read_p</b>(<i>size=-1</i>) |
248 <b>read_p</b>(<i>size=-1</i>) |
243 <p> |
249 <p> |
244 Public method to read bytes from this file. |
250 Public method to read bytes from this file. |
245 </p><dl> |
251 </p><dl> |
246 <dt><i>size</i></dt> |
252 <dt><i>size</i> (int)</dt> |
247 <dd> |
253 <dd> |
248 maximum number of bytes to be read (int) |
254 maximum number of bytes to be read |
249 </dd> |
255 </dd> |
250 </dl><dl> |
256 </dl><dl> |
251 <dt>Returns:</dt> |
257 <dt>Returns:</dt> |
252 <dd> |
258 <dd> |
253 the bytes read (any) |
259 the bytes read |
|
260 </dd> |
|
261 </dl><dl> |
|
262 <dt>Return Type:</dt> |
|
263 <dd> |
|
264 str |
254 </dd> |
265 </dd> |
255 </dl><a NAME="AsyncFile.readable" ID="AsyncFile.readable"></a> |
266 </dl><a NAME="AsyncFile.readable" ID="AsyncFile.readable"></a> |
256 <h4>AsyncFile.readable</h4> |
267 <h4>AsyncFile.readable</h4> |
257 <b>readable</b>(<i></i>) |
268 <b>readable</b>(<i></i>) |
258 <p> |
269 <p> |
259 Public method to check, if the stream is readable. |
270 Public method to check, if the stream is readable. |
260 </p><dl> |
271 </p><dl> |
261 <dt>Returns:</dt> |
272 <dt>Returns:</dt> |
262 <dd> |
273 <dd> |
263 flag indicating a readable stream (boolean) |
274 flag indicating a readable stream |
|
275 </dd> |
|
276 </dl><dl> |
|
277 <dt>Return Type:</dt> |
|
278 <dd> |
|
279 bool |
264 </dd> |
280 </dd> |
265 </dl><a NAME="AsyncFile.readline" ID="AsyncFile.readline"></a> |
281 </dl><a NAME="AsyncFile.readline" ID="AsyncFile.readline"></a> |
266 <h4>AsyncFile.readline</h4> |
282 <h4>AsyncFile.readline</h4> |
267 <b>readline</b>(<i>sizehint=-1</i>) |
283 <b>readline</b>(<i>sizehint=-1</i>) |
268 <p> |
284 <p> |
269 Public method to read one line from this file. |
285 Public method to read one line from this file. |
270 </p><dl> |
286 </p><dl> |
271 <dt><i>sizehint</i></dt> |
287 <dt><i>sizehint</i> (int)</dt> |
272 <dd> |
288 <dd> |
273 hint of the numbers of bytes to be read (int) |
289 hint of the numbers of bytes to be read |
274 </dd> |
290 </dd> |
275 </dl><dl> |
291 </dl><dl> |
276 <dt>Returns:</dt> |
292 <dt>Returns:</dt> |
277 <dd> |
293 <dd> |
278 one line read (string) |
294 one line read |
|
295 </dd> |
|
296 </dl><dl> |
|
297 <dt>Return Type:</dt> |
|
298 <dd> |
|
299 str |
279 </dd> |
300 </dd> |
280 </dl><a NAME="AsyncFile.readline_p" ID="AsyncFile.readline_p"></a> |
301 </dl><a NAME="AsyncFile.readline_p" ID="AsyncFile.readline_p"></a> |
281 <h4>AsyncFile.readline_p</h4> |
302 <h4>AsyncFile.readline_p</h4> |
282 <b>readline_p</b>(<i>size=-1</i>) |
303 <b>readline_p</b>(<i>size=-1</i>) |
283 <p> |
304 <p> |
284 Public method to read a line from this file. |
305 Public method to read a line from this file. |
285 </p><p> |
306 </p><p> |
286 <b>Note</b>: This method will not block and may return |
307 <b>Note</b>: This method will not block and may return |
287 only a part of a line if that is all that is available. |
308 only a part of a line if that is all that is available. |
288 </p><dl> |
309 </p><dl> |
289 <dt><i>size</i></dt> |
310 <dt><i>size</i> (int)</dt> |
290 <dd> |
311 <dd> |
291 maximum number of bytes to be read (int) |
312 maximum number of bytes to be read |
292 </dd> |
313 </dd> |
293 </dl><dl> |
314 </dl><dl> |
294 <dt>Returns:</dt> |
315 <dt>Returns:</dt> |
295 <dd> |
316 <dd> |
296 one line of text up to size bytes (string) |
317 one line of text up to size bytes |
|
318 </dd> |
|
319 </dl><dl> |
|
320 <dt>Return Type:</dt> |
|
321 <dd> |
|
322 str |
297 </dd> |
323 </dd> |
298 </dl><a NAME="AsyncFile.readlines" ID="AsyncFile.readlines"></a> |
324 </dl><a NAME="AsyncFile.readlines" ID="AsyncFile.readlines"></a> |
299 <h4>AsyncFile.readlines</h4> |
325 <h4>AsyncFile.readlines</h4> |
300 <b>readlines</b>(<i>sizehint=-1</i>) |
326 <b>readlines</b>(<i>sizehint=-1</i>) |
301 <p> |
327 <p> |
302 Public method to read all lines from this file. |
328 Public method to read all lines from this file. |
303 </p><dl> |
329 </p><dl> |
304 <dt><i>sizehint</i></dt> |
330 <dt><i>sizehint</i> (int)</dt> |
305 <dd> |
331 <dd> |
306 hint of the numbers of bytes to be read (int) |
332 hint of the numbers of bytes to be read |
307 </dd> |
333 </dd> |
308 </dl><dl> |
334 </dl><dl> |
309 <dt>Returns:</dt> |
335 <dt>Returns:</dt> |
310 <dd> |
336 <dd> |
311 list of lines read (list of strings) |
337 list of lines read |
|
338 </dd> |
|
339 </dl><dl> |
|
340 <dt>Return Type:</dt> |
|
341 <dd> |
|
342 list of str |
312 </dd> |
343 </dd> |
313 </dl><a NAME="AsyncFile.seek" ID="AsyncFile.seek"></a> |
344 </dl><a NAME="AsyncFile.seek" ID="AsyncFile.seek"></a> |
314 <h4>AsyncFile.seek</h4> |
345 <h4>AsyncFile.seek</h4> |
315 <b>seek</b>(<i>offset, whence=0</i>) |
346 <b>seek</b>(<i>offset, whence=0</i>) |
316 <p> |
347 <p> |
317 Public method to move the filepointer. |
348 Public method to move the filepointer. |
318 </p><dl> |
349 </p><dl> |
319 <dt><i>offset</i></dt> |
350 <dt><i>offset</i> (int)</dt> |
320 <dd> |
351 <dd> |
321 offset to move the filepointer to (integer) |
352 offset to move the filepointer to |
322 </dd><dt><i>whence</i></dt> |
353 </dd><dt><i>whence</i> (int)</dt> |
323 <dd> |
354 <dd> |
324 position the offset relates to |
355 position the offset relates to |
325 </dd> |
356 </dd> |
326 </dl><dl> |
357 </dl><dl> |
327 <dt>Raises <b>IOError</b>:</dt> |
358 <dt>Raises <b>IOError</b>:</dt> |
372 <p> |
408 <p> |
373 Public method to check, if a stream is writable. |
409 Public method to check, if a stream is writable. |
374 </p><dl> |
410 </p><dl> |
375 <dt>Returns:</dt> |
411 <dt>Returns:</dt> |
376 <dd> |
412 <dd> |
377 flag indicating a writable stream (boolean) |
413 flag indicating a writable stream |
|
414 </dd> |
|
415 </dl><dl> |
|
416 <dt>Return Type:</dt> |
|
417 <dd> |
|
418 bool |
378 </dd> |
419 </dd> |
379 </dl><a NAME="AsyncFile.write" ID="AsyncFile.write"></a> |
420 </dl><a NAME="AsyncFile.write" ID="AsyncFile.write"></a> |
380 <h4>AsyncFile.write</h4> |
421 <h4>AsyncFile.write</h4> |
381 <b>write</b>(<i>s</i>) |
422 <b>write</b>(<i>s</i>) |
382 <p> |
423 <p> |
383 Public method to write a string to the file. |
424 Public method to write a string to the file. |
384 </p><dl> |
425 </p><dl> |
385 <dt><i>s</i></dt> |
426 <dt><i>s</i> (str)</dt> |
386 <dd> |
427 <dd> |
387 text to be written (string) |
428 text to be written |
388 </dd> |
429 </dd> |
389 </dl><a NAME="AsyncFile.write_p" ID="AsyncFile.write_p"></a> |
430 </dl><a NAME="AsyncFile.write_p" ID="AsyncFile.write_p"></a> |
390 <h4>AsyncFile.write_p</h4> |
431 <h4>AsyncFile.write_p</h4> |
391 <b>write_p</b>(<i>s</i>) |
432 <b>write_p</b>(<i>s</i>) |
392 <p> |
433 <p> |
393 Public method to write a string to the file. |
434 Public method to write a json-rpc 2.0 coded string to the file. |
394 </p><dl> |
435 </p><dl> |
395 <dt><i>s</i></dt> |
436 <dt><i>s</i> (str)</dt> |
396 <dd> |
437 <dd> |
397 text to be written (string) |
438 text to be written |
398 </dd> |
|
399 </dl><dl> |
|
400 <dt>Raises <b>socket.error</b>:</dt> |
|
401 <dd> |
|
402 raised to indicate too many send attempts |
|
403 </dd> |
439 </dd> |
404 </dl><a NAME="AsyncFile.writelines" ID="AsyncFile.writelines"></a> |
440 </dl><a NAME="AsyncFile.writelines" ID="AsyncFile.writelines"></a> |
405 <h4>AsyncFile.writelines</h4> |
441 <h4>AsyncFile.writelines</h4> |
406 <b>writelines</b>(<i>lines</i>) |
442 <b>writelines</b>(<i>lines</i>) |
407 <p> |
443 <p> |
408 Public method to write a list of strings to the file. |
444 Public method to write a list of strings to the file. |
409 </p><dl> |
445 </p><dl> |
410 <dt><i>lines</i></dt> |
446 <dt><i>lines</i> (list of str)</dt> |
411 <dd> |
447 <dd> |
412 list of texts to be written (list of string) |
448 list of texts to be written |
413 </dd> |
449 </dd> |
414 </dl> |
450 </dl> |
415 <div align="right"><a href="#top">Up</a></div> |
451 <div align="right"><a href="#top">Up</a></div> |
416 <hr /><hr /> |
452 <hr /><hr /> |
417 <a NAME="AsyncPendingWrite" ID="AsyncPendingWrite"></a> |
453 <a NAME="AsyncPendingWrite" ID="AsyncPendingWrite"></a> |
418 <h2>AsyncPendingWrite</h2> |
454 <h2>AsyncPendingWrite</h2> |
419 <b>AsyncPendingWrite</b>(<i>file</i>) |
455 <b>AsyncPendingWrite</b>(<i>file</i>) |
420 <p> |
456 <p> |
421 Module function to check for data to be written. |
457 Module function to check for data to be written. |
422 </p><dl> |
458 </p><dl> |
423 <dt><i>file</i></dt> |
459 <dt><i>file</i> (file)</dt> |
424 <dd> |
460 <dd> |
425 The file object to be checked (file) |
461 The file object to be checked |
426 </dd> |
462 </dd> |
427 </dl><dl> |
463 </dl><dl> |
428 <dt>Returns:</dt> |
464 <dt>Returns:</dt> |
429 <dd> |
465 <dd> |
430 Flag indicating if there is data wating (int) |
466 Flag indicating if there is data waiting |
|
467 </dd> |
|
468 </dl><dl> |
|
469 <dt>Return Type:</dt> |
|
470 <dd> |
|
471 int |
431 </dd> |
472 </dd> |
432 </dl> |
473 </dl> |
433 <div align="right"><a href="#top">Up</a></div> |
474 <div align="right"><a href="#top">Up</a></div> |
434 <hr /> |
475 <hr /> |
435 </body></html> |
476 </body></html> |