Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle.html

changeset 6253
a148632e9610
parent 5516
a165ff497046
child 6264
04a671fa4adb
equal deleted inserted replaced
6250:71b951449f33 6253:a148632e9610
21 <body><a NAME="top" ID="top"></a> 21 <body><a NAME="top" ID="top"></a>
22 <h1>eric6.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle</h1> 22 <h1>eric6.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle</h1>
23 23
24 <h3>Global Attributes</h3> 24 <h3>Global Attributes</h3>
25 <table> 25 <table>
26 <tr><td>ARITHMETIC_OP</td></tr><tr><td>BENCHMARK_KEYS</td></tr><tr><td>COMMENT_WITH_NL</td></tr><tr><td>COMPARE_NEGATIVE_REGEX</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>DUNDER_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>NEWLINE</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_COMMENTS</td></tr><tr><td>SKIP_TOKENS</td></tr><tr><td>STARTSWITH_DEF_REGEX</td></tr><tr><td>STARTSWITH_INDENT_STATEMENT_REGEX</td></tr><tr><td>STARTSWITH_TOP_LEVEL_REGEX</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> 26 <tr><td>ARITHMETIC_OP</td></tr><tr><td>BENCHMARK_KEYS</td></tr><tr><td>BLANK_LINES_CONFIG</td></tr><tr><td>COMMENT_WITH_NL</td></tr><tr><td>COMPARE_NEGATIVE_REGEX</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>DUNDER_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>NEWLINE</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_COMMENTS</td></tr><tr><td>SKIP_TOKENS</td></tr><tr><td>STARTSWITH_DEF_REGEX</td></tr><tr><td>STARTSWITH_INDENT_STATEMENT_REGEX</td></tr><tr><td>STARTSWITH_TOP_LEVEL_REGEX</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>
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> 31 <td><a href="#BaseReport">BaseReport</a></td>
48 </tr> 48 </tr>
49 </table> 49 </table>
50 <h3>Functions</h3> 50 <h3>Functions</h3>
51 <table> 51 <table>
52 <tr> 52 <tr>
53 <td><a href="#__init__">__init__</a></td>
54 <td></td>
55 </tr><tr>
56 <td><a href="#__init___1">__init__</a></td>
57 <td></td>
58 </tr><tr>
59 <td><a href="#__init___2">__init__</a></td>
60 <td></td>
61 </tr><tr>
62 <td><a href="#__init___3">__init__</a></td>
63 <td></td>
64 </tr><tr>
65 <td><a href="#__init___4">__init__</a></td>
66 <td></td>
67 </tr><tr>
53 <td><a href="#_add_check">_add_check</a></td> 68 <td><a href="#_add_check">_add_check</a></td>
54 <td></td> 69 <td></td>
55 </tr><tr> 70 </tr><tr>
71 <td><a href="#_break_around_binary_operators">_break_around_binary_operators</a></td>
72 <td>Private function to reduce duplication.</td>
73 </tr><tr>
56 <td><a href="#_get_parameters">_get_parameters</a></td> 74 <td><a href="#_get_parameters">_get_parameters</a></td>
57 <td></td> 75 <td></td>
58 </tr><tr> 76 </tr><tr>
77 <td><a href="#_is_binary_operator">_is_binary_operator</a></td>
78 <td></td>
79 </tr><tr>
59 <td><a href="#_is_eol_token">_is_eol_token</a></td> 80 <td><a href="#_is_eol_token">_is_eol_token</a></td>
60 <td></td> 81 <td></td>
61 </tr><tr> 82 </tr><tr>
62 <td><a href="#_is_eol_token_1">_is_eol_token</a></td> 83 <td><a href="#_is_eol_token_1">_is_eol_token</a></td>
63 <td></td> 84 <td></td>
70 </tr><tr> 91 </tr><tr>
71 <td><a href="#ambiguous_identifier">ambiguous_identifier</a></td> 92 <td><a href="#ambiguous_identifier">ambiguous_identifier</a></td>
72 <td>Never use the characters 'l', 'O', or 'I' as variable names.</td> 93 <td>Never use the characters 'l', 'O', or 'I' as variable names.</td>
73 </tr><tr> 94 </tr><tr>
74 <td><a href="#bare_except">bare_except</a></td> 95 <td><a href="#bare_except">bare_except</a></td>
75 <td>When catching exceptions, mention specific exceptions whenever possible.</td> 96 <td>When catching exceptions, mention specific exceptions when possible.</td>
76 </tr><tr> 97 </tr><tr>
77 <td><a href="#blank_lines">blank_lines</a></td> 98 <td><a href="#blank_lines">blank_lines</a></td>
78 <td>Separate top-level function and class definitions with two blank lines.</td> 99 <td>Separate top-level function and class definitions with two blank lines.</td>
79 </tr><tr> 100 </tr><tr>
80 <td><a href="#break_around_binary_operator">break_around_binary_operator</a></td> 101 <td><a href="#break_after_binary_operator">break_after_binary_operator</a></td>
102 <td>Avoid breaks after binary operators.</td>
103 </tr><tr>
104 <td><a href="#break_before_binary_operator">break_before_binary_operator</a></td>
81 <td>Avoid breaks before binary operators.</td> 105 <td>Avoid breaks before binary operators.</td>
106 </tr><tr>
107 <td><a href="#build_tokens_line">build_tokens_line</a></td>
108 <td>Build a logical line from tokens.</td>
109 </tr><tr>
110 <td><a href="#check_all">check_all</a></td>
111 <td>Run all checks on the input file.</td>
112 </tr><tr>
113 <td><a href="#check_ast">check_ast</a></td>
114 <td>Build the file's AST and run all AST checks.</td>
115 </tr><tr>
116 <td><a href="#check_files">check_files</a></td>
117 <td>Run all checks on the paths.</td>
118 </tr><tr>
119 <td><a href="#check_logical">check_logical</a></td>
120 <td>Build a line from tokens and run all logical checks on it.</td>
121 </tr><tr>
122 <td><a href="#check_physical">check_physical</a></td>
123 <td>Run all physical checks on a raw input line.</td>
82 </tr><tr> 124 </tr><tr>
83 <td><a href="#comparison_negative">comparison_negative</a></td> 125 <td><a href="#comparison_negative">comparison_negative</a></td>
84 <td>Negative comparison should be done using "not in" and "is not".</td> 126 <td>Negative comparison should be done using "not in" and "is not".</td>
85 </tr><tr> 127 </tr><tr>
86 <td><a href="#comparison_to_singleton">comparison_to_singleton</a></td> 128 <td><a href="#comparison_to_singleton">comparison_to_singleton</a></td>
93 <td>Compound statements (on the same line) are generally discouraged.</td> 135 <td>Compound statements (on the same line) are generally discouraged.</td>
94 </tr><tr> 136 </tr><tr>
95 <td><a href="#continued_indentation">continued_indentation</a></td> 137 <td><a href="#continued_indentation">continued_indentation</a></td>
96 <td>Continuation lines indentation.</td> 138 <td>Continuation lines indentation.</td>
97 </tr><tr> 139 </tr><tr>
140 <td><a href="#error">error</a></td>
141 <td>Report an error, according to options.</td>
142 </tr><tr>
143 <td><a href="#error_1">error</a></td>
144 <td>Report an error, according to options.</td>
145 </tr><tr>
146 <td><a href="#error_2">error</a></td>
147 <td></td>
148 </tr><tr>
149 <td><a href="#error_args">error_args</a></td>
150 <td>Report an error, according to options.</td>
151 </tr><tr>
152 <td><a href="#error_args_1">error_args</a></td>
153 <td>Report an error, according to options.</td>
154 </tr><tr>
155 <td><a href="#excluded">excluded</a></td>
156 <td>Check if the file should be excluded.</td>
157 </tr><tr>
98 <td><a href="#expand_indent">expand_indent</a></td> 158 <td><a href="#expand_indent">expand_indent</a></td>
99 <td>Return the amount of indentation.</td> 159 <td>Return the amount of indentation.</td>
100 </tr><tr> 160 </tr><tr>
101 <td><a href="#explicit_line_join">explicit_line_join</a></td> 161 <td><a href="#explicit_line_join">explicit_line_join</a></td>
102 <td>Avoid explicit line join between brackets.</td> 162 <td>Avoid explicit line join between brackets.</td>
105 <td>Avoid extraneous whitespace.</td> 165 <td>Avoid extraneous whitespace.</td>
106 </tr><tr> 166 </tr><tr>
107 <td><a href="#filename_match">filename_match</a></td> 167 <td><a href="#filename_match">filename_match</a></td>
108 <td>Check if patterns contains a pattern that matches filename.</td> 168 <td>Check if patterns contains a pattern that matches filename.</td>
109 </tr><tr> 169 </tr><tr>
170 <td><a href="#generate_tokens">generate_tokens</a></td>
171 <td>Tokenize the file, run physical line checks and yield tokens.</td>
172 </tr><tr>
173 <td><a href="#get_checks">get_checks</a></td>
174 <td>Get all the checks for this category.</td>
175 </tr><tr>
176 <td><a href="#get_count">get_count</a></td>
177 <td>Return the total count of errors and warnings.</td>
178 </tr><tr>
179 <td><a href="#get_file_results">get_file_results</a></td>
180 <td>Return the count of errors and warnings for this file.</td>
181 </tr><tr>
182 <td><a href="#get_file_results_1">get_file_results</a></td>
183 <td>Print the result and return the overall count for this file.</td>
184 </tr><tr>
110 <td><a href="#get_parser">get_parser</a></td> 185 <td><a href="#get_parser">get_parser</a></td>
111 <td>Create the parser for the program.</td> 186 <td>Create the parser for the program.</td>
112 </tr><tr> 187 </tr><tr>
188 <td><a href="#get_statistics">get_statistics</a></td>
189 <td>Get statistics for message codes that start with the prefix.</td>
190 </tr><tr>
191 <td><a href="#ignore_code">ignore_code</a></td>
192 <td>Check if the error code should be ignored.</td>
193 </tr><tr>
113 <td><a href="#imports_on_separate_lines">imports_on_separate_lines</a></td> 194 <td><a href="#imports_on_separate_lines">imports_on_separate_lines</a></td>
114 <td>Place imports on separate lines.</td> 195 <td>Place imports on separate lines.</td>
115 </tr><tr> 196 </tr><tr>
197 <td><a href="#increment_logical_line">increment_logical_line</a></td>
198 <td>Signal a new logical line.</td>
199 </tr><tr>
116 <td><a href="#indentation">indentation</a></td> 200 <td><a href="#indentation">indentation</a></td>
117 <td>Use 4 spaces per indentation level.</td> 201 <td>Use 4 spaces per indentation level.</td>
118 </tr><tr> 202 </tr><tr>
119 <td><a href="#init_checks_registry">init_checks_registry</a></td> 203 <td><a href="#init_checker_state">init_checker_state</a></td>
120 <td>Register all globally visible functions.</td> 204 <td>Prepare custom state for the specific checker plugin.</td>
121 </tr><tr> 205 </tr><tr>
122 <td><a href="#is_binary_operator">is_binary_operator</a></td> 206 <td><a href="#init_file">init_file</a></td>
123 <td></td> 207 <td>Signal a new file.</td>
208 </tr><tr>
209 <td><a href="#init_file_1">init_file</a></td>
210 <td>Signal a new file.</td>
211 </tr><tr>
212 <td><a href="#init_report">init_report</a></td>
213 <td>Initialize the report instance.</td>
214 </tr><tr>
215 <td><a href="#input_dir">input_dir</a></td>
216 <td>Check all files in this directory and all subdirectories.</td>
217 </tr><tr>
218 <td><a href="#input_file">input_file</a></td>
219 <td>Run all checks on a Python source file.</td>
124 </tr><tr> 220 </tr><tr>
125 <td><a href="#is_string_literal">is_string_literal</a></td> 221 <td><a href="#is_string_literal">is_string_literal</a></td>
126 <td></td> 222 <td></td>
127 </tr><tr> 223 </tr><tr>
224 <td><a href="#lru_cache">lru_cache</a></td>
225 <td></td>
226 </tr><tr>
128 <td><a href="#maximum_line_length">maximum_line_length</a></td> 227 <td><a href="#maximum_line_length">maximum_line_length</a></td>
129 <td>Limit all lines to a maximum of 79 characters.</td> 228 <td>Limit all lines to a maximum of 79 characters.</td>
130 </tr><tr> 229 </tr><tr>
230 <td><a href="#maybe_check_physical">maybe_check_physical</a></td>
231 <td>If appropriate (based on token), check current physical line(s).</td>
232 </tr><tr>
131 <td><a href="#missing_whitespace">missing_whitespace</a></td> 233 <td><a href="#missing_whitespace">missing_whitespace</a></td>
132 <td>Each comma, semicolon or colon should be followed by whitespace.</td> 234 <td>Each comma, semicolon or colon should be followed by whitespace.</td>
133 </tr><tr> 235 </tr><tr>
134 <td><a href="#missing_whitespace_after_import_keyword">missing_whitespace_after_import_keyword</a></td> 236 <td><a href="#missing_whitespace_after_import_keyword">missing_whitespace_after_import_keyword</a></td>
135 <td>Multiple imports in form from x import (a, b, c) should have space between import statement and parenthesised name list.</td> 237 <td>Multiple imports in form from x import (a, b, c) should have space between import statement and parenthesised name list.</td>
147 <td>Parse a comma-separated list of paths.</td> 249 <td>Parse a comma-separated list of paths.</td>
148 </tr><tr> 250 </tr><tr>
149 <td><a href="#parse_udiff">parse_udiff</a></td> 251 <td><a href="#parse_udiff">parse_udiff</a></td>
150 <td>Return a dictionary of matching lines.</td> 252 <td>Return a dictionary of matching lines.</td>
151 </tr><tr> 253 </tr><tr>
254 <td><a href="#print_benchmark">print_benchmark</a></td>
255 <td>Print benchmark numbers.</td>
256 </tr><tr>
257 <td><a href="#print_statistics">print_statistics</a></td>
258 <td>Print overall statistics (number of errors and warnings).</td>
259 </tr><tr>
152 <td><a href="#process_options">process_options</a></td> 260 <td><a href="#process_options">process_options</a></td>
153 <td>Process options passed either via arglist or via command line args.</td> 261 <td>Process options passed either via arglist or via command line args.</td>
154 </tr><tr> 262 </tr><tr>
263 <td><a href="#python_3000_async_await_keywords">python_3000_async_await_keywords</a></td>
264 <td>'async' and 'await' are reserved keywords starting with Python 3.7</td>
265 </tr><tr>
155 <td><a href="#python_3000_backticks">python_3000_backticks</a></td> 266 <td><a href="#python_3000_backticks">python_3000_backticks</a></td>
156 <td>Use repr() instead of backticks in Python 3.</td> 267 <td>Use repr() instead of backticks in Python 3.</td>
157 </tr><tr> 268 </tr><tr>
158 <td><a href="#python_3000_has_key">python_3000_has_key</a></td> 269 <td><a href="#python_3000_has_key">python_3000_has_key</a></td>
159 <td>The {}.has_key() method is removed in Python 3: use the 'in' operator.</td> 270 <td>The {}.has_key() method is removed in Python 3: use the 'in' operator.</td>
160 </tr><tr> 271 </tr><tr>
272 <td><a href="#python_3000_invalid_escape_sequence">python_3000_invalid_escape_sequence</a></td>
273 <td>Invalid escape sequences are deprecated in Python 3.6.</td>
274 </tr><tr>
161 <td><a href="#python_3000_not_equal">python_3000_not_equal</a></td> 275 <td><a href="#python_3000_not_equal">python_3000_not_equal</a></td>
162 <td>New code should always use != instead of <>.</td> 276 <td>New code should always use != instead of <>.</td>
163 </tr><tr> 277 </tr><tr>
164 <td><a href="#python_3000_raise_comma">python_3000_raise_comma</a></td> 278 <td><a href="#python_3000_raise_comma">python_3000_raise_comma</a></td>
165 <td>When raising an exception, use "raise ValueError('message')".</td> 279 <td>When raising an exception, use "raise ValueError('message')".</td>
166 </tr><tr> 280 </tr><tr>
167 <td><a href="#read_config">read_config</a></td> 281 <td><a href="#read_config">read_config</a></td>
168 <td>Read and parse configurations.</td> 282 <td>Read and parse configurations.</td>
169 </tr><tr> 283 </tr><tr>
284 <td><a href="#readline">readline</a></td>
285 <td>Get the next line from the input buffer.</td>
286 </tr><tr>
170 <td><a href="#readlines">readlines</a></td> 287 <td><a href="#readlines">readlines</a></td>
171 <td>Read the source code.</td> 288 <td>Read the source code.</td>
172 </tr><tr> 289 </tr><tr>
173 <td><a href="#readlines_1">readlines</a></td> 290 <td><a href="#readlines_1">readlines</a></td>
174 <td>Read the source code.</td> 291 <td>Read the source code.</td>
175 </tr><tr> 292 </tr><tr>
176 <td><a href="#register_check">register_check</a></td> 293 <td><a href="#register_check">register_check</a></td>
177 <td>Register a new check object.</td> 294 <td>Register a new check object.</td>
178 </tr><tr> 295 </tr><tr>
296 <td><a href="#report_invalid_syntax">report_invalid_syntax</a></td>
297 <td>Check if the syntax is valid.</td>
298 </tr><tr>
299 <td><a href="#run_check">run_check</a></td>
300 <td>Run a check plugin.</td>
301 </tr><tr>
302 <td><a href="#start">start</a></td>
303 <td>Start the timer.</td>
304 </tr><tr>
179 <td><a href="#stdin_get_value">stdin_get_value</a></td> 305 <td><a href="#stdin_get_value">stdin_get_value</a></td>
180 <td>Read the value from stdin.</td> 306 <td>Read the value from stdin.</td>
307 </tr><tr>
308 <td><a href="#stop">stop</a></td>
309 <td>Stop the timer.</td>
181 </tr><tr> 310 </tr><tr>
182 <td><a href="#tabs_obsolete">tabs_obsolete</a></td> 311 <td><a href="#tabs_obsolete">tabs_obsolete</a></td>
183 <td>For new projects, spaces-only are strongly recommended over tabs.</td> 312 <td>For new projects, spaces-only are strongly recommended over tabs.</td>
184 </tr><tr> 313 </tr><tr>
185 <td><a href="#tabs_or_spaces">tabs_or_spaces</a></td> 314 <td><a href="#tabs_or_spaces">tabs_or_spaces</a></td>
229 <table> 358 <table>
230 <tr><td>None</td></tr> 359 <tr><td>None</td></tr>
231 </table> 360 </table>
232 <h3>Methods</h3> 361 <h3>Methods</h3>
233 <table> 362 <table>
234 <tr> 363 <tr><td>None</td></tr>
235 <td><a href="#BaseReport.__init__">BaseReport</a></td>
236 <td></td>
237 </tr><tr>
238 <td><a href="#BaseReport.error">error</a></td>
239 <td>Report an error, according to options.</td>
240 </tr><tr>
241 <td><a href="#BaseReport.error_args">error_args</a></td>
242 <td>Report an error, according to options.</td>
243 </tr><tr>
244 <td><a href="#BaseReport.get_count">get_count</a></td>
245 <td>Return the total count of errors and warnings.</td>
246 </tr><tr>
247 <td><a href="#BaseReport.get_file_results">get_file_results</a></td>
248 <td>Return the count of errors and warnings for this file.</td>
249 </tr><tr>
250 <td><a href="#BaseReport.get_statistics">get_statistics</a></td>
251 <td>Get statistics for message codes that start with the prefix.</td>
252 </tr><tr>
253 <td><a href="#BaseReport.increment_logical_line">increment_logical_line</a></td>
254 <td>Signal a new logical line.</td>
255 </tr><tr>
256 <td><a href="#BaseReport.init_file">init_file</a></td>
257 <td>Signal a new file.</td>
258 </tr><tr>
259 <td><a href="#BaseReport.print_benchmark">print_benchmark</a></td>
260 <td>Print benchmark numbers.</td>
261 </tr><tr>
262 <td><a href="#BaseReport.print_statistics">print_statistics</a></td>
263 <td>Print overall statistics (number of errors and warnings).</td>
264 </tr><tr>
265 <td><a href="#BaseReport.start">start</a></td>
266 <td>Start the timer.</td>
267 </tr><tr>
268 <td><a href="#BaseReport.stop">stop</a></td>
269 <td>Stop the timer.</td>
270 </tr>
271 </table> 364 </table>
272 <h3>Static Methods</h3> 365 <h3>Static Methods</h3>
273 <table> 366 <table>
274 <tr><td>None</td></tr> 367 <tr><td>None</td></tr>
275 </table> 368 </table>
276 <a NAME="BaseReport.__init__" ID="BaseReport.__init__"></a> 369
277 <h4>BaseReport (Constructor)</h4>
278 <b>BaseReport</b>(<i>options</i>)
279 <a NAME="BaseReport.error" ID="BaseReport.error"></a>
280 <h4>BaseReport.error</h4>
281 <b>error</b>(<i>line_number, offset, text, check</i>)
282 <p>
283 Report an error, according to options.
284 </p><a NAME="BaseReport.error_args" ID="BaseReport.error_args"></a>
285 <h4>BaseReport.error_args</h4>
286 <b>error_args</b>(<i>line_number, offset, text, check, *args</i>)
287 <p>
288 Report an error, according to options.
289 </p><a NAME="BaseReport.get_count" ID="BaseReport.get_count"></a>
290 <h4>BaseReport.get_count</h4>
291 <b>get_count</b>(<i>prefix=''</i>)
292 <p>
293 Return the total count of errors and warnings.
294 </p><a NAME="BaseReport.get_file_results" ID="BaseReport.get_file_results"></a>
295 <h4>BaseReport.get_file_results</h4>
296 <b>get_file_results</b>(<i></i>)
297 <p>
298 Return the count of errors and warnings for this file.
299 </p><a NAME="BaseReport.get_statistics" ID="BaseReport.get_statistics"></a>
300 <h4>BaseReport.get_statistics</h4>
301 <b>get_statistics</b>(<i>prefix=''</i>)
302 <p>
303 Get statistics for message codes that start with the prefix.
304 </p><p>
305 prefix='' matches all errors and warnings
306 prefix='E' matches all errors
307 prefix='W' matches all warnings
308 prefix='E4' matches all errors that have to do with imports
309 </p><a NAME="BaseReport.increment_logical_line" ID="BaseReport.increment_logical_line"></a>
310 <h4>BaseReport.increment_logical_line</h4>
311 <b>increment_logical_line</b>(<i></i>)
312 <p>
313 Signal a new logical line.
314 </p><a NAME="BaseReport.init_file" ID="BaseReport.init_file"></a>
315 <h4>BaseReport.init_file</h4>
316 <b>init_file</b>(<i>filename, lines, expected, line_offset</i>)
317 <p>
318 Signal a new file.
319 </p><a NAME="BaseReport.print_benchmark" ID="BaseReport.print_benchmark"></a>
320 <h4>BaseReport.print_benchmark</h4>
321 <b>print_benchmark</b>(<i></i>)
322 <p>
323 Print benchmark numbers.
324 </p><a NAME="BaseReport.print_statistics" ID="BaseReport.print_statistics"></a>
325 <h4>BaseReport.print_statistics</h4>
326 <b>print_statistics</b>(<i>prefix=''</i>)
327 <p>
328 Print overall statistics (number of errors and warnings).
329 </p><a NAME="BaseReport.start" ID="BaseReport.start"></a>
330 <h4>BaseReport.start</h4>
331 <b>start</b>(<i></i>)
332 <p>
333 Start the timer.
334 </p><a NAME="BaseReport.stop" ID="BaseReport.stop"></a>
335 <h4>BaseReport.stop</h4>
336 <b>stop</b>(<i></i>)
337 <p>
338 Stop the timer.
339 </p>
340 <div align="right"><a href="#top">Up</a></div> 370 <div align="right"><a href="#top">Up</a></div>
341 <hr /><hr /> 371 <hr /><hr />
342 <a NAME="Checker" ID="Checker"></a> 372 <a NAME="Checker" ID="Checker"></a>
343 <h2>Checker</h2> 373 <h2>Checker</h2>
344 <p> 374 <p>
354 <table> 384 <table>
355 <tr><td>None</td></tr> 385 <tr><td>None</td></tr>
356 </table> 386 </table>
357 <h3>Methods</h3> 387 <h3>Methods</h3>
358 <table> 388 <table>
359 <tr> 389 <tr><td>None</td></tr>
360 <td><a href="#Checker.__init__">Checker</a></td>
361 <td></td>
362 </tr><tr>
363 <td><a href="#Checker.build_tokens_line">build_tokens_line</a></td>
364 <td>Build a logical line from tokens.</td>
365 </tr><tr>
366 <td><a href="#Checker.check_all">check_all</a></td>
367 <td>Run all checks on the input file.</td>
368 </tr><tr>
369 <td><a href="#Checker.check_ast">check_ast</a></td>
370 <td>Build the file's AST and run all AST checks.</td>
371 </tr><tr>
372 <td><a href="#Checker.check_logical">check_logical</a></td>
373 <td>Build a line from tokens and run all logical checks on it.</td>
374 </tr><tr>
375 <td><a href="#Checker.check_physical">check_physical</a></td>
376 <td>Run all physical checks on a raw input line.</td>
377 </tr><tr>
378 <td><a href="#Checker.generate_tokens">generate_tokens</a></td>
379 <td>Tokenize the file, run physical line checks and yield tokens.</td>
380 </tr><tr>
381 <td><a href="#Checker.init_checker_state">init_checker_state</a></td>
382 <td>Prepare custom state for the specific checker plugin.</td>
383 </tr><tr>
384 <td><a href="#Checker.maybe_check_physical">maybe_check_physical</a></td>
385 <td>If appropriate (based on token), check current physical line(s).</td>
386 </tr><tr>
387 <td><a href="#Checker.readline">readline</a></td>
388 <td>Get the next line from the input buffer.</td>
389 </tr><tr>
390 <td><a href="#Checker.report_invalid_syntax">report_invalid_syntax</a></td>
391 <td>Check if the syntax is valid.</td>
392 </tr><tr>
393 <td><a href="#Checker.run_check">run_check</a></td>
394 <td>Run a check plugin.</td>
395 </tr>
396 </table> 390 </table>
397 <h3>Static Methods</h3> 391 <h3>Static Methods</h3>
398 <table> 392 <table>
399 <tr><td>None</td></tr> 393 <tr><td>None</td></tr>
400 </table> 394 </table>
401 <a NAME="Checker.__init__" ID="Checker.__init__"></a> 395
402 <h4>Checker (Constructor)</h4>
403 <b>Checker</b>(<i>filename=None, lines=None, options=None, report=None, **kwargs</i>)
404 <a NAME="Checker.build_tokens_line" ID="Checker.build_tokens_line"></a>
405 <h4>Checker.build_tokens_line</h4>
406 <b>build_tokens_line</b>(<i></i>)
407 <p>
408 Build a logical line from tokens.
409 </p><a NAME="Checker.check_all" ID="Checker.check_all"></a>
410 <h4>Checker.check_all</h4>
411 <b>check_all</b>(<i>expected=None, line_offset=0</i>)
412 <p>
413 Run all checks on the input file.
414 </p><a NAME="Checker.check_ast" ID="Checker.check_ast"></a>
415 <h4>Checker.check_ast</h4>
416 <b>check_ast</b>(<i></i>)
417 <p>
418 Build the file's AST and run all AST checks.
419 </p><a NAME="Checker.check_logical" ID="Checker.check_logical"></a>
420 <h4>Checker.check_logical</h4>
421 <b>check_logical</b>(<i></i>)
422 <p>
423 Build a line from tokens and run all logical checks on it.
424 </p><a NAME="Checker.check_physical" ID="Checker.check_physical"></a>
425 <h4>Checker.check_physical</h4>
426 <b>check_physical</b>(<i>line</i>)
427 <p>
428 Run all physical checks on a raw input line.
429 </p><a NAME="Checker.generate_tokens" ID="Checker.generate_tokens"></a>
430 <h4>Checker.generate_tokens</h4>
431 <b>generate_tokens</b>(<i></i>)
432 <p>
433 Tokenize the file, run physical line checks and yield tokens.
434 </p><a NAME="Checker.init_checker_state" ID="Checker.init_checker_state"></a>
435 <h4>Checker.init_checker_state</h4>
436 <b>init_checker_state</b>(<i>name, argument_names</i>)
437 <p>
438 Prepare custom state for the specific checker plugin.
439 </p><a NAME="Checker.maybe_check_physical" ID="Checker.maybe_check_physical"></a>
440 <h4>Checker.maybe_check_physical</h4>
441 <b>maybe_check_physical</b>(<i>token</i>)
442 <p>
443 If appropriate (based on token), check current physical line(s).
444 </p><a NAME="Checker.readline" ID="Checker.readline"></a>
445 <h4>Checker.readline</h4>
446 <b>readline</b>(<i></i>)
447 <p>
448 Get the next line from the input buffer.
449 </p><a NAME="Checker.report_invalid_syntax" ID="Checker.report_invalid_syntax"></a>
450 <h4>Checker.report_invalid_syntax</h4>
451 <b>report_invalid_syntax</b>(<i></i>)
452 <p>
453 Check if the syntax is valid.
454 </p><a NAME="Checker.run_check" ID="Checker.run_check"></a>
455 <h4>Checker.run_check</h4>
456 <b>run_check</b>(<i>check, argument_names</i>)
457 <p>
458 Run a check plugin.
459 </p>
460 <div align="right"><a href="#top">Up</a></div> 396 <div align="right"><a href="#top">Up</a></div>
461 <hr /><hr /> 397 <hr /><hr />
462 <a NAME="DiffReport" ID="DiffReport"></a> 398 <a NAME="DiffReport" ID="DiffReport"></a>
463 <h2>DiffReport</h2> 399 <h2>DiffReport</h2>
464 <p> 400 <p>
474 <table> 410 <table>
475 <tr><td>None</td></tr> 411 <tr><td>None</td></tr>
476 </table> 412 </table>
477 <h3>Methods</h3> 413 <h3>Methods</h3>
478 <table> 414 <table>
479 <tr> 415 <tr><td>None</td></tr>
480 <td><a href="#DiffReport.__init__">DiffReport</a></td>
481 <td></td>
482 </tr><tr>
483 <td><a href="#DiffReport.error">error</a></td>
484 <td></td>
485 </tr>
486 </table> 416 </table>
487 <h3>Static Methods</h3> 417 <h3>Static Methods</h3>
488 <table> 418 <table>
489 <tr><td>None</td></tr> 419 <tr><td>None</td></tr>
490 </table> 420 </table>
491 <a NAME="DiffReport.__init__" ID="DiffReport.__init__"></a>
492 <h4>DiffReport (Constructor)</h4>
493 <b>DiffReport</b>(<i>options</i>)
494 <a NAME="DiffReport.error" ID="DiffReport.error"></a>
495 <h4>DiffReport.error</h4>
496 <b>error</b>(<i>line_number, offset, text, check</i>)
497 421
498 <div align="right"><a href="#top">Up</a></div> 422 <div align="right"><a href="#top">Up</a></div>
499 <hr /><hr /> 423 <hr /><hr />
500 <a NAME="FileReport" ID="FileReport"></a> 424 <a NAME="FileReport" ID="FileReport"></a>
501 <h2>FileReport</h2> 425 <h2>FileReport</h2>
538 <table> 462 <table>
539 <tr><td>None</td></tr> 463 <tr><td>None</td></tr>
540 </table> 464 </table>
541 <h3>Methods</h3> 465 <h3>Methods</h3>
542 <table> 466 <table>
543 <tr> 467 <tr><td>None</td></tr>
544 <td><a href="#StandardReport.__init__">StandardReport</a></td>
545 <td></td>
546 </tr><tr>
547 <td><a href="#StandardReport.error">error</a></td>
548 <td>Report an error, according to options.</td>
549 </tr><tr>
550 <td><a href="#StandardReport.error_args">error_args</a></td>
551 <td>Report an error, according to options.</td>
552 </tr><tr>
553 <td><a href="#StandardReport.get_file_results">get_file_results</a></td>
554 <td>Print the result and return the overall count for this file.</td>
555 </tr><tr>
556 <td><a href="#StandardReport.init_file">init_file</a></td>
557 <td>Signal a new file.</td>
558 </tr>
559 </table> 468 </table>
560 <h3>Static Methods</h3> 469 <h3>Static Methods</h3>
561 <table> 470 <table>
562 <tr><td>None</td></tr> 471 <tr><td>None</td></tr>
563 </table> 472 </table>
564 <a NAME="StandardReport.__init__" ID="StandardReport.__init__"></a> 473
565 <h4>StandardReport (Constructor)</h4>
566 <b>StandardReport</b>(<i>options</i>)
567 <a NAME="StandardReport.error" ID="StandardReport.error"></a>
568 <h4>StandardReport.error</h4>
569 <b>error</b>(<i>line_number, offset, text, check</i>)
570 <p>
571 Report an error, according to options.
572 </p><a NAME="StandardReport.error_args" ID="StandardReport.error_args"></a>
573 <h4>StandardReport.error_args</h4>
574 <b>error_args</b>(<i>line_number, offset, code, check, *args</i>)
575 <p>
576 Report an error, according to options.
577 </p><a NAME="StandardReport.get_file_results" ID="StandardReport.get_file_results"></a>
578 <h4>StandardReport.get_file_results</h4>
579 <b>get_file_results</b>(<i></i>)
580 <p>
581 Print the result and return the overall count for this file.
582 </p><a NAME="StandardReport.init_file" ID="StandardReport.init_file"></a>
583 <h4>StandardReport.init_file</h4>
584 <b>init_file</b>(<i>filename, lines, expected, line_offset</i>)
585 <p>
586 Signal a new file.
587 </p>
588 <div align="right"><a href="#top">Up</a></div> 474 <div align="right"><a href="#top">Up</a></div>
589 <hr /><hr /> 475 <hr /><hr />
590 <a NAME="StyleGuide" ID="StyleGuide"></a> 476 <a NAME="StyleGuide" ID="StyleGuide"></a>
591 <h2>StyleGuide</h2> 477 <h2>StyleGuide</h2>
592 <p> 478 <p>
602 <table> 488 <table>
603 <tr><td>None</td></tr> 489 <tr><td>None</td></tr>
604 </table> 490 </table>
605 <h3>Methods</h3> 491 <h3>Methods</h3>
606 <table> 492 <table>
607 <tr> 493 <tr><td>None</td></tr>
608 <td><a href="#StyleGuide.__init__">StyleGuide</a></td>
609 <td></td>
610 </tr><tr>
611 <td><a href="#StyleGuide.check_files">check_files</a></td>
612 <td>Run all checks on the paths.</td>
613 </tr><tr>
614 <td><a href="#StyleGuide.excluded">excluded</a></td>
615 <td>Check if the file should be excluded.</td>
616 </tr><tr>
617 <td><a href="#StyleGuide.get_checks">get_checks</a></td>
618 <td>Get all the checks for this category.</td>
619 </tr><tr>
620 <td><a href="#StyleGuide.ignore_code">ignore_code</a></td>
621 <td>Check if the error code should be ignored.</td>
622 </tr><tr>
623 <td><a href="#StyleGuide.init_report">init_report</a></td>
624 <td>Initialize the report instance.</td>
625 </tr><tr>
626 <td><a href="#StyleGuide.input_dir">input_dir</a></td>
627 <td>Check all files in this directory and all subdirectories.</td>
628 </tr><tr>
629 <td><a href="#StyleGuide.input_file">input_file</a></td>
630 <td>Run all checks on a Python source file.</td>
631 </tr>
632 </table> 494 </table>
633 <h3>Static Methods</h3> 495 <h3>Static Methods</h3>
634 <table> 496 <table>
635 <tr><td>None</td></tr> 497 <tr><td>None</td></tr>
636 </table> 498 </table>
637 <a NAME="StyleGuide.__init__" ID="StyleGuide.__init__"></a> 499
638 <h4>StyleGuide (Constructor)</h4> 500 <div align="right"><a href="#top">Up</a></div>
639 <b>StyleGuide</b>(<i>*args, **kwargs</i>) 501 <hr /><hr />
640 <a NAME="StyleGuide.check_files" ID="StyleGuide.check_files"></a> 502 <a NAME="__init__" ID="__init__"></a>
641 <h4>StyleGuide.check_files</h4> 503 <h2>__init__</h2>
642 <b>check_files</b>(<i>paths=None</i>) 504 <b>__init__</b>(<i>self, filename=None, lines=None, options=None, report=None, **kwargs</i>)
643 <p> 505
644 Run all checks on the paths. 506 <div align="right"><a href="#top">Up</a></div>
645 </p><a NAME="StyleGuide.excluded" ID="StyleGuide.excluded"></a> 507 <hr /><hr />
646 <h4>StyleGuide.excluded</h4> 508 <a NAME="__init___1" ID="__init___1"></a>
647 <b>excluded</b>(<i>filename, parent=None</i>) 509 <h2>__init__</h2>
648 <p> 510 <b>__init__</b>(<i>self, options</i>)
649 Check if the file should be excluded. 511
650 </p><p> 512 <div align="right"><a href="#top">Up</a></div>
651 Check if 'options.exclude' contains a pattern that matches filename. 513 <hr /><hr />
652 </p><a NAME="StyleGuide.get_checks" ID="StyleGuide.get_checks"></a> 514 <a NAME="__init___2" ID="__init___2"></a>
653 <h4>StyleGuide.get_checks</h4> 515 <h2>__init__</h2>
654 <b>get_checks</b>(<i>argument_name</i>) 516 <b>__init__</b>(<i>self, options</i>)
655 <p> 517
656 Get all the checks for this category. 518 <div align="right"><a href="#top">Up</a></div>
657 </p><p> 519 <hr /><hr />
658 Find all globally visible functions where the first argument name 520 <a NAME="__init___3" ID="__init___3"></a>
659 starts with argument_name and which contain selected tests. 521 <h2>__init__</h2>
660 </p><a NAME="StyleGuide.ignore_code" ID="StyleGuide.ignore_code"></a> 522 <b>__init__</b>(<i>self, options</i>)
661 <h4>StyleGuide.ignore_code</h4> 523
662 <b>ignore_code</b>(<i>code</i>) 524 <div align="right"><a href="#top">Up</a></div>
663 <p> 525 <hr /><hr />
664 Check if the error code should be ignored. 526 <a NAME="__init___4" ID="__init___4"></a>
665 </p><p> 527 <h2>__init__</h2>
666 If 'options.select' contains a prefix of the error code, 528 <b>__init__</b>(<i>self, *args, **kwargs</i>)
667 return False. Else, if 'options.ignore' contains a prefix of 529
668 the error code, return True.
669 </p><a NAME="StyleGuide.init_report" ID="StyleGuide.init_report"></a>
670 <h4>StyleGuide.init_report</h4>
671 <b>init_report</b>(<i>reporter=None</i>)
672 <p>
673 Initialize the report instance.
674 </p><a NAME="StyleGuide.input_dir" ID="StyleGuide.input_dir"></a>
675 <h4>StyleGuide.input_dir</h4>
676 <b>input_dir</b>(<i>dirname</i>)
677 <p>
678 Check all files in this directory and all subdirectories.
679 </p><a NAME="StyleGuide.input_file" ID="StyleGuide.input_file"></a>
680 <h4>StyleGuide.input_file</h4>
681 <b>input_file</b>(<i>filename, lines=None, expected=None, line_offset=0</i>)
682 <p>
683 Run all checks on a Python source file.
684 </p>
685 <div align="right"><a href="#top">Up</a></div> 530 <div align="right"><a href="#top">Up</a></div>
686 <hr /><hr /> 531 <hr /><hr />
687 <a NAME="_add_check" ID="_add_check"></a> 532 <a NAME="_add_check" ID="_add_check"></a>
688 <h2>_add_check</h2> 533 <h2>_add_check</h2>
689 <b>_add_check</b>(<i>check, kind, codes, args</i>) 534 <b>_add_check</b>(<i>check, kind, codes, args</i>)
690 535
691 <div align="right"><a href="#top">Up</a></div> 536 <div align="right"><a href="#top">Up</a></div>
692 <hr /><hr /> 537 <hr /><hr />
538 <a NAME="_break_around_binary_operators" ID="_break_around_binary_operators"></a>
539 <h2>_break_around_binary_operators</h2>
540 <b>_break_around_binary_operators</b>(<i>tokens</i>)
541 <p>
542 Private function to reduce duplication.
543 </p><p>
544 This factors out the shared details between
545 :func:`break_before_binary_operator` and
546 :func:`break_after_binary_operator`.
547 </p>
548 <div align="right"><a href="#top">Up</a></div>
549 <hr /><hr />
693 <a NAME="_get_parameters" ID="_get_parameters"></a> 550 <a NAME="_get_parameters" ID="_get_parameters"></a>
694 <h2>_get_parameters</h2> 551 <h2>_get_parameters</h2>
695 <b>_get_parameters</b>(<i>function</i>) 552 <b>_get_parameters</b>(<i>function</i>)
553
554 <div align="right"><a href="#top">Up</a></div>
555 <hr /><hr />
556 <a NAME="_is_binary_operator" ID="_is_binary_operator"></a>
557 <h2>_is_binary_operator</h2>
558 <b>_is_binary_operator</b>(<i>token_type, text</i>)
696 559
697 <div align="right"><a href="#top">Up</a></div> 560 <div align="right"><a href="#top">Up</a></div>
698 <hr /><hr /> 561 <hr /><hr />
699 <a NAME="_is_eol_token" ID="_is_eol_token"></a> 562 <a NAME="_is_eol_token" ID="_is_eol_token"></a>
700 <h2>_is_eol_token</h2> 563 <h2>_is_eol_token</h2>
764 <hr /><hr /> 627 <hr /><hr />
765 <a NAME="bare_except" ID="bare_except"></a> 628 <a NAME="bare_except" ID="bare_except"></a>
766 <h2>bare_except</h2> 629 <h2>bare_except</h2>
767 <b>bare_except</b>(<i>logical_line, noqa</i>) 630 <b>bare_except</b>(<i>logical_line, noqa</i>)
768 <p> 631 <p>
769 When catching exceptions, mention specific exceptions whenever possible. 632 When catching exceptions, mention specific exceptions when possible.
770 </p><p> 633 </p><p>
771 Okay: except Exception: 634 Okay: except Exception:
772 Okay: except BaseException: 635 Okay: except BaseException:
773 E722: except: 636 E722: except:
774 </p> 637 </p>
803 E305: def a():\n pass\na() 666 E305: def a():\n pass\na()
804 E306: def a():\n def b():\n pass\n def c():\n pass 667 E306: def a():\n def b():\n pass\n def c():\n pass
805 </p> 668 </p>
806 <div align="right"><a href="#top">Up</a></div> 669 <div align="right"><a href="#top">Up</a></div>
807 <hr /><hr /> 670 <hr /><hr />
808 <a NAME="break_around_binary_operator" ID="break_around_binary_operator"></a> 671 <a NAME="break_after_binary_operator" ID="break_after_binary_operator"></a>
809 <h2>break_around_binary_operator</h2> 672 <h2>break_after_binary_operator</h2>
810 <b>break_around_binary_operator</b>(<i>logical_line, tokens</i>) 673 <b>break_after_binary_operator</b>(<i>logical_line, tokens</i>)
674 <p>
675 Avoid breaks after binary operators.
676 </p><p>
677 The preferred place to break around a binary operator is before the
678 operator, not after it.
679 </p><p>
680 W504: (width == 0 +\n height == 0)
681 W504: (width == 0 and\n height == 0)
682 W504: var = (1 &\n ~2)
683 </p><p>
684 Okay: foo(\n -x)
685 Okay: foo(x\n [])
686 Okay: x = '''\n''' + ''
687 Okay: x = '' + '''\n'''
688 Okay: foo(x,\n -y)
689 Okay: foo(x, # comment\n -y)
690 </p><p>
691 The following should be W504 but unary_context is tricky with these
692 Okay: var = (1 /\n -2)
693 Okay: var = (1 +\n -1 +\n -2)
694 </p>
695 <div align="right"><a href="#top">Up</a></div>
696 <hr /><hr />
697 <a NAME="break_before_binary_operator" ID="break_before_binary_operator"></a>
698 <h2>break_before_binary_operator</h2>
699 <b>break_before_binary_operator</b>(<i>logical_line, tokens</i>)
811 <p> 700 <p>
812 Avoid breaks before binary operators. 701 Avoid breaks before binary operators.
813 </p><p> 702 </p><p>
814 The preferred place to break around a binary operator is after the 703 The preferred place to break around a binary operator is after the
815 operator, not before it. 704 operator, not before it.
816 </p><p> 705 </p><p>
817 W503: (width == 0\n + height == 0) 706 W503: (width == 0\n + height == 0)
818 W503: (width == 0\n and height == 0) 707 W503: (width == 0\n and height == 0)
819 </p><p> 708 W503: var = (1\n & ~2)
820 Okay: (width == 0 +\n height == 0) 709 W503: var = (1\n / -2)
710 W503: var = (1\n + -1\n + -2)
711 </p><p>
821 Okay: foo(\n -x) 712 Okay: foo(\n -x)
822 Okay: foo(x\n []) 713 Okay: foo(x\n [])
823 Okay: x = '''\n''' + '' 714 Okay: x = '''\n''' + ''
824 Okay: foo(x,\n -y) 715 Okay: foo(x,\n -y)
825 Okay: foo(x, # comment\n -y) 716 Okay: foo(x, # comment\n -y)
826 Okay: var = (1 &\n ~2) 717 </p>
827 Okay: var = (1 /\n -2) 718 <div align="right"><a href="#top">Up</a></div>
828 Okay: var = (1 +\n -1 +\n -2) 719 <hr /><hr />
720 <a NAME="build_tokens_line" ID="build_tokens_line"></a>
721 <h2>build_tokens_line</h2>
722 <b>build_tokens_line</b>(<i>self</i>)
723 <p>
724 Build a logical line from tokens.
725 </p>
726 <div align="right"><a href="#top">Up</a></div>
727 <hr /><hr />
728 <a NAME="check_all" ID="check_all"></a>
729 <h2>check_all</h2>
730 <b>check_all</b>(<i>self, expected=None, line_offset=0</i>)
731 <p>
732 Run all checks on the input file.
733 </p>
734 <div align="right"><a href="#top">Up</a></div>
735 <hr /><hr />
736 <a NAME="check_ast" ID="check_ast"></a>
737 <h2>check_ast</h2>
738 <b>check_ast</b>(<i>self</i>)
739 <p>
740 Build the file's AST and run all AST checks.
741 </p>
742 <div align="right"><a href="#top">Up</a></div>
743 <hr /><hr />
744 <a NAME="check_files" ID="check_files"></a>
745 <h2>check_files</h2>
746 <b>check_files</b>(<i>self, paths=None</i>)
747 <p>
748 Run all checks on the paths.
749 </p>
750 <div align="right"><a href="#top">Up</a></div>
751 <hr /><hr />
752 <a NAME="check_logical" ID="check_logical"></a>
753 <h2>check_logical</h2>
754 <b>check_logical</b>(<i>self</i>)
755 <p>
756 Build a line from tokens and run all logical checks on it.
757 </p>
758 <div align="right"><a href="#top">Up</a></div>
759 <hr /><hr />
760 <a NAME="check_physical" ID="check_physical"></a>
761 <h2>check_physical</h2>
762 <b>check_physical</b>(<i>self, line</i>)
763 <p>
764 Run all physical checks on a raw input line.
829 </p> 765 </p>
830 <div align="right"><a href="#top">Up</a></div> 766 <div align="right"><a href="#top">Up</a></div>
831 <hr /><hr /> 767 <hr /><hr />
832 <a NAME="comparison_negative" ID="comparison_negative"></a> 768 <a NAME="comparison_negative" ID="comparison_negative"></a>
833 <h2>comparison_negative</h2> 769 <h2>comparison_negative</h2>
951 E129: if (a or\n b):\n pass 887 E129: if (a or\n b):\n pass
952 E131: a = (\n 42\n 24) 888 E131: a = (\n 42\n 24)
953 </p> 889 </p>
954 <div align="right"><a href="#top">Up</a></div> 890 <div align="right"><a href="#top">Up</a></div>
955 <hr /><hr /> 891 <hr /><hr />
892 <a NAME="error" ID="error"></a>
893 <h2>error</h2>
894 <b>error</b>(<i>self, line_number, offset, text, check</i>)
895 <p>
896 Report an error, according to options.
897 </p>
898 <div align="right"><a href="#top">Up</a></div>
899 <hr /><hr />
900 <a NAME="error_1" ID="error_1"></a>
901 <h2>error</h2>
902 <b>error</b>(<i>self, line_number, offset, text, check</i>)
903 <p>
904 Report an error, according to options.
905 </p>
906 <div align="right"><a href="#top">Up</a></div>
907 <hr /><hr />
908 <a NAME="error_2" ID="error_2"></a>
909 <h2>error</h2>
910 <b>error</b>(<i>self, line_number, offset, text, check</i>)
911
912 <div align="right"><a href="#top">Up</a></div>
913 <hr /><hr />
914 <a NAME="error_args" ID="error_args"></a>
915 <h2>error_args</h2>
916 <b>error_args</b>(<i>self, line_number, offset, text, check, *args</i>)
917 <p>
918 Report an error, according to options.
919 </p>
920 <div align="right"><a href="#top">Up</a></div>
921 <hr /><hr />
922 <a NAME="error_args_1" ID="error_args_1"></a>
923 <h2>error_args</h2>
924 <b>error_args</b>(<i>self, line_number, offset, code, check, *args</i>)
925 <p>
926 Report an error, according to options.
927 </p>
928 <div align="right"><a href="#top">Up</a></div>
929 <hr /><hr />
930 <a NAME="excluded" ID="excluded"></a>
931 <h2>excluded</h2>
932 <b>excluded</b>(<i>self, filename, parent=None</i>)
933 <p>
934 Check if the file should be excluded.
935 </p><p>
936 Check if 'options.exclude' contains a pattern that matches filename.
937 </p>
938 <div align="right"><a href="#top">Up</a></div>
939 <hr /><hr />
956 <a NAME="expand_indent" ID="expand_indent"></a> 940 <a NAME="expand_indent" ID="expand_indent"></a>
957 <h2>expand_indent</h2> 941 <h2>expand_indent</h2>
958 <b>expand_indent</b>(<i>line</i>) 942 <b>expand_indent</b>(<i>line</i>)
959 <p> 943 <p>
960 Return the amount of indentation. 944 Return the amount of indentation.
1025 </p><p> 1009 </p><p>
1026 If patterns is unspecified, this always returns True. 1010 If patterns is unspecified, this always returns True.
1027 </p> 1011 </p>
1028 <div align="right"><a href="#top">Up</a></div> 1012 <div align="right"><a href="#top">Up</a></div>
1029 <hr /><hr /> 1013 <hr /><hr />
1014 <a NAME="generate_tokens" ID="generate_tokens"></a>
1015 <h2>generate_tokens</h2>
1016 <b>generate_tokens</b>(<i>self</i>)
1017 <p>
1018 Tokenize the file, run physical line checks and yield tokens.
1019 </p>
1020 <div align="right"><a href="#top">Up</a></div>
1021 <hr /><hr />
1022 <a NAME="get_checks" ID="get_checks"></a>
1023 <h2>get_checks</h2>
1024 <b>get_checks</b>(<i>self, argument_name</i>)
1025 <p>
1026 Get all the checks for this category.
1027 </p><p>
1028 Find all globally visible functions where the first argument name
1029 starts with argument_name and which contain selected tests.
1030 </p>
1031 <div align="right"><a href="#top">Up</a></div>
1032 <hr /><hr />
1033 <a NAME="get_count" ID="get_count"></a>
1034 <h2>get_count</h2>
1035 <b>get_count</b>(<i>self, prefix=''</i>)
1036 <p>
1037 Return the total count of errors and warnings.
1038 </p>
1039 <div align="right"><a href="#top">Up</a></div>
1040 <hr /><hr />
1041 <a NAME="get_file_results" ID="get_file_results"></a>
1042 <h2>get_file_results</h2>
1043 <b>get_file_results</b>(<i>self</i>)
1044 <p>
1045 Return the count of errors and warnings for this file.
1046 </p>
1047 <div align="right"><a href="#top">Up</a></div>
1048 <hr /><hr />
1049 <a NAME="get_file_results_1" ID="get_file_results_1"></a>
1050 <h2>get_file_results</h2>
1051 <b>get_file_results</b>(<i>self</i>)
1052 <p>
1053 Print the result and return the overall count for this file.
1054 </p>
1055 <div align="right"><a href="#top">Up</a></div>
1056 <hr /><hr />
1030 <a NAME="get_parser" ID="get_parser"></a> 1057 <a NAME="get_parser" ID="get_parser"></a>
1031 <h2>get_parser</h2> 1058 <h2>get_parser</h2>
1032 <b>get_parser</b>(<i>prog='pycodestyle', version=__version__</i>) 1059 <b>get_parser</b>(<i>prog='pycodestyle', version=__version__</i>)
1033 <p> 1060 <p>
1034 Create the parser for the program. 1061 Create the parser for the program.
1062 </p>
1063 <div align="right"><a href="#top">Up</a></div>
1064 <hr /><hr />
1065 <a NAME="get_statistics" ID="get_statistics"></a>
1066 <h2>get_statistics</h2>
1067 <b>get_statistics</b>(<i>self, prefix=''</i>)
1068 <p>
1069 Get statistics for message codes that start with the prefix.
1070 </p><p>
1071 prefix='' matches all errors and warnings
1072 prefix='E' matches all errors
1073 prefix='W' matches all warnings
1074 prefix='E4' matches all errors that have to do with imports
1075 </p>
1076 <div align="right"><a href="#top">Up</a></div>
1077 <hr /><hr />
1078 <a NAME="ignore_code" ID="ignore_code"></a>
1079 <h2>ignore_code</h2>
1080 <b>ignore_code</b>(<i>self, code</i>)
1081 <p>
1082 Check if the error code should be ignored.
1083 </p><p>
1084 If 'options.select' contains a prefix of the error code,
1085 return False. Else, if 'options.ignore' contains a prefix of
1086 the error code, return True.
1035 </p> 1087 </p>
1036 <div align="right"><a href="#top">Up</a></div> 1088 <div align="right"><a href="#top">Up</a></div>
1037 <hr /><hr /> 1089 <hr /><hr />
1038 <a NAME="imports_on_separate_lines" ID="imports_on_separate_lines"></a> 1090 <a NAME="imports_on_separate_lines" ID="imports_on_separate_lines"></a>
1039 <h2>imports_on_separate_lines</h2> 1091 <h2>imports_on_separate_lines</h2>
1050 Okay: import myclass 1102 Okay: import myclass
1051 Okay: import foo.bar.yourclass 1103 Okay: import foo.bar.yourclass
1052 </p> 1104 </p>
1053 <div align="right"><a href="#top">Up</a></div> 1105 <div align="right"><a href="#top">Up</a></div>
1054 <hr /><hr /> 1106 <hr /><hr />
1107 <a NAME="increment_logical_line" ID="increment_logical_line"></a>
1108 <h2>increment_logical_line</h2>
1109 <b>increment_logical_line</b>(<i>self</i>)
1110 <p>
1111 Signal a new logical line.
1112 </p>
1113 <div align="right"><a href="#top">Up</a></div>
1114 <hr /><hr />
1055 <a NAME="indentation" ID="indentation"></a> 1115 <a NAME="indentation" ID="indentation"></a>
1056 <h2>indentation</h2> 1116 <h2>indentation</h2>
1057 <b>indentation</b>(<i>logical_line, previous_logical, indent_char, indent_level, previous_indent_level</i>) 1117 <b>indentation</b>(<i>logical_line, previous_logical, indent_char, indent_level, previous_indent_level</i>)
1058 <p> 1118 <p>
1059 Use 4 spaces per indentation level. 1119 Use 4 spaces per indentation level.
1074 E113: a = 1\n b = 2 1134 E113: a = 1\n b = 2
1075 E116: a = 1\n # b = 2 1135 E116: a = 1\n # b = 2
1076 </p> 1136 </p>
1077 <div align="right"><a href="#top">Up</a></div> 1137 <div align="right"><a href="#top">Up</a></div>
1078 <hr /><hr /> 1138 <hr /><hr />
1079 <a NAME="init_checks_registry" ID="init_checks_registry"></a> 1139 <a NAME="init_checker_state" ID="init_checker_state"></a>
1080 <h2>init_checks_registry</h2> 1140 <h2>init_checker_state</h2>
1081 <b>init_checks_registry</b>(<i></i>) 1141 <b>init_checker_state</b>(<i>self, name, argument_names</i>)
1082 <p> 1142 <p>
1083 Register all globally visible functions. 1143 Prepare custom state for the specific checker plugin.
1084 </p><p> 1144 </p>
1085 The first argument name is either 'physical_line' or 'logical_line'. 1145 <div align="right"><a href="#top">Up</a></div>
1086 </p> 1146 <hr /><hr />
1087 <div align="right"><a href="#top">Up</a></div> 1147 <a NAME="init_file" ID="init_file"></a>
1088 <hr /><hr /> 1148 <h2>init_file</h2>
1089 <a NAME="is_binary_operator" ID="is_binary_operator"></a> 1149 <b>init_file</b>(<i>self, filename, lines, expected, line_offset</i>)
1090 <h2>is_binary_operator</h2> 1150 <p>
1091 <b>is_binary_operator</b>(<i>token_type, text</i>) 1151 Signal a new file.
1092 1152 </p>
1153 <div align="right"><a href="#top">Up</a></div>
1154 <hr /><hr />
1155 <a NAME="init_file_1" ID="init_file_1"></a>
1156 <h2>init_file</h2>
1157 <b>init_file</b>(<i>self, filename, lines, expected, line_offset</i>)
1158 <p>
1159 Signal a new file.
1160 </p>
1161 <div align="right"><a href="#top">Up</a></div>
1162 <hr /><hr />
1163 <a NAME="init_report" ID="init_report"></a>
1164 <h2>init_report</h2>
1165 <b>init_report</b>(<i>self, reporter=None</i>)
1166 <p>
1167 Initialize the report instance.
1168 </p>
1169 <div align="right"><a href="#top">Up</a></div>
1170 <hr /><hr />
1171 <a NAME="input_dir" ID="input_dir"></a>
1172 <h2>input_dir</h2>
1173 <b>input_dir</b>(<i>self, dirname</i>)
1174 <p>
1175 Check all files in this directory and all subdirectories.
1176 </p>
1177 <div align="right"><a href="#top">Up</a></div>
1178 <hr /><hr />
1179 <a NAME="input_file" ID="input_file"></a>
1180 <h2>input_file</h2>
1181 <b>input_file</b>(<i>self, filename, lines=None, expected=None, line_offset=0</i>)
1182 <p>
1183 Run all checks on a Python source file.
1184 </p>
1093 <div align="right"><a href="#top">Up</a></div> 1185 <div align="right"><a href="#top">Up</a></div>
1094 <hr /><hr /> 1186 <hr /><hr />
1095 <a NAME="is_string_literal" ID="is_string_literal"></a> 1187 <a NAME="is_string_literal" ID="is_string_literal"></a>
1096 <h2>is_string_literal</h2> 1188 <h2>is_string_literal</h2>
1097 <b>is_string_literal</b>(<i>line</i>) 1189 <b>is_string_literal</b>(<i>line</i>)
1098 1190
1099 <div align="right"><a href="#top">Up</a></div> 1191 <div align="right"><a href="#top">Up</a></div>
1100 <hr /><hr /> 1192 <hr /><hr />
1193 <a NAME="lru_cache" ID="lru_cache"></a>
1194 <h2>lru_cache</h2>
1195 <b>lru_cache</b>(<i>maxsize=128</i>)
1196
1197 <div align="right"><a href="#top">Up</a></div>
1198 <hr /><hr />
1101 <a NAME="maximum_line_length" ID="maximum_line_length"></a> 1199 <a NAME="maximum_line_length" ID="maximum_line_length"></a>
1102 <h2>maximum_line_length</h2> 1200 <h2>maximum_line_length</h2>
1103 <b>maximum_line_length</b>(<i>physical_line, max_line_length, multiline, noqa</i>) 1201 <b>maximum_line_length</b>(<i>physical_line, max_line_length, multiline, line_number, noqa</i>)
1104 <p> 1202 <p>
1105 Limit all lines to a maximum of 79 characters. 1203 Limit all lines to a maximum of 79 characters.
1106 </p><p> 1204 </p><p>
1107 There are still many devices around that are limited to 80 character 1205 There are still many devices around that are limited to 80 character
1108 lines; plus, limiting windows to 80 characters makes it possible to have 1206 lines; plus, limiting windows to 80 characters makes it possible to have
1110 ugly. Therefore, please limit all lines to a maximum of 79 characters. 1208 ugly. Therefore, please limit all lines to a maximum of 79 characters.
1111 For flowing long blocks of text (docstrings or comments), limiting the 1209 For flowing long blocks of text (docstrings or comments), limiting the
1112 length to 72 characters is recommended. 1210 length to 72 characters is recommended.
1113 </p><p> 1211 </p><p>
1114 Reports error E501. 1212 Reports error E501.
1213 </p>
1214 <div align="right"><a href="#top">Up</a></div>
1215 <hr /><hr />
1216 <a NAME="maybe_check_physical" ID="maybe_check_physical"></a>
1217 <h2>maybe_check_physical</h2>
1218 <b>maybe_check_physical</b>(<i>self, token</i>)
1219 <p>
1220 If appropriate (based on token), check current physical line(s).
1115 </p> 1221 </p>
1116 <div align="right"><a href="#top">Up</a></div> 1222 <div align="right"><a href="#top">Up</a></div>
1117 <hr /><hr /> 1223 <hr /><hr />
1118 <a NAME="missing_whitespace" ID="missing_whitespace"></a> 1224 <a NAME="missing_whitespace" ID="missing_whitespace"></a>
1119 <h2>missing_whitespace</h2> 1225 <h2>missing_whitespace</h2>
1236 <p> 1342 <p>
1237 Return a dictionary of matching lines. 1343 Return a dictionary of matching lines.
1238 </p> 1344 </p>
1239 <div align="right"><a href="#top">Up</a></div> 1345 <div align="right"><a href="#top">Up</a></div>
1240 <hr /><hr /> 1346 <hr /><hr />
1347 <a NAME="print_benchmark" ID="print_benchmark"></a>
1348 <h2>print_benchmark</h2>
1349 <b>print_benchmark</b>(<i>self</i>)
1350 <p>
1351 Print benchmark numbers.
1352 </p>
1353 <div align="right"><a href="#top">Up</a></div>
1354 <hr /><hr />
1355 <a NAME="print_statistics" ID="print_statistics"></a>
1356 <h2>print_statistics</h2>
1357 <b>print_statistics</b>(<i>self, prefix=''</i>)
1358 <p>
1359 Print overall statistics (number of errors and warnings).
1360 </p>
1361 <div align="right"><a href="#top">Up</a></div>
1362 <hr /><hr />
1241 <a NAME="process_options" ID="process_options"></a> 1363 <a NAME="process_options" ID="process_options"></a>
1242 <h2>process_options</h2> 1364 <h2>process_options</h2>
1243 <b>process_options</b>(<i>arglist=None, parse_argv=False, config_file=None, parser=None</i>) 1365 <b>process_options</b>(<i>arglist=None, parse_argv=False, config_file=None, parser=None, verbose=None</i>)
1244 <p> 1366 <p>
1245 Process options passed either via arglist or via command line args. 1367 Process options passed either via arglist or via command line args.
1246 </p><p> 1368 </p><p>
1247 Passing in the ``config_file`` parameter allows other tools, such as flake8 1369 Passing in the ``config_file`` parameter allows other tools, such as flake8
1248 to specify their own options to be processed in pycodestyle. 1370 to specify their own options to be processed in pycodestyle.
1371 </p>
1372 <div align="right"><a href="#top">Up</a></div>
1373 <hr /><hr />
1374 <a NAME="python_3000_async_await_keywords" ID="python_3000_async_await_keywords"></a>
1375 <h2>python_3000_async_await_keywords</h2>
1376 <b>python_3000_async_await_keywords</b>(<i>logical_line, tokens</i>)
1377 <p>
1378 'async' and 'await' are reserved keywords starting with Python 3.7
1379 </p><p>
1380 W606: async = 42
1381 W606: await = 42
1382 Okay: async def read_data(db):\n data = await db.fetch('SELECT ...')
1249 </p> 1383 </p>
1250 <div align="right"><a href="#top">Up</a></div> 1384 <div align="right"><a href="#top">Up</a></div>
1251 <hr /><hr /> 1385 <hr /><hr />
1252 <a NAME="python_3000_backticks" ID="python_3000_backticks"></a> 1386 <a NAME="python_3000_backticks" ID="python_3000_backticks"></a>
1253 <h2>python_3000_backticks</h2> 1387 <h2>python_3000_backticks</h2>
1269 Okay: if "alph" in d:\n print d["alph"] 1403 Okay: if "alph" in d:\n print d["alph"]
1270 W601: assert d.has_key('alph') 1404 W601: assert d.has_key('alph')
1271 </p> 1405 </p>
1272 <div align="right"><a href="#top">Up</a></div> 1406 <div align="right"><a href="#top">Up</a></div>
1273 <hr /><hr /> 1407 <hr /><hr />
1408 <a NAME="python_3000_invalid_escape_sequence" ID="python_3000_invalid_escape_sequence"></a>
1409 <h2>python_3000_invalid_escape_sequence</h2>
1410 <b>python_3000_invalid_escape_sequence</b>(<i>logical_line, tokens</i>)
1411 <p>
1412 Invalid escape sequences are deprecated in Python 3.6.
1413 </p><p>
1414 Okay: regex = r'\.png$'
1415 W605: regex = '\.png$'
1416 </p>
1417 <div align="right"><a href="#top">Up</a></div>
1418 <hr /><hr />
1274 <a NAME="python_3000_not_equal" ID="python_3000_not_equal"></a> 1419 <a NAME="python_3000_not_equal" ID="python_3000_not_equal"></a>
1275 <h2>python_3000_not_equal</h2> 1420 <h2>python_3000_not_equal</h2>
1276 <b>python_3000_not_equal</b>(<i>logical_line</i>) 1421 <b>python_3000_not_equal</b>(<i>logical_line</i>)
1277 <p> 1422 <p>
1278 New code should always use != instead of <>. 1423 New code should always use != instead of <>.
1310 configurations in the current directory or above will be merged together 1455 configurations in the current directory or above will be merged together
1311 (in that order) using the read method of ConfigParser. 1456 (in that order) using the read method of ConfigParser.
1312 </p> 1457 </p>
1313 <div align="right"><a href="#top">Up</a></div> 1458 <div align="right"><a href="#top">Up</a></div>
1314 <hr /><hr /> 1459 <hr /><hr />
1460 <a NAME="readline" ID="readline"></a>
1461 <h2>readline</h2>
1462 <b>readline</b>(<i>self</i>)
1463 <p>
1464 Get the next line from the input buffer.
1465 </p>
1466 <div align="right"><a href="#top">Up</a></div>
1467 <hr /><hr />
1315 <a NAME="readlines" ID="readlines"></a> 1468 <a NAME="readlines" ID="readlines"></a>
1316 <h2>readlines</h2> 1469 <h2>readlines</h2>
1317 <b>readlines</b>(<i>filename</i>) 1470 <b>readlines</b>(<i>filename</i>)
1318 <p> 1471 <p>
1319 Read the source code. 1472 Read the source code.
1334 <p> 1487 <p>
1335 Register a new check object. 1488 Register a new check object.
1336 </p> 1489 </p>
1337 <div align="right"><a href="#top">Up</a></div> 1490 <div align="right"><a href="#top">Up</a></div>
1338 <hr /><hr /> 1491 <hr /><hr />
1492 <a NAME="report_invalid_syntax" ID="report_invalid_syntax"></a>
1493 <h2>report_invalid_syntax</h2>
1494 <b>report_invalid_syntax</b>(<i>self</i>)
1495 <p>
1496 Check if the syntax is valid.
1497 </p>
1498 <div align="right"><a href="#top">Up</a></div>
1499 <hr /><hr />
1500 <a NAME="run_check" ID="run_check"></a>
1501 <h2>run_check</h2>
1502 <b>run_check</b>(<i>self, check, argument_names</i>)
1503 <p>
1504 Run a check plugin.
1505 </p>
1506 <div align="right"><a href="#top">Up</a></div>
1507 <hr /><hr />
1508 <a NAME="start" ID="start"></a>
1509 <h2>start</h2>
1510 <b>start</b>(<i>self</i>)
1511 <p>
1512 Start the timer.
1513 </p>
1514 <div align="right"><a href="#top">Up</a></div>
1515 <hr /><hr />
1339 <a NAME="stdin_get_value" ID="stdin_get_value"></a> 1516 <a NAME="stdin_get_value" ID="stdin_get_value"></a>
1340 <h2>stdin_get_value</h2> 1517 <h2>stdin_get_value</h2>
1341 <b>stdin_get_value</b>(<i></i>) 1518 <b>stdin_get_value</b>(<i></i>)
1342 <p> 1519 <p>
1343 Read the value from stdin. 1520 Read the value from stdin.
1521 </p>
1522 <div align="right"><a href="#top">Up</a></div>
1523 <hr /><hr />
1524 <a NAME="stop" ID="stop"></a>
1525 <h2>stop</h2>
1526 <b>stop</b>(<i>self</i>)
1527 <p>
1528 Stop the timer.
1344 </p> 1529 </p>
1345 <div align="right"><a href="#top">Up</a></div> 1530 <div align="right"><a href="#top">Up</a></div>
1346 <hr /><hr /> 1531 <hr /><hr />
1347 <a NAME="tabs_obsolete" ID="tabs_obsolete"></a> 1532 <a NAME="tabs_obsolete" ID="tabs_obsolete"></a>
1348 <h2>tabs_obsolete</h2> 1533 <h2>tabs_obsolete</h2>
1443 <b>whitespace_around_named_parameter_equals</b>(<i>logical_line, tokens</i>) 1628 <b>whitespace_around_named_parameter_equals</b>(<i>logical_line, tokens</i>)
1444 <p> 1629 <p>
1445 Don't use spaces around the '=' sign in function arguments. 1630 Don't use spaces around the '=' sign in function arguments.
1446 </p><p> 1631 </p><p>
1447 Don't use spaces around the '=' sign when used to indicate a 1632 Don't use spaces around the '=' sign when used to indicate a
1448 keyword argument or a default parameter value. 1633 keyword argument or a default parameter value, except when using a type
1634 annotation.
1449 </p><p> 1635 </p><p>
1450 Okay: def complex(real, imag=0.0): 1636 Okay: def complex(real, imag=0.0):
1451 Okay: return magic(r=real, i=imag) 1637 Okay: return magic(r=real, i=imag)
1452 Okay: boolean(a == b) 1638 Okay: boolean(a == b)
1453 Okay: boolean(a != b) 1639 Okay: boolean(a != b)
1456 Okay: def foo(arg: int = 42): 1642 Okay: def foo(arg: int = 42):
1457 Okay: async def foo(arg: int = 42): 1643 Okay: async def foo(arg: int = 42):
1458 </p><p> 1644 </p><p>
1459 E251: def complex(real, imag = 0.0): 1645 E251: def complex(real, imag = 0.0):
1460 E251: return magic(r = real, i = imag) 1646 E251: return magic(r = real, i = imag)
1647 E252: def complex(real, image: float=0.0):
1461 </p> 1648 </p>
1462 <div align="right"><a href="#top">Up</a></div> 1649 <div align="right"><a href="#top">Up</a></div>
1463 <hr /><hr /> 1650 <hr /><hr />
1464 <a NAME="whitespace_around_operator" ID="whitespace_around_operator"></a> 1651 <a NAME="whitespace_around_operator" ID="whitespace_around_operator"></a>
1465 <h2>whitespace_around_operator</h2> 1652 <h2>whitespace_around_operator</h2>

eric ide

mercurial