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