59 </table> |
59 </table> |
60 <h3>Methods</h3> |
60 <h3>Methods</h3> |
61 <table> |
61 <table> |
62 <tr> |
62 <tr> |
63 <td><a href="#Pep8NamingChecker.__init__">Pep8NamingChecker</a></td> |
63 <td><a href="#Pep8NamingChecker.__init__">Pep8NamingChecker</a></td> |
64 <td>Constructor (according to pep8.py API)</td> |
64 <td>Constructor (according to 'extended' pep8.py API)</td> |
65 </tr><tr> |
65 </tr><tr> |
66 <td><a href="#Pep8NamingChecker.__checkClassName">__checkClassName</a></td> |
66 <td><a href="#Pep8NamingChecker.__checkClassName">__checkClassName</a></td> |
67 <td>Private class to check the given node for class name conventions (N801, N831).</td> |
67 <td>Private class to check the given node for class name conventions (N801).</td> |
68 </tr><tr> |
68 </tr><tr> |
69 <td><a href="#Pep8NamingChecker.__checkFunctionArgumentNames">__checkFunctionArgumentNames</a></td> |
69 <td><a href="#Pep8NamingChecker.__checkFunctionArgumentNames">__checkFunctionArgumentNames</a></td> |
70 <td>Private class to check the argument names of functions (N803, N804, N805, N806, N831).</td> |
70 <td>Private class to check the argument names of functions (N803, N804, N805, N806).</td> |
71 </tr><tr> |
71 </tr><tr> |
72 <td><a href="#Pep8NamingChecker.__checkFuntionName">__checkFuntionName</a></td> |
72 <td><a href="#Pep8NamingChecker.__checkFuntionName">__checkFuntionName</a></td> |
73 <td>Private class to check the given node for function name conventions (N802, N831).</td> |
73 <td>Private class to check the given node for function name conventions (N802).</td> |
74 </tr><tr> |
74 </tr><tr> |
75 <td><a href="#Pep8NamingChecker.__checkImportAs">__checkImportAs</a></td> |
75 <td><a href="#Pep8NamingChecker.__checkImportAs">__checkImportAs</a></td> |
76 <td>Private method to check that imports don't change the naming convention (N811, N812, N813, N814).</td> |
76 <td>Private method to check that imports don't change the naming convention (N811, N812, N813, N814).</td> |
77 </tr><tr> |
77 </tr><tr> |
78 <td><a href="#Pep8NamingChecker.__checkModule">__checkModule</a></td> |
78 <td><a href="#Pep8NamingChecker.__checkModule">__checkModule</a></td> |
79 <td>Private method to check module naming conventions (N807, N808).</td> |
79 <td>Private method to check module naming conventions (N807, N808).</td> |
80 </tr><tr> |
80 </tr><tr> |
|
81 <td><a href="#Pep8NamingChecker.__checkNameToBeAvoided">__checkNameToBeAvoided</a></td> |
|
82 <td>Private class to check the given node for a name to be avoided (N831).</td> |
|
83 </tr><tr> |
81 <td><a href="#Pep8NamingChecker.__checkVariablesInFunction">__checkVariablesInFunction</a></td> |
84 <td><a href="#Pep8NamingChecker.__checkVariablesInFunction">__checkVariablesInFunction</a></td> |
82 <td>Private method to check local variables in functions (N821, N831).</td> |
85 <td>Private method to check local variables in functions (N821).</td> |
83 </tr><tr> |
86 </tr><tr> |
84 <td><a href="#Pep8NamingChecker.__error">__error</a></td> |
87 <td><a href="#Pep8NamingChecker.__error">__error</a></td> |
85 <td>Private method to build the error information</td> |
88 <td>Private method to build the error information</td> |
86 </tr><tr> |
89 </tr><tr> |
87 <td><a href="#Pep8NamingChecker.__findGlobalDefs">__findGlobalDefs</a></td> |
90 <td><a href="#Pep8NamingChecker.__findGlobalDefs">__findGlobalDefs</a></td> |
129 <dd> |
132 <dd> |
130 translated and formatted message (string) |
133 translated and formatted message (string) |
131 </dd> |
134 </dd> |
132 </dl><a NAME="Pep8NamingChecker.__init__" ID="Pep8NamingChecker.__init__"></a> |
135 </dl><a NAME="Pep8NamingChecker.__init__" ID="Pep8NamingChecker.__init__"></a> |
133 <h4>Pep8NamingChecker (Constructor)</h4> |
136 <h4>Pep8NamingChecker (Constructor)</h4> |
134 <b>Pep8NamingChecker</b>(<i>tree, filename</i>) |
137 <b>Pep8NamingChecker</b>(<i>tree, filename, options</i>) |
135 <p> |
138 <p> |
136 Constructor (according to pep8.py API) |
139 Constructor (according to 'extended' pep8.py API) |
137 </p><dl> |
140 </p><dl> |
138 <dt><i>tree</i></dt> |
141 <dt><i>tree</i></dt> |
139 <dd> |
142 <dd> |
140 AST tree of the source file |
143 AST tree of the source file |
141 </dd><dt><i>filename</i></dt> |
144 </dd><dt><i>filename</i></dt> |
142 <dd> |
145 <dd> |
143 name of the source file (string) |
146 name of the source file (string) |
|
147 </dd><dt><i>options</i></dt> |
|
148 <dd> |
|
149 options as parsed by pep8.StyleGuide |
144 </dd> |
150 </dd> |
145 </dl><a NAME="Pep8NamingChecker.__checkClassName" ID="Pep8NamingChecker.__checkClassName"></a> |
151 </dl><a NAME="Pep8NamingChecker.__checkClassName" ID="Pep8NamingChecker.__checkClassName"></a> |
146 <h4>Pep8NamingChecker.__checkClassName</h4> |
152 <h4>Pep8NamingChecker.__checkClassName</h4> |
147 <b>__checkClassName</b>(<i>node, parents</i>) |
153 <b>__checkClassName</b>(<i>node, parents</i>) |
148 <p> |
154 <p> |
149 Private class to check the given node for class name |
155 Private class to check the given node for class name |
150 conventions (N801, N831). |
156 conventions (N801). |
151 </p><p> |
157 </p><p> |
152 Almost without exception, class names use the CapWords convention. |
158 Almost without exception, class names use the CapWords convention. |
153 Classes for internal use have a leading underscore in addition. |
159 Classes for internal use have a leading underscore in addition. |
154 </p><dl> |
160 </p><dl> |
155 <dt><i>node</i></dt> |
161 <dt><i>node</i></dt> |
165 </dl><a NAME="Pep8NamingChecker.__checkFunctionArgumentNames" ID="Pep8NamingChecker.__checkFunctionArgumentNames"></a> |
171 </dl><a NAME="Pep8NamingChecker.__checkFunctionArgumentNames" ID="Pep8NamingChecker.__checkFunctionArgumentNames"></a> |
166 <h4>Pep8NamingChecker.__checkFunctionArgumentNames</h4> |
172 <h4>Pep8NamingChecker.__checkFunctionArgumentNames</h4> |
167 <b>__checkFunctionArgumentNames</b>(<i>node, parents</i>) |
173 <b>__checkFunctionArgumentNames</b>(<i>node, parents</i>) |
168 <p> |
174 <p> |
169 Private class to check the argument names of functions |
175 Private class to check the argument names of functions |
170 (N803, N804, N805, N806, N831). |
176 (N803, N804, N805, N806). |
171 </p><p> |
177 </p><p> |
172 The argument names of a function should be lowercase, with words |
178 The argument names of a function should be lowercase, with words |
173 separated by underscores. A class method should have 'cls' as the |
179 separated by underscores. A class method should have 'cls' as the |
174 first argument. A method should have 'self' as the first argument. |
180 first argument. A method should have 'self' as the first argument. |
175 </p><dl> |
181 </p><dl> |
186 </dl><a NAME="Pep8NamingChecker.__checkFuntionName" ID="Pep8NamingChecker.__checkFuntionName"></a> |
192 </dl><a NAME="Pep8NamingChecker.__checkFuntionName" ID="Pep8NamingChecker.__checkFuntionName"></a> |
187 <h4>Pep8NamingChecker.__checkFuntionName</h4> |
193 <h4>Pep8NamingChecker.__checkFuntionName</h4> |
188 <b>__checkFuntionName</b>(<i>node, parents</i>) |
194 <b>__checkFuntionName</b>(<i>node, parents</i>) |
189 <p> |
195 <p> |
190 Private class to check the given node for function name |
196 Private class to check the given node for function name |
191 conventions (N802, N831). |
197 conventions (N802). |
192 </p><p> |
198 </p><p> |
193 Function names should be lowercase, with words separated by underscores |
199 Function names should be lowercase, with words separated by underscores |
194 as necessary to improve readability. Functions <b>not</b> being |
200 as necessary to improve readability. Functions <b>not</b> being |
195 methods '__' in front and back are not allowed. Mixed case is allowed |
201 methods '__' in front and back are not allowed. Mixed case is allowed |
196 only in contexts where that's already the prevailing style |
202 only in contexts where that's already the prevailing style |
239 <dt>Returns:</dt> |
245 <dt>Returns:</dt> |
240 <dd> |
246 <dd> |
241 tuple giving line number, offset within line and error code |
247 tuple giving line number, offset within line and error code |
242 (integer, integer, string) |
248 (integer, integer, string) |
243 </dd> |
249 </dd> |
|
250 </dl><a NAME="Pep8NamingChecker.__checkNameToBeAvoided" ID="Pep8NamingChecker.__checkNameToBeAvoided"></a> |
|
251 <h4>Pep8NamingChecker.__checkNameToBeAvoided</h4> |
|
252 <b>__checkNameToBeAvoided</b>(<i>node, parents</i>) |
|
253 <p> |
|
254 Private class to check the given node for a name to be avoided (N831). |
|
255 </p><dl> |
|
256 <dt><i>node</i></dt> |
|
257 <dd> |
|
258 AST note to check |
|
259 </dd> |
|
260 </dl><dl> |
|
261 <dt>Returns:</dt> |
|
262 <dd> |
|
263 tuple giving line number, offset within line and error code |
|
264 (integer, integer, string) |
|
265 </dd> |
244 </dl><a NAME="Pep8NamingChecker.__checkVariablesInFunction" ID="Pep8NamingChecker.__checkVariablesInFunction"></a> |
266 </dl><a NAME="Pep8NamingChecker.__checkVariablesInFunction" ID="Pep8NamingChecker.__checkVariablesInFunction"></a> |
245 <h4>Pep8NamingChecker.__checkVariablesInFunction</h4> |
267 <h4>Pep8NamingChecker.__checkVariablesInFunction</h4> |
246 <b>__checkVariablesInFunction</b>(<i>node, parents</i>) |
268 <b>__checkVariablesInFunction</b>(<i>node, parents</i>) |
247 <p> |
269 <p> |
248 Private method to check local variables in functions (N821, N831). |
270 Private method to check local variables in functions (N821). |
249 </p><p> |
271 </p><p> |
250 Local variables in functions should be lowercase. |
272 Local variables in functions should be lowercase. |
251 </p><dl> |
273 </p><dl> |
252 <dt><i>node</i></dt> |
274 <dt><i>node</i></dt> |
253 <dd> |
275 <dd> |