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