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

changeset 3673
e26d7d0c1088
child 5144
1ab536d25072
equal deleted inserted replaced
3670:f0cb7579c0b4 3673:e26d7d0c1088
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.DebugClients.Python3.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.Python3.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.writelines">writelines</a></td>
125 <td>Public method to write a list of strings to the file.</td>
126 </tr>
127 </table>
128 <h3>Static Methods</h3>
129 <table>
130 <tr><td>None</td></tr>
131 </table>
132 <a NAME="AsyncFile.__init__" ID="AsyncFile.__init__"></a>
133 <h4>AsyncFile (Constructor)</h4>
134 <b>AsyncFile</b>(<i>sock, mode, name</i>)
135 <p>
136 Constructor
137 </p><dl>
138 <dt><i>sock</i></dt>
139 <dd>
140 the socket object being wrapped
141 </dd><dt><i>mode</i></dt>
142 <dd>
143 mode of this file (string)
144 </dd><dt><i>name</i></dt>
145 <dd>
146 name of this file (string)
147 </dd>
148 </dl><a NAME="AsyncFile.__checkMode" ID="AsyncFile.__checkMode"></a>
149 <h4>AsyncFile.__checkMode</h4>
150 <b>__checkMode</b>(<i>mode</i>)
151 <p>
152 Private method to check the mode.
153 </p><p>
154 This method checks, if an operation is permitted according to
155 the mode of the file. If it is not, an IOError is raised.
156 </p><dl>
157 <dt><i>mode</i></dt>
158 <dd>
159 the mode to be checked (string)
160 </dd>
161 </dl><dl>
162 <dt>Raises <b>IOError</b>:</dt>
163 <dd>
164 raised to indicate a bad file descriptor
165 </dd>
166 </dl><a NAME="AsyncFile.__nWrite" ID="AsyncFile.__nWrite"></a>
167 <h4>AsyncFile.__nWrite</h4>
168 <b>__nWrite</b>(<i>n</i>)
169 <p>
170 Private method to write a specific number of pending bytes.
171 </p><dl>
172 <dt><i>n</i></dt>
173 <dd>
174 the number of bytes to be written (int)
175 </dd>
176 </dl><a NAME="AsyncFile.close" ID="AsyncFile.close"></a>
177 <h4>AsyncFile.close</h4>
178 <b>close</b>(<i>closeit=False</i>)
179 <p>
180 Public method to close the file.
181 </p><dl>
182 <dt><i>closeit</i></dt>
183 <dd>
184 flag to indicate a close ordered by the debugger code
185 (boolean)
186 </dd>
187 </dl><a NAME="AsyncFile.fileno" ID="AsyncFile.fileno"></a>
188 <h4>AsyncFile.fileno</h4>
189 <b>fileno</b>(<i></i>)
190 <p>
191 Public method returning the file number.
192 </p><dl>
193 <dt>Returns:</dt>
194 <dd>
195 file number (int)
196 </dd>
197 </dl><a NAME="AsyncFile.flush" ID="AsyncFile.flush"></a>
198 <h4>AsyncFile.flush</h4>
199 <b>flush</b>(<i></i>)
200 <p>
201 Public method to write all pending bytes.
202 </p><a NAME="AsyncFile.isatty" ID="AsyncFile.isatty"></a>
203 <h4>AsyncFile.isatty</h4>
204 <b>isatty</b>(<i></i>)
205 <p>
206 Public method to indicate whether a tty interface is supported.
207 </p><dl>
208 <dt>Returns:</dt>
209 <dd>
210 always false
211 </dd>
212 </dl><a NAME="AsyncFile.pendingWrite" ID="AsyncFile.pendingWrite"></a>
213 <h4>AsyncFile.pendingWrite</h4>
214 <b>pendingWrite</b>(<i></i>)
215 <p>
216 Public method that returns the number of bytes waiting to be written.
217 </p><dl>
218 <dt>Returns:</dt>
219 <dd>
220 the number of bytes to be written (int)
221 </dd>
222 </dl><a NAME="AsyncFile.read" ID="AsyncFile.read"></a>
223 <h4>AsyncFile.read</h4>
224 <b>read</b>(<i>size=-1</i>)
225 <p>
226 Public method to read bytes from this file.
227 </p><dl>
228 <dt><i>size</i></dt>
229 <dd>
230 maximum number of bytes to be read (int)
231 </dd>
232 </dl><dl>
233 <dt>Returns:</dt>
234 <dd>
235 the bytes read (any)
236 </dd>
237 </dl><a NAME="AsyncFile.read_p" ID="AsyncFile.read_p"></a>
238 <h4>AsyncFile.read_p</h4>
239 <b>read_p</b>(<i>size=-1</i>)
240 <p>
241 Public method to read bytes from this file.
242 </p><dl>
243 <dt><i>size</i></dt>
244 <dd>
245 maximum number of bytes to be read (int)
246 </dd>
247 </dl><dl>
248 <dt>Returns:</dt>
249 <dd>
250 the bytes read (any)
251 </dd>
252 </dl><a NAME="AsyncFile.readable" ID="AsyncFile.readable"></a>
253 <h4>AsyncFile.readable</h4>
254 <b>readable</b>(<i></i>)
255 <p>
256 Public method to check, if the stream is readable.
257 </p><dl>
258 <dt>Returns:</dt>
259 <dd>
260 flag indicating a readable stream (boolean)
261 </dd>
262 </dl><a NAME="AsyncFile.readline" ID="AsyncFile.readline"></a>
263 <h4>AsyncFile.readline</h4>
264 <b>readline</b>(<i>sizehint=-1</i>)
265 <p>
266 Public method to read one line from this file.
267 </p><dl>
268 <dt><i>sizehint</i></dt>
269 <dd>
270 hint of the numbers of bytes to be read (int)
271 </dd>
272 </dl><dl>
273 <dt>Returns:</dt>
274 <dd>
275 one line read (string)
276 </dd>
277 </dl><a NAME="AsyncFile.readline_p" ID="AsyncFile.readline_p"></a>
278 <h4>AsyncFile.readline_p</h4>
279 <b>readline_p</b>(<i>size=-1</i>)
280 <p>
281 Public method to read a line from this file.
282 </p><p>
283 <b>Note</b>: This method will not block and may return
284 only a part of a line if that is all that is available.
285 </p><dl>
286 <dt><i>size</i></dt>
287 <dd>
288 maximum number of bytes to be read (int)
289 </dd>
290 </dl><dl>
291 <dt>Returns:</dt>
292 <dd>
293 one line of text up to size bytes (string)
294 </dd>
295 </dl><a NAME="AsyncFile.readlines" ID="AsyncFile.readlines"></a>
296 <h4>AsyncFile.readlines</h4>
297 <b>readlines</b>(<i>sizehint=-1</i>)
298 <p>
299 Public method to read all lines from this file.
300 </p><dl>
301 <dt><i>sizehint</i></dt>
302 <dd>
303 hint of the numbers of bytes to be read (int)
304 </dd>
305 </dl><dl>
306 <dt>Returns:</dt>
307 <dd>
308 list of lines read (list of strings)
309 </dd>
310 </dl><a NAME="AsyncFile.seek" ID="AsyncFile.seek"></a>
311 <h4>AsyncFile.seek</h4>
312 <b>seek</b>(<i>offset, whence=0</i>)
313 <p>
314 Public method to move the filepointer.
315 </p><dl>
316 <dt><i>offset</i></dt>
317 <dd>
318 offset to move the filepointer to (integer)
319 </dd><dt><i>whence</i></dt>
320 <dd>
321 position the offset relates to
322 </dd>
323 </dl><dl>
324 <dt>Raises <b>IOError</b>:</dt>
325 <dd>
326 This method is not supported and always raises an
327 IOError.
328 </dd>
329 </dl><a NAME="AsyncFile.seekable" ID="AsyncFile.seekable"></a>
330 <h4>AsyncFile.seekable</h4>
331 <b>seekable</b>(<i></i>)
332 <p>
333 Public method to check, if the stream is seekable.
334 </p><dl>
335 <dt>Returns:</dt>
336 <dd>
337 flag indicating a seekable stream (boolean)
338 </dd>
339 </dl><a NAME="AsyncFile.tell" ID="AsyncFile.tell"></a>
340 <h4>AsyncFile.tell</h4>
341 <b>tell</b>(<i></i>)
342 <p>
343 Public method to get the filepointer position.
344 </p><dl>
345 <dt>Raises <b>IOError</b>:</dt>
346 <dd>
347 This method is not supported and always raises an
348 IOError.
349 </dd>
350 </dl><a NAME="AsyncFile.truncate" ID="AsyncFile.truncate"></a>
351 <h4>AsyncFile.truncate</h4>
352 <b>truncate</b>(<i>size=-1</i>)
353 <p>
354 Public method to truncate the file.
355 </p><dl>
356 <dt><i>size</i></dt>
357 <dd>
358 size to truncaze to (integer)
359 </dd>
360 </dl><dl>
361 <dt>Raises <b>IOError</b>:</dt>
362 <dd>
363 This method is not supported and always raises an
364 IOError.
365 </dd>
366 </dl><a NAME="AsyncFile.writable" ID="AsyncFile.writable"></a>
367 <h4>AsyncFile.writable</h4>
368 <b>writable</b>(<i></i>)
369 <p>
370 Public method to check, if a stream is writable.
371 </p><dl>
372 <dt>Returns:</dt>
373 <dd>
374 flag indicating a writable stream (boolean)
375 </dd>
376 </dl><a NAME="AsyncFile.write" ID="AsyncFile.write"></a>
377 <h4>AsyncFile.write</h4>
378 <b>write</b>(<i>s</i>)
379 <p>
380 Public method to write a string to the file.
381 </p><dl>
382 <dt><i>s</i></dt>
383 <dd>
384 bytes to be written (string)
385 </dd>
386 </dl><dl>
387 <dt>Raises <b>socket.error</b>:</dt>
388 <dd>
389 raised to indicate too many send attempts
390 </dd>
391 </dl><a NAME="AsyncFile.writelines" ID="AsyncFile.writelines"></a>
392 <h4>AsyncFile.writelines</h4>
393 <b>writelines</b>(<i>list</i>)
394 <p>
395 Public method to write a list of strings to the file.
396 </p><dl>
397 <dt><i>list</i></dt>
398 <dd>
399 the list to be written (list of string)
400 </dd>
401 </dl>
402 <div align="right"><a href="#top">Up</a></div>
403 <hr /><hr />
404 <a NAME="AsyncPendingWrite" ID="AsyncPendingWrite"></a>
405 <h2>AsyncPendingWrite</h2>
406 <b>AsyncPendingWrite</b>(<i>file</i>)
407 <p>
408 Module function to check for data to be written.
409 </p><dl>
410 <dt><i>file</i></dt>
411 <dd>
412 The file object to be checked (file)
413 </dd>
414 </dl><dl>
415 <dt>Returns:</dt>
416 <dd>
417 Flag indicating if there is data wating (int)
418 </dd>
419 </dl>
420 <div align="right"><a href="#top">Up</a></div>
421 <hr />
422 </body></html>

eric ide

mercurial