src/eric7/Documentation/Source/eric7.DebugClients.Python.AsyncFile.html

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

eric ide

mercurial