|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' |
|
3 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> |
|
4 <html><head> |
|
5 <title>eric4.DebugClients.Python3.AsyncFile</title> |
|
6 <style> |
|
7 body { |
|
8 background:white; |
|
9 margin: 0em 1em 10em 1em; |
|
10 color: black; |
|
11 } |
|
12 |
|
13 h1 { color: white; background: #4FA4FF; } |
|
14 h2 { color: white; background: #4FA4FF; } |
|
15 h3 { color: white; background: #00557F; } |
|
16 h4 { color: white; background: #00557F; } |
|
17 |
|
18 a { color: #AA5500; } |
|
19 |
|
20 </style> |
|
21 </head> |
|
22 <body><a NAME="top" ID="top"></a> |
|
23 <h1>eric4.DebugClients.Python3.AsyncFile</h1> |
|
24 <p> |
|
25 Module implementing an asynchronous file like socket interface for the 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>Methods</h3> |
|
58 <table> |
|
59 <tr> |
|
60 <td><a href="#AsyncFile.__init__">AsyncFile</a></td> |
|
61 <td>Constructor</td> |
|
62 </tr><tr> |
|
63 <td><a href="#AsyncFile.__checkMode">__checkMode</a></td> |
|
64 <td>Private method to check the mode.</td> |
|
65 </tr><tr> |
|
66 <td><a href="#AsyncFile.__nWrite">__nWrite</a></td> |
|
67 <td>Private method to write a specific number of pending bytes.</td> |
|
68 </tr><tr> |
|
69 <td><a href="#AsyncFile.close">close</a></td> |
|
70 <td>Public method to close the file.</td> |
|
71 </tr><tr> |
|
72 <td><a href="#AsyncFile.fileno">fileno</a></td> |
|
73 <td>Public method returning the file number.</td> |
|
74 </tr><tr> |
|
75 <td><a href="#AsyncFile.flush">flush</a></td> |
|
76 <td>Public method to write all pending bytes.</td> |
|
77 </tr><tr> |
|
78 <td><a href="#AsyncFile.isatty">isatty</a></td> |
|
79 <td>Public method to indicate whether a tty interface is supported.</td> |
|
80 </tr><tr> |
|
81 <td><a href="#AsyncFile.pendingWrite">pendingWrite</a></td> |
|
82 <td>Public method that returns the number of bytes waiting to be written.</td> |
|
83 </tr><tr> |
|
84 <td><a href="#AsyncFile.read">read</a></td> |
|
85 <td>Public method to read bytes from this file.</td> |
|
86 </tr><tr> |
|
87 <td><a href="#AsyncFile.read_p">read_p</a></td> |
|
88 <td>Public method to read bytes from this file.</td> |
|
89 </tr><tr> |
|
90 <td><a href="#AsyncFile.readline">readline</a></td> |
|
91 <td>Public method to read one line from this file.</td> |
|
92 </tr><tr> |
|
93 <td><a href="#AsyncFile.readline_p">readline_p</a></td> |
|
94 <td>Public method to read a line from this file.</td> |
|
95 </tr><tr> |
|
96 <td><a href="#AsyncFile.readlines">readlines</a></td> |
|
97 <td>Public method to read all lines from this file.</td> |
|
98 </tr><tr> |
|
99 <td><a href="#AsyncFile.seek">seek</a></td> |
|
100 <td>Public method to move the filepointer.</td> |
|
101 </tr><tr> |
|
102 <td><a href="#AsyncFile.tell">tell</a></td> |
|
103 <td>Public method to get the filepointer position.</td> |
|
104 </tr><tr> |
|
105 <td><a href="#AsyncFile.truncate">truncate</a></td> |
|
106 <td>Public method to truncate the file.</td> |
|
107 </tr><tr> |
|
108 <td><a href="#AsyncFile.write">write</a></td> |
|
109 <td>Public method to write a string to the file.</td> |
|
110 </tr><tr> |
|
111 <td><a href="#AsyncFile.writelines">writelines</a></td> |
|
112 <td>Public method to write a list of strings to the file.</td> |
|
113 </tr> |
|
114 </table> |
|
115 <a NAME="AsyncFile.__init__" ID="AsyncFile.__init__"></a> |
|
116 <h4>AsyncFile (Constructor)</h4> |
|
117 <b>AsyncFile</b>(<i>sock, mode, name</i>) |
|
118 <p> |
|
119 Constructor |
|
120 </p><dl> |
|
121 <dt><i>sock</i></dt> |
|
122 <dd> |
|
123 the socket object being wrapped |
|
124 </dd><dt><i>mode</i></dt> |
|
125 <dd> |
|
126 mode of this file (string) |
|
127 </dd><dt><i>name</i></dt> |
|
128 <dd> |
|
129 name of this file (string) |
|
130 </dd> |
|
131 </dl><a NAME="AsyncFile.__checkMode" ID="AsyncFile.__checkMode"></a> |
|
132 <h4>AsyncFile.__checkMode</h4> |
|
133 <b>__checkMode</b>(<i>mode</i>) |
|
134 <p> |
|
135 Private method to check the mode. |
|
136 </p><p> |
|
137 This method checks, if an operation is permitted according to |
|
138 the mode of the file. If it is not, an IOError is raised. |
|
139 </p><dl> |
|
140 <dt><i>mode</i></dt> |
|
141 <dd> |
|
142 the mode to be checked (string) |
|
143 </dd> |
|
144 </dl><a NAME="AsyncFile.__nWrite" ID="AsyncFile.__nWrite"></a> |
|
145 <h4>AsyncFile.__nWrite</h4> |
|
146 <b>__nWrite</b>(<i>n</i>) |
|
147 <p> |
|
148 Private method to write a specific number of pending bytes. |
|
149 </p><dl> |
|
150 <dt><i>n</i></dt> |
|
151 <dd> |
|
152 the number of bytes to be written (int) |
|
153 </dd> |
|
154 </dl><a NAME="AsyncFile.close" ID="AsyncFile.close"></a> |
|
155 <h4>AsyncFile.close</h4> |
|
156 <b>close</b>(<i>closeit = False</i>) |
|
157 <p> |
|
158 Public method to close the file. |
|
159 </p><dl> |
|
160 <dt><i>closeit</i></dt> |
|
161 <dd> |
|
162 flag to indicate a close ordered by the debugger code (boolean) |
|
163 </dd> |
|
164 </dl><a NAME="AsyncFile.fileno" ID="AsyncFile.fileno"></a> |
|
165 <h4>AsyncFile.fileno</h4> |
|
166 <b>fileno</b>(<i></i>) |
|
167 <p> |
|
168 Public method returning the file number. |
|
169 </p><dl> |
|
170 <dt>Returns:</dt> |
|
171 <dd> |
|
172 file number (int) |
|
173 </dd> |
|
174 </dl><a NAME="AsyncFile.flush" ID="AsyncFile.flush"></a> |
|
175 <h4>AsyncFile.flush</h4> |
|
176 <b>flush</b>(<i></i>) |
|
177 <p> |
|
178 Public method to write all pending bytes. |
|
179 </p><a NAME="AsyncFile.isatty" ID="AsyncFile.isatty"></a> |
|
180 <h4>AsyncFile.isatty</h4> |
|
181 <b>isatty</b>(<i></i>) |
|
182 <p> |
|
183 Public method to indicate whether a tty interface is supported. |
|
184 </p><dl> |
|
185 <dt>Returns:</dt> |
|
186 <dd> |
|
187 always false |
|
188 </dd> |
|
189 </dl><a NAME="AsyncFile.pendingWrite" ID="AsyncFile.pendingWrite"></a> |
|
190 <h4>AsyncFile.pendingWrite</h4> |
|
191 <b>pendingWrite</b>(<i></i>) |
|
192 <p> |
|
193 Public method that returns the number of bytes waiting to be written. |
|
194 </p><dl> |
|
195 <dt>Returns:</dt> |
|
196 <dd> |
|
197 the number of bytes to be written (int) |
|
198 </dd> |
|
199 </dl><a NAME="AsyncFile.read" ID="AsyncFile.read"></a> |
|
200 <h4>AsyncFile.read</h4> |
|
201 <b>read</b>(<i>size = -1</i>) |
|
202 <p> |
|
203 Public method to read bytes from this file. |
|
204 </p><dl> |
|
205 <dt><i>size</i></dt> |
|
206 <dd> |
|
207 maximum number of bytes to be read (int) |
|
208 </dd> |
|
209 </dl><dl> |
|
210 <dt>Returns:</dt> |
|
211 <dd> |
|
212 the bytes read (any) |
|
213 </dd> |
|
214 </dl><a NAME="AsyncFile.read_p" ID="AsyncFile.read_p"></a> |
|
215 <h4>AsyncFile.read_p</h4> |
|
216 <b>read_p</b>(<i>size = -1</i>) |
|
217 <p> |
|
218 Public method to read bytes from this file. |
|
219 </p><dl> |
|
220 <dt><i>size</i></dt> |
|
221 <dd> |
|
222 maximum number of bytes to be read (int) |
|
223 </dd> |
|
224 </dl><dl> |
|
225 <dt>Returns:</dt> |
|
226 <dd> |
|
227 the bytes read (any) |
|
228 </dd> |
|
229 </dl><a NAME="AsyncFile.readline" ID="AsyncFile.readline"></a> |
|
230 <h4>AsyncFile.readline</h4> |
|
231 <b>readline</b>(<i>sizehint = -1</i>) |
|
232 <p> |
|
233 Public method to read one line from this file. |
|
234 </p><dl> |
|
235 <dt><i>sizehint</i></dt> |
|
236 <dd> |
|
237 hint of the numbers of bytes to be read (int) |
|
238 </dd> |
|
239 </dl><dl> |
|
240 <dt>Returns:</dt> |
|
241 <dd> |
|
242 one line read (string) |
|
243 </dd> |
|
244 </dl><a NAME="AsyncFile.readline_p" ID="AsyncFile.readline_p"></a> |
|
245 <h4>AsyncFile.readline_p</h4> |
|
246 <b>readline_p</b>(<i>size = -1</i>) |
|
247 <p> |
|
248 Public method to read a line from this file. |
|
249 </p><p> |
|
250 <b>Note</b>: This method will not block and may return |
|
251 only a part of a line if that is all that is available. |
|
252 </p><dl> |
|
253 <dt><i>size</i></dt> |
|
254 <dd> |
|
255 maximum number of bytes to be read (int) |
|
256 </dd> |
|
257 </dl><dl> |
|
258 <dt>Returns:</dt> |
|
259 <dd> |
|
260 one line of text up to size bytes (string) |
|
261 </dd> |
|
262 </dl><a NAME="AsyncFile.readlines" ID="AsyncFile.readlines"></a> |
|
263 <h4>AsyncFile.readlines</h4> |
|
264 <b>readlines</b>(<i>sizehint = -1</i>) |
|
265 <p> |
|
266 Public method to read all lines 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 list of lines read (list of strings) |
|
276 </dd> |
|
277 </dl><a NAME="AsyncFile.seek" ID="AsyncFile.seek"></a> |
|
278 <h4>AsyncFile.seek</h4> |
|
279 <b>seek</b>(<i>offset, whence = 0</i>) |
|
280 <p> |
|
281 Public method to move the filepointer. |
|
282 </p><dl> |
|
283 <dt><i>offset</i></dt> |
|
284 <dd> |
|
285 offset to move the filepointer to (integer) |
|
286 </dd><dt><i>whence</i></dt> |
|
287 <dd> |
|
288 position the offset relates to |
|
289 </dd> |
|
290 </dl><dl> |
|
291 <dt>Raises <b>IOError</b>:</dt> |
|
292 <dd> |
|
293 This method is not supported and always raises an |
|
294 IOError. |
|
295 </dd> |
|
296 </dl><a NAME="AsyncFile.tell" ID="AsyncFile.tell"></a> |
|
297 <h4>AsyncFile.tell</h4> |
|
298 <b>tell</b>(<i></i>) |
|
299 <p> |
|
300 Public method to get the filepointer position. |
|
301 </p><dl> |
|
302 <dt>Raises <b>IOError</b>:</dt> |
|
303 <dd> |
|
304 This method is not supported and always raises an |
|
305 IOError. |
|
306 </dd> |
|
307 </dl><a NAME="AsyncFile.truncate" ID="AsyncFile.truncate"></a> |
|
308 <h4>AsyncFile.truncate</h4> |
|
309 <b>truncate</b>(<i>size = -1</i>) |
|
310 <p> |
|
311 Public method to truncate the file. |
|
312 </p><dl> |
|
313 <dt><i>size</i></dt> |
|
314 <dd> |
|
315 size to truncaze to (integer) |
|
316 </dd> |
|
317 </dl><dl> |
|
318 <dt>Raises <b>IOError</b>:</dt> |
|
319 <dd> |
|
320 This method is not supported and always raises an |
|
321 IOError. |
|
322 </dd> |
|
323 </dl><a NAME="AsyncFile.write" ID="AsyncFile.write"></a> |
|
324 <h4>AsyncFile.write</h4> |
|
325 <b>write</b>(<i>s</i>) |
|
326 <p> |
|
327 Public method to write a string to the file. |
|
328 </p><dl> |
|
329 <dt><i>s</i></dt> |
|
330 <dd> |
|
331 bytes to be written (string) |
|
332 </dd> |
|
333 </dl><a NAME="AsyncFile.writelines" ID="AsyncFile.writelines"></a> |
|
334 <h4>AsyncFile.writelines</h4> |
|
335 <b>writelines</b>(<i>list</i>) |
|
336 <p> |
|
337 Public method to write a list of strings to the file. |
|
338 </p><dl> |
|
339 <dt><i>list</i></dt> |
|
340 <dd> |
|
341 the list to be written (list of string) |
|
342 </dd> |
|
343 </dl> |
|
344 <div align="right"><a href="#top">Up</a></div> |
|
345 <hr /><hr /> |
|
346 <a NAME="AsyncPendingWrite" ID="AsyncPendingWrite"></a> |
|
347 <h2>AsyncPendingWrite</h2> |
|
348 <b>AsyncPendingWrite</b>(<i>file</i>) |
|
349 <p> |
|
350 Module function to check for data to be written. |
|
351 </p><dl> |
|
352 <dt><i>file</i></dt> |
|
353 <dd> |
|
354 The file object to be checked (file) |
|
355 </dd> |
|
356 </dl><dl> |
|
357 <dt>Returns:</dt> |
|
358 <dd> |
|
359 Flag indicating if there is data wating (int) |
|
360 </dd> |
|
361 </dl> |
|
362 <div align="right"><a href="#top">Up</a></div> |
|
363 <hr /> |
|
364 </body></html> |