--- a/Documentation/Source/eric5.Utilities.__init__.html Mon Jan 11 17:42:24 2010 +0000 +++ b/Documentation/Source/eric5.Utilities.__init__.html Mon Jan 11 18:05:51 2010 +0000 @@ -26,11 +26,14 @@ </p> <h3>Global Attributes</h3> <table> -<tr><td>_escape</td></tr><tr><td>_escape_map</td></tr><tr><td>_uescape</td></tr><tr><td>configDir</td></tr><tr><td>supportedCodecs</td></tr> +<tr><td>_escape</td></tr><tr><td>_escape_map</td></tr><tr><td>_uescape</td></tr><tr><td>codingBytes_regexps</td></tr><tr><td>coding_regexps</td></tr><tr><td>configDir</td></tr><tr><td>supportedCodecs</td></tr> </table> <h3>Classes</h3> <table> -<tr><td>None</td></tr> +<tr> +<td><a href="#CodingError">CodingError</a></td> +<td>Class implementing an exception, which is raised, if a given coding is incorrect.</td> +</tr> </table> <h3>Functions</h3> <table> @@ -47,9 +50,15 @@ <td><a href="#convertLineEnds">convertLineEnds</a></td> <td>Function to convert the end of line characters.</td> </tr><tr> +<td><a href="#decode">decode</a></td> +<td>Function to decode some byte text into a string.</td> +</tr><tr> <td><a href="#direntries">direntries</a></td> <td>Function returning a list of all files and directories.</td> </tr><tr> +<td><a href="#encode">encode</a></td> +<td>Function to encode text into a byte text.</td> +</tr><tr> <td><a href="#escape_entities">escape_entities</a></td> <td>Function to encode html entities.</td> </tr><tr> @@ -107,6 +116,12 @@ <td><a href="#getUserName">getUserName</a></td> <td>Function to get the user name.</td> </tr><tr> +<td><a href="#get_coding">get_coding</a></td> +<td>Function to get the coding of a text.</td> +</tr><tr> +<td><a href="#get_codingBytes">get_codingBytes</a></td> +<td>Function to get the coding of a bytes text.</td> +</tr><tr> <td><a href="#hasEnvironmentEntry">hasEnvironmentEntry</a></td> <td>Module function to check, if the environment contains an entry.</td> </tr><tr> @@ -164,6 +179,9 @@ <td><a href="#pwEncode">pwEncode</a></td> <td>Module function to encode a password.</td> </tr><tr> +<td><a href="#readEncodedFile">readEncodedFile</a></td> +<td>Function to read a file and decode it's contents into proper text.</td> +</tr><tr> <td><a href="#relpath">relpath</a></td> <td>Return a relative version of a path.</td> </tr><tr> @@ -184,9 +202,64 @@ </tr><tr> <td><a href="#win32_Kill">win32_Kill</a></td> <td>Function to provide an os.kill equivalent for Win32.</td> +</tr><tr> +<td><a href="#writeEncodedFile">writeEncodedFile</a></td> +<td>Function to write a file with properly encoded text.</td> </tr> </table> <hr /><hr /> +<a NAME="CodingError" ID="CodingError"></a> +<h2>CodingError</h2> +<p> + Class implementing an exception, which is raised, if a given coding is incorrect. +</p> +<h3>Derived from</h3> +Exception +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> +<h3>Methods</h3> +<table> +<tr> +<td><a href="#CodingError.__init__">CodingError</a></td> +<td>Constructor</td> +</tr><tr> +<td><a href="#CodingError.__repr__">__repr__</a></td> +<td>Private method returning a representation of the exception.</td> +</tr><tr> +<td><a href="#CodingError.__str__">__str__</a></td> +<td>Private method returning a string representation of the exception.</td> +</tr> +</table> +<a NAME="CodingError.__init__" ID="CodingError.__init__"></a> +<h4>CodingError (Constructor)</h4> +<b>CodingError</b>(<i>coding</i>) +<p> + Constructor +</p><a NAME="CodingError.__repr__" ID="CodingError.__repr__"></a> +<h4>CodingError.__repr__</h4> +<b>__repr__</b>(<i></i>) +<p> + Private method returning a representation of the exception. +</p><dl> +<dt>Returns:</dt> +<dd> +string representing the error message +</dd> +</dl><a NAME="CodingError.__str__" ID="CodingError.__str__"></a> +<h4>CodingError.__str__</h4> +<b>__str__</b>(<i></i>) +<p> + Private method returning a string representation of the exception. +</p><dl> +<dt>Returns:</dt> +<dd> +string representing the error message +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> <a NAME="_percentReplacementFunc" ID="_percentReplacementFunc"></a> <h2>_percentReplacementFunc</h2> <b>_percentReplacementFunc</b>(<i>matchobj</i>) @@ -274,6 +347,24 @@ </dl> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> +<a NAME="decode" ID="decode"></a> +<h2>decode</h2> +<b>decode</b>(<i>text</i>) +<p> + Function to decode some byte text into a string. +</p><dl> +<dt><i>text</i></dt> +<dd> +byte text to decode (bytes) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +tuple of decoded text and encoding (string, string) +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> <a NAME="direntries" ID="direntries"></a> <h2>direntries</h2> <b>direntries</b>(<i>path, filesonly=False, pattern=None, followsymlinks=True, checkStop=None</i>) @@ -306,6 +397,27 @@ </dl> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> +<a NAME="encode" ID="encode"></a> +<h2>encode</h2> +<b>encode</b>(<i>text, orig_coding</i>) +<p> + Function to encode text into a byte text. +</p><dl> +<dt><i>text</i></dt> +<dd> +text to be encoded (string) +</dd><dt><i>orig_coding</i></dt> +<dd> +type of the original encoding (string) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +tuple of encoded text and encoding used (bytes, string) +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> <a NAME="escape_entities" ID="escape_entities"></a> <h2>escape_entities</h2> <b>escape_entities</b>(<i>m, map=_escape_map</i>) @@ -629,6 +741,42 @@ </dl> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> +<a NAME="get_coding" ID="get_coding"></a> +<h2>get_coding</h2> +<b>get_coding</b>(<i>text</i>) +<p> + Function to get the coding of a text. +</p><dl> +<dt><i>text</i></dt> +<dd> +text to inspect (string) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +coding string +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> +<a NAME="get_codingBytes" ID="get_codingBytes"></a> +<h2>get_codingBytes</h2> +<b>get_codingBytes</b>(<i>text</i>) +<p> + Function to get the coding of a bytes text. +</p><dl> +<dt><i>text</i></dt> +<dd> +bytes text to inspect (bytes) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +coding string +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> <a NAME="hasEnvironmentEntry" ID="hasEnvironmentEntry"></a> <h2>hasEnvironmentEntry</h2> <b>hasEnvironmentEntry</b>(<i>key</i>) @@ -990,6 +1138,24 @@ </dl> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> +<a NAME="readEncodedFile" ID="readEncodedFile"></a> +<h2>readEncodedFile</h2> +<b>readEncodedFile</b>(<i>filename</i>) +<p> + Function to read a file and decode it's contents into proper text. +</p><dl> +<dt><i>filename</i></dt> +<dd> +name of the file to read (string) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +tuple of decoded text and encoding (string, string) +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> <a NAME="relpath" ID="relpath"></a> <h2>relpath</h2> <b>relpath</b>(<i>path, start = os.path.curdir</i>) @@ -1102,5 +1268,29 @@ </dd> </dl> <div align="right"><a href="#top">Up</a></div> +<hr /><hr /> +<a NAME="writeEncodedFile" ID="writeEncodedFile"></a> +<h2>writeEncodedFile</h2> +<b>writeEncodedFile</b>(<i>filename, text, orig_coding</i>) +<p> + Function to write a file with properly encoded text. +</p><dl> +<dt><i>filename</i></dt> +<dd> +name of the file to read (string) +</dd><dt><i>text</i></dt> +<dd> +text to be written (string) +</dd><dt><i>orig_coding</i></dt> +<dd> +type of the original encoding (string) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +encoding used for writing the file (string) +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> <hr /> </body></html> \ No newline at end of file