56 </table> |
56 </table> |
57 <h3>Methods</h3> |
57 <h3>Methods</h3> |
58 <table> |
58 <table> |
59 <tr> |
59 <tr> |
60 <td><a href="#Pep8NamingChecker.__init__">Pep8NamingChecker</a></td> |
60 <td><a href="#Pep8NamingChecker.__init__">Pep8NamingChecker</a></td> |
61 <td>Constructor (according to pep8.py API)</td> |
61 <td>Constructor (according to 'extended' pep8.py API)</td> |
62 </tr><tr> |
62 </tr><tr> |
63 <td><a href="#Pep8NamingChecker.__checkClassName">__checkClassName</a></td> |
63 <td><a href="#Pep8NamingChecker.__checkClassName">__checkClassName</a></td> |
64 <td>Private class to check the given node for class name conventions (N801, N831).</td> |
64 <td>Private class to check the given node for class name conventions (N801).</td> |
65 </tr><tr> |
65 </tr><tr> |
66 <td><a href="#Pep8NamingChecker.__checkFunctionArgumentNames">__checkFunctionArgumentNames</a></td> |
66 <td><a href="#Pep8NamingChecker.__checkFunctionArgumentNames">__checkFunctionArgumentNames</a></td> |
67 <td>Private class to check the argument names of functions (N803, N804, N805, N806, N831).</td> |
67 <td>Private class to check the argument names of functions (N803, N804, N805, N806).</td> |
68 </tr><tr> |
68 </tr><tr> |
69 <td><a href="#Pep8NamingChecker.__checkFuntionName">__checkFuntionName</a></td> |
69 <td><a href="#Pep8NamingChecker.__checkFuntionName">__checkFuntionName</a></td> |
70 <td>Private class to check the given node for function name conventions (N802, N831).</td> |
70 <td>Private class to check the given node for function name conventions (N802).</td> |
71 </tr><tr> |
71 </tr><tr> |
72 <td><a href="#Pep8NamingChecker.__checkImportAs">__checkImportAs</a></td> |
72 <td><a href="#Pep8NamingChecker.__checkImportAs">__checkImportAs</a></td> |
73 <td>Private method to check that imports don't change the naming convention (N811, N812, N813, N814).</td> |
73 <td>Private method to check that imports don't change the naming convention (N811, N812, N813, N814).</td> |
74 </tr><tr> |
74 </tr><tr> |
75 <td><a href="#Pep8NamingChecker.__checkModule">__checkModule</a></td> |
75 <td><a href="#Pep8NamingChecker.__checkModule">__checkModule</a></td> |
76 <td>Private method to check module naming conventions (N807, N808).</td> |
76 <td>Private method to check module naming conventions (N807, N808).</td> |
77 </tr><tr> |
77 </tr><tr> |
|
78 <td><a href="#Pep8NamingChecker.__checkNameToBeAvoided">__checkNameToBeAvoided</a></td> |
|
79 <td>Private class to check the given node for a name to be avoided (N831).</td> |
|
80 </tr><tr> |
78 <td><a href="#Pep8NamingChecker.__checkVariablesInFunction">__checkVariablesInFunction</a></td> |
81 <td><a href="#Pep8NamingChecker.__checkVariablesInFunction">__checkVariablesInFunction</a></td> |
79 <td>Private method to check local variables in functions (N821, N831).</td> |
82 <td>Private method to check local variables in functions (N821).</td> |
80 </tr><tr> |
83 </tr><tr> |
81 <td><a href="#Pep8NamingChecker.__error">__error</a></td> |
84 <td><a href="#Pep8NamingChecker.__error">__error</a></td> |
82 <td>Private method to build the error information</td> |
85 <td>Private method to build the error information</td> |
83 </tr><tr> |
86 </tr><tr> |
84 <td><a href="#Pep8NamingChecker.__findGlobalDefs">__findGlobalDefs</a></td> |
87 <td><a href="#Pep8NamingChecker.__findGlobalDefs">__findGlobalDefs</a></td> |
110 <table> |
113 <table> |
111 <tr><td>None</td></tr> |
114 <tr><td>None</td></tr> |
112 </table> |
115 </table> |
113 <a NAME="Pep8NamingChecker.__init__" ID="Pep8NamingChecker.__init__"></a> |
116 <a NAME="Pep8NamingChecker.__init__" ID="Pep8NamingChecker.__init__"></a> |
114 <h4>Pep8NamingChecker (Constructor)</h4> |
117 <h4>Pep8NamingChecker (Constructor)</h4> |
115 <b>Pep8NamingChecker</b>(<i>tree, filename</i>) |
118 <b>Pep8NamingChecker</b>(<i>tree, filename, options</i>) |
116 <p> |
119 <p> |
117 Constructor (according to pep8.py API) |
120 Constructor (according to 'extended' pep8.py API) |
118 </p><dl> |
121 </p><dl> |
119 <dt><i>tree</i></dt> |
122 <dt><i>tree</i></dt> |
120 <dd> |
123 <dd> |
121 AST tree of the source file |
124 AST tree of the source file |
122 </dd><dt><i>filename</i></dt> |
125 </dd><dt><i>filename</i></dt> |
123 <dd> |
126 <dd> |
124 name of the source file (string) |
127 name of the source file (string) |
|
128 </dd><dt><i>options</i></dt> |
|
129 <dd> |
|
130 options as parsed by pep8.StyleGuide |
125 </dd> |
131 </dd> |
126 </dl><a NAME="Pep8NamingChecker.__checkClassName" ID="Pep8NamingChecker.__checkClassName"></a> |
132 </dl><a NAME="Pep8NamingChecker.__checkClassName" ID="Pep8NamingChecker.__checkClassName"></a> |
127 <h4>Pep8NamingChecker.__checkClassName</h4> |
133 <h4>Pep8NamingChecker.__checkClassName</h4> |
128 <b>__checkClassName</b>(<i>node, parents</i>) |
134 <b>__checkClassName</b>(<i>node, parents</i>) |
129 <p> |
135 <p> |
130 Private class to check the given node for class name |
136 Private class to check the given node for class name |
131 conventions (N801, N831). |
137 conventions (N801). |
132 </p><p> |
138 </p><p> |
133 Almost without exception, class names use the CapWords convention. |
139 Almost without exception, class names use the CapWords convention. |
134 Classes for internal use have a leading underscore in addition. |
140 Classes for internal use have a leading underscore in addition. |
135 </p><dl> |
141 </p><dl> |
136 <dt><i>node</i></dt> |
142 <dt><i>node</i></dt> |
146 </dl><a NAME="Pep8NamingChecker.__checkFunctionArgumentNames" ID="Pep8NamingChecker.__checkFunctionArgumentNames"></a> |
152 </dl><a NAME="Pep8NamingChecker.__checkFunctionArgumentNames" ID="Pep8NamingChecker.__checkFunctionArgumentNames"></a> |
147 <h4>Pep8NamingChecker.__checkFunctionArgumentNames</h4> |
153 <h4>Pep8NamingChecker.__checkFunctionArgumentNames</h4> |
148 <b>__checkFunctionArgumentNames</b>(<i>node, parents</i>) |
154 <b>__checkFunctionArgumentNames</b>(<i>node, parents</i>) |
149 <p> |
155 <p> |
150 Private class to check the argument names of functions |
156 Private class to check the argument names of functions |
151 (N803, N804, N805, N806, N831). |
157 (N803, N804, N805, N806). |
152 </p><p> |
158 </p><p> |
153 The argument names of a function should be lowercase, with words |
159 The argument names of a function should be lowercase, with words |
154 separated by underscores. A class method should have 'cls' as the |
160 separated by underscores. A class method should have 'cls' as the |
155 first argument. A method should have 'self' as the first argument. |
161 first argument. A method should have 'self' as the first argument. |
156 </p><dl> |
162 </p><dl> |
167 </dl><a NAME="Pep8NamingChecker.__checkFuntionName" ID="Pep8NamingChecker.__checkFuntionName"></a> |
173 </dl><a NAME="Pep8NamingChecker.__checkFuntionName" ID="Pep8NamingChecker.__checkFuntionName"></a> |
168 <h4>Pep8NamingChecker.__checkFuntionName</h4> |
174 <h4>Pep8NamingChecker.__checkFuntionName</h4> |
169 <b>__checkFuntionName</b>(<i>node, parents</i>) |
175 <b>__checkFuntionName</b>(<i>node, parents</i>) |
170 <p> |
176 <p> |
171 Private class to check the given node for function name |
177 Private class to check the given node for function name |
172 conventions (N802, N831). |
178 conventions (N802). |
173 </p><p> |
179 </p><p> |
174 Function names should be lowercase, with words separated by underscores |
180 Function names should be lowercase, with words separated by underscores |
175 as necessary to improve readability. Functions <b>not</b> being |
181 as necessary to improve readability. Functions <b>not</b> being |
176 methods '__' in front and back are not allowed. Mixed case is allowed |
182 methods '__' in front and back are not allowed. Mixed case is allowed |
177 only in contexts where that's already the prevailing style |
183 only in contexts where that's already the prevailing style |
220 <dt>Returns:</dt> |
226 <dt>Returns:</dt> |
221 <dd> |
227 <dd> |
222 tuple giving line number, offset within line and error code |
228 tuple giving line number, offset within line and error code |
223 (integer, integer, string) |
229 (integer, integer, string) |
224 </dd> |
230 </dd> |
|
231 </dl><a NAME="Pep8NamingChecker.__checkNameToBeAvoided" ID="Pep8NamingChecker.__checkNameToBeAvoided"></a> |
|
232 <h4>Pep8NamingChecker.__checkNameToBeAvoided</h4> |
|
233 <b>__checkNameToBeAvoided</b>(<i>node, parents</i>) |
|
234 <p> |
|
235 Private class to check the given node for a name to be avoided (N831). |
|
236 </p><dl> |
|
237 <dt><i>node</i></dt> |
|
238 <dd> |
|
239 AST note to check |
|
240 </dd> |
|
241 </dl><dl> |
|
242 <dt>Returns:</dt> |
|
243 <dd> |
|
244 tuple giving line number, offset within line and error code |
|
245 (integer, integer, string) |
|
246 </dd> |
225 </dl><a NAME="Pep8NamingChecker.__checkVariablesInFunction" ID="Pep8NamingChecker.__checkVariablesInFunction"></a> |
247 </dl><a NAME="Pep8NamingChecker.__checkVariablesInFunction" ID="Pep8NamingChecker.__checkVariablesInFunction"></a> |
226 <h4>Pep8NamingChecker.__checkVariablesInFunction</h4> |
248 <h4>Pep8NamingChecker.__checkVariablesInFunction</h4> |
227 <b>__checkVariablesInFunction</b>(<i>node, parents</i>) |
249 <b>__checkVariablesInFunction</b>(<i>node, parents</i>) |
228 <p> |
250 <p> |
229 Private method to check local variables in functions (N821, N831). |
251 Private method to check local variables in functions (N821). |
230 </p><p> |
252 </p><p> |
231 Local variables in functions should be lowercase. |
253 Local variables in functions should be lowercase. |
232 </p><dl> |
254 </p><dl> |
233 <dt><i>node</i></dt> |
255 <dt><i>node</i></dt> |
234 <dd> |
256 <dd> |