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

changeset 58
37f0444c3479
parent 21
b88a0e6268bd
child 409
0ea528e80202
equal deleted inserted replaced
57:81326a94fdca 58:37f0444c3479
20 </style> 20 </style>
21 </head> 21 </head>
22 <body><a NAME="top" ID="top"></a> 22 <body><a NAME="top" ID="top"></a>
23 <h1>eric5.Plugins.CheckerPlugins.Tabnanny.Tabnanny</h1> 23 <h1>eric5.Plugins.CheckerPlugins.Tabnanny.Tabnanny</h1>
24 <p> 24 <p>
25 &#84;&#104;&#101; &#84;&#97;&#98; &#78;&#97;&#110;&#110;y &#100;&#101;&#115;&#112;&#105;&#115;&#101;&#115; &#97;&#109;&#98;&#105;&#103;&#117;&#111;&#117;&#115; &#105;&#110;&#100;&#101;&#110;&#116;&#97;&#116;&#105;&#111;&#110;. &#83;&#104;&#101; &#107;&#110;&#111;w&#115; &#110;&#111; &#109;&#101;&#114;&#99;y. 25 The Tab Nanny despises ambiguous indentation. She knows no mercy.
26 </p><p> 26 </p><p>
27 &#116;&#97;&#98;&#110;&#97;&#110;&#110;y -- &#68;&#101;&#116;&#101;&#99;&#116;&#105;&#111;&#110; &#111;&#102; &#97;&#109;&#98;&#105;&#103;&#117;&#111;&#117;&#115; &#105;&#110;&#100;&#101;&#110;&#116;&#97;&#116;&#105;&#111;&#110; 27 tabnanny -- Detection of ambiguous indentation
28 </p><p> 28 </p><p>
29 &#70;&#111;&#114; &#116;&#104;&#101; &#116;&#105;&#109;&#101; &#98;&#101;&#105;&#110;&#103; &#116;&#104;&#105;&#115; &#109;&#111;&#100;&#117;&#108;&#101; &#105;&#115; &#105;&#110;&#116;&#101;&#110;&#100;&#101;&#100; &#116;&#111; &#98;&#101; &#99;&#97;&#108;&#108;&#101;&#100; &#97;&#115; &#97; &#115;&#99;&#114;&#105;&#112;&#116;. 29 For the time being this module is intended to be called as a script.
30 &#72;&#111;w&#101;v&#101;&#114; &#105;&#116; &#105;&#115; &#112;&#111;&#115;&#115;&#105;&#98;&#108;&#101; &#116;&#111; &#105;&#109;&#112;&#111;&#114;&#116; &#105;&#116; &#105;&#110;&#116;&#111; &#97;&#110; &#73;&#68;&#69; &#97;&#110;&#100; &#117;&#115;&#101; &#116;&#104;&#101; &#102;&#117;&#110;&#99;&#116;&#105;&#111;&#110; 30 However it is possible to import it into an IDE and use the function
31 &#99;&#104;&#101;&#99;&#107;() &#100;&#101;&#115;&#99;&#114;&#105;&#98;&#101;&#100; &#98;&#101;&#108;&#111;w. 31 check() described below.
32 </p><p> 32 </p><p>
33 &#87;&#97;&#114;&#110;&#105;&#110;&#103;&#58; &#84;&#104;&#101; &#65;&#80;&#73; &#112;&#114;&#111;v&#105;&#100;&#101;&#100; &#98;y &#116;&#104;&#105;&#115; &#109;&#111;&#100;&#117;&#108;&#101; &#105;&#115; &#108;&#105;&#107;&#101;&#108;y &#116;&#111; &#99;&#104;&#97;&#110;&#103;&#101; &#105;&#110; &#102;&#117;&#116;&#117;&#114;&#101; 33 Warning: The API provided by this module is likely to change in future
34 &#114;&#101;&#108;&#101;&#97;&#115;&#101;&#115;&#59; &#115;&#117;&#99;&#104; &#99;&#104;&#97;&#110;&#103;&#101;&#115; &#109;&#97;y &#110;&#111;&#116; &#98;&#101; &#98;&#97;&#99;&#107;w&#97;&#114;&#100; &#99;&#111;&#109;&#112;&#97;&#116;&#105;&#98;&#108;&#101;. 34 releases; such changes may not be backward compatible.
35 </p><p> 35 </p><p>
36 &#84;&#104;&#105;&#115; &#105;&#115; &#97; &#109;&#111;&#100;&#105;&#102;&#105;&#101;&#100; v&#101;&#114;&#115;&#105;&#111;&#110; &#116;&#111; &#109;&#97;&#107;&#101; &#116;&#104;&#101; &#111;&#114;&#105;&#103;&#105;&#110;&#97;&#108; &#116;&#97;&#98;&#110;&#97;&#110;&#110;y &#98;&#101;&#116;&#116;&#101;&#114; &#115;&#117;&#105;&#116;&#97;&#98;&#108;&#101; 36 This is a modified version to make the original tabnanny better suitable
37 &#102;&#111;&#114; &#98;&#101;&#105;&#110;&#103; &#99;&#97;&#108;&#108;&#101;&#100; &#102;&#114;&#111;&#109; w&#105;&#116;&#104;&#105;&#110; &#116;&#104;&#101; &#101;&#114;&#105;&#99;&#53; &#73;&#68;&#69;. 37 for being called from within the eric5 IDE.
38 </p><dl> 38 </p><dl>
39 <dt>Raises <b>ValueError</b>:</dt> 39 <dt>Raises <b>ValueError</b>:</dt>
40 <dd> 40 <dd>
41 &#84;&#104;&#101; &#116;&#111;&#107;&#101;&#110;&#105;z&#101; &#109;&#111;&#100;&#117;&#108;&#101; &#105;&#115; &#116;&#111;&#111; &#111;&#108;&#100;. 41 The tokenize module is too old.
42 </dd> 42 </dd>
43 </dl> 43 </dl>
44 <h3>Global Attributes</h3> 44 <h3>Global Attributes</h3>
45 <table> 45 <table>
46 <tr><td>__all__</td></tr><tr><td>__version__</td></tr> 46 <tr><td>__all__</td></tr><tr><td>__version__</td></tr>
47 </table> 47 </table>
48 <h3>Classes</h3> 48 <h3>Classes</h3>
49 <table> 49 <table>
50 <tr> 50 <tr>
51 <td><a href="#NannyNag">NannyNag</a></td> 51 <td><a href="#NannyNag">NannyNag</a></td>
52 <td>&#82;&#97;&#105;&#115;&#101;&#100; &#98;y &#116;&#111;&#107;&#101;&#110;&#101;&#97;&#116;&#101;&#114;() &#105;&#102; &#100;&#101;&#116;&#101;&#99;&#116;&#105;&#110;&#103; &#97;&#110; &#97;&#109;&#98;&#105;&#103;&#117;&#111;&#117;&#115; &#105;&#110;&#100;&#101;&#110;&#116;.</td> 52 <td>Raised by tokeneater() if detecting an ambiguous indent.</td>
53 </tr><tr> 53 </tr><tr>
54 <td><a href="#Whitespace">Whitespace</a></td> 54 <td><a href="#Whitespace">Whitespace</a></td>
55 <td>&#67;&#108;&#97;&#115;&#115; &#105;&#109;&#112;&#108;&#101;&#109;&#101;&#110;&#116;&#105;&#110;&#103; &#116;&#104;&#101; w&#104;&#105;&#116;&#101;&#115;&#112;&#97;&#99;&#101; &#99;&#104;&#101;&#99;&#107;&#101;&#114;.</td> 55 <td>Class implementing the whitespace checker.</td>
56 </tr> 56 </tr>
57 </table> 57 </table>
58 <h3>Functions</h3> 58 <h3>Functions</h3>
59 <table> 59 <table>
60 <tr> 60 <tr>
61 <td><a href="#check">check</a></td> 61 <td><a href="#check">check</a></td>
62 <td>&#80;&#114;&#105;v&#97;&#116;&#101; &#102;&#117;&#110;&#99;&#116;&#105;&#111;&#110; &#116;&#111; &#99;&#104;&#101;&#99;&#107; &#111;&#110;&#101; &#80;y&#116;&#104;&#111;&#110; &#115;&#111;&#117;&#114;&#99;&#101; &#102;&#105;&#108;&#101; &#102;&#111;&#114; w&#104;&#105;&#116;&#101;&#115;&#112;&#97;&#99;&#101; &#114;&#101;&#108;&#97;&#116;&#101;&#100; &#112;&#114;&#111;&#98;&#108;&#101;&#109;&#115;.</td> 62 <td>Private function to check one Python source file for whitespace related problems.</td>
63 </tr><tr> 63 </tr><tr>
64 <td><a href="#format_witnesses">format_witnesses</a></td> 64 <td><a href="#format_witnesses">format_witnesses</a></td>
65 <td>&#70;&#117;&#110;&#99;&#116;&#105;&#111;&#110; &#116;&#111; &#102;&#111;&#114;&#109;&#97;&#116; &#116;&#104;&#101; w&#105;&#116;&#110;&#101;&#115;&#115;&#101;&#115; &#97;&#115; &#97; &#114;&#101;&#97;&#100;&#97;&#98;&#108;&#101; &#115;&#116;&#114;&#105;&#110;&#103;.</td> 65 <td>Function to format the witnesses as a readable string.</td>
66 </tr><tr> 66 </tr><tr>
67 <td><a href="#process_tokens">process_tokens</a></td> 67 <td><a href="#process_tokens">process_tokens</a></td>
68 <td>&#70;&#117;&#110;&#99;&#116;&#105;&#111;&#110; &#112;&#114;&#111;&#99;&#101;&#115;&#115;&#105;&#110;&#103; &#97;&#108;&#108; &#116;&#111;&#107;&#101;&#110;&#115; &#103;&#101;&#110;&#101;&#114;&#97;&#116;&#101;&#100; &#98;y &#97; &#116;&#111;&#107;&#101;&#110;&#105;z&#101;&#114; &#114;&#117;&#110;.</td> 68 <td>Function processing all tokens generated by a tokenizer run.</td>
69 </tr> 69 </tr>
70 </table> 70 </table>
71 <hr /><hr /> 71 <hr /><hr />
72 <a NAME="NannyNag" ID="NannyNag"></a> 72 <a NAME="NannyNag" ID="NannyNag"></a>
73 <h2>NannyNag</h2> 73 <h2>NannyNag</h2>
74 <p> 74 <p>
75 &#82;&#97;&#105;&#115;&#101;&#100; &#98;y &#116;&#111;&#107;&#101;&#110;&#101;&#97;&#116;&#101;&#114;() &#105;&#102; &#100;&#101;&#116;&#101;&#99;&#116;&#105;&#110;&#103; &#97;&#110; &#97;&#109;&#98;&#105;&#103;&#117;&#111;&#117;&#115; &#105;&#110;&#100;&#101;&#110;&#116;. 75 Raised by tokeneater() if detecting an ambiguous indent.
76 &#67;&#97;&#112;&#116;&#117;&#114;&#101;&#100; &#97;&#110;&#100; &#104;&#97;&#110;&#100;&#108;&#101;&#100; &#105;&#110; &#99;&#104;&#101;&#99;&#107;(). 76 Captured and handled in check().
77 </p> 77 </p>
78 <h3>Derived from</h3> 78 <h3>Derived from</h3>
79 Exception 79 Exception
80 <h3>Class Attributes</h3> 80 <h3>Class Attributes</h3>
81 <table> 81 <table>
83 </table> 83 </table>
84 <h3>Methods</h3> 84 <h3>Methods</h3>
85 <table> 85 <table>
86 <tr> 86 <tr>
87 <td><a href="#NannyNag.__init__">NannyNag</a></td> 87 <td><a href="#NannyNag.__init__">NannyNag</a></td>
88 <td>&#67;&#111;&#110;&#115;&#116;&#114;&#117;&#99;&#116;&#111;&#114;</td> 88 <td>Constructor</td>
89 </tr><tr> 89 </tr><tr>
90 <td><a href="#NannyNag.get_line">get_line</a></td> 90 <td><a href="#NannyNag.get_line">get_line</a></td>
91 <td>&#77;&#101;&#116;&#104;&#111;&#100; &#116;&#111; &#114;&#101;&#116;&#114;&#105;&#101;v&#101; &#116;&#104;&#101; &#111;&#102;&#102;&#101;&#110;&#100;&#105;&#110;&#103; &#108;&#105;&#110;&#101;.</td> 91 <td>Method to retrieve the offending line.</td>
92 </tr><tr> 92 </tr><tr>
93 <td><a href="#NannyNag.get_lineno">get_lineno</a></td> 93 <td><a href="#NannyNag.get_lineno">get_lineno</a></td>
94 <td>&#77;&#101;&#116;&#104;&#111;&#100; &#116;&#111; &#114;&#101;&#116;&#114;&#105;&#101;v&#101; &#116;&#104;&#101; &#108;&#105;&#110;&#101; &#110;&#117;&#109;&#98;&#101;&#114;.</td> 94 <td>Method to retrieve the line number.</td>
95 </tr><tr> 95 </tr><tr>
96 <td><a href="#NannyNag.get_msg">get_msg</a></td> 96 <td><a href="#NannyNag.get_msg">get_msg</a></td>
97 <td>&#77;&#101;&#116;&#104;&#111;&#100; &#116;&#111; &#114;&#101;&#116;&#114;&#105;&#101;v&#101; &#116;&#104;&#101; &#109;&#101;&#115;&#115;&#97;&#103;&#101;.</td> 97 <td>Method to retrieve the message.</td>
98 </tr> 98 </tr>
99 </table> 99 </table>
100 <a NAME="NannyNag.__init__" ID="NannyNag.__init__"></a> 100 <a NAME="NannyNag.__init__" ID="NannyNag.__init__"></a>
101 <h4>NannyNag (Constructor)</h4> 101 <h4>NannyNag (Constructor)</h4>
102 <b>NannyNag</b>(<i>lineno, msg, line</i>) 102 <b>NannyNag</b>(<i>lineno, msg, line</i>)
103 <p> 103 <p>
104 &#67;&#111;&#110;&#115;&#116;&#114;&#117;&#99;&#116;&#111;&#114; 104 Constructor
105 </p><dl> 105 </p><dl>
106 <dt><i>lineno</i></dt> 106 <dt><i>lineno</i></dt>
107 <dd> 107 <dd>
108 &#76;&#105;&#110;&#101; &#110;&#117;&#109;&#98;&#101;&#114; &#111;&#102; &#116;&#104;&#101; &#97;&#109;&#98;&#105;&#103;&#117;&#111;&#117;&#115; &#105;&#110;&#100;&#101;&#110;&#116;. 108 Line number of the ambiguous indent.
109 </dd><dt><i>msg</i></dt> 109 </dd><dt><i>msg</i></dt>
110 <dd> 110 <dd>
111 &#68;&#101;&#115;&#99;&#114;&#105;&#112;&#116;&#105;v&#101; &#109;&#101;&#115;&#115;&#97;&#103;&#101; &#97;&#115;&#115;&#105;&#103;&#110;&#101;&#100; &#116;&#111; &#116;&#104;&#105;&#115; &#112;&#114;&#111;&#98;&#108;&#101;&#109;. 111 Descriptive message assigned to this problem.
112 </dd><dt><i>line</i></dt> 112 </dd><dt><i>line</i></dt>
113 <dd> 113 <dd>
114 &#84;&#104;&#101; &#111;&#102;&#102;&#101;&#110;&#100;&#105;&#110;&#103; &#115;&#111;&#117;&#114;&#99;&#101; &#108;&#105;&#110;&#101;. 114 The offending source line.
115 </dd> 115 </dd>
116 </dl><a NAME="NannyNag.get_line" ID="NannyNag.get_line"></a> 116 </dl><a NAME="NannyNag.get_line" ID="NannyNag.get_line"></a>
117 <h4>NannyNag.get_line</h4> 117 <h4>NannyNag.get_line</h4>
118 <b>get_line</b>(<i></i>) 118 <b>get_line</b>(<i></i>)
119 <p> 119 <p>
120 &#77;&#101;&#116;&#104;&#111;&#100; &#116;&#111; &#114;&#101;&#116;&#114;&#105;&#101;v&#101; &#116;&#104;&#101; &#111;&#102;&#102;&#101;&#110;&#100;&#105;&#110;&#103; &#108;&#105;&#110;&#101;. 120 Method to retrieve the offending line.
121 </p><dl> 121 </p><dl>
122 <dt>Returns:</dt> 122 <dt>Returns:</dt>
123 <dd> 123 <dd>
124 &#84;&#104;&#101; &#108;&#105;&#110;&#101; &#111;&#102; &#99;&#111;&#100;&#101; (&#115;&#116;&#114;&#105;&#110;&#103;) 124 The line of code (string)
125 </dd> 125 </dd>
126 </dl><a NAME="NannyNag.get_lineno" ID="NannyNag.get_lineno"></a> 126 </dl><a NAME="NannyNag.get_lineno" ID="NannyNag.get_lineno"></a>
127 <h4>NannyNag.get_lineno</h4> 127 <h4>NannyNag.get_lineno</h4>
128 <b>get_lineno</b>(<i></i>) 128 <b>get_lineno</b>(<i></i>)
129 <p> 129 <p>
130 &#77;&#101;&#116;&#104;&#111;&#100; &#116;&#111; &#114;&#101;&#116;&#114;&#105;&#101;v&#101; &#116;&#104;&#101; &#108;&#105;&#110;&#101; &#110;&#117;&#109;&#98;&#101;&#114;. 130 Method to retrieve the line number.
131 </p><dl> 131 </p><dl>
132 <dt>Returns:</dt> 132 <dt>Returns:</dt>
133 <dd> 133 <dd>
134 &#84;&#104;&#101; &#108;&#105;&#110;&#101; &#110;&#117;&#109;&#98;&#101;&#114; (&#105;&#110;&#116;&#101;&#103;&#101;&#114;) 134 The line number (integer)
135 </dd> 135 </dd>
136 </dl><a NAME="NannyNag.get_msg" ID="NannyNag.get_msg"></a> 136 </dl><a NAME="NannyNag.get_msg" ID="NannyNag.get_msg"></a>
137 <h4>NannyNag.get_msg</h4> 137 <h4>NannyNag.get_msg</h4>
138 <b>get_msg</b>(<i></i>) 138 <b>get_msg</b>(<i></i>)
139 <p> 139 <p>
140 &#77;&#101;&#116;&#104;&#111;&#100; &#116;&#111; &#114;&#101;&#116;&#114;&#105;&#101;v&#101; &#116;&#104;&#101; &#109;&#101;&#115;&#115;&#97;&#103;&#101;. 140 Method to retrieve the message.
141 </p><dl> 141 </p><dl>
142 <dt>Returns:</dt> 142 <dt>Returns:</dt>
143 <dd> 143 <dd>
144 &#84;&#104;&#101; &#101;&#114;&#114;&#111;&#114; &#109;&#101;&#115;&#115;&#97;&#103;&#101; (&#115;&#116;&#114;&#105;&#110;&#103;) 144 The error message (string)
145 </dd> 145 </dd>
146 </dl> 146 </dl>
147 <div align="right"><a href="#top">Up</a></div> 147 <div align="right"><a href="#top">Up</a></div>
148 <hr /><hr /> 148 <hr /><hr />
149 <a NAME="Whitespace" ID="Whitespace"></a> 149 <a NAME="Whitespace" ID="Whitespace"></a>
150 <h2>Whitespace</h2> 150 <h2>Whitespace</h2>
151 <p> 151 <p>
152 &#67;&#108;&#97;&#115;&#115; &#105;&#109;&#112;&#108;&#101;&#109;&#101;&#110;&#116;&#105;&#110;&#103; &#116;&#104;&#101; w&#104;&#105;&#116;&#101;&#115;&#112;&#97;&#99;&#101; &#99;&#104;&#101;&#99;&#107;&#101;&#114;. 152 Class implementing the whitespace checker.
153 </p> 153 </p>
154 <h3>Derived from</h3> 154 <h3>Derived from</h3>
155 object 155 object
156 <h3>Class Attributes</h3> 156 <h3>Class Attributes</h3>
157 <table> 157 <table>
159 </table> 159 </table>
160 <h3>Methods</h3> 160 <h3>Methods</h3>
161 <table> 161 <table>
162 <tr> 162 <tr>
163 <td><a href="#Whitespace.__init__">Whitespace</a></td> 163 <td><a href="#Whitespace.__init__">Whitespace</a></td>
164 <td>&#67;&#111;&#110;&#115;&#116;&#114;&#117;&#99;&#116;&#111;&#114;</td> 164 <td>Constructor</td>
165 </tr><tr> 165 </tr><tr>
166 <td><a href="#Whitespace.equal">equal</a></td> 166 <td><a href="#Whitespace.equal">equal</a></td>
167 <td>&#77;&#101;&#116;&#104;&#111;&#100; &#116;&#111; &#99;&#111;&#109;&#112;&#97;&#114;&#101; &#116;&#104;&#101; &#105;&#110;&#100;&#101;&#110;&#116;&#97;&#116;&#105;&#111;&#110; &#108;&#101;v&#101;&#108;&#115; &#111;&#102; &#116;w&#111; &#87;&#104;&#105;&#116;&#101;&#115;&#112;&#97;&#99;&#101; &#111;&#98;&#106;&#101;&#99;&#116;&#115; &#102;&#111;&#114; &#101;&#113;&#117;&#97;&#108;&#105;&#116;y.</td> 167 <td>Method to compare the indentation levels of two Whitespace objects for equality.</td>
168 </tr><tr> 168 </tr><tr>
169 <td><a href="#Whitespace.indent_level">indent_level</a></td> 169 <td><a href="#Whitespace.indent_level">indent_level</a></td>
170 <td>&#77;&#101;&#116;&#104;&#111;&#100; &#116;&#111; &#100;&#101;&#116;&#101;&#114;&#109;&#105;&#110;&#101; &#116;&#104;&#101; &#105;&#110;&#100;&#101;&#110;&#116;&#97;&#116;&#105;&#111;&#110; &#108;&#101;v&#101;&#108;.</td> 170 <td>Method to determine the indentation level.</td>
171 </tr><tr> 171 </tr><tr>
172 <td><a href="#Whitespace.less">less</a></td> 172 <td><a href="#Whitespace.less">less</a></td>
173 <td>&#77;&#101;&#116;&#104;&#111;&#100; &#116;&#111; &#99;&#111;&#109;&#112;&#97;&#114;&#101; &#116;&#104;&#101; &#105;&#110;&#100;&#101;&#110;&#116;&#97;&#116;&#105;&#111;&#110; &#108;&#101;v&#101;&#108; &#97;&#103;&#97;&#105;&#110;&#115;&#116; &#97;&#110;&#111;&#116;&#104;&#101;&#114; &#87;&#104;&#105;&#116;&#101;&#115;&#112;&#97;&#99;&#101; &#111;&#98;&#106;&#101;&#99;&#116;&#115; &#116;&#111; &#98;&#101; &#115;&#109;&#97;&#108;&#108;&#101;&#114;.</td> 173 <td>Method to compare the indentation level against another Whitespace objects to be smaller.</td>
174 </tr><tr> 174 </tr><tr>
175 <td><a href="#Whitespace.longest_run_of_spaces">longest_run_of_spaces</a></td> 175 <td><a href="#Whitespace.longest_run_of_spaces">longest_run_of_spaces</a></td>
176 <td>&#77;&#101;&#116;&#104;&#111;&#100; &#116;&#111; &#99;&#97;&#108;&#99;&#117;&#108;&#97;&#116;&#101; &#116;&#104;&#101; &#108;&#101;&#110;&#103;&#116;&#104; &#111;&#102; &#108;&#111;&#110;&#103;&#101;&#115;&#116; &#99;&#111;&#110;&#116;&#105;&#103;&#117;&#111;&#117;&#115; &#114;&#117;&#110; &#111;&#102; &#115;&#112;&#97;&#99;&#101;&#115;.</td> 176 <td>Method to calculate the length of longest contiguous run of spaces.</td>
177 </tr><tr> 177 </tr><tr>
178 <td><a href="#Whitespace.not_equal_witness">not_equal_witness</a></td> 178 <td><a href="#Whitespace.not_equal_witness">not_equal_witness</a></td>
179 <td>&#77;&#101;&#116;&#104;&#111;&#100; &#116;&#111; &#99;&#97;&#108;&#99;&#117;&#108;&#97;&#116;&#101; &#97; &#116;&#117;&#112;&#108;&#101; &#111;&#102; w&#105;&#116;&#110;&#101;&#115;&#115;&#105;&#110;&#103; &#116;&#97;&#98; &#115;&#105;z&#101;.</td> 179 <td>Method to calculate a tuple of witnessing tab size.</td>
180 </tr><tr> 180 </tr><tr>
181 <td><a href="#Whitespace.not_less_witness">not_less_witness</a></td> 181 <td><a href="#Whitespace.not_less_witness">not_less_witness</a></td>
182 <td>&#77;&#101;&#116;&#104;&#111;&#100; &#116;&#111; &#99;&#97;&#108;&#99;&#117;&#108;&#97;&#116;&#101; &#97; &#116;&#117;&#112;&#108;&#101; &#111;&#102; w&#105;&#116;&#110;&#101;&#115;&#115;&#105;&#110;&#103; &#116;&#97;&#98; &#115;&#105;z&#101;.</td> 182 <td>Method to calculate a tuple of witnessing tab size.</td>
183 </tr> 183 </tr>
184 </table> 184 </table>
185 <a NAME="Whitespace.__init__" ID="Whitespace.__init__"></a> 185 <a NAME="Whitespace.__init__" ID="Whitespace.__init__"></a>
186 <h4>Whitespace (Constructor)</h4> 186 <h4>Whitespace (Constructor)</h4>
187 <b>Whitespace</b>(<i>ws</i>) 187 <b>Whitespace</b>(<i>ws</i>)
188 <p> 188 <p>
189 &#67;&#111;&#110;&#115;&#116;&#114;&#117;&#99;&#116;&#111;&#114; 189 Constructor
190 </p><dl> 190 </p><dl>
191 <dt><i>ws</i></dt> 191 <dt><i>ws</i></dt>
192 <dd> 192 <dd>
193 &#84;&#104;&#101; &#115;&#116;&#114;&#105;&#110;&#103; &#116;&#111; &#98;&#101; &#99;&#104;&#101;&#99;&#107;&#101;&#100;. 193 The string to be checked.
194 </dd> 194 </dd>
195 </dl><a NAME="Whitespace.equal" ID="Whitespace.equal"></a> 195 </dl><a NAME="Whitespace.equal" ID="Whitespace.equal"></a>
196 <h4>Whitespace.equal</h4> 196 <h4>Whitespace.equal</h4>
197 <b>equal</b>(<i>other</i>) 197 <b>equal</b>(<i>other</i>)
198 <p> 198 <p>
199 &#77;&#101;&#116;&#104;&#111;&#100; &#116;&#111; &#99;&#111;&#109;&#112;&#97;&#114;&#101; &#116;&#104;&#101; &#105;&#110;&#100;&#101;&#110;&#116;&#97;&#116;&#105;&#111;&#110; &#108;&#101;v&#101;&#108;&#115; &#111;&#102; &#116;w&#111; &#87;&#104;&#105;&#116;&#101;&#115;&#112;&#97;&#99;&#101; &#111;&#98;&#106;&#101;&#99;&#116;&#115; &#102;&#111;&#114; &#101;&#113;&#117;&#97;&#108;&#105;&#116;y. 199 Method to compare the indentation levels of two Whitespace objects for equality.
200 </p><dl> 200 </p><dl>
201 <dt><i>other</i></dt> 201 <dt><i>other</i></dt>
202 <dd> 202 <dd>
203 &#87;&#104;&#105;&#116;&#101;&#115;&#112;&#97;&#99;&#101; &#111;&#98;&#106;&#101;&#99;&#116; &#116;&#111; &#99;&#111;&#109;&#112;&#97;&#114;&#101; &#97;&#103;&#97;&#105;&#110;&#115;&#116;. 203 Whitespace object to compare against.
204 </dd> 204 </dd>
205 </dl><dl> 205 </dl><dl>
206 <dt>Returns:</dt> 206 <dt>Returns:</dt>
207 <dd> 207 <dd>
208 &#84;&#114;&#117;&#101;, &#105;&#102; w&#101; &#99;&#111;&#109;&#112;&#97;&#114;&#101; &#101;&#113;&#117;&#97;&#108; &#97;&#103;&#97;&#105;&#110;&#115;&#116; &#116;&#104;&#101; &#111;&#116;&#104;&#101;&#114; &#87;&#104;&#105;&#116;&#101;&#115;&#112;&#97;&#99;&#101; &#111;&#98;&#106;&#101;&#99;&#116;. 208 True, if we compare equal against the other Whitespace object.
209 </dd> 209 </dd>
210 </dl><a NAME="Whitespace.indent_level" ID="Whitespace.indent_level"></a> 210 </dl><a NAME="Whitespace.indent_level" ID="Whitespace.indent_level"></a>
211 <h4>Whitespace.indent_level</h4> 211 <h4>Whitespace.indent_level</h4>
212 <b>indent_level</b>(<i>tabsize</i>) 212 <b>indent_level</b>(<i>tabsize</i>)
213 <p> 213 <p>
214 &#77;&#101;&#116;&#104;&#111;&#100; &#116;&#111; &#100;&#101;&#116;&#101;&#114;&#109;&#105;&#110;&#101; &#116;&#104;&#101; &#105;&#110;&#100;&#101;&#110;&#116;&#97;&#116;&#105;&#111;&#110; &#108;&#101;v&#101;&#108;. 214 Method to determine the indentation level.
215 </p><dl> 215 </p><dl>
216 <dt><i>tabsize</i></dt> 216 <dt><i>tabsize</i></dt>
217 <dd> 217 <dd>
218 &#84;&#104;&#101; &#108;&#101;&#110;&#103;&#116;&#104; &#111;&#102; &#97; &#116;&#97;&#98; &#115;&#116;&#111;&#112;. (&#105;&#110;&#116;&#101;&#103;&#101;&#114;) 218 The length of a tab stop. (integer)
219 </dd> 219 </dd>
220 </dl><dl> 220 </dl><dl>
221 <dt>Returns:</dt> 221 <dt>Returns:</dt>
222 <dd> 222 <dd>
223 &#105;&#110;&#100;&#101;&#110;&#116;&#97;&#116;&#105;&#111;&#110; &#108;&#101;v&#101;&#108; (&#105;&#110;&#116;&#101;&#103;&#101;&#114;) 223 indentation level (integer)
224 </dd> 224 </dd>
225 </dl><a NAME="Whitespace.less" ID="Whitespace.less"></a> 225 </dl><a NAME="Whitespace.less" ID="Whitespace.less"></a>
226 <h4>Whitespace.less</h4> 226 <h4>Whitespace.less</h4>
227 <b>less</b>(<i>other</i>) 227 <b>less</b>(<i>other</i>)
228 <p> 228 <p>
229 &#77;&#101;&#116;&#104;&#111;&#100; &#116;&#111; &#99;&#111;&#109;&#112;&#97;&#114;&#101; &#116;&#104;&#101; &#105;&#110;&#100;&#101;&#110;&#116;&#97;&#116;&#105;&#111;&#110; &#108;&#101;v&#101;&#108; &#97;&#103;&#97;&#105;&#110;&#115;&#116; &#97;&#110;&#111;&#116;&#104;&#101;&#114; &#87;&#104;&#105;&#116;&#101;&#115;&#112;&#97;&#99;&#101; &#111;&#98;&#106;&#101;&#99;&#116;&#115; &#116;&#111; 229 Method to compare the indentation level against another Whitespace objects to
230 &#98;&#101; &#115;&#109;&#97;&#108;&#108;&#101;&#114;. 230 be smaller.
231 </p><dl> 231 </p><dl>
232 <dt><i>other</i></dt> 232 <dt><i>other</i></dt>
233 <dd> 233 <dd>
234 &#87;&#104;&#105;&#116;&#101;&#115;&#112;&#97;&#99;&#101; &#111;&#98;&#106;&#101;&#99;&#116; &#116;&#111; &#99;&#111;&#109;&#112;&#97;&#114;&#101; &#97;&#103;&#97;&#105;&#110;&#115;&#116;. 234 Whitespace object to compare against.
235 </dd> 235 </dd>
236 </dl><dl> 236 </dl><dl>
237 <dt>Returns:</dt> 237 <dt>Returns:</dt>
238 <dd> 238 <dd>
239 &#84;&#114;&#117;&#101;, &#105;&#102; w&#101; &#99;&#111;&#109;&#112;&#97;&#114;&#101; &#108;&#101;&#115;&#115; &#97;&#103;&#97;&#105;&#110;&#115;&#116; &#116;&#104;&#101; &#111;&#116;&#104;&#101;&#114; &#87;&#104;&#105;&#116;&#101;&#115;&#112;&#97;&#99;&#101; &#111;&#98;&#106;&#101;&#99;&#116;. 239 True, if we compare less against the other Whitespace object.
240 </dd> 240 </dd>
241 </dl><a NAME="Whitespace.longest_run_of_spaces" ID="Whitespace.longest_run_of_spaces"></a> 241 </dl><a NAME="Whitespace.longest_run_of_spaces" ID="Whitespace.longest_run_of_spaces"></a>
242 <h4>Whitespace.longest_run_of_spaces</h4> 242 <h4>Whitespace.longest_run_of_spaces</h4>
243 <b>longest_run_of_spaces</b>(<i></i>) 243 <b>longest_run_of_spaces</b>(<i></i>)
244 <p> 244 <p>
245 &#77;&#101;&#116;&#104;&#111;&#100; &#116;&#111; &#99;&#97;&#108;&#99;&#117;&#108;&#97;&#116;&#101; &#116;&#104;&#101; &#108;&#101;&#110;&#103;&#116;&#104; &#111;&#102; &#108;&#111;&#110;&#103;&#101;&#115;&#116; &#99;&#111;&#110;&#116;&#105;&#103;&#117;&#111;&#117;&#115; &#114;&#117;&#110; &#111;&#102; &#115;&#112;&#97;&#99;&#101;&#115;. 245 Method to calculate the length of longest contiguous run of spaces.
246 </p><dl> 246 </p><dl>
247 <dt>Returns:</dt> 247 <dt>Returns:</dt>
248 <dd> 248 <dd>
249 &#84;&#104;&#101; &#108;&#101;&#110;&#103;&#116;&#104; &#111;&#102; &#108;&#111;&#110;&#103;&#101;&#115;&#116; &#99;&#111;&#110;&#116;&#105;&#103;&#117;&#111;&#117;&#115; &#114;&#117;&#110; &#111;&#102; &#115;&#112;&#97;&#99;&#101;&#115; (w&#104;&#101;&#116;&#104;&#101;&#114; &#111;&#114; &#110;&#111;&#116; 249 The length of longest contiguous run of spaces (whether or not
250 &#112;&#114;&#101;&#99;&#101;&#100;&#105;&#110;&#103; &#97; &#116;&#97;&#98;) 250 preceding a tab)
251 </dd> 251 </dd>
252 </dl><a NAME="Whitespace.not_equal_witness" ID="Whitespace.not_equal_witness"></a> 252 </dl><a NAME="Whitespace.not_equal_witness" ID="Whitespace.not_equal_witness"></a>
253 <h4>Whitespace.not_equal_witness</h4> 253 <h4>Whitespace.not_equal_witness</h4>
254 <b>not_equal_witness</b>(<i>other</i>) 254 <b>not_equal_witness</b>(<i>other</i>)
255 <p> 255 <p>
256 &#77;&#101;&#116;&#104;&#111;&#100; &#116;&#111; &#99;&#97;&#108;&#99;&#117;&#108;&#97;&#116;&#101; &#97; &#116;&#117;&#112;&#108;&#101; &#111;&#102; w&#105;&#116;&#110;&#101;&#115;&#115;&#105;&#110;&#103; &#116;&#97;&#98; &#115;&#105;z&#101;. 256 Method to calculate a tuple of witnessing tab size.
257 </p><p> 257 </p><p>
258 &#73;&#110;&#116;&#101;&#110;&#100;&#101;&#100; &#116;&#111; &#98;&#101; &#117;&#115;&#101;&#100; &#97;&#102;&#116;&#101;&#114; &#110;&#111;&#116; &#115;&#101;&#108;&#102;.&#101;&#113;&#117;&#97;&#108;(&#111;&#116;&#104;&#101;&#114;) &#105;&#115; &#107;&#110;&#111;w&#110;, &#105;&#110; w&#104;&#105;&#99;&#104; 258 Intended to be used after not self.equal(other) is known, in which
259 &#99;&#97;&#115;&#101; &#105;&#116; w&#105;&#108;&#108; &#114;&#101;&#116;&#117;&#114;&#110; &#97;&#116; &#108;&#101;&#97;&#115;&#116; &#111;&#110;&#101; w&#105;&#116;&#110;&#101;&#115;&#115;&#105;&#110;&#103; &#116;&#97;&#98; &#115;&#105;z&#101;. 259 case it will return at least one witnessing tab size.
260 </p><dl> 260 </p><dl>
261 <dt><i>other</i></dt> 261 <dt><i>other</i></dt>
262 <dd> 262 <dd>
263 &#87;&#104;&#105;&#116;&#101;&#115;&#112;&#97;&#99;&#101; &#111;&#98;&#106;&#101;&#99;&#116; &#116;&#111; &#99;&#97;&#108;&#99;&#117;&#108;&#97;&#116;&#101; &#97;&#103;&#97;&#105;&#110;&#115;&#116;. 263 Whitespace object to calculate against.
264 </dd> 264 </dd>
265 </dl><dl> 265 </dl><dl>
266 <dt>Returns:</dt> 266 <dt>Returns:</dt>
267 <dd> 267 <dd>
268 &#65; &#108;&#105;&#115;&#116; &#111;&#102; &#116;&#117;&#112;&#108;&#101;&#115; (&#116;&#115;, &#105;&#49;, &#105;&#50;) &#115;&#117;&#99;&#104; &#116;&#104;&#97;&#116; 268 A list of tuples (ts, i1, i2) such that
269 &#105;&#49; &#61;&#61; &#115;&#101;&#108;&#102;.&#105;&#110;&#100;&#101;&#110;&#116;&#95;&#108;&#101;v&#101;&#108;(&#116;&#115;) !&#61; &#111;&#116;&#104;&#101;&#114;.&#105;&#110;&#100;&#101;&#110;&#116;&#95;&#108;&#101;v&#101;&#108;(&#116;&#115;) &#61;&#61; &#105;&#50;. 269 i1 == self.indent_level(ts) != other.indent_level(ts) == i2.
270 </dd> 270 </dd>
271 </dl><a NAME="Whitespace.not_less_witness" ID="Whitespace.not_less_witness"></a> 271 </dl><a NAME="Whitespace.not_less_witness" ID="Whitespace.not_less_witness"></a>
272 <h4>Whitespace.not_less_witness</h4> 272 <h4>Whitespace.not_less_witness</h4>
273 <b>not_less_witness</b>(<i>other</i>) 273 <b>not_less_witness</b>(<i>other</i>)
274 <p> 274 <p>
275 &#77;&#101;&#116;&#104;&#111;&#100; &#116;&#111; &#99;&#97;&#108;&#99;&#117;&#108;&#97;&#116;&#101; &#97; &#116;&#117;&#112;&#108;&#101; &#111;&#102; w&#105;&#116;&#110;&#101;&#115;&#115;&#105;&#110;&#103; &#116;&#97;&#98; &#115;&#105;z&#101;. 275 Method to calculate a tuple of witnessing tab size.
276 </p><p> 276 </p><p>
277 &#73;&#110;&#116;&#101;&#110;&#100;&#101;&#100; &#116;&#111; &#98;&#101; &#117;&#115;&#101;&#100; &#97;&#102;&#116;&#101;&#114; &#110;&#111;&#116; &#115;&#101;&#108;&#102;.&#108;&#101;&#115;&#115;(&#111;&#116;&#104;&#101;&#114; &#105;&#115; &#107;&#110;&#111;w&#110;, &#105;&#110; w&#104;&#105;&#99;&#104; 277 Intended to be used after not self.less(other is known, in which
278 &#99;&#97;&#115;&#101; &#105;&#116; w&#105;&#108;&#108; &#114;&#101;&#116;&#117;&#114;&#110; &#97;&#116; &#108;&#101;&#97;&#115;&#116; &#111;&#110;&#101; w&#105;&#116;&#110;&#101;&#115;&#115;&#105;&#110;&#103; &#116;&#97;&#98; &#115;&#105;z&#101;. 278 case it will return at least one witnessing tab size.
279 </p><dl> 279 </p><dl>
280 <dt><i>other</i></dt> 280 <dt><i>other</i></dt>
281 <dd> 281 <dd>
282 &#87;&#104;&#105;&#116;&#101;&#115;&#112;&#97;&#99;&#101; &#111;&#98;&#106;&#101;&#99;&#116; &#116;&#111; &#99;&#97;&#108;&#99;&#117;&#108;&#97;&#116;&#101; &#97;&#103;&#97;&#105;&#110;&#115;&#116;. 282 Whitespace object to calculate against.
283 </dd> 283 </dd>
284 </dl><dl> 284 </dl><dl>
285 <dt>Returns:</dt> 285 <dt>Returns:</dt>
286 <dd> 286 <dd>
287 &#65; &#108;&#105;&#115;&#116; &#111;&#102; &#116;&#117;&#112;&#108;&#101;&#115; (&#116;&#115;, &#105;&#49;, &#105;&#50;) &#115;&#117;&#99;&#104; &#116;&#104;&#97;&#116; 287 A list of tuples (ts, i1, i2) such that
288 &#105;&#49; &#61;&#61; &#115;&#101;&#108;&#102;.&#105;&#110;&#100;&#101;&#110;&#116;&#95;&#108;&#101;v&#101;&#108;(&#116;&#115;) &#62;&#61; &#111;&#116;&#104;&#101;&#114;.&#105;&#110;&#100;&#101;&#110;&#116;&#95;&#108;&#101;v&#101;&#108;(&#116;&#115;) &#61;&#61; &#105;&#50;. 288 i1 == self.indent_level(ts) >= other.indent_level(ts) == i2.
289 </dd> 289 </dd>
290 </dl> 290 </dl>
291 <div align="right"><a href="#top">Up</a></div> 291 <div align="right"><a href="#top">Up</a></div>
292 <hr /><hr /> 292 <hr /><hr />
293 <a NAME="check" ID="check"></a> 293 <a NAME="check" ID="check"></a>
294 <h2>check</h2> 294 <h2>check</h2>
295 <b>check</b>(<i>file</i>) 295 <b>check</b>(<i>file</i>)
296 <p> 296 <p>
297 &#80;&#114;&#105;v&#97;&#116;&#101; &#102;&#117;&#110;&#99;&#116;&#105;&#111;&#110; &#116;&#111; &#99;&#104;&#101;&#99;&#107; &#111;&#110;&#101; &#80;y&#116;&#104;&#111;&#110; &#115;&#111;&#117;&#114;&#99;&#101; &#102;&#105;&#108;&#101; &#102;&#111;&#114; w&#104;&#105;&#116;&#101;&#115;&#112;&#97;&#99;&#101; &#114;&#101;&#108;&#97;&#116;&#101;&#100; &#112;&#114;&#111;&#98;&#108;&#101;&#109;&#115;. 297 Private function to check one Python source file for whitespace related problems.
298 </p><dl> 298 </p><dl>
299 <dt><i>file</i></dt> 299 <dt><i>file</i></dt>
300 <dd> 300 <dd>
301 &#115;&#111;&#117;&#114;&#99;&#101; &#102;&#105;&#108;&#101;&#110;&#97;&#109;&#101; (&#115;&#116;&#114;&#105;&#110;&#103;) 301 source filename (string)
302 </dd> 302 </dd>
303 </dl><dl> 303 </dl><dl>
304 <dt>Returns:</dt> 304 <dt>Returns:</dt>
305 <dd> 305 <dd>
306 &#65; &#116;&#117;&#112;&#108;&#101; &#105;&#110;&#100;&#105;&#99;&#97;&#116;&#105;&#110;&#103; &#115;&#116;&#97;&#116;&#117;&#115; (&#84;&#114;&#117;&#101; &#61; &#97;&#110; &#101;&#114;&#114;&#111;&#114; w&#97;&#115; &#102;&#111;&#117;&#110;&#100;), &#116;&#104;&#101; 306 A tuple indicating status (True = an error was found), the
307 &#102;&#105;&#108;&#101;&#110;&#97;&#109;&#101;, &#116;&#104;&#101; &#108;&#105;&#110;&#101;&#110;&#117;&#109;&#98;&#101;&#114; &#97;&#110;&#100; &#116;&#104;&#101; &#101;&#114;&#114;&#111;&#114; &#109;&#101;&#115;&#115;&#97;&#103;&#101; 307 filename, the linenumber and the error message
308 (&#98;&#111;&#111;&#108;&#101;&#97;&#110;, &#115;&#116;&#114;&#105;&#110;&#103;, &#115;&#116;&#114;&#105;&#110;&#103;, &#115;&#116;&#114;&#105;&#110;&#103;). &#84;&#104;&#101; v&#97;&#108;&#117;&#101;&#115; &#97;&#114;&#101; &#111;&#110;&#108;y 308 (boolean, string, string, string). The values are only
309 v&#97;&#108;&#105;&#100;, &#105;&#102; &#116;&#104;&#101; &#115;&#116;&#97;&#116;&#117;&#115; &#105;&#115; &#84;&#114;&#117;&#101;. 309 valid, if the status is True.
310 </dd> 310 </dd>
311 </dl> 311 </dl>
312 <div align="right"><a href="#top">Up</a></div> 312 <div align="right"><a href="#top">Up</a></div>
313 <hr /><hr /> 313 <hr /><hr />
314 <a NAME="format_witnesses" ID="format_witnesses"></a> 314 <a NAME="format_witnesses" ID="format_witnesses"></a>
315 <h2>format_witnesses</h2> 315 <h2>format_witnesses</h2>
316 <b>format_witnesses</b>(<i>w</i>) 316 <b>format_witnesses</b>(<i>w</i>)
317 <p> 317 <p>
318 &#70;&#117;&#110;&#99;&#116;&#105;&#111;&#110; &#116;&#111; &#102;&#111;&#114;&#109;&#97;&#116; &#116;&#104;&#101; w&#105;&#116;&#110;&#101;&#115;&#115;&#101;&#115; &#97;&#115; &#97; &#114;&#101;&#97;&#100;&#97;&#98;&#108;&#101; &#115;&#116;&#114;&#105;&#110;&#103;. 318 Function to format the witnesses as a readable string.
319 </p><dl> 319 </p><dl>
320 <dt><i>w</i></dt> 320 <dt><i>w</i></dt>
321 <dd> 321 <dd>
322 &#65; &#108;&#105;&#115;&#116; &#111;&#102; w&#105;&#116;&#110;&#101;&#115;&#115;&#101;&#115; 322 A list of witnesses
323 </dd> 323 </dd>
324 </dl><dl> 324 </dl><dl>
325 <dt>Returns:</dt> 325 <dt>Returns:</dt>
326 <dd> 326 <dd>
327 &#65; &#102;&#111;&#114;&#109;&#97;&#116;&#101;&#100; &#115;&#116;&#114;&#105;&#110;&#103; &#111;&#102; &#116;&#104;&#101; w&#105;&#116;&#110;&#101;&#115;&#115;&#101;&#115;. 327 A formated string of the witnesses.
328 </dd> 328 </dd>
329 </dl> 329 </dl>
330 <div align="right"><a href="#top">Up</a></div> 330 <div align="right"><a href="#top">Up</a></div>
331 <hr /><hr /> 331 <hr /><hr />
332 <a NAME="process_tokens" ID="process_tokens"></a> 332 <a NAME="process_tokens" ID="process_tokens"></a>
333 <h2>process_tokens</h2> 333 <h2>process_tokens</h2>
334 <b>process_tokens</b>(<i>tokens</i>) 334 <b>process_tokens</b>(<i>tokens</i>)
335 <p> 335 <p>
336 &#70;&#117;&#110;&#99;&#116;&#105;&#111;&#110; &#112;&#114;&#111;&#99;&#101;&#115;&#115;&#105;&#110;&#103; &#97;&#108;&#108; &#116;&#111;&#107;&#101;&#110;&#115; &#103;&#101;&#110;&#101;&#114;&#97;&#116;&#101;&#100; &#98;y &#97; &#116;&#111;&#107;&#101;&#110;&#105;z&#101;&#114; &#114;&#117;&#110;. 336 Function processing all tokens generated by a tokenizer run.
337 </p><dl> 337 </p><dl>
338 <dt><i>tokens</i></dt> 338 <dt><i>tokens</i></dt>
339 <dd> 339 <dd>
340 &#108;&#105;&#115;&#116; &#111;&#102; &#116;&#111;&#107;&#101;&#110;&#115; 340 list of tokens
341 </dd> 341 </dd>
342 </dl> 342 </dl>
343 <div align="right"><a href="#top">Up</a></div> 343 <div align="right"><a href="#top">Up</a></div>
344 <hr /> 344 <hr />
345 </body></html> 345 </body></html>

eric ide

mercurial