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

changeset 5245
e1908fd9deac
child 5264
8bc23ecb4ea3
equal deleted inserted replaced
5244:54a0f215a6f0 5245:e1908fd9deac
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><a NAME="top" ID="top"></a>
22 <h1>eric6.DebugClients.Python.AsyncFile</h1>
23 <p>
24 Module implementing an asynchronous file like socket interface for the
25 debugger.
26 </p>
27 <h3>Global Attributes</h3>
28 <table>
29 <tr><td>None</td></tr>
30 </table>
31 <h3>Classes</h3>
32 <table>
33 <tr>
34 <td><a href="#AsyncFile">AsyncFile</a></td>
35 <td>Class wrapping a socket object with a file interface.</td>
36 </tr>
37 </table>
38 <h3>Functions</h3>
39 <table>
40 <tr>
41 <td><a href="#AsyncPendingWrite">AsyncPendingWrite</a></td>
42 <td>Module function to check for data to be written.</td>
43 </tr>
44 </table>
45 <hr /><hr />
46 <a NAME="AsyncFile" ID="AsyncFile"></a>
47 <h2>AsyncFile</h2>
48 <p>
49 Class wrapping a socket object with a file interface.
50 </p>
51 <h3>Derived from</h3>
52 object
53 <h3>Class Attributes</h3>
54 <table>
55 <tr><td>maxbuffersize</td></tr><tr><td>maxtries</td></tr>
56 </table>
57 <h3>Class Methods</h3>
58 <table>
59 <tr><td>None</td></tr>
60 </table>
61 <h3>Methods</h3>
62 <table>
63 <tr>
64 <td><a href="#AsyncFile.__init__">AsyncFile</a></td>
65 <td>Constructor</td>
66 </tr><tr>
67 <td><a href="#AsyncFile.__checkMode">__checkMode</a></td>
68 <td>Private method to check the mode.</td>
69 </tr><tr>
70 <td><a href="#AsyncFile.__nWrite">__nWrite</a></td>
71 <td>Private method to write a specific number of pending bytes.</td>
72 </tr><tr>
73 <td><a href="#AsyncFile.close">close</a></td>
74 <td>Public method to close the file.</td>
75 </tr><tr>
76 <td><a href="#AsyncFile.fileno">fileno</a></td>
77 <td>Public method returning the file number.</td>
78 </tr><tr>
79 <td><a href="#AsyncFile.flush">flush</a></td>
80 <td>Public method to write all pending bytes.</td>
81 </tr><tr>
82 <td><a href="#AsyncFile.isatty">isatty</a></td>
83 <td>Public method to indicate whether a tty interface is supported.</td>
84 </tr><tr>
85 <td><a href="#AsyncFile.pendingWrite">pendingWrite</a></td>
86 <td>Public method that returns the number of bytes waiting to be written.</td>
87 </tr><tr>
88 <td><a href="#AsyncFile.read">read</a></td>
89 <td>Public method to read bytes from this file.</td>
90 </tr><tr>
91 <td><a href="#AsyncFile.read_p">read_p</a></td>
92 <td>Public method to read bytes from this file.</td>
93 </tr><tr>
94 <td><a href="#AsyncFile.readable">readable</a></td>
95 <td>Public method to check, if the stream is readable.</td>
96 </tr><tr>
97 <td><a href="#AsyncFile.readline">readline</a></td>
98 <td>Public method to read one line from this file.</td>
99 </tr><tr>
100 <td><a href="#AsyncFile.readline_p">readline_p</a></td>
101 <td>Public method to read a line from this file.</td>
102 </tr><tr>
103 <td><a href="#AsyncFile.readlines">readlines</a></td>
104 <td>Public method to read all lines from this file.</td>
105 </tr><tr>
106 <td><a href="#AsyncFile.seek">seek</a></td>
107 <td>Public method to move the filepointer.</td>
108 </tr><tr>
109 <td><a href="#AsyncFile.seekable">seekable</a></td>
110 <td>Public method to check, if the stream is seekable.</td>
111 </tr><tr>
112 <td><a href="#AsyncFile.tell">tell</a></td>
113 <td>Public method to get the filepointer position.</td>
114 </tr><tr>
115 <td><a href="#AsyncFile.truncate">truncate</a></td>
116 <td>Public method to truncate the file.</td>
117 </tr><tr>
118 <td><a href="#AsyncFile.writable">writable</a></td>
119 <td>Public method to check, if a stream is writable.</td>
120 </tr><tr>
121 <td><a href="#AsyncFile.write">write</a></td>
122 <td>Public method to write a string to the file.</td>
123 </tr><tr>
124 <td><a href="#AsyncFile.write_p">write_p</a></td>
125 <td>Public method to write a string to the file.</td>
126 </tr><tr>
127 <td><a href="#AsyncFile.writelines">writelines</a></td>
128 <td>Public method to write a list of strings to the file.</td>
129 </tr>
130 </table>
131 <h3>Static Methods</h3>
132 <table>
133 <tr><td>None</td></tr>
134 </table>
135 <a NAME="AsyncFile.__init__" ID="AsyncFile.__init__"></a>
136 <h4>AsyncFile (Constructor)</h4>
137 <b>AsyncFile</b>(<i>sock, mode, name</i>)
138 <p>
139 Constructor
140 </p><dl>
141 <dt><i>sock</i></dt>
142 <dd>
143 the socket object being wrapped
144 </dd><dt><i>mode</i></dt>
145 <dd>
146 mode of this file (string)
147 </dd><dt><i>name</i></dt>
148 <dd>
149 name of this file (string)
150 </dd>
151 </dl><a NAME="AsyncFile.__checkMode" ID="AsyncFile.__checkMode"></a>
152 <h4>AsyncFile.__checkMode</h4>
153 <b>__checkMode</b>(<i>mode</i>)
154 <p>
155 Private method to check the mode.
156 </p><p>
157 This method checks, if an operation is permitted according to
158 the mode of the file. If it is not, an IOError is raised.
159 </p><dl>
160 <dt><i>mode</i></dt>
161 <dd>
162 the mode to be checked (string)
163 </dd>
164 </dl><dl>
165 <dt>Raises <b>IOError</b>:</dt>
166 <dd>
167 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>
179 </dl><a NAME="AsyncFile.close" ID="AsyncFile.close"></a>
180 <h4>AsyncFile.close</h4>
181 <b>close</b>(<i>closeit=False</i>)
182 <p>
183 Public method to close the file.
184 </p><dl>
185 <dt><i>closeit</i></dt>
186 <dd>
187 flag to indicate a close ordered by the debugger code
188 (boolean)
189 </dd>
190 </dl><a NAME="AsyncFile.fileno" ID="AsyncFile.fileno"></a>
191 <h4>AsyncFile.fileno</h4>
192 <b>fileno</b>(<i></i>)
193 <p>
194 Public method returning the file number.
195 </p><dl>
196 <dt>Returns:</dt>
197 <dd>
198 file number (int)
199 </dd>
200 </dl><a NAME="AsyncFile.flush" ID="AsyncFile.flush"></a>
201 <h4>AsyncFile.flush</h4>
202 <b>flush</b>(<i></i>)
203 <p>
204 Public method to write all pending bytes.
205 </p><a NAME="AsyncFile.isatty" ID="AsyncFile.isatty"></a>
206 <h4>AsyncFile.isatty</h4>
207 <b>isatty</b>(<i></i>)
208 <p>
209 Public method to indicate whether a tty interface is supported.
210 </p><dl>
211 <dt>Returns:</dt>
212 <dd>
213 always false
214 </dd>
215 </dl><a NAME="AsyncFile.pendingWrite" ID="AsyncFile.pendingWrite"></a>
216 <h4>AsyncFile.pendingWrite</h4>
217 <b>pendingWrite</b>(<i></i>)
218 <p>
219 Public method that returns the number of bytes waiting to be written.
220 </p><dl>
221 <dt>Returns:</dt>
222 <dd>
223 the number of bytes to be written (int)
224 </dd>
225 </dl><a NAME="AsyncFile.read" ID="AsyncFile.read"></a>
226 <h4>AsyncFile.read</h4>
227 <b>read</b>(<i>size=-1</i>)
228 <p>
229 Public method to read bytes from this file.
230 </p><dl>
231 <dt><i>size</i></dt>
232 <dd>
233 maximum number of bytes to be read (int)
234 </dd>
235 </dl><dl>
236 <dt>Returns:</dt>
237 <dd>
238 the bytes read (any)
239 </dd>
240 </dl><a NAME="AsyncFile.read_p" ID="AsyncFile.read_p"></a>
241 <h4>AsyncFile.read_p</h4>
242 <b>read_p</b>(<i>size=-1</i>)
243 <p>
244 Public method to read bytes from this file.
245 </p><dl>
246 <dt><i>size</i></dt>
247 <dd>
248 maximum number of bytes to be read (int)
249 </dd>
250 </dl><dl>
251 <dt>Returns:</dt>
252 <dd>
253 the bytes read (any)
254 </dd>
255 </dl><a NAME="AsyncFile.readable" ID="AsyncFile.readable"></a>
256 <h4>AsyncFile.readable</h4>
257 <b>readable</b>(<i></i>)
258 <p>
259 Public method to check, if the stream is readable.
260 </p><dl>
261 <dt>Returns:</dt>
262 <dd>
263 flag indicating a readable stream (boolean)
264 </dd>
265 </dl><a NAME="AsyncFile.readline" ID="AsyncFile.readline"></a>
266 <h4>AsyncFile.readline</h4>
267 <b>readline</b>(<i>sizehint=-1</i>)
268 <p>
269 Public method to read one line from this file.
270 </p><dl>
271 <dt><i>sizehint</i></dt>
272 <dd>
273 hint of the numbers of bytes to be read (int)
274 </dd>
275 </dl><dl>
276 <dt>Returns:</dt>
277 <dd>
278 one line read (string)
279 </dd>
280 </dl><a NAME="AsyncFile.readline_p" ID="AsyncFile.readline_p"></a>
281 <h4>AsyncFile.readline_p</h4>
282 <b>readline_p</b>(<i>size=-1</i>)
283 <p>
284 Public method to read a line from this file.
285 </p><p>
286 <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.
288 </p><dl>
289 <dt><i>size</i></dt>
290 <dd>
291 maximum number of bytes to be read (int)
292 </dd>
293 </dl><dl>
294 <dt>Returns:</dt>
295 <dd>
296 one line of text up to size bytes (string)
297 </dd>
298 </dl><a NAME="AsyncFile.readlines" ID="AsyncFile.readlines"></a>
299 <h4>AsyncFile.readlines</h4>
300 <b>readlines</b>(<i>sizehint=-1</i>)
301 <p>
302 Public method to read all lines from this file.
303 </p><dl>
304 <dt><i>sizehint</i></dt>
305 <dd>
306 hint of the numbers of bytes to be read (int)
307 </dd>
308 </dl><dl>
309 <dt>Returns:</dt>
310 <dd>
311 list of lines read (list of strings)
312 </dd>
313 </dl><a NAME="AsyncFile.seek" ID="AsyncFile.seek"></a>
314 <h4>AsyncFile.seek</h4>
315 <b>seek</b>(<i>offset, whence=0</i>)
316 <p>
317 Public method to move the filepointer.
318 </p><dl>
319 <dt><i>offset</i></dt>
320 <dd>
321 offset to move the filepointer to (integer)
322 </dd><dt><i>whence</i></dt>
323 <dd>
324 position the offset relates to
325 </dd>
326 </dl><dl>
327 <dt>Raises <b>IOError</b>:</dt>
328 <dd>
329 This method is not supported and always raises an
330 IOError.
331 </dd>
332 </dl><a NAME="AsyncFile.seekable" ID="AsyncFile.seekable"></a>
333 <h4>AsyncFile.seekable</h4>
334 <b>seekable</b>(<i></i>)
335 <p>
336 Public method to check, if the stream is seekable.
337 </p><dl>
338 <dt>Returns:</dt>
339 <dd>
340 flag indicating a seekable stream (boolean)
341 </dd>
342 </dl><a NAME="AsyncFile.tell" ID="AsyncFile.tell"></a>
343 <h4>AsyncFile.tell</h4>
344 <b>tell</b>(<i></i>)
345 <p>
346 Public method to get the filepointer position.
347 </p><dl>
348 <dt>Raises <b>IOError</b>:</dt>
349 <dd>
350 This method is not supported and always raises an
351 IOError.
352 </dd>
353 </dl><a NAME="AsyncFile.truncate" ID="AsyncFile.truncate"></a>
354 <h4>AsyncFile.truncate</h4>
355 <b>truncate</b>(<i>size=-1</i>)
356 <p>
357 Public method to truncate the file.
358 </p><dl>
359 <dt><i>size</i></dt>
360 <dd>
361 size to truncate to (integer)
362 </dd>
363 </dl><dl>
364 <dt>Raises <b>IOError</b>:</dt>
365 <dd>
366 This method is not supported and always raises an
367 IOError.
368 </dd>
369 </dl><a NAME="AsyncFile.writable" ID="AsyncFile.writable"></a>
370 <h4>AsyncFile.writable</h4>
371 <b>writable</b>(<i></i>)
372 <p>
373 Public method to check, if a stream is writable.
374 </p><dl>
375 <dt>Returns:</dt>
376 <dd>
377 flag indicating a writable stream (boolean)
378 </dd>
379 </dl><a NAME="AsyncFile.write" ID="AsyncFile.write"></a>
380 <h4>AsyncFile.write</h4>
381 <b>write</b>(<i>s</i>)
382 <p>
383 Public method to write a string to the file.
384 </p><dl>
385 <dt><i>s</i></dt>
386 <dd>
387 text to be written (string)
388 </dd>
389 </dl><a NAME="AsyncFile.write_p" ID="AsyncFile.write_p"></a>
390 <h4>AsyncFile.write_p</h4>
391 <b>write_p</b>(<i>s</i>)
392 <p>
393 Public method to write a string to the file.
394 </p><dl>
395 <dt><i>s</i></dt>
396 <dd>
397 text to be written (string)
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>
404 </dl><a NAME="AsyncFile.writelines" ID="AsyncFile.writelines"></a>
405 <h4>AsyncFile.writelines</h4>
406 <b>writelines</b>(<i>lines</i>)
407 <p>
408 Public method to write a list of strings to the file.
409 </p><dl>
410 <dt><i>lines</i></dt>
411 <dd>
412 list of texts to be written (list of string)
413 </dd>
414 </dl>
415 <div align="right"><a href="#top">Up</a></div>
416 <hr /><hr />
417 <a NAME="AsyncPendingWrite" ID="AsyncPendingWrite"></a>
418 <h2>AsyncPendingWrite</h2>
419 <b>AsyncPendingWrite</b>(<i>file</i>)
420 <p>
421 Module function to check for data to be written.
422 </p><dl>
423 <dt><i>file</i></dt>
424 <dd>
425 The file object to be checked (file)
426 </dd>
427 </dl><dl>
428 <dt>Returns:</dt>
429 <dd>
430 Flag indicating if there is data wating (int)
431 </dd>
432 </dl>
433 <div align="right"><a href="#top">Up</a></div>
434 <hr />
435 </body></html>

eric ide

mercurial