eric6/Documentation/Source/eric6.DebugClients.Python.AsyncFile.html

branch
eric7
changeset 8312
800c432b34c8
parent 8311
4e8b98454baa
child 8313
dac33c7fce07
equal deleted inserted replaced
8311:4e8b98454baa 8312:800c432b34c8
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.DebugClients.Python.AsyncFile</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body>
22 <a NAME="top" ID="top"></a>
23 <h1>eric6.DebugClients.Python.AsyncFile</h1>
24
25 <p>
26 Module implementing an asynchronous file like socket interface for the
27 debugger.
28 </p>
29 <h3>Global Attributes</h3>
30
31 <table>
32 <tr><td>None</td></tr>
33 </table>
34 <h3>Classes</h3>
35
36 <table>
37
38 <tr>
39 <td><a href="#AsyncFile">AsyncFile</a></td>
40 <td>Class wrapping a socket object with a file interface.</td>
41 </tr>
42 </table>
43 <h3>Functions</h3>
44
45 <table>
46
47 <tr>
48 <td><a href="#AsyncPendingWrite">AsyncPendingWrite</a></td>
49 <td>Module function to check for data to be written.</td>
50 </tr>
51 </table>
52 <hr />
53 <hr />
54 <a NAME="AsyncFile" ID="AsyncFile"></a>
55 <h2>AsyncFile</h2>
56
57 <p>
58 Class wrapping a socket object with a file interface.
59 </p>
60 <h3>Derived from</h3>
61 None
62 <h3>Class Attributes</h3>
63
64 <table>
65 <tr><td>maxtries</td></tr>
66 </table>
67 <h3>Class Methods</h3>
68
69 <table>
70 <tr><td>None</td></tr>
71 </table>
72 <h3>Methods</h3>
73
74 <table>
75
76 <tr>
77 <td><a href="#AsyncFile.__init__">AsyncFile</a></td>
78 <td>Constructor</td>
79 </tr>
80 <tr>
81 <td><a href="#AsyncFile.__checkMode">__checkMode</a></td>
82 <td>Private method to check the mode.</td>
83 </tr>
84 <tr>
85 <td><a href="#AsyncFile.close">close</a></td>
86 <td>Public method to close the file.</td>
87 </tr>
88 <tr>
89 <td><a href="#AsyncFile.fileno">fileno</a></td>
90 <td>Public method returning the file number.</td>
91 </tr>
92 <tr>
93 <td><a href="#AsyncFile.flush">flush</a></td>
94 <td>Public method to write all pending entries.</td>
95 </tr>
96 <tr>
97 <td><a href="#AsyncFile.isatty">isatty</a></td>
98 <td>Public method to indicate whether a tty interface is supported.</td>
99 </tr>
100 <tr>
101 <td><a href="#AsyncFile.pendingWrite">pendingWrite</a></td>
102 <td>Public method that returns the number of strings waiting to be written.</td>
103 </tr>
104 <tr>
105 <td><a href="#AsyncFile.read">read</a></td>
106 <td>Public method to read bytes from this file.</td>
107 </tr>
108 <tr>
109 <td><a href="#AsyncFile.readCommand">readCommand</a></td>
110 <td>Public method to read a length prefixed command string.</td>
111 </tr>
112 <tr>
113 <td><a href="#AsyncFile.read_p">read_p</a></td>
114 <td>Public method to read bytes from this file.</td>
115 </tr>
116 <tr>
117 <td><a href="#AsyncFile.readable">readable</a></td>
118 <td>Public method to check, if the stream is readable.</td>
119 </tr>
120 <tr>
121 <td><a href="#AsyncFile.readline">readline</a></td>
122 <td>Public method to read one line from this file.</td>
123 </tr>
124 <tr>
125 <td><a href="#AsyncFile.readline_p">readline_p</a></td>
126 <td>Public method to read a line from this file.</td>
127 </tr>
128 <tr>
129 <td><a href="#AsyncFile.readlines">readlines</a></td>
130 <td>Public method to read all lines from this file.</td>
131 </tr>
132 <tr>
133 <td><a href="#AsyncFile.seek">seek</a></td>
134 <td>Public method to move the filepointer.</td>
135 </tr>
136 <tr>
137 <td><a href="#AsyncFile.seekable">seekable</a></td>
138 <td>Public method to check, if the stream is seekable.</td>
139 </tr>
140 <tr>
141 <td><a href="#AsyncFile.tell">tell</a></td>
142 <td>Public method to get the filepointer position.</td>
143 </tr>
144 <tr>
145 <td><a href="#AsyncFile.truncate">truncate</a></td>
146 <td>Public method to truncate the file.</td>
147 </tr>
148 <tr>
149 <td><a href="#AsyncFile.writable">writable</a></td>
150 <td>Public method to check, if a stream is writable.</td>
151 </tr>
152 <tr>
153 <td><a href="#AsyncFile.write">write</a></td>
154 <td>Public method to write a string to the file.</td>
155 </tr>
156 <tr>
157 <td><a href="#AsyncFile.write_p">write_p</a></td>
158 <td>Public method to write a json-rpc 2.0 coded string to the file.</td>
159 </tr>
160 <tr>
161 <td><a href="#AsyncFile.writelines">writelines</a></td>
162 <td>Public method to write a list of strings to the file.</td>
163 </tr>
164 </table>
165 <h3>Static Methods</h3>
166
167 <table>
168 <tr><td>None</td></tr>
169 </table>
170
171 <a NAME="AsyncFile.__init__" ID="AsyncFile.__init__"></a>
172 <h4>AsyncFile (Constructor)</h4>
173 <b>AsyncFile</b>(<i>sock, mode, name</i>)
174
175 <p>
176 Constructor
177 </p>
178 <dl>
179
180 <dt><i>sock</i> (socket)</dt>
181 <dd>
182 the socket object being wrapped
183 </dd>
184 <dt><i>mode</i> (str)</dt>
185 <dd>
186 mode of this file
187 </dd>
188 <dt><i>name</i> (str)</dt>
189 <dd>
190 name of this file
191 </dd>
192 </dl>
193 <a NAME="AsyncFile.__checkMode" ID="AsyncFile.__checkMode"></a>
194 <h4>AsyncFile.__checkMode</h4>
195 <b>__checkMode</b>(<i>mode</i>)
196
197 <p>
198 Private method to check the mode.
199 </p>
200 <p>
201 This method checks, if an operation is permitted according to
202 the mode of the file. If it is not, an OSError is raised.
203 </p>
204 <dl>
205
206 <dt><i>mode</i> (string)</dt>
207 <dd>
208 the mode to be checked
209 </dd>
210 </dl>
211 <dl>
212
213 <dt>Raises <b>OSError</b>:</dt>
214 <dd>
215 raised to indicate a bad file descriptor
216 </dd>
217 </dl>
218 <a NAME="AsyncFile.close" ID="AsyncFile.close"></a>
219 <h4>AsyncFile.close</h4>
220 <b>close</b>(<i>closeit=False</i>)
221
222 <p>
223 Public method to close the file.
224 </p>
225 <dl>
226
227 <dt><i>closeit</i> (bool)</dt>
228 <dd>
229 flag to indicate a close ordered by the debugger code
230 </dd>
231 </dl>
232 <a NAME="AsyncFile.fileno" ID="AsyncFile.fileno"></a>
233 <h4>AsyncFile.fileno</h4>
234 <b>fileno</b>(<i></i>)
235
236 <p>
237 Public method returning the file number.
238 </p>
239 <dl>
240 <dt>Return:</dt>
241 <dd>
242 file number
243 </dd>
244 </dl>
245 <dl>
246 <dt>Return Type:</dt>
247 <dd>
248 int
249 </dd>
250 </dl>
251 <a NAME="AsyncFile.flush" ID="AsyncFile.flush"></a>
252 <h4>AsyncFile.flush</h4>
253 <b>flush</b>(<i></i>)
254
255 <p>
256 Public method to write all pending entries.
257 </p>
258 <a NAME="AsyncFile.isatty" ID="AsyncFile.isatty"></a>
259 <h4>AsyncFile.isatty</h4>
260 <b>isatty</b>(<i></i>)
261
262 <p>
263 Public method to indicate whether a tty interface is supported.
264 </p>
265 <dl>
266 <dt>Return:</dt>
267 <dd>
268 always false
269 </dd>
270 </dl>
271 <dl>
272 <dt>Return Type:</dt>
273 <dd>
274 bool
275 </dd>
276 </dl>
277 <a NAME="AsyncFile.pendingWrite" ID="AsyncFile.pendingWrite"></a>
278 <h4>AsyncFile.pendingWrite</h4>
279 <b>pendingWrite</b>(<i></i>)
280
281 <p>
282 Public method that returns the number of strings waiting to be written.
283 </p>
284 <dl>
285 <dt>Return:</dt>
286 <dd>
287 the number of strings to be written
288 </dd>
289 </dl>
290 <dl>
291 <dt>Return Type:</dt>
292 <dd>
293 int
294 </dd>
295 </dl>
296 <a NAME="AsyncFile.read" ID="AsyncFile.read"></a>
297 <h4>AsyncFile.read</h4>
298 <b>read</b>(<i>size=-1</i>)
299
300 <p>
301 Public method to read bytes from this file.
302 </p>
303 <dl>
304
305 <dt><i>size</i> (int)</dt>
306 <dd>
307 maximum number of bytes to be read
308 </dd>
309 </dl>
310 <dl>
311 <dt>Return:</dt>
312 <dd>
313 the bytes read
314 </dd>
315 </dl>
316 <dl>
317 <dt>Return Type:</dt>
318 <dd>
319 str
320 </dd>
321 </dl>
322 <a NAME="AsyncFile.readCommand" ID="AsyncFile.readCommand"></a>
323 <h4>AsyncFile.readCommand</h4>
324 <b>readCommand</b>(<i></i>)
325
326 <p>
327 Public method to read a length prefixed command string.
328 </p>
329 <dl>
330 <dt>Return:</dt>
331 <dd>
332 command string
333 </dd>
334 </dl>
335 <dl>
336 <dt>Return Type:</dt>
337 <dd>
338 str
339 </dd>
340 </dl>
341 <a NAME="AsyncFile.read_p" ID="AsyncFile.read_p"></a>
342 <h4>AsyncFile.read_p</h4>
343 <b>read_p</b>(<i>size=-1</i>)
344
345 <p>
346 Public method to read bytes from this file.
347 </p>
348 <dl>
349
350 <dt><i>size</i> (int)</dt>
351 <dd>
352 maximum number of bytes to be read
353 </dd>
354 </dl>
355 <dl>
356 <dt>Return:</dt>
357 <dd>
358 the bytes read
359 </dd>
360 </dl>
361 <dl>
362 <dt>Return Type:</dt>
363 <dd>
364 str
365 </dd>
366 </dl>
367 <a NAME="AsyncFile.readable" ID="AsyncFile.readable"></a>
368 <h4>AsyncFile.readable</h4>
369 <b>readable</b>(<i></i>)
370
371 <p>
372 Public method to check, if the stream is readable.
373 </p>
374 <dl>
375 <dt>Return:</dt>
376 <dd>
377 flag indicating a readable stream
378 </dd>
379 </dl>
380 <dl>
381 <dt>Return Type:</dt>
382 <dd>
383 bool
384 </dd>
385 </dl>
386 <a NAME="AsyncFile.readline" ID="AsyncFile.readline"></a>
387 <h4>AsyncFile.readline</h4>
388 <b>readline</b>(<i>sizehint=-1</i>)
389
390 <p>
391 Public method to read one line from this file.
392 </p>
393 <dl>
394
395 <dt><i>sizehint</i> (int)</dt>
396 <dd>
397 hint of the numbers of bytes to be read
398 </dd>
399 </dl>
400 <dl>
401 <dt>Return:</dt>
402 <dd>
403 one line read
404 </dd>
405 </dl>
406 <dl>
407 <dt>Return Type:</dt>
408 <dd>
409 str
410 </dd>
411 </dl>
412 <a NAME="AsyncFile.readline_p" ID="AsyncFile.readline_p"></a>
413 <h4>AsyncFile.readline_p</h4>
414 <b>readline_p</b>(<i>size=-1</i>)
415
416 <p>
417 Public method to read a line from this file.
418 </p>
419 <p>
420 <b>Note</b>: This method will not block and may return
421 only a part of a line if that is all that is available.
422 </p>
423 <dl>
424
425 <dt><i>size</i> (int)</dt>
426 <dd>
427 maximum number of bytes to be read
428 </dd>
429 </dl>
430 <dl>
431 <dt>Return:</dt>
432 <dd>
433 one line of text up to size bytes
434 </dd>
435 </dl>
436 <dl>
437 <dt>Return Type:</dt>
438 <dd>
439 str
440 </dd>
441 </dl>
442 <a NAME="AsyncFile.readlines" ID="AsyncFile.readlines"></a>
443 <h4>AsyncFile.readlines</h4>
444 <b>readlines</b>(<i>sizehint=-1</i>)
445
446 <p>
447 Public method to read all lines from this file.
448 </p>
449 <dl>
450
451 <dt><i>sizehint</i> (int)</dt>
452 <dd>
453 hint of the numbers of bytes to be read
454 </dd>
455 </dl>
456 <dl>
457 <dt>Return:</dt>
458 <dd>
459 list of lines read
460 </dd>
461 </dl>
462 <dl>
463 <dt>Return Type:</dt>
464 <dd>
465 list of str
466 </dd>
467 </dl>
468 <a NAME="AsyncFile.seek" ID="AsyncFile.seek"></a>
469 <h4>AsyncFile.seek</h4>
470 <b>seek</b>(<i>offset, whence=0</i>)
471
472 <p>
473 Public method to move the filepointer.
474 </p>
475 <dl>
476
477 <dt><i>offset</i> (int)</dt>
478 <dd>
479 offset to move the filepointer to
480 </dd>
481 <dt><i>whence</i> (int)</dt>
482 <dd>
483 position the offset relates to
484 </dd>
485 </dl>
486 <dl>
487
488 <dt>Raises <b>OSError</b>:</dt>
489 <dd>
490 This method is not supported and always raises an
491 OSError.
492 </dd>
493 </dl>
494 <a NAME="AsyncFile.seekable" ID="AsyncFile.seekable"></a>
495 <h4>AsyncFile.seekable</h4>
496 <b>seekable</b>(<i></i>)
497
498 <p>
499 Public method to check, if the stream is seekable.
500 </p>
501 <dl>
502 <dt>Return:</dt>
503 <dd>
504 flag indicating a seekable stream
505 </dd>
506 </dl>
507 <dl>
508 <dt>Return Type:</dt>
509 <dd>
510 bool
511 </dd>
512 </dl>
513 <a NAME="AsyncFile.tell" ID="AsyncFile.tell"></a>
514 <h4>AsyncFile.tell</h4>
515 <b>tell</b>(<i></i>)
516
517 <p>
518 Public method to get the filepointer position.
519 </p>
520 <dl>
521
522 <dt>Raises <b>OSError</b>:</dt>
523 <dd>
524 This method is not supported and always raises an
525 OSError.
526 </dd>
527 </dl>
528 <a NAME="AsyncFile.truncate" ID="AsyncFile.truncate"></a>
529 <h4>AsyncFile.truncate</h4>
530 <b>truncate</b>(<i>size=-1</i>)
531
532 <p>
533 Public method to truncate the file.
534 </p>
535 <dl>
536
537 <dt><i>size</i> (int)</dt>
538 <dd>
539 size to truncate to
540 </dd>
541 </dl>
542 <dl>
543
544 <dt>Raises <b>OSError</b>:</dt>
545 <dd>
546 This method is not supported and always raises an
547 OSError.
548 </dd>
549 </dl>
550 <a NAME="AsyncFile.writable" ID="AsyncFile.writable"></a>
551 <h4>AsyncFile.writable</h4>
552 <b>writable</b>(<i></i>)
553
554 <p>
555 Public method to check, if a stream is writable.
556 </p>
557 <dl>
558 <dt>Return:</dt>
559 <dd>
560 flag indicating a writable stream
561 </dd>
562 </dl>
563 <dl>
564 <dt>Return Type:</dt>
565 <dd>
566 bool
567 </dd>
568 </dl>
569 <a NAME="AsyncFile.write" ID="AsyncFile.write"></a>
570 <h4>AsyncFile.write</h4>
571 <b>write</b>(<i>s</i>)
572
573 <p>
574 Public method to write a string to the file.
575 </p>
576 <dl>
577
578 <dt><i>s</i> (str, bytes or bytearray)</dt>
579 <dd>
580 text to be written
581 </dd>
582 </dl>
583 <a NAME="AsyncFile.write_p" ID="AsyncFile.write_p"></a>
584 <h4>AsyncFile.write_p</h4>
585 <b>write_p</b>(<i>s</i>)
586
587 <p>
588 Public method to write a json-rpc 2.0 coded string to the file.
589 </p>
590 <dl>
591
592 <dt><i>s</i> (str)</dt>
593 <dd>
594 text to be written
595 </dd>
596 </dl>
597 <a NAME="AsyncFile.writelines" ID="AsyncFile.writelines"></a>
598 <h4>AsyncFile.writelines</h4>
599 <b>writelines</b>(<i>lines</i>)
600
601 <p>
602 Public method to write a list of strings to the file.
603 </p>
604 <dl>
605
606 <dt><i>lines</i> (list of str)</dt>
607 <dd>
608 list of texts to be written
609 </dd>
610 </dl>
611 <div align="right"><a href="#top">Up</a></div>
612 <hr />
613 <hr />
614 <a NAME="AsyncPendingWrite" ID="AsyncPendingWrite"></a>
615 <h2>AsyncPendingWrite</h2>
616 <b>AsyncPendingWrite</b>(<i>file</i>)
617
618 <p>
619 Module function to check for data to be written.
620 </p>
621 <dl>
622
623 <dt><i>file</i> (file)</dt>
624 <dd>
625 The file object to be checked
626 </dd>
627 </dl>
628 <dl>
629 <dt>Return:</dt>
630 <dd>
631 Flag indicating if there is data waiting
632 </dd>
633 </dl>
634 <dl>
635 <dt>Return Type:</dt>
636 <dd>
637 int
638 </dd>
639 </dl>
640 <div align="right"><a href="#top">Up</a></div>
641 <hr />
642 </body></html>

eric ide

mercurial