Documentation/Source/eric6.Plugins.CheckerPlugins.Tabnanny.Tabnanny.html

changeset 3673
e26d7d0c1088
child 4237
ff8a3e769fca
diff -r f0cb7579c0b4 -r e26d7d0c1088 Documentation/Source/eric6.Plugins.CheckerPlugins.Tabnanny.Tabnanny.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Documentation/Source/eric6.Plugins.CheckerPlugins.Tabnanny.Tabnanny.html	Sat Jul 05 12:29:15 2014 +0200
@@ -0,0 +1,389 @@
+<!DOCTYPE html>
+<html><head>
+<title>eric6.Plugins.CheckerPlugins.Tabnanny.Tabnanny</title>
+<meta charset="UTF-8">
+<style>
+body {
+    background: #EDECE6;
+    margin: 0em 1em 10em 1em;
+    color: black;
+}
+
+h1 { color: white; background: #85774A; }
+h2 { color: white; background: #85774A; }
+h3 { color: white; background: #9D936E; }
+h4 { color: white; background: #9D936E; }
+    
+a { color: #BA6D36; }
+
+</style>
+</head>
+<body><a NAME="top" ID="top"></a>
+<h1>eric6.Plugins.CheckerPlugins.Tabnanny.Tabnanny</h1>
+<p>
+The Tab Nanny despises ambiguous indentation.  She knows no mercy.
+</p><p>
+tabnanny -- Detection of ambiguous indentation
+</p><p>
+For the time being this module is intended to be called as a script.
+However it is possible to import it into an IDE and use the function
+check() described below.
+</p><p>
+Warning: The API provided by this module is likely to change in future
+releases; such changes may not be backward compatible.
+</p><p>
+This is a modified version to make the original tabnanny better suitable
+for being called from within the eric6 IDE.
+</p><dl>
+<dt>Raises <b>ValueError</b>:</dt>
+<dd>
+The tokenize module is too old.
+</dd>
+</dl>
+<h3>Global Attributes</h3>
+<table>
+<tr><td>__all__</td></tr><tr><td>__version__</td></tr>
+</table>
+<h3>Classes</h3>
+<table>
+<tr>
+<td><a href="#NannyNag">NannyNag</a></td>
+<td>Class implementing an exception for indentation issues.</td>
+</tr><tr>
+<td><a href="#Whitespace">Whitespace</a></td>
+<td>Class implementing the whitespace checker.</td>
+</tr>
+</table>
+<h3>Functions</h3>
+<table>
+<tr>
+<td><a href="#check">check</a></td>
+<td>Private function to check one Python source file for whitespace related problems.</td>
+</tr><tr>
+<td><a href="#format_witnesses">format_witnesses</a></td>
+<td>Function to format the witnesses as a readable string.</td>
+</tr><tr>
+<td><a href="#initService">initService</a></td>
+<td>Initialize the service and return the entry point.</td>
+</tr><tr>
+<td><a href="#process_tokens">process_tokens</a></td>
+<td>Function processing all tokens generated by a tokenizer run.</td>
+</tr>
+</table>
+<hr /><hr />
+<a NAME="NannyNag" ID="NannyNag"></a>
+<h2>NannyNag</h2>
+<p>
+    Class implementing an exception for indentation issues.
+</p><p>
+    Raised by tokeneater() if detecting an ambiguous indent.
+    Captured and handled in check().
+</p>
+<h3>Derived from</h3>
+Exception
+<h3>Class Attributes</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<h3>Class Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<h3>Methods</h3>
+<table>
+<tr>
+<td><a href="#NannyNag.__init__">NannyNag</a></td>
+<td>Constructor</td>
+</tr><tr>
+<td><a href="#NannyNag.get_line">get_line</a></td>
+<td>Public method to retrieve the offending line.</td>
+</tr><tr>
+<td><a href="#NannyNag.get_lineno">get_lineno</a></td>
+<td>Public method to retrieve the line number.</td>
+</tr><tr>
+<td><a href="#NannyNag.get_msg">get_msg</a></td>
+<td>Public method to retrieve the message.</td>
+</tr>
+</table>
+<h3>Static Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<a NAME="NannyNag.__init__" ID="NannyNag.__init__"></a>
+<h4>NannyNag (Constructor)</h4>
+<b>NannyNag</b>(<i>lineno, msg, line</i>)
+<p>
+        Constructor
+</p><dl>
+<dt><i>lineno</i></dt>
+<dd>
+Line number of the ambiguous indent.
+</dd><dt><i>msg</i></dt>
+<dd>
+Descriptive message assigned to this problem.
+</dd><dt><i>line</i></dt>
+<dd>
+The offending source line.
+</dd>
+</dl><a NAME="NannyNag.get_line" ID="NannyNag.get_line"></a>
+<h4>NannyNag.get_line</h4>
+<b>get_line</b>(<i></i>)
+<p>
+        Public method to retrieve the offending line.
+</p><dl>
+<dt>Returns:</dt>
+<dd>
+The line of code (string)
+</dd>
+</dl><a NAME="NannyNag.get_lineno" ID="NannyNag.get_lineno"></a>
+<h4>NannyNag.get_lineno</h4>
+<b>get_lineno</b>(<i></i>)
+<p>
+        Public method to retrieve the line number.
+</p><dl>
+<dt>Returns:</dt>
+<dd>
+The line number (integer)
+</dd>
+</dl><a NAME="NannyNag.get_msg" ID="NannyNag.get_msg"></a>
+<h4>NannyNag.get_msg</h4>
+<b>get_msg</b>(<i></i>)
+<p>
+        Public method to retrieve the message.
+</p><dl>
+<dt>Returns:</dt>
+<dd>
+The error message (string)
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
+<a NAME="Whitespace" ID="Whitespace"></a>
+<h2>Whitespace</h2>
+<p>
+    Class implementing the whitespace checker.
+</p>
+<h3>Derived from</h3>
+object
+<h3>Class Attributes</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<h3>Class Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<h3>Methods</h3>
+<table>
+<tr>
+<td><a href="#Whitespace.__init__">Whitespace</a></td>
+<td>Constructor</td>
+</tr><tr>
+<td><a href="#Whitespace.equal">equal</a></td>
+<td>Public method to compare the indentation levels of two Whitespace objects for equality.</td>
+</tr><tr>
+<td><a href="#Whitespace.indent_level">indent_level</a></td>
+<td>Public method to determine the indentation level.</td>
+</tr><tr>
+<td><a href="#Whitespace.less">less</a></td>
+<td>Public method to compare the indentation level against another Whitespace objects to be smaller.</td>
+</tr><tr>
+<td><a href="#Whitespace.longest_run_of_spaces">longest_run_of_spaces</a></td>
+<td>Public method to calculate the length of longest contiguous run of spaces.</td>
+</tr><tr>
+<td><a href="#Whitespace.not_equal_witness">not_equal_witness</a></td>
+<td>Public method to calculate a tuple of witnessing tab size.</td>
+</tr><tr>
+<td><a href="#Whitespace.not_less_witness">not_less_witness</a></td>
+<td>Public method to calculate a tuple of witnessing tab size.</td>
+</tr>
+</table>
+<h3>Static Methods</h3>
+<table>
+<tr><td>None</td></tr>
+</table>
+<a NAME="Whitespace.__init__" ID="Whitespace.__init__"></a>
+<h4>Whitespace (Constructor)</h4>
+<b>Whitespace</b>(<i>ws</i>)
+<p>
+        Constructor
+</p><dl>
+<dt><i>ws</i></dt>
+<dd>
+The string to be checked.
+</dd>
+</dl><a NAME="Whitespace.equal" ID="Whitespace.equal"></a>
+<h4>Whitespace.equal</h4>
+<b>equal</b>(<i>other</i>)
+<p>
+        Public method to compare the indentation levels of two Whitespace
+        objects for equality.
+</p><dl>
+<dt><i>other</i></dt>
+<dd>
+Whitespace object to compare against.
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+True, if we compare equal against the other Whitespace object.
+</dd>
+</dl><a NAME="Whitespace.indent_level" ID="Whitespace.indent_level"></a>
+<h4>Whitespace.indent_level</h4>
+<b>indent_level</b>(<i>tabsize</i>)
+<p>
+        Public method to determine the indentation level.
+</p><dl>
+<dt><i>tabsize</i></dt>
+<dd>
+The length of a tab stop. (integer)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+indentation level (integer)
+</dd>
+</dl><a NAME="Whitespace.less" ID="Whitespace.less"></a>
+<h4>Whitespace.less</h4>
+<b>less</b>(<i>other</i>)
+<p>
+        Public method to compare the indentation level against another
+        Whitespace objects to be smaller.
+</p><dl>
+<dt><i>other</i></dt>
+<dd>
+Whitespace object to compare against.
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+True, if we compare less against the other Whitespace object.
+</dd>
+</dl><a NAME="Whitespace.longest_run_of_spaces" ID="Whitespace.longest_run_of_spaces"></a>
+<h4>Whitespace.longest_run_of_spaces</h4>
+<b>longest_run_of_spaces</b>(<i></i>)
+<p>
+        Public method to calculate the length of longest contiguous run of
+        spaces.
+</p><dl>
+<dt>Returns:</dt>
+<dd>
+The length of longest contiguous run of spaces (whether or not
+            preceding a tab)
+</dd>
+</dl><a NAME="Whitespace.not_equal_witness" ID="Whitespace.not_equal_witness"></a>
+<h4>Whitespace.not_equal_witness</h4>
+<b>not_equal_witness</b>(<i>other</i>)
+<p>
+        Public method to calculate a tuple of witnessing tab size.
+</p><p>
+        Intended to be used after not self.equal(other) is known, in which
+        case it will return at least one witnessing tab size.
+</p><dl>
+<dt><i>other</i></dt>
+<dd>
+Whitespace object to calculate against.
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+A list of tuples (ts, i1, i2) such that
+            i1 == self.indent_level(ts) != other.indent_level(ts) == i2.
+</dd>
+</dl><a NAME="Whitespace.not_less_witness" ID="Whitespace.not_less_witness"></a>
+<h4>Whitespace.not_less_witness</h4>
+<b>not_less_witness</b>(<i>other</i>)
+<p>
+        Public method to calculate a tuple of witnessing tab size.
+</p><p>
+        Intended to be used after not self.less(other is known, in which
+        case it will return at least one witnessing tab size.
+</p><dl>
+<dt><i>other</i></dt>
+<dd>
+Whitespace object to calculate against.
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+A list of tuples (ts, i1, i2) such that
+            i1 == self.indent_level(ts) >= other.indent_level(ts) == i2.
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
+<a NAME="check" ID="check"></a>
+<h2>check</h2>
+<b>check</b>(<i>file, text=""</i>)
+<p>
+    Private function to check one Python source file for whitespace related
+    problems.
+</p><dl>
+<dt><i>file</i></dt>
+<dd>
+source filename (string)
+</dd><dt><i>text</i></dt>
+<dd>
+source text (string)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+A tuple indicating status (True = an error was found), the
+        filename, the linenumber and the error message
+        (boolean, 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="format_witnesses" ID="format_witnesses"></a>
+<h2>format_witnesses</h2>
+<b>format_witnesses</b>(<i>w</i>)
+<p>
+    Function to format the witnesses as a readable string.
+</p><dl>
+<dt><i>w</i></dt>
+<dd>
+A list of witnesses
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+A formated string of the witnesses.
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
+<a NAME="initService" ID="initService"></a>
+<h2>initService</h2>
+<b>initService</b>(<i></i>)
+<p>
+    Initialize the service and return the entry point.
+</p><dl>
+<dt>Returns:</dt>
+<dd>
+the entry point for the background client (function)
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
+<a NAME="process_tokens" ID="process_tokens"></a>
+<h2>process_tokens</h2>
+<b>process_tokens</b>(<i>tokens</i>)
+<p>
+    Function processing all tokens generated by a tokenizer run.
+</p><dl>
+<dt><i>tokens</i></dt>
+<dd>
+list of tokens
+</dd>
+</dl><dl>
+<dt>Raises <b>NannyNag</b>:</dt>
+<dd>
+raised to indicate an indentation error
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr />
+</body></html>
\ No newline at end of file

eric ide

mercurial