eric6/Documentation/Source/eric6.Globals.compatibility_fixes.html

branch
without_py2_and_pyqt4
changeset 7197
331569d44b19
parent 7196
ab0a91b82b37
child 7198
684261ef2165
equal deleted inserted replaced
7196:ab0a91b82b37 7197:331569d44b19
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.Globals.compatibility_fixes</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.Globals.compatibility_fixes</h1>
23 <p>
24 Module implementing some workarounds to let eric6 run under Python 2.
25 </p>
26 <h3>Global Attributes</h3>
27 <table>
28 <tr><td>__find_module</td></tr><tr><td>__join</td></tr><tr><td>__load_source</td></tr>
29 </table>
30 <h3>Classes</h3>
31 <table>
32 <tr>
33 <td><a href="#File">File</a></td>
34 <td></td>
35 </tr><tr>
36 <td><a href="#PlainStrList">PlainStrList</a></td>
37 <td>Keep track that all added paths to sys.path are str.</td>
38 </tr>
39 </table>
40 <h3>Functions</h3>
41 <table>
42 <tr>
43 <td><a href="#find_moduleAsStr">find_moduleAsStr</a></td>
44 <td>Convert none str parameter of the imp.find_module into str.</td>
45 </tr><tr>
46 <td><a href="#joinAsUnicode">joinAsUnicode</a></td>
47 <td>Convert none unicode parameter of the os.path.join into unicode.</td>
48 </tr><tr>
49 <td><a href="#load_sourceAsStr">load_sourceAsStr</a></td>
50 <td>Convert none str parameter of the imp.load_source into str.</td>
51 </tr><tr>
52 <td><a href="#open">open</a></td>
53 <td>Replacement for the build in open function.</td>
54 </tr>
55 </table>
56 <hr /><hr />
57 <a NAME="File" ID="File"></a>
58 <h2>File</h2>
59
60 <h3>Derived from</h3>
61 file
62 <h3>Class Attributes</h3>
63 <table>
64 <tr><td>None</td></tr>
65 </table>
66 <h3>Class Methods</h3>
67 <table>
68 <tr><td>None</td></tr>
69 </table>
70 <h3>Methods</h3>
71 <table>
72 <tr>
73 <td><a href="#File.__init__">File</a></td>
74 <td>Constructor</td>
75 </tr><tr>
76 <td><a href="#File.next">next</a></td>
77 <td>Public method used in an iterator.</td>
78 </tr><tr>
79 <td><a href="#File.read">read</a></td>
80 <td>Public method to read n bytes or all if n=-1 from file.</td>
81 </tr><tr>
82 <td><a href="#File.readline">readline</a></td>
83 <td>Public method to read one line from file.</td>
84 </tr><tr>
85 <td><a href="#File.readlines">readlines</a></td>
86 <td>Public method to read all lines from file.</td>
87 </tr><tr>
88 <td><a href="#File.write">write</a></td>
89 <td>Public method to write given data to file and encode if needed.</td>
90 </tr>
91 </table>
92 <h3>Static Methods</h3>
93 <table>
94 <tr><td>None</td></tr>
95 </table>
96 <a NAME="File.__init__" ID="File.__init__"></a>
97 <h4>File (Constructor)</h4>
98 <b>File</b>(<i>filein, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True</i>)
99 <p>
100 Constructor
101 </p><p>
102 It checks for unimplemented parameters.
103 </p><dl>
104 <dt><i>filein</i></dt>
105 <dd>
106 filename or file descriptor (string)
107 </dd><dt><i>mode=</i></dt>
108 <dd>
109 access mode (string)
110 </dd><dt><i>buffering=</i></dt>
111 <dd>
112 size of the read buffer (string)
113 </dd><dt><i>encoding=</i></dt>
114 <dd>
115 character encoding for reading/ writing (string)
116 </dd><dt><i>errors=</i></dt>
117 <dd>
118 behavior for the character encoding ('strict',
119 'explicit', ...) (string)
120 </dd><dt><i>newline=</i></dt>
121 <dd>
122 controls how universal newlines works (string)
123 </dd><dt><i>closefd=</i></dt>
124 <dd>
125 close underlying file descriptor if given as file
126 parameter (boolean)
127 </dd>
128 </dl><dl>
129 <dt>Raises <b>NotImplementedError</b>:</dt>
130 <dd>
131 for not implemented method parameters
132 </dd>
133 </dl><a NAME="File.next" ID="File.next"></a>
134 <h4>File.next</h4>
135 <b>next</b>(<i></i>)
136 <p>
137 Public method used in an iterator.
138 </p><dl>
139 <dt>Returns:</dt>
140 <dd>
141 decoded data read
142 </dd>
143 </dl><a NAME="File.read" ID="File.read"></a>
144 <h4>File.read</h4>
145 <b>read</b>(<i>n=-1</i>)
146 <p>
147 Public method to read n bytes or all if n=-1 from file.
148 </p><dl>
149 <dt><i>n=</i></dt>
150 <dd>
151 bytecount or all if n=-1 (int)
152 </dd>
153 </dl><dl>
154 <dt>Returns:</dt>
155 <dd>
156 decoded bytes read
157 </dd>
158 </dl><a NAME="File.readline" ID="File.readline"></a>
159 <h4>File.readline</h4>
160 <b>readline</b>(<i>limit=-1</i>)
161 <p>
162 Public method to read one line from file.
163 </p><dl>
164 <dt><i>limit=</i></dt>
165 <dd>
166 maximum bytes to read or all if limit=-1 (int)
167 </dd>
168 </dl><dl>
169 <dt>Returns:</dt>
170 <dd>
171 decoded line read
172 </dd>
173 </dl><a NAME="File.readlines" ID="File.readlines"></a>
174 <h4>File.readlines</h4>
175 <b>readlines</b>(<i>hint=-1</i>)
176 <p>
177 Public method to read all lines from file.
178 </p><dl>
179 <dt><i>hint=</i></dt>
180 <dd>
181 maximum bytes to read or all if hint=-1 (int)
182 </dd>
183 </dl><dl>
184 <dt>Returns:</dt>
185 <dd>
186 decoded lines read
187 </dd>
188 </dl><a NAME="File.write" ID="File.write"></a>
189 <h4>File.write</h4>
190 <b>write</b>(<i>txt</i>)
191 <p>
192 Public method to write given data to file and encode if needed.
193 </p><dl>
194 <dt><i>txt</i></dt>
195 <dd>
196 data to write. (str, bytes)
197 </dd>
198 </dl>
199 <div align="right"><a href="#top">Up</a></div>
200 <hr /><hr />
201 <a NAME="PlainStrList" ID="PlainStrList"></a>
202 <h2>PlainStrList</h2>
203 <p>
204 Keep track that all added paths to sys.path are str.
205 </p>
206 <h3>Derived from</h3>
207 list
208 <h3>Class Attributes</h3>
209 <table>
210 <tr><td>None</td></tr>
211 </table>
212 <h3>Class Methods</h3>
213 <table>
214 <tr><td>None</td></tr>
215 </table>
216 <h3>Methods</h3>
217 <table>
218 <tr>
219 <td><a href="#PlainStrList.__init__">PlainStrList</a></td>
220 <td>Constructor</td>
221 </tr><tr>
222 <td><a href="#PlainStrList.__convert">__convert</a></td>
223 <td>Private method to convert unicode to file system encoding.</td>
224 </tr><tr>
225 <td><a href="#PlainStrList.__setitem__">__setitem__</a></td>
226 <td>Special method to overwrite a specific list item.</td>
227 </tr><tr>
228 <td><a href="#PlainStrList.insert">insert</a></td>
229 <td>Public method to insert a specific list item.</td>
230 </tr>
231 </table>
232 <h3>Static Methods</h3>
233 <table>
234 <tr><td>None</td></tr>
235 </table>
236 <a NAME="PlainStrList.__init__" ID="PlainStrList.__init__"></a>
237 <h4>PlainStrList (Constructor)</h4>
238 <b>PlainStrList</b>(<i>*args</i>)
239 <p>
240 Constructor
241 </p><dl>
242 <dt><i>args</i></dt>
243 <dd>
244 list of paths to start with (list)
245 </dd>
246 </dl><a NAME="PlainStrList.__convert" ID="PlainStrList.__convert"></a>
247 <h4>PlainStrList.__convert</h4>
248 <b>__convert</b>(<i>element</i>)
249 <p>
250 Private method to convert unicode to file system encoding.
251 </p><dl>
252 <dt><i>element</i></dt>
253 <dd>
254 to convert from unicode to file system encoding (any)
255 </dd>
256 </dl><dl>
257 <dt>Returns:</dt>
258 <dd>
259 converted element
260 </dd>
261 </dl><a NAME="PlainStrList.__setitem__" ID="PlainStrList.__setitem__"></a>
262 <h4>PlainStrList.__setitem__</h4>
263 <b>__setitem__</b>(<i>idx, value</i>)
264 <p>
265 Special method to overwrite a specific list item.
266 </p><dl>
267 <dt><i>idx</i></dt>
268 <dd>
269 index of the item (int)
270 </dd><dt><i>value</i></dt>
271 <dd>
272 the new value (any)
273 </dd>
274 </dl><a NAME="PlainStrList.insert" ID="PlainStrList.insert"></a>
275 <h4>PlainStrList.insert</h4>
276 <b>insert</b>(<i>idx, value</i>)
277 <p>
278 Public method to insert a specific list item.
279 </p><dl>
280 <dt><i>idx</i></dt>
281 <dd>
282 index of the item (int)
283 </dd><dt><i>value</i></dt>
284 <dd>
285 the new value (any)
286 </dd>
287 </dl>
288 <div align="right"><a href="#top">Up</a></div>
289 <hr /><hr />
290 <a NAME="find_moduleAsStr" ID="find_moduleAsStr"></a>
291 <h2>find_moduleAsStr</h2>
292 <b>find_moduleAsStr</b>(<i>*args</i>)
293 <p>
294 Convert none str parameter of the imp.find_module into str.
295 </p><dl>
296 <dt><i>args</i></dt>
297 <dd>
298 (str, unicode)
299 </dd>
300 </dl><dl>
301 <dt>Returns:</dt>
302 <dd>
303 list of args converted to str (list)
304 </dd>
305 </dl>
306 <div align="right"><a href="#top">Up</a></div>
307 <hr /><hr />
308 <a NAME="joinAsUnicode" ID="joinAsUnicode"></a>
309 <h2>joinAsUnicode</h2>
310 <b>joinAsUnicode</b>(<i>*args</i>)
311 <p>
312 Convert none unicode parameter of the os.path.join into unicode.
313 </p><dl>
314 <dt><i>args</i></dt>
315 <dd>
316 paths which should be joined (str, unicode)
317 </dd>
318 </dl><dl>
319 <dt>Returns:</dt>
320 <dd>
321 unicode str of the path (unicode)
322 </dd>
323 </dl>
324 <div align="right"><a href="#top">Up</a></div>
325 <hr /><hr />
326 <a NAME="load_sourceAsStr" ID="load_sourceAsStr"></a>
327 <h2>load_sourceAsStr</h2>
328 <b>load_sourceAsStr</b>(<i>*args</i>)
329 <p>
330 Convert none str parameter of the imp.load_source into str.
331 </p><dl>
332 <dt><i>args</i></dt>
333 <dd>
334 (str, unicode)
335 </dd>
336 </dl><dl>
337 <dt>Returns:</dt>
338 <dd>
339 list of args converted to str (list)
340 </dd>
341 </dl>
342 <div align="right"><a href="#top">Up</a></div>
343 <hr /><hr />
344 <a NAME="open" ID="open"></a>
345 <h2>open</h2>
346 <b>open</b>(<i>filein, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True</i>)
347 <p>
348 Replacement for the build in open function.
349 </p><dl>
350 <dt><i>filein</i></dt>
351 <dd>
352 filename or file descriptor (string)
353 </dd><dt><i>mode=</i></dt>
354 <dd>
355 access mode (string)
356 </dd><dt><i>buffering=</i></dt>
357 <dd>
358 size of the read buffer (string)
359 </dd><dt><i>encoding=</i></dt>
360 <dd>
361 character encoding for reading/ writing (string)
362 </dd><dt><i>errors=</i></dt>
363 <dd>
364 behavior for the character encoding ('strict',
365 'explicit', ...) (string)
366 </dd><dt><i>newline=</i></dt>
367 <dd>
368 controls how universal newlines works (string)
369 </dd><dt><i>closefd=</i></dt>
370 <dd>
371 close underlying file descriptor if given as file
372 parameter (boolean)
373 </dd>
374 </dl><dl>
375 <dt>Returns:</dt>
376 <dd>
377 Returns the new file object
378 </dd>
379 </dl>
380 <div align="right"><a href="#top">Up</a></div>
381 <hr />
382 </body></html>

eric ide

mercurial