21 <body><a NAME="top" ID="top"></a> |
21 <body><a NAME="top" ID="top"></a> |
22 <h1>eric5.Plugins.CheckerPlugins.Pep8.pep8</h1> |
22 <h1>eric5.Plugins.CheckerPlugins.Pep8.pep8</h1> |
23 |
23 |
24 <h3>Global Attributes</h3> |
24 <h3>Global Attributes</h3> |
25 <table> |
25 <table> |
26 <tr><td>BENCHMARK_KEYS</td></tr><tr><td>BINARY_OPERATORS</td></tr><tr><td>DEFAULT_EXCLUDE</td></tr><tr><td>DEFAULT_IGNORE</td></tr><tr><td>DOCSTRING_REGEX</td></tr><tr><td>E225NOT_KEYWORDS</td></tr><tr><td>ERRORCODE_REGEX</td></tr><tr><td>EXTRANEOUS_WHITESPACE_REGEX</td></tr><tr><td>INDENT_REGEX</td></tr><tr><td>MAX_LINE_LENGTH</td></tr><tr><td>OPERATORS</td></tr><tr><td>RAISE_COMMA_REGEX</td></tr><tr><td>SELFTEST_REGEX</td></tr><tr><td>SKIP_TOKENS</td></tr><tr><td>UNARY_OPERATORS</td></tr><tr><td>WHITESPACE</td></tr><tr><td>WHITESPACE_AROUND_NAMED_PARAMETER_REGEX</td></tr><tr><td>WHITESPACE_AROUND_OPERATOR_REGEX</td></tr><tr><td>__version__</td></tr><tr><td>args</td></tr><tr><td>options</td></tr><tr><td>pep8_messages</td></tr><tr><td>pep8_messages_sample_args</td></tr> |
26 <tr><td>ARITHMETIC_OP</td></tr><tr><td>BENCHMARK_KEYS</td></tr><tr><td>COMMENT_WITH_NL</td></tr><tr><td>COMPARE_SINGLETON_REGEX</td></tr><tr><td>COMPARE_TYPE_REGEX</td></tr><tr><td>DEFAULT_EXCLUDE</td></tr><tr><td>DEFAULT_IGNORE</td></tr><tr><td>DOCSTRING_REGEX</td></tr><tr><td>ERRORCODE_REGEX</td></tr><tr><td>EXTRANEOUS_WHITESPACE_REGEX</td></tr><tr><td>HUNK_REGEX</td></tr><tr><td>INDENT_REGEX</td></tr><tr><td>KEYWORDS</td></tr><tr><td>KEYWORD_REGEX</td></tr><tr><td>LAMBDA_REGEX</td></tr><tr><td>MAX_LINE_LENGTH</td></tr><tr><td>OPERATOR_REGEX</td></tr><tr><td>PROJECT_CONFIG</td></tr><tr><td>PyCF_ONLY_AST</td></tr><tr><td>RAISE_COMMA_REGEX</td></tr><tr><td>REPORT_FORMAT</td></tr><tr><td>RERAISE_COMMA_REGEX</td></tr><tr><td>SINGLETONS</td></tr><tr><td>SKIP_TOKENS</td></tr><tr><td>TESTSUITE_PATH</td></tr><tr><td>UNARY_OPERATORS</td></tr><tr><td>WHITESPACE</td></tr><tr><td>WHITESPACE_AFTER_COMMA_REGEX</td></tr><tr><td>WS_NEEDED_OPERATORS</td></tr><tr><td>WS_OPTIONAL_OPERATORS</td></tr><tr><td>__version__</td></tr><tr><td>_checks</td></tr><tr><td>noqa</td></tr><tr><td>pep8_messages</td></tr><tr><td>pep8_messages_sample_args</td></tr> |
27 </table> |
27 </table> |
28 <h3>Classes</h3> |
28 <h3>Classes</h3> |
29 <table> |
29 <table> |
30 <tr> |
30 <tr> |
|
31 <td><a href="#BaseReport">BaseReport</a></td> |
|
32 <td>Collect the results of the checks.</td> |
|
33 </tr><tr> |
31 <td><a href="#Checker">Checker</a></td> |
34 <td><a href="#Checker">Checker</a></td> |
32 <td>Load a Python source file, tokenize it, check coding style.</td> |
35 <td>Load a Python source file, tokenize it, check coding style.</td> |
|
36 </tr><tr> |
|
37 <td><a href="#DiffReport">DiffReport</a></td> |
|
38 <td>Collect and print the results for the changed lines only.</td> |
|
39 </tr><tr> |
|
40 <td><a href="#FileReport">FileReport</a></td> |
|
41 <td>Collect the results of the checks and print only the filenames.</td> |
|
42 </tr><tr> |
|
43 <td><a href="#StandardReport">StandardReport</a></td> |
|
44 <td>Collect and print the results of the checks.</td> |
|
45 </tr><tr> |
|
46 <td><a href="#StyleGuide">StyleGuide</a></td> |
|
47 <td>Initialize a PEP-8 instance with few options.</td> |
33 </tr> |
48 </tr> |
34 </table> |
49 </table> |
35 <h3>Functions</h3> |
50 <h3>Functions</h3> |
36 <table> |
51 <table> |
37 <tr> |
52 <tr> |
|
53 <td><a href="#_add_check">_add_check</a></td> |
|
54 <td></td> |
|
55 </tr><tr> |
38 <td><a href="#_main">_main</a></td> |
56 <td><a href="#_main">_main</a></td> |
39 <td>Parse options and run checks on Python source.</td> |
57 <td>Parse options and run checks on Python source.</td> |
40 </tr><tr> |
58 </tr><tr> |
41 <td><a href="#blank_lines">blank_lines</a></td> |
59 <td><a href="#blank_lines">blank_lines</a></td> |
42 <td></td> |
60 <td></td> |
43 </tr><tr> |
61 </tr><tr> |
|
62 <td><a href="#comparison_to_singleton">comparison_to_singleton</a></td> |
|
63 <td>Comparisons to singletons like None should always be done with "is" or "is not", never the equality operators.</td> |
|
64 </tr><tr> |
|
65 <td><a href="#comparison_type">comparison_type</a></td> |
|
66 <td>Object type comparisons should always use isinstance() instead of comparing types directly.</td> |
|
67 </tr><tr> |
44 <td><a href="#compound_statements">compound_statements</a></td> |
68 <td><a href="#compound_statements">compound_statements</a></td> |
45 <td></td> |
69 <td></td> |
46 </tr><tr> |
70 </tr><tr> |
47 <td><a href="#excluded">excluded</a></td> |
71 <td><a href="#continued_indentation">continued_indentation</a></td> |
48 <td>Check if options.exclude contains a pattern that matches filename.</td> |
72 <td></td> |
49 </tr><tr> |
73 </tr><tr> |
50 <td><a href="#expand_indent">expand_indent</a></td> |
74 <td><a href="#expand_indent">expand_indent</a></td> |
51 <td>Return the amount of indentation.</td> |
75 <td></td> |
|
76 </tr><tr> |
|
77 <td><a href="#explicit_line_join">explicit_line_join</a></td> |
|
78 <td></td> |
52 </tr><tr> |
79 </tr><tr> |
53 <td><a href="#extraneous_whitespace">extraneous_whitespace</a></td> |
80 <td><a href="#extraneous_whitespace">extraneous_whitespace</a></td> |
54 <td>Avoid extraneous whitespace in the following situations:</td> |
81 <td>Avoid extraneous whitespace in the following situations:</td> |
55 </tr><tr> |
82 </tr><tr> |
56 <td><a href="#filename_match">filename_match</a></td> |
83 <td><a href="#filename_match">filename_match</a></td> |
57 <td>Check if options.filename contains a pattern that matches filename.</td> |
84 <td>Check if patterns contains a pattern that matches filename.</td> |
58 </tr><tr> |
|
59 <td><a href="#find_checks">find_checks</a></td> |
|
60 <td>Find all globally visible functions where the first argument name starts with argument_name.</td> |
|
61 </tr><tr> |
85 </tr><tr> |
62 <td><a href="#getMessage">getMessage</a></td> |
86 <td><a href="#getMessage">getMessage</a></td> |
63 <td>Function to get a translated and formatted message for a given code.</td> |
87 <td>Function to get a translated and formatted message for a given code.</td> |
64 </tr><tr> |
88 </tr><tr> |
65 <td><a href="#get_count">get_count</a></td> |
89 <td><a href="#get_parser">get_parser</a></td> |
66 <td>Return the total count of errors and warnings.</td> |
90 <td></td> |
67 </tr><tr> |
|
68 <td><a href="#get_error_statistics">get_error_statistics</a></td> |
|
69 <td>Get error statistics.</td> |
|
70 </tr><tr> |
|
71 <td><a href="#get_statistics">get_statistics</a></td> |
|
72 <td>Get statistics for message codes that start with the prefix.</td> |
|
73 </tr><tr> |
|
74 <td><a href="#get_warning_statistics">get_warning_statistics</a></td> |
|
75 <td>Get warning statistics.</td> |
|
76 </tr><tr> |
|
77 <td><a href="#ignore_code">ignore_code</a></td> |
|
78 <td>Check if options.ignore contains a prefix of the error code.</td> |
|
79 </tr><tr> |
91 </tr><tr> |
80 <td><a href="#imports_on_separate_lines">imports_on_separate_lines</a></td> |
92 <td><a href="#imports_on_separate_lines">imports_on_separate_lines</a></td> |
81 <td></td> |
93 <td></td> |
82 </tr><tr> |
94 </tr><tr> |
83 <td><a href="#indentation">indentation</a></td> |
95 <td><a href="#indentation">indentation</a></td> |
84 <td></td> |
96 <td></td> |
85 </tr><tr> |
97 </tr><tr> |
86 <td><a href="#input_dir">input_dir</a></td> |
98 <td><a href="#init_checks_registry">init_checks_registry</a></td> |
87 <td>Check all Python source files in this directory and all subdirectories.</td> |
99 <td>Register all globally visible functions where the first argument name is 'physical_line' or 'logical_line'.</td> |
88 </tr><tr> |
|
89 <td><a href="#input_file">input_file</a></td> |
|
90 <td>Run all checks on a Python source file.</td> |
|
91 </tr><tr> |
100 </tr><tr> |
92 <td><a href="#maximum_line_length">maximum_line_length</a></td> |
101 <td><a href="#maximum_line_length">maximum_line_length</a></td> |
93 <td>Limit all lines to a maximum of 79 characters.</td> |
102 <td>Limit all lines to a maximum of 79 characters.</td> |
94 </tr><tr> |
103 </tr><tr> |
95 <td><a href="#message">message</a></td> |
|
96 <td>Print a message.</td> |
|
97 </tr><tr> |
|
98 <td><a href="#missing_newline">missing_newline</a></td> |
104 <td><a href="#missing_newline">missing_newline</a></td> |
99 <td>JCR: The last line should have a newline.</td> |
105 <td>JCR: The last line should have a newline.</td> |
100 </tr><tr> |
106 </tr><tr> |
101 <td><a href="#missing_whitespace">missing_whitespace</a></td> |
107 <td><a href="#missing_whitespace">missing_whitespace</a></td> |
102 <td>JCR: Each comma, semicolon or colon should be followed by whitespace.</td> |
108 <td>JCR: Each comma, semicolon or colon should be followed by whitespace.</td> |
170 <td><a href="#whitespace_before_parameters">whitespace_before_parameters</a></td> |
176 <td><a href="#whitespace_before_parameters">whitespace_before_parameters</a></td> |
171 <td>Avoid extraneous whitespace in the following situations:</td> |
177 <td>Avoid extraneous whitespace in the following situations:</td> |
172 </tr> |
178 </tr> |
173 </table> |
179 </table> |
174 <hr /><hr /> |
180 <hr /><hr /> |
175 <a NAME="Checker" ID="Checker"></a> |
181 <a NAME="BaseReport" ID="BaseReport"></a> |
176 <h2>Checker</h2> |
182 <h2>BaseReport</h2> |
177 <p> |
183 <p> |
178 Load a Python source file, tokenize it, check coding style. |
184 Collect the results of the checks. |
179 </p> |
185 </p> |
180 <h3>Derived from</h3> |
186 <h3>Derived from</h3> |
181 object |
187 object |
182 <h3>Class Attributes</h3> |
188 <h3>Class Attributes</h3> |
183 <table> |
189 <table> |
|
190 <tr><td>print_filename</td></tr> |
|
191 </table> |
|
192 <h3>Class Methods</h3> |
|
193 <table> |
|
194 <tr><td>None</td></tr> |
|
195 </table> |
|
196 <h3>Methods</h3> |
|
197 <table> |
|
198 <tr> |
|
199 <td><a href="#BaseReport.__init__">BaseReport</a></td> |
|
200 <td></td> |
|
201 </tr><tr> |
|
202 <td><a href="#BaseReport.error">error</a></td> |
|
203 <td>Report an error, according to options.</td> |
|
204 </tr><tr> |
|
205 <td><a href="#BaseReport.error_args">error_args</a></td> |
|
206 <td>Report an error, according to options.</td> |
|
207 </tr><tr> |
|
208 <td><a href="#BaseReport.get_count">get_count</a></td> |
|
209 <td>Return the total count of errors and warnings.</td> |
|
210 </tr><tr> |
|
211 <td><a href="#BaseReport.get_file_results">get_file_results</a></td> |
|
212 <td>Return the count of errors and warnings for this file.</td> |
|
213 </tr><tr> |
|
214 <td><a href="#BaseReport.get_statistics">get_statistics</a></td> |
|
215 <td>Get statistics for message codes that start with the prefix.</td> |
|
216 </tr><tr> |
|
217 <td><a href="#BaseReport.increment_logical_line">increment_logical_line</a></td> |
|
218 <td>Signal a new logical line.</td> |
|
219 </tr><tr> |
|
220 <td><a href="#BaseReport.init_file">init_file</a></td> |
|
221 <td>Signal a new file.</td> |
|
222 </tr><tr> |
|
223 <td><a href="#BaseReport.print_benchmark">print_benchmark</a></td> |
|
224 <td>Print benchmark numbers.</td> |
|
225 </tr><tr> |
|
226 <td><a href="#BaseReport.print_statistics">print_statistics</a></td> |
|
227 <td>Print overall statistics (number of errors and warnings).</td> |
|
228 </tr><tr> |
|
229 <td><a href="#BaseReport.start">start</a></td> |
|
230 <td>Start the timer.</td> |
|
231 </tr><tr> |
|
232 <td><a href="#BaseReport.stop">stop</a></td> |
|
233 <td>Stop the timer.</td> |
|
234 </tr> |
|
235 </table> |
|
236 <h3>Static Methods</h3> |
|
237 <table> |
|
238 <tr><td>None</td></tr> |
|
239 </table> |
|
240 <a NAME="BaseReport.__init__" ID="BaseReport.__init__"></a> |
|
241 <h4>BaseReport (Constructor)</h4> |
|
242 <b>BaseReport</b>(<i>options</i>) |
|
243 <a NAME="BaseReport.error" ID="BaseReport.error"></a> |
|
244 <h4>BaseReport.error</h4> |
|
245 <b>error</b>(<i>line_number, offset, text, check</i>) |
|
246 <p> |
|
247 Report an error, according to options. |
|
248 </p><a NAME="BaseReport.error_args" ID="BaseReport.error_args"></a> |
|
249 <h4>BaseReport.error_args</h4> |
|
250 <b>error_args</b>(<i>line_number, offset, code, check, *args</i>) |
|
251 <p> |
|
252 Report an error, according to options. |
|
253 </p><a NAME="BaseReport.get_count" ID="BaseReport.get_count"></a> |
|
254 <h4>BaseReport.get_count</h4> |
|
255 <b>get_count</b>(<i>prefix=''</i>) |
|
256 <p> |
|
257 Return the total count of errors and warnings. |
|
258 </p><a NAME="BaseReport.get_file_results" ID="BaseReport.get_file_results"></a> |
|
259 <h4>BaseReport.get_file_results</h4> |
|
260 <b>get_file_results</b>(<i></i>) |
|
261 <p> |
|
262 Return the count of errors and warnings for this file. |
|
263 </p><a NAME="BaseReport.get_statistics" ID="BaseReport.get_statistics"></a> |
|
264 <h4>BaseReport.get_statistics</h4> |
|
265 <b>get_statistics</b>(<i>prefix=''</i>) |
|
266 <p> |
|
267 Get statistics for message codes that start with the prefix. |
|
268 </p><p> |
|
269 prefix='' matches all errors and warnings |
|
270 prefix='E' matches all errors |
|
271 prefix='W' matches all warnings |
|
272 prefix='E4' matches all errors that have to do with imports |
|
273 </p><a NAME="BaseReport.increment_logical_line" ID="BaseReport.increment_logical_line"></a> |
|
274 <h4>BaseReport.increment_logical_line</h4> |
|
275 <b>increment_logical_line</b>(<i></i>) |
|
276 <p> |
|
277 Signal a new logical line. |
|
278 </p><a NAME="BaseReport.init_file" ID="BaseReport.init_file"></a> |
|
279 <h4>BaseReport.init_file</h4> |
|
280 <b>init_file</b>(<i>filename, lines, expected, line_offset</i>) |
|
281 <p> |
|
282 Signal a new file. |
|
283 </p><a NAME="BaseReport.print_benchmark" ID="BaseReport.print_benchmark"></a> |
|
284 <h4>BaseReport.print_benchmark</h4> |
|
285 <b>print_benchmark</b>(<i></i>) |
|
286 <p> |
|
287 Print benchmark numbers. |
|
288 </p><a NAME="BaseReport.print_statistics" ID="BaseReport.print_statistics"></a> |
|
289 <h4>BaseReport.print_statistics</h4> |
|
290 <b>print_statistics</b>(<i>prefix=''</i>) |
|
291 <p> |
|
292 Print overall statistics (number of errors and warnings). |
|
293 </p><a NAME="BaseReport.start" ID="BaseReport.start"></a> |
|
294 <h4>BaseReport.start</h4> |
|
295 <b>start</b>(<i></i>) |
|
296 <p> |
|
297 Start the timer. |
|
298 </p><a NAME="BaseReport.stop" ID="BaseReport.stop"></a> |
|
299 <h4>BaseReport.stop</h4> |
|
300 <b>stop</b>(<i></i>) |
|
301 <p> |
|
302 Stop the timer. |
|
303 </p> |
|
304 <div align="right"><a href="#top">Up</a></div> |
|
305 <hr /><hr /> |
|
306 <a NAME="Checker" ID="Checker"></a> |
|
307 <h2>Checker</h2> |
|
308 <p> |
|
309 Load a Python source file, tokenize it, check coding style. |
|
310 </p> |
|
311 <h3>Derived from</h3> |
|
312 object |
|
313 <h3>Class Attributes</h3> |
|
314 <table> |
184 <tr><td>None</td></tr> |
315 <tr><td>None</td></tr> |
185 </table> |
316 </table> |
186 <h3>Class Methods</h3> |
317 <h3>Class Methods</h3> |
187 <table> |
318 <table> |
188 <tr><td>None</td></tr> |
319 <tr><td>None</td></tr> |
222 <table> |
359 <table> |
223 <tr><td>None</td></tr> |
360 <tr><td>None</td></tr> |
224 </table> |
361 </table> |
225 <a NAME="Checker.__init__" ID="Checker.__init__"></a> |
362 <a NAME="Checker.__init__" ID="Checker.__init__"></a> |
226 <h4>Checker (Constructor)</h4> |
363 <h4>Checker (Constructor)</h4> |
227 <b>Checker</b>(<i>filename, lines=None</i>) |
364 <b>Checker</b>(<i>filename=None, lines=None, options=None, report=None, **kwargs</i>) |
228 <a NAME="Checker.build_tokens_line" ID="Checker.build_tokens_line"></a> |
365 <a NAME="Checker.build_tokens_line" ID="Checker.build_tokens_line"></a> |
229 <h4>Checker.build_tokens_line</h4> |
366 <h4>Checker.build_tokens_line</h4> |
230 <b>build_tokens_line</b>(<i></i>) |
367 <b>build_tokens_line</b>(<i></i>) |
231 <p> |
368 <p> |
232 Build a logical line from tokens. |
369 Build a logical line from tokens. |
233 </p><a NAME="Checker.check_all" ID="Checker.check_all"></a> |
370 </p><a NAME="Checker.check_all" ID="Checker.check_all"></a> |
234 <h4>Checker.check_all</h4> |
371 <h4>Checker.check_all</h4> |
235 <b>check_all</b>(<i>expected=None, line_offset=0</i>) |
372 <b>check_all</b>(<i>expected=None, line_offset=0</i>) |
236 <p> |
373 <p> |
237 Run all checks on the input file. |
374 Run all checks on the input file. |
238 </p><a NAME="Checker.check_logical" ID="Checker.check_logical"></a> |
375 </p><a NAME="Checker.check_ast" ID="Checker.check_ast"></a> |
|
376 <h4>Checker.check_ast</h4> |
|
377 <b>check_ast</b>(<i></i>) |
|
378 <a NAME="Checker.check_logical" ID="Checker.check_logical"></a> |
239 <h4>Checker.check_logical</h4> |
379 <h4>Checker.check_logical</h4> |
240 <b>check_logical</b>(<i></i>) |
380 <b>check_logical</b>(<i></i>) |
241 <p> |
381 <p> |
242 Build a line from tokens and run all logical checks on it. |
382 Build a line from tokens and run all logical checks on it. |
243 </p><a NAME="Checker.check_physical" ID="Checker.check_physical"></a> |
383 </p><a NAME="Checker.check_physical" ID="Checker.check_physical"></a> |
244 <h4>Checker.check_physical</h4> |
384 <h4>Checker.check_physical</h4> |
245 <b>check_physical</b>(<i>line</i>) |
385 <b>check_physical</b>(<i>line</i>) |
246 <p> |
386 <p> |
247 Run all physical checks on a raw input line. |
387 Run all physical checks on a raw input line. |
248 </p><a NAME="Checker.readline" ID="Checker.readline"></a> |
388 </p><a NAME="Checker.generate_tokens" ID="Checker.generate_tokens"></a> |
|
389 <h4>Checker.generate_tokens</h4> |
|
390 <b>generate_tokens</b>(<i></i>) |
|
391 <a NAME="Checker.readline" ID="Checker.readline"></a> |
249 <h4>Checker.readline</h4> |
392 <h4>Checker.readline</h4> |
250 <b>readline</b>(<i></i>) |
393 <b>readline</b>(<i></i>) |
251 <p> |
394 <p> |
252 Get the next line from the input buffer. |
395 Get the next line from the input buffer. |
253 </p><a NAME="Checker.readline_check_physical" ID="Checker.readline_check_physical"></a> |
396 </p><a NAME="Checker.readline_check_physical" ID="Checker.readline_check_physical"></a> |
254 <h4>Checker.readline_check_physical</h4> |
397 <h4>Checker.readline_check_physical</h4> |
255 <b>readline_check_physical</b>(<i></i>) |
398 <b>readline_check_physical</b>(<i></i>) |
256 <p> |
399 <p> |
257 Check and return the next physical line. This method can be |
400 Check and return the next physical line. This method can be |
258 used to feed tokenize.generate_tokens. |
401 used to feed tokenize.generate_tokens. |
259 </p><a NAME="Checker.report_error" ID="Checker.report_error"></a> |
402 </p><a NAME="Checker.report_invalid_syntax" ID="Checker.report_invalid_syntax"></a> |
260 <h4>Checker.report_error</h4> |
403 <h4>Checker.report_invalid_syntax</h4> |
261 <b>report_error</b>(<i>line_number, offset, text, check</i>) |
404 <b>report_invalid_syntax</b>(<i></i>) |
262 <p> |
405 <a NAME="Checker.run_check" ID="Checker.run_check"></a> |
263 Report an error, according to options. |
|
264 </p><a NAME="Checker.run_check" ID="Checker.run_check"></a> |
|
265 <h4>Checker.run_check</h4> |
406 <h4>Checker.run_check</h4> |
266 <b>run_check</b>(<i>check, argument_names</i>) |
407 <b>run_check</b>(<i>check, argument_names</i>) |
267 <p> |
408 <p> |
268 Run a check plugin. |
409 Run a check plugin. |
269 </p> |
410 </p> |
|
411 <div align="right"><a href="#top">Up</a></div> |
|
412 <hr /><hr /> |
|
413 <a NAME="DiffReport" ID="DiffReport"></a> |
|
414 <h2>DiffReport</h2> |
|
415 <p> |
|
416 Collect and print the results for the changed lines only. |
|
417 </p> |
|
418 <h3>Derived from</h3> |
|
419 StandardReport |
|
420 <h3>Class Attributes</h3> |
|
421 <table> |
|
422 <tr><td>None</td></tr> |
|
423 </table> |
|
424 <h3>Class Methods</h3> |
|
425 <table> |
|
426 <tr><td>None</td></tr> |
|
427 </table> |
|
428 <h3>Methods</h3> |
|
429 <table> |
|
430 <tr> |
|
431 <td><a href="#DiffReport.__init__">DiffReport</a></td> |
|
432 <td></td> |
|
433 </tr><tr> |
|
434 <td><a href="#DiffReport.error">error</a></td> |
|
435 <td></td> |
|
436 </tr> |
|
437 </table> |
|
438 <h3>Static Methods</h3> |
|
439 <table> |
|
440 <tr><td>None</td></tr> |
|
441 </table> |
|
442 <a NAME="DiffReport.__init__" ID="DiffReport.__init__"></a> |
|
443 <h4>DiffReport (Constructor)</h4> |
|
444 <b>DiffReport</b>(<i>options</i>) |
|
445 <a NAME="DiffReport.error" ID="DiffReport.error"></a> |
|
446 <h4>DiffReport.error</h4> |
|
447 <b>error</b>(<i>line_number, offset, text, check</i>) |
|
448 |
|
449 <div align="right"><a href="#top">Up</a></div> |
|
450 <hr /><hr /> |
|
451 <a NAME="FileReport" ID="FileReport"></a> |
|
452 <h2>FileReport</h2> |
|
453 <p> |
|
454 Collect the results of the checks and print only the filenames. |
|
455 </p> |
|
456 <h3>Derived from</h3> |
|
457 BaseReport |
|
458 <h3>Class Attributes</h3> |
|
459 <table> |
|
460 <tr><td>print_filename</td></tr> |
|
461 </table> |
|
462 <h3>Class Methods</h3> |
|
463 <table> |
|
464 <tr><td>None</td></tr> |
|
465 </table> |
|
466 <h3>Methods</h3> |
|
467 <table> |
|
468 <tr><td>None</td></tr> |
|
469 </table> |
|
470 <h3>Static Methods</h3> |
|
471 <table> |
|
472 <tr><td>None</td></tr> |
|
473 </table> |
|
474 |
|
475 <div align="right"><a href="#top">Up</a></div> |
|
476 <hr /><hr /> |
|
477 <a NAME="StandardReport" ID="StandardReport"></a> |
|
478 <h2>StandardReport</h2> |
|
479 <p> |
|
480 Collect and print the results of the checks. |
|
481 </p> |
|
482 <h3>Derived from</h3> |
|
483 BaseReport |
|
484 <h3>Class Attributes</h3> |
|
485 <table> |
|
486 <tr><td>None</td></tr> |
|
487 </table> |
|
488 <h3>Class Methods</h3> |
|
489 <table> |
|
490 <tr><td>None</td></tr> |
|
491 </table> |
|
492 <h3>Methods</h3> |
|
493 <table> |
|
494 <tr> |
|
495 <td><a href="#StandardReport.__init__">StandardReport</a></td> |
|
496 <td></td> |
|
497 </tr><tr> |
|
498 <td><a href="#StandardReport.error">error</a></td> |
|
499 <td>Report an error, according to options.</td> |
|
500 </tr><tr> |
|
501 <td><a href="#StandardReport.error_args">error_args</a></td> |
|
502 <td>Report an error, according to options.</td> |
|
503 </tr><tr> |
|
504 <td><a href="#StandardReport.get_file_results">get_file_results</a></td> |
|
505 <td>Print the result and return the overall count for this file.</td> |
|
506 </tr><tr> |
|
507 <td><a href="#StandardReport.init_file">init_file</a></td> |
|
508 <td>Signal a new file.</td> |
|
509 </tr> |
|
510 </table> |
|
511 <h3>Static Methods</h3> |
|
512 <table> |
|
513 <tr><td>None</td></tr> |
|
514 </table> |
|
515 <a NAME="StandardReport.__init__" ID="StandardReport.__init__"></a> |
|
516 <h4>StandardReport (Constructor)</h4> |
|
517 <b>StandardReport</b>(<i>options</i>) |
|
518 <a NAME="StandardReport.error" ID="StandardReport.error"></a> |
|
519 <h4>StandardReport.error</h4> |
|
520 <b>error</b>(<i>line_number, offset, text, check</i>) |
|
521 <p> |
|
522 Report an error, according to options. |
|
523 </p><a NAME="StandardReport.error_args" ID="StandardReport.error_args"></a> |
|
524 <h4>StandardReport.error_args</h4> |
|
525 <b>error_args</b>(<i>line_number, offset, code, check, *args</i>) |
|
526 <p> |
|
527 Report an error, according to options. |
|
528 </p><a NAME="StandardReport.get_file_results" ID="StandardReport.get_file_results"></a> |
|
529 <h4>StandardReport.get_file_results</h4> |
|
530 <b>get_file_results</b>(<i></i>) |
|
531 <p> |
|
532 Print the result and return the overall count for this file. |
|
533 </p><a NAME="StandardReport.init_file" ID="StandardReport.init_file"></a> |
|
534 <h4>StandardReport.init_file</h4> |
|
535 <b>init_file</b>(<i>filename, lines, expected, line_offset</i>) |
|
536 <p> |
|
537 Signal a new file. |
|
538 </p> |
|
539 <div align="right"><a href="#top">Up</a></div> |
|
540 <hr /><hr /> |
|
541 <a NAME="StyleGuide" ID="StyleGuide"></a> |
|
542 <h2>StyleGuide</h2> |
|
543 <p> |
|
544 Initialize a PEP-8 instance with few options. |
|
545 </p> |
|
546 <h3>Derived from</h3> |
|
547 object |
|
548 <h3>Class Attributes</h3> |
|
549 <table> |
|
550 <tr><td>None</td></tr> |
|
551 </table> |
|
552 <h3>Class Methods</h3> |
|
553 <table> |
|
554 <tr><td>None</td></tr> |
|
555 </table> |
|
556 <h3>Methods</h3> |
|
557 <table> |
|
558 <tr> |
|
559 <td><a href="#StyleGuide.__init__">StyleGuide</a></td> |
|
560 <td></td> |
|
561 </tr><tr> |
|
562 <td><a href="#StyleGuide.check_files">check_files</a></td> |
|
563 <td>Run all checks on the paths.</td> |
|
564 </tr><tr> |
|
565 <td><a href="#StyleGuide.excluded">excluded</a></td> |
|
566 <td>Check if options.exclude contains a pattern that matches filename.</td> |
|
567 </tr><tr> |
|
568 <td><a href="#StyleGuide.get_checks">get_checks</a></td> |
|
569 <td>Find all globally visible functions where the first argument name starts with argument_name and which contain selected tests.</td> |
|
570 </tr><tr> |
|
571 <td><a href="#StyleGuide.ignore_code">ignore_code</a></td> |
|
572 <td>Check if the error code should be ignored.</td> |
|
573 </tr><tr> |
|
574 <td><a href="#StyleGuide.init_report">init_report</a></td> |
|
575 <td>Initialize the report instance.</td> |
|
576 </tr><tr> |
|
577 <td><a href="#StyleGuide.input_dir">input_dir</a></td> |
|
578 <td>Check all files in this directory and all subdirectories.</td> |
|
579 </tr><tr> |
|
580 <td><a href="#StyleGuide.input_file">input_file</a></td> |
|
581 <td>Run all checks on a Python source file.</td> |
|
582 </tr> |
|
583 </table> |
|
584 <h3>Static Methods</h3> |
|
585 <table> |
|
586 <tr><td>None</td></tr> |
|
587 </table> |
|
588 <a NAME="StyleGuide.__init__" ID="StyleGuide.__init__"></a> |
|
589 <h4>StyleGuide (Constructor)</h4> |
|
590 <b>StyleGuide</b>(<i>*args, **kwargs</i>) |
|
591 <a NAME="StyleGuide.check_files" ID="StyleGuide.check_files"></a> |
|
592 <h4>StyleGuide.check_files</h4> |
|
593 <b>check_files</b>(<i>paths=None</i>) |
|
594 <p> |
|
595 Run all checks on the paths. |
|
596 </p><a NAME="StyleGuide.excluded" ID="StyleGuide.excluded"></a> |
|
597 <h4>StyleGuide.excluded</h4> |
|
598 <b>excluded</b>(<i>filename, parent=None</i>) |
|
599 <p> |
|
600 Check if options.exclude contains a pattern that matches filename. |
|
601 </p><a NAME="StyleGuide.get_checks" ID="StyleGuide.get_checks"></a> |
|
602 <h4>StyleGuide.get_checks</h4> |
|
603 <b>get_checks</b>(<i>argument_name</i>) |
|
604 <p> |
|
605 Find all globally visible functions where the first argument name |
|
606 starts with argument_name and which contain selected tests. |
|
607 </p><a NAME="StyleGuide.ignore_code" ID="StyleGuide.ignore_code"></a> |
|
608 <h4>StyleGuide.ignore_code</h4> |
|
609 <b>ignore_code</b>(<i>code</i>) |
|
610 <p> |
|
611 Check if the error code should be ignored. |
|
612 </p><p> |
|
613 If 'options.select' contains a prefix of the error code, |
|
614 return False. Else, if 'options.ignore' contains a prefix of |
|
615 the error code, return True. |
|
616 </p><a NAME="StyleGuide.init_report" ID="StyleGuide.init_report"></a> |
|
617 <h4>StyleGuide.init_report</h4> |
|
618 <b>init_report</b>(<i>reporter=None</i>) |
|
619 <p> |
|
620 Initialize the report instance. |
|
621 </p><a NAME="StyleGuide.input_dir" ID="StyleGuide.input_dir"></a> |
|
622 <h4>StyleGuide.input_dir</h4> |
|
623 <b>input_dir</b>(<i>dirname</i>) |
|
624 <p> |
|
625 Check all files in this directory and all subdirectories. |
|
626 </p><a NAME="StyleGuide.input_file" ID="StyleGuide.input_file"></a> |
|
627 <h4>StyleGuide.input_file</h4> |
|
628 <b>input_file</b>(<i>filename, lines=None, expected=None, line_offset=0</i>) |
|
629 <p> |
|
630 Run all checks on a Python source file. |
|
631 </p> |
|
632 <div align="right"><a href="#top">Up</a></div> |
|
633 <hr /><hr /> |
|
634 <a NAME="_add_check" ID="_add_check"></a> |
|
635 <h2>_add_check</h2> |
|
636 <b>_add_check</b>(<i>check, kind, codes, args</i>) |
|
637 |
270 <div align="right"><a href="#top">Up</a></div> |
638 <div align="right"><a href="#top">Up</a></div> |
271 <hr /><hr /> |
639 <hr /><hr /> |
272 <a NAME="_main" ID="_main"></a> |
640 <a NAME="_main" ID="_main"></a> |
273 <h2>_main</h2> |
641 <h2>_main</h2> |
274 <b>_main</b>(<i></i>) |
642 <b>_main</b>(<i></i>) |
275 <p> |
643 <p> |
276 Parse options and run checks on Python source. |
644 Parse options and run checks on Python source. |
277 </p> |
645 </p> |
278 <div align="right"><a href="#top">Up</a></div> |
646 <div align="right"><a href="#top">Up</a></div> |
279 <hr /><hr /> |
647 <hr /><hr /> |
280 <a NAME="blank_lines" ID="blank_lines"></a> |
648 <a NAME="blank_lines" ID="blank_lines"></a> |
281 <h2>blank_lines</h2> |
649 <h2>blank_lines</h2> |
282 <b>blank_lines</b>(<i>logical_line, blank_lines, indent_level, line_number, previous_logical, previous_indent_level, blank_lines_before_comment</i>) |
650 <b>blank_lines</b>(<i>logical_line, blank_lines, indent_level, line_number, previous_logical, previous_indent_level</i>) |
283 |
651 |
|
652 <div align="right"><a href="#top">Up</a></div> |
|
653 <hr /><hr /> |
|
654 <a NAME="comparison_to_singleton" ID="comparison_to_singleton"></a> |
|
655 <h2>comparison_to_singleton</h2> |
|
656 <b>comparison_to_singleton</b>(<i>logical_line, noqa</i>) |
|
657 <p> |
|
658 Comparisons to singletons like None should always be done |
|
659 with "is" or "is not", never the equality operators. |
|
660 </p><p> |
|
661 Okay: if arg is not None: |
|
662 E711: if arg != None: |
|
663 E712: if arg == True: |
|
664 </p><p> |
|
665 Also, beware of writing if x when you really mean if x is not None -- |
|
666 e.g. when testing whether a variable or argument that defaults to None was |
|
667 set to some other value. The other value might have a type (such as a |
|
668 container) that could be false in a boolean context! |
|
669 </p> |
|
670 <div align="right"><a href="#top">Up</a></div> |
|
671 <hr /><hr /> |
|
672 <a NAME="comparison_type" ID="comparison_type"></a> |
|
673 <h2>comparison_type</h2> |
|
674 <b>comparison_type</b>(<i>logical_line</i>) |
|
675 <p> |
|
676 Object type comparisons should always use isinstance() instead of |
|
677 comparing types directly. |
|
678 </p><p> |
|
679 Okay: if isinstance(obj, int): |
|
680 E721: if type(obj) is type(1): |
|
681 </p><p> |
|
682 When checking if an object is a string, keep in mind that it might be a |
|
683 unicode string too! In Python 2.3, str and unicode have a common base |
|
684 class, basestring, so you can do: |
|
685 </p><p> |
|
686 Okay: if isinstance(obj, basestring): |
|
687 Okay: if type(a1) is type(b1): |
|
688 </p> |
284 <div align="right"><a href="#top">Up</a></div> |
689 <div align="right"><a href="#top">Up</a></div> |
285 <hr /><hr /> |
690 <hr /><hr /> |
286 <a NAME="compound_statements" ID="compound_statements"></a> |
691 <a NAME="compound_statements" ID="compound_statements"></a> |
287 <h2>compound_statements</h2> |
692 <h2>compound_statements</h2> |
288 <b>compound_statements</b>(<i>logical_line</i>) |
693 <b>compound_statements</b>(<i>logical_line</i>) |
289 |
694 |
290 <div align="right"><a href="#top">Up</a></div> |
695 <div align="right"><a href="#top">Up</a></div> |
291 <hr /><hr /> |
696 <hr /><hr /> |
292 <a NAME="excluded" ID="excluded"></a> |
697 <a NAME="continued_indentation" ID="continued_indentation"></a> |
293 <h2>excluded</h2> |
698 <h2>continued_indentation</h2> |
294 <b>excluded</b>(<i>filename</i>) |
699 <b>continued_indentation</b>(<i>logical_line, tokens, indent_level, hang_closing, noqa, verbose</i>) |
295 <p> |
700 |
296 Check if options.exclude contains a pattern that matches filename. |
|
297 </p> |
|
298 <div align="right"><a href="#top">Up</a></div> |
701 <div align="right"><a href="#top">Up</a></div> |
299 <hr /><hr /> |
702 <hr /><hr /> |
300 <a NAME="expand_indent" ID="expand_indent"></a> |
703 <a NAME="expand_indent" ID="expand_indent"></a> |
301 <h2>expand_indent</h2> |
704 <h2>expand_indent</h2> |
302 <b>expand_indent</b>(<i>line</i>) |
705 <b>expand_indent</b>(<i>line</i>) |
303 <p> |
706 |
304 Return the amount of indentation. |
707 <div align="right"><a href="#top">Up</a></div> |
305 Tabs are expanded to the next multiple of 8. |
708 <hr /><hr /> |
306 </p><p> |
709 <a NAME="explicit_line_join" ID="explicit_line_join"></a> |
307 >>> expand_indent(' ') |
710 <h2>explicit_line_join</h2> |
308 4 |
711 <b>explicit_line_join</b>(<i>logical_line, tokens</i>) |
309 >>> expand_indent('\\t') |
712 |
310 8 |
|
311 >>> expand_indent(' \\t') |
|
312 8 |
|
313 >>> expand_indent(' \\t') |
|
314 8 |
|
315 >>> expand_indent(' \\t') |
|
316 16 |
|
317 </p> |
|
318 <div align="right"><a href="#top">Up</a></div> |
713 <div align="right"><a href="#top">Up</a></div> |
319 <hr /><hr /> |
714 <hr /><hr /> |
320 <a NAME="extraneous_whitespace" ID="extraneous_whitespace"></a> |
715 <a NAME="extraneous_whitespace" ID="extraneous_whitespace"></a> |
321 <h2>extraneous_whitespace</h2> |
716 <h2>extraneous_whitespace</h2> |
322 <b>extraneous_whitespace</b>(<i>logical_line</i>) |
717 <b>extraneous_whitespace</b>(<i>logical_line</i>) |
436 <h2>indentation</h2> |
782 <h2>indentation</h2> |
437 <b>indentation</b>(<i>logical_line, previous_logical, indent_char, indent_level, previous_indent_level</i>) |
783 <b>indentation</b>(<i>logical_line, previous_logical, indent_char, indent_level, previous_indent_level</i>) |
438 |
784 |
439 <div align="right"><a href="#top">Up</a></div> |
785 <div align="right"><a href="#top">Up</a></div> |
440 <hr /><hr /> |
786 <hr /><hr /> |
441 <a NAME="input_dir" ID="input_dir"></a> |
787 <a NAME="init_checks_registry" ID="init_checks_registry"></a> |
442 <h2>input_dir</h2> |
788 <h2>init_checks_registry</h2> |
443 <b>input_dir</b>(<i>dirname, runner=None</i>) |
789 <b>init_checks_registry</b>(<i></i>) |
444 <p> |
790 <p> |
445 Check all Python source files in this directory and all subdirectories. |
791 Register all globally visible functions where the first argument name |
446 </p> |
792 is 'physical_line' or 'logical_line'. |
447 <div align="right"><a href="#top">Up</a></div> |
|
448 <hr /><hr /> |
|
449 <a NAME="input_file" ID="input_file"></a> |
|
450 <h2>input_file</h2> |
|
451 <b>input_file</b>(<i>filename</i>) |
|
452 <p> |
|
453 Run all checks on a Python source file. |
|
454 </p> |
793 </p> |
455 <div align="right"><a href="#top">Up</a></div> |
794 <div align="right"><a href="#top">Up</a></div> |
456 <hr /><hr /> |
795 <hr /><hr /> |
457 <a NAME="maximum_line_length" ID="maximum_line_length"></a> |
796 <a NAME="maximum_line_length" ID="maximum_line_length"></a> |
458 <h2>maximum_line_length</h2> |
797 <h2>maximum_line_length</h2> |
459 <b>maximum_line_length</b>(<i>physical_line</i>) |
798 <b>maximum_line_length</b>(<i>physical_line, max_line_length</i>) |
460 <p> |
799 <p> |
461 Limit all lines to a maximum of 79 characters. |
800 Limit all lines to a maximum of 79 characters. |
462 </p><p> |
801 </p><p> |
463 There are still many devices around that are limited to 80 character |
802 There are still many devices around that are limited to 80 character |
464 lines; plus, limiting windows to 80 characters makes it possible to have |
803 lines; plus, limiting windows to 80 characters makes it possible to have |
465 several windows side-by-side. The default wrapping on such devices looks |
804 several windows side-by-side. The default wrapping on such devices looks |
466 ugly. Therefore, please limit all lines to a maximum of 79 characters. |
805 ugly. Therefore, please limit all lines to a maximum of 79 characters. |
467 For flowing long blocks of text (docstrings or comments), limiting the |
806 For flowing long blocks of text (docstrings or comments), limiting the |
468 length to 72 characters is recommended. |
807 length to 72 characters is recommended. |
469 </p> |
808 </p><p> |
470 <div align="right"><a href="#top">Up</a></div> |
809 Reports error E501. |
471 <hr /><hr /> |
|
472 <a NAME="message" ID="message"></a> |
|
473 <h2>message</h2> |
|
474 <b>message</b>(<i>text</i>) |
|
475 <p> |
|
476 Print a message. |
|
477 </p> |
810 </p> |
478 <div align="right"><a href="#top">Up</a></div> |
811 <div align="right"><a href="#top">Up</a></div> |
479 <hr /><hr /> |
812 <hr /><hr /> |
480 <a NAME="missing_newline" ID="missing_newline"></a> |
813 <a NAME="missing_newline" ID="missing_newline"></a> |
481 <h2>missing_newline</h2> |
814 <h2>missing_newline</h2> |
482 <b>missing_newline</b>(<i>physical_line</i>) |
815 <b>missing_newline</b>(<i>physical_line</i>) |
483 <p> |
816 <p> |
484 JCR: The last line should have a newline. |
817 JCR: The last line should have a newline. |
|
818 </p><p> |
|
819 Reports warning W292. |
485 </p> |
820 </p> |
486 <div align="right"><a href="#top">Up</a></div> |
821 <div align="right"><a href="#top">Up</a></div> |
487 <hr /><hr /> |
822 <hr /><hr /> |
488 <a NAME="missing_whitespace" ID="missing_whitespace"></a> |
823 <a NAME="missing_whitespace" ID="missing_whitespace"></a> |
489 <h2>missing_whitespace</h2> |
824 <h2>missing_whitespace</h2> |
521 >>> mute_string("r'abc'") |
857 >>> mute_string("r'abc'") |
522 "r'xxx'" |
858 "r'xxx'" |
523 </p> |
859 </p> |
524 <div align="right"><a href="#top">Up</a></div> |
860 <div align="right"><a href="#top">Up</a></div> |
525 <hr /><hr /> |
861 <hr /><hr /> |
526 <a NAME="print_benchmark" ID="print_benchmark"></a> |
862 <a NAME="parse_udiff" ID="parse_udiff"></a> |
527 <h2>print_benchmark</h2> |
863 <h2>parse_udiff</h2> |
528 <b>print_benchmark</b>(<i>elapsed</i>) |
864 <b>parse_udiff</b>(<i>diff, patterns=None, parent='.'</i>) |
529 <p> |
865 <p> |
530 Print benchmark numbers. |
866 Return a dictionary of matching lines. |
531 </p> |
|
532 <div align="right"><a href="#top">Up</a></div> |
|
533 <hr /><hr /> |
|
534 <a NAME="print_statistics" ID="print_statistics"></a> |
|
535 <h2>print_statistics</h2> |
|
536 <b>print_statistics</b>(<i>prefix=''</i>) |
|
537 <p> |
|
538 Print overall statistics (number of errors and warnings). |
|
539 </p> |
867 </p> |
540 <div align="right"><a href="#top">Up</a></div> |
868 <div align="right"><a href="#top">Up</a></div> |
541 <hr /><hr /> |
869 <hr /><hr /> |
542 <a NAME="process_options" ID="process_options"></a> |
870 <a NAME="process_options" ID="process_options"></a> |
543 <h2>process_options</h2> |
871 <h2>process_options</h2> |
544 <b>process_options</b>(<i>arglist=None</i>) |
872 <b>process_options</b>(<i>arglist=None, parse_argv=False, config_file=None, parser=None</i>) |
545 <p> |
873 <p> |
546 Process options passed either via arglist or via command line args. |
874 Process options passed either via arglist or via command line args. |
547 </p> |
875 </p> |
548 <div align="right"><a href="#top">Up</a></div> |
876 <div align="right"><a href="#top">Up</a></div> |
549 <hr /><hr /> |
877 <hr /><hr /> |
550 <a NAME="python_3000_backticks" ID="python_3000_backticks"></a> |
878 <a NAME="python_3000_backticks" ID="python_3000_backticks"></a> |
551 <h2>python_3000_backticks</h2> |
879 <h2>python_3000_backticks</h2> |
552 <b>python_3000_backticks</b>(<i>logical_line</i>) |
880 <b>python_3000_backticks</b>(<i>logical_line</i>) |
553 <p> |
881 <p> |
554 Backticks are removed in Python 3000. |
882 Backticks are removed in Python 3. |
555 Use repr() instead. |
883 Use repr() instead. |
|
884 </p><p> |
|
885 Okay: val = repr(1 + 2) |
|
886 W604: val = `1 + 2` |
556 </p> |
887 </p> |
557 <div align="right"><a href="#top">Up</a></div> |
888 <div align="right"><a href="#top">Up</a></div> |
558 <hr /><hr /> |
889 <hr /><hr /> |
559 <a NAME="python_3000_has_key" ID="python_3000_has_key"></a> |
890 <a NAME="python_3000_has_key" ID="python_3000_has_key"></a> |
560 <h2>python_3000_has_key</h2> |
891 <h2>python_3000_has_key</h2> |
561 <b>python_3000_has_key</b>(<i>logical_line</i>) |
892 <b>python_3000_has_key</b>(<i>logical_line</i>) |
562 <p> |
893 |
563 The {}.has_key() method will be removed in the future version of |
|
564 Python. Use the 'in' operation instead, like: |
|
565 d = {"a": 1, "b": 2} |
|
566 if "b" in d: |
|
567 print d["b"] |
|
568 </p> |
|
569 <div align="right"><a href="#top">Up</a></div> |
894 <div align="right"><a href="#top">Up</a></div> |
570 <hr /><hr /> |
895 <hr /><hr /> |
571 <a NAME="python_3000_not_equal" ID="python_3000_not_equal"></a> |
896 <a NAME="python_3000_not_equal" ID="python_3000_not_equal"></a> |
572 <h2>python_3000_not_equal</h2> |
897 <h2>python_3000_not_equal</h2> |
573 <b>python_3000_not_equal</b>(<i>logical_line</i>) |
898 <b>python_3000_not_equal</b>(<i>logical_line</i>) |
574 <p> |
899 <p> |
575 != can also be written <>, but this is an obsolete usage kept for |
900 != can also be written <>, but this is an obsolete usage kept for |
576 backwards compatibility only. New code should always use !=. |
901 backwards compatibility only. New code should always use !=. |
577 The older syntax is removed in Python 3000. |
902 The older syntax is removed in Python 3. |
|
903 </p><p> |
|
904 Okay: if a != 'no': |
|
905 W603: if a <> 'no': |
578 </p> |
906 </p> |
579 <div align="right"><a href="#top">Up</a></div> |
907 <div align="right"><a href="#top">Up</a></div> |
580 <hr /><hr /> |
908 <hr /><hr /> |
581 <a NAME="python_3000_raise_comma" ID="python_3000_raise_comma"></a> |
909 <a NAME="python_3000_raise_comma" ID="python_3000_raise_comma"></a> |
582 <h2>python_3000_raise_comma</h2> |
910 <h2>python_3000_raise_comma</h2> |