--- a/Documentation/Source/eric5.Utilities.__init__.html Sun Jan 05 23:22:17 2014 +0100 +++ b/Documentation/Source/eric5.Utilities.__init__.html Sun Mar 30 22:00:14 2014 +0200 @@ -25,7 +25,7 @@ </p> <h3>Global Attributes</h3> <table> -<tr><td>_escape</td></tr><tr><td>_escape_map</td></tr><tr><td>_uescape</td></tr><tr><td>_uunescape</td></tr><tr><td>coding_regexps</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>_uunescape</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> @@ -49,21 +49,21 @@ <td><a href="#compactPath">compactPath</a></td> <td>Function to return a compacted path fitting inside the given width.</td> </tr><tr> -<td><a href="#compile">compile</a></td> -<td>Function to compile one Python source file to Python bytecode.</td> -</tr><tr> -<td><a href="#compile_extern">compile_extern</a></td> -<td>Function to compile one Python source file to Python bytecode.</td> -</tr><tr> <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="#decodeBytes">decodeBytes</a></td> <td>Function to decode some byte text into a string.</td> </tr><tr> <td><a href="#decodeString">decodeString</a></td> <td>Function to decode a string containing Unicode encoded characters.</td> </tr><tr> +<td><a href="#determinePythonVersion">determinePythonVersion</a></td> +<td>Determine the python version of a given file.</td> +</tr><tr> <td><a href="#direntries">direntries</a></td> <td>Function returning a list of all files and directories.</td> </tr><tr> @@ -82,6 +82,9 @@ <td><a href="#extractFlagsFromFile">extractFlagsFromFile</a></td> <td>Function to extract eric specific flags out of the given file.</td> </tr><tr> +<td><a href="#extractLineFlags">extractLineFlags</a></td> +<td>Function to extract flags starting and ending with '__' from a line comment.</td> +</tr><tr> <td><a href="#fromNativeSeparators">fromNativeSeparators</a></td> <td>Function returning a path, that is using "/" separator characters.</td> </tr><tr> @@ -142,6 +145,9 @@ <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> @@ -196,6 +202,9 @@ <td><a href="#quote">quote</a></td> <td>Replacement for the urllib.quote function because of unicode problems.</td> </tr><tr> +<td><a href="#readEncodedFile">readEncodedFile</a></td> +<td>Function to read a file and decode its contents into proper text.</td> +</tr><tr> <td><a href="#readEncodedFileWithHash">readEncodedFileWithHash</a></td> <td>Function to read a file, calculate a hash value and decode its contents into proper text.</td> </tr><tr> @@ -393,67 +402,6 @@ </dl> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> -<a NAME="compile" ID="compile"></a> -<h2>compile</h2> -<b>compile</b>(<i>file, codestring="", isPy2=False</i>) -<p> - Function to compile one Python source file to Python bytecode. -</p><dl> -<dt><i>file</i></dt> -<dd> -source filename (string) -</dd><dt><i>codestring</i></dt> -<dd> -string containing the code to compile (string) -</dd><dt><i>isPy2</i></dt> -<dd> -shows which interperter to use (boolean) -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -A tuple indicating status (True = an error was found), the - file name, the line number, the index number, the code string - and the error message (boolean, string, string, string, string, - string). The values are only valid, if the status is True. -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="compile_extern" ID="compile_extern"></a> -<h2>compile_extern</h2> -<b>compile_extern</b>(<i>file, isPy2, checkFlakes=True, ignoreStarImportWarnings=False</i>) -<p> - Function to compile one Python source file to Python bytecode. -</p><dl> -<dt><i>file</i></dt> -<dd> -source filename (string) -</dd><dt><i>isPy2</i></dt> -<dd> -flag indicating if it's a Python 2 or 3 file (boolean) -</dd><dt><i>checkFlakes=</i></dt> -<dd> -flag indicating to do a pyflakes check (boolean) -</dd><dt><i>ignoreStarImportWarnings=</i></dt> -<dd> -flag if star import warnings should be - suppressed (boolean) -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -A tuple indicating status (True = an error was found), the - file name, the line number, the index number, the code string, - the error message and a list of tuples of pyflakes warnings indicating - file name, line number and message (boolean, string, string, string, - string, string, list of (string, string, string)). The syntax error - values are only valid, if the status is True. The pyflakes list will - be empty, if a syntax error was detected by the syntax checker. -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> <a NAME="convertLineEnds" ID="convertLineEnds"></a> <h2>convertLineEnds</h2> <b>convertLineEnds</b>(<i>text, eol</i>) @@ -475,6 +423,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="decodeBytes" ID="decodeBytes"></a> <h2>decodeBytes</h2> <b>decodeBytes</b>(<i>buffer</i>) @@ -511,6 +477,30 @@ </dl> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> +<a NAME="determinePythonVersion" ID="determinePythonVersion"></a> +<h2>determinePythonVersion</h2> +<b>determinePythonVersion</b>(<i>filename, source, editor=None</i>) +<p> + Determine the python version of a given file. +</p><dl> +<dt><i>filename</i></dt> +<dd> +name of the file with extension (str) +</dd><dt><i>source</i></dt> +<dd> +of the file (str) +</dd><dt><i>editor=</i></dt> +<dd> +if the file is opened already (Editor object) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +Python version if file is Python2 or Python3 (int) +</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>) @@ -652,6 +642,31 @@ </dl> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> +<a NAME="extractLineFlags" ID="extractLineFlags"></a> +<h2>extractLineFlags</h2> +<b>extractLineFlags</b>(<i>line, startComment="</i>) +<p> + Function to extract flags starting and ending with '__' from a line + comment. +</p><dl> +<dt><i>line</i></dt> +<dd> +line to extract flags from (string) +</dd><dt><i>startComment=</i></dt> +<dd> +string identifying the start of the comment (string) +</dd><dt><i>endComment=</i></dt> +<dd> +string identifying the end of a comment (string) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +list containing the extracted flags (list of strings) +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> <a NAME="fromNativeSeparators" ID="fromNativeSeparators"></a> <h2>fromNativeSeparators</h2> <b>fromNativeSeparators</b>(<i>path</i>) @@ -998,6 +1013,24 @@ </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>) @@ -1352,6 +1385,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 its 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="readEncodedFileWithHash" ID="readEncodedFileWithHash"></a> <h2>readEncodedFileWithHash</h2> <b>readEncodedFileWithHash</b>(<i>filename</i>)