Documentation/Source/eric5.Utilities.compatibility_fixes.html

branch
Py2 comp.
changeset 2790
6686a3326df8
parent 2533
8fb5922867f2
child 3066
76a310bc7bba
equal deleted inserted replaced
2789:6593aab36403 2790:6686a3326df8
20 </head> 20 </head>
21 <body><a NAME="top" ID="top"></a> 21 <body><a NAME="top" ID="top"></a>
22 <h1>eric5.Utilities.compatibility_fixes</h1> 22 <h1>eric5.Utilities.compatibility_fixes</h1>
23 <p> 23 <p>
24 Module implementing the open behavior of Python3 for use with Eric5. 24 Module implementing the open behavior of Python3 for use with Eric5.
25 The from Eric5 used features are emulated only. The not emulated features 25 The Eric5 used features are emulated only. The not emulated features
26 should throw a NotImplementedError exception. 26 should throw a NotImplementedError exception.
27 </p> 27 </p>
28 <h3>Global Attributes</h3> 28 <h3>Global Attributes</h3>
29 <table> 29 <table>
30 <tr><td>None</td></tr> 30 <tr><td>None</td></tr>
38 </table> 38 </table>
39 <h3>Functions</h3> 39 <h3>Functions</h3>
40 <table> 40 <table>
41 <tr> 41 <tr>
42 <td><a href="#open">open</a></td> 42 <td><a href="#open">open</a></td>
43 <td></td> 43 <td>Replacement for the build in open function.</td>
44 </tr> 44 </tr>
45 </table> 45 </table>
46 <hr /><hr /> 46 <hr /><hr />
47 <a NAME="File" ID="File"></a> 47 <a NAME="File" ID="File"></a>
48 <h2>File</h2> 48 <h2>File</h2>
59 </table> 59 </table>
60 <h3>Methods</h3> 60 <h3>Methods</h3>
61 <table> 61 <table>
62 <tr> 62 <tr>
63 <td><a href="#File.__init__">File</a></td> 63 <td><a href="#File.__init__">File</a></td>
64 <td></td> 64 <td>Constructor, checks for unimplemented parameters.</td>
65 </tr><tr> 65 </tr><tr>
66 <td><a href="#File.next">next</a></td> 66 <td><a href="#File.next">next</a></td>
67 <td></td> 67 <td>Method if used in a iterator.</td>
68 </tr><tr> 68 </tr><tr>
69 <td><a href="#File.read">read</a></td> 69 <td><a href="#File.read">read</a></td>
70 <td></td> 70 <td>Read n bytes or all if n=-1 from file.</td>
71 </tr><tr> 71 </tr><tr>
72 <td><a href="#File.readline">readline</a></td> 72 <td><a href="#File.readline">readline</a></td>
73 <td></td> 73 <td>Read one line from file.</td>
74 </tr><tr> 74 </tr><tr>
75 <td><a href="#File.readlines">readlines</a></td> 75 <td><a href="#File.readlines">readlines</a></td>
76 <td></td> 76 <td>Read all lines from file.</td>
77 </tr><tr> 77 </tr><tr>
78 <td><a href="#File.write">write</a></td> 78 <td><a href="#File.write">write</a></td>
79 <td></td> 79 <td>Write given data to file.</td>
80 </tr> 80 </tr>
81 </table> 81 </table>
82 <h3>Static Methods</h3> 82 <h3>Static Methods</h3>
83 <table> 83 <table>
84 <tr><td>None</td></tr> 84 <tr><td>None</td></tr>
85 </table> 85 </table>
86 <a NAME="File.__init__" ID="File.__init__"></a> 86 <a NAME="File.__init__" ID="File.__init__"></a>
87 <h4>File (Constructor)</h4> 87 <h4>File (Constructor)</h4>
88 <b>File</b>(<i>filein, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True</i>) 88 <b>File</b>(<i>filein, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True</i>)
89 <a NAME="File.next" ID="File.next"></a> 89 <p>
90 Constructor, checks for unimplemented parameters.
91 </p><dl>
92 <dt><i>filein</i></dt>
93 <dd>
94 filename or file descriptor (string)
95 </dd><dt><i>mode=</i></dt>
96 <dd>
97 access mode (string)
98 </dd><dt><i>buffering=</i></dt>
99 <dd>
100 size of the read buffer (string)
101 </dd><dt><i>encoding=</i></dt>
102 <dd>
103 character encoding for reading/ writing (string)
104 </dd><dt><i>errors=</i></dt>
105 <dd>
106 behavior for the character encoding ('strict', 'explicit', ...) (string)
107 </dd><dt><i>newline=</i></dt>
108 <dd>
109 controls how universal newlines works (string)
110 </dd><dt><i>closefd=</i></dt>
111 <dd>
112 close underlying file descriptor if given as file parameter (boolean)
113 </dd>
114 </dl><a NAME="File.next" ID="File.next"></a>
90 <h4>File.next</h4> 115 <h4>File.next</h4>
91 <b>next</b>(<i></i>) 116 <b>next</b>(<i></i>)
92 <a NAME="File.read" ID="File.read"></a> 117 <p>
118 Method if used in a iterator.
119 </p><dl>
120 <dt>Returns:</dt>
121 <dd>
122 decoded data read
123 </dd>
124 </dl><a NAME="File.read" ID="File.read"></a>
93 <h4>File.read</h4> 125 <h4>File.read</h4>
94 <b>read</b>(<i>n=-1</i>) 126 <b>read</b>(<i>n=-1</i>)
95 <a NAME="File.readline" ID="File.readline"></a> 127 <p>
128 Read n bytes or all if n=-1 from file.
129 </p><dl>
130 <dt><i>n=</i></dt>
131 <dd>
132 bytecount or all if n=-1 (int)
133 </dd>
134 </dl><dl>
135 <dt>Returns:</dt>
136 <dd>
137 decoded bytes read
138 </dd>
139 </dl><a NAME="File.readline" ID="File.readline"></a>
96 <h4>File.readline</h4> 140 <h4>File.readline</h4>
97 <b>readline</b>(<i>limit=-1</i>) 141 <b>readline</b>(<i>limit=-1</i>)
98 <a NAME="File.readlines" ID="File.readlines"></a> 142 <p>
143 Read one line from file.
144 </p><dl>
145 <dt><i>limit=</i></dt>
146 <dd>
147 maximum bytes to read or all if limit=-1 (int)
148 </dd>
149 </dl><dl>
150 <dt>Returns:</dt>
151 <dd>
152 decoded line read
153 </dd>
154 </dl><a NAME="File.readlines" ID="File.readlines"></a>
99 <h4>File.readlines</h4> 155 <h4>File.readlines</h4>
100 <b>readlines</b>(<i>hint=-1</i>) 156 <b>readlines</b>(<i>hint=-1</i>)
101 <a NAME="File.write" ID="File.write"></a> 157 <p>
158 Read all lines from file.
159 </p><dl>
160 <dt><i>hint=</i></dt>
161 <dd>
162 maximum bytes to read or all if hint=-1 (int)
163 </dd>
164 </dl><dl>
165 <dt>Returns:</dt>
166 <dd>
167 decoded lines read
168 </dd>
169 </dl><a NAME="File.write" ID="File.write"></a>
102 <h4>File.write</h4> 170 <h4>File.write</h4>
103 <b>write</b>(<i>txt</i>) 171 <b>write</b>(<i>txt</i>)
104 172 <p>
173 Write given data to file. Encode if needed.
174 </p><dl>
175 <dt><i>txt</i></dt>
176 <dd>
177 data to write. (str, bytes)
178 </dd>
179 </dl>
105 <div align="right"><a href="#top">Up</a></div> 180 <div align="right"><a href="#top">Up</a></div>
106 <hr /><hr /> 181 <hr /><hr />
107 <a NAME="open" ID="open"></a> 182 <a NAME="open" ID="open"></a>
108 <h2>open</h2> 183 <h2>open</h2>
109 <b>open</b>(<i>file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True</i>) 184 <b>open</b>(<i>file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True</i>)
110 185 <p>
186 Replacement for the build in open function.
187 </p><dl>
188 <dt><i>file</i></dt>
189 <dd>
190 filename or file descriptor (string)
191 </dd><dt><i>mode=</i></dt>
192 <dd>
193 access mode (string)
194 </dd><dt><i>buffering=</i></dt>
195 <dd>
196 size of the read buffer (string)
197 </dd><dt><i>encoding=</i></dt>
198 <dd>
199 character encoding for reading/ writing (string)
200 </dd><dt><i>errors=</i></dt>
201 <dd>
202 behavior for the character encoding ('strict', 'explicit', ...) (string)
203 </dd><dt><i>newline=</i></dt>
204 <dd>
205 controls how universal newlines works (string)
206 </dd><dt><i>closefd=</i></dt>
207 <dd>
208 close underlying file descriptor if given as file parameter (boolean)
209 </dd>
210 </dl>
111 <div align="right"><a href="#top">Up</a></div> 211 <div align="right"><a href="#top">Up</a></div>
112 <hr /> 212 <hr />
113 </body></html> 213 </body></html>

eric ide

mercurial