--- a/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle.html Fri Feb 15 18:58:49 2019 +0100 +++ b/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle.html Fri Feb 15 19:19:20 2019 +0100 @@ -23,7 +23,7 @@ <h3>Global Attributes</h3> <table> -<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> +<tr><td>ARITHMETIC_OP</td></tr><tr><td>BENCHMARK_KEYS</td></tr><tr><td>BLANK_LINES_CONFIG</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>FUNCTION_RETURN_ANNOTATION_OP</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_DOC_LENGTH</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> </table> <h3>Classes</h3> <table> @@ -38,7 +38,7 @@ <td>Collect and print the results for the changed lines only.</td> </tr><tr> <td><a href="#FileReport">FileReport</a></td> -<td>Collect the results of the checks and print only the filenames.</td> +<td>Collect the results of the checks and print the filenames.</td> </tr><tr> <td><a href="#StandardReport">StandardReport</a></td> <td>Collect and print the results of the checks.</td> @@ -50,21 +50,6 @@ <h3>Functions</h3> <table> <tr> -<td><a href="#__init__">__init__</a></td> -<td></td> -</tr><tr> -<td><a href="#__init___1">__init__</a></td> -<td></td> -</tr><tr> -<td><a href="#__init___2">__init__</a></td> -<td></td> -</tr><tr> -<td><a href="#__init___3">__init__</a></td> -<td></td> -</tr><tr> -<td><a href="#__init___4">__init__</a></td> -<td></td> -</tr><tr> <td><a href="#_add_check">_add_check</a></td> <td></td> </tr><tr> @@ -80,9 +65,6 @@ <td><a href="#_is_eol_token">_is_eol_token</a></td> <td></td> </tr><tr> -<td><a href="#_is_eol_token_1">_is_eol_token</a></td> -<td></td> -</tr><tr> <td><a href="#_main">_main</a></td> <td>Parse options and run checks on Python source.</td> </tr><tr> @@ -104,24 +86,6 @@ <td><a href="#break_before_binary_operator">break_before_binary_operator</a></td> <td>Avoid breaks before binary operators.</td> </tr><tr> -<td><a href="#build_tokens_line">build_tokens_line</a></td> -<td>Build a logical line from tokens.</td> -</tr><tr> -<td><a href="#check_all">check_all</a></td> -<td>Run all checks on the input file.</td> -</tr><tr> -<td><a href="#check_ast">check_ast</a></td> -<td>Build the file's AST and run all AST checks.</td> -</tr><tr> -<td><a href="#check_files">check_files</a></td> -<td>Run all checks on the paths.</td> -</tr><tr> -<td><a href="#check_logical">check_logical</a></td> -<td>Build a line from tokens and run all logical checks on it.</td> -</tr><tr> -<td><a href="#check_physical">check_physical</a></td> -<td>Run all physical checks on a raw input line.</td> -</tr><tr> <td><a href="#comparison_negative">comparison_negative</a></td> <td>Negative comparison should be done using "not in" and "is not".</td> </tr><tr> @@ -137,24 +101,6 @@ <td><a href="#continued_indentation">continued_indentation</a></td> <td>Continuation lines indentation.</td> </tr><tr> -<td><a href="#error">error</a></td> -<td>Report an error, according to options.</td> -</tr><tr> -<td><a href="#error_1">error</a></td> -<td>Report an error, according to options.</td> -</tr><tr> -<td><a href="#error_2">error</a></td> -<td></td> -</tr><tr> -<td><a href="#error_args">error_args</a></td> -<td>Report an error, according to options.</td> -</tr><tr> -<td><a href="#error_args_1">error_args</a></td> -<td>Report an error, according to options.</td> -</tr><tr> -<td><a href="#excluded">excluded</a></td> -<td>Check if the file should be excluded.</td> -</tr><tr> <td><a href="#expand_indent">expand_indent</a></td> <td>Return the amount of indentation.</td> </tr><tr> @@ -167,69 +113,27 @@ <td><a href="#filename_match">filename_match</a></td> <td>Check if patterns contains a pattern that matches filename.</td> </tr><tr> -<td><a href="#generate_tokens">generate_tokens</a></td> -<td>Tokenize the file, run physical line checks and yield tokens.</td> -</tr><tr> -<td><a href="#get_checks">get_checks</a></td> -<td>Get all the checks for this category.</td> -</tr><tr> -<td><a href="#get_count">get_count</a></td> -<td>Return the total count of errors and warnings.</td> -</tr><tr> -<td><a href="#get_file_results">get_file_results</a></td> -<td>Return the count of errors and warnings for this file.</td> -</tr><tr> -<td><a href="#get_file_results_1">get_file_results</a></td> -<td>Print the result and return the overall count for this file.</td> -</tr><tr> <td><a href="#get_parser">get_parser</a></td> <td>Create the parser for the program.</td> </tr><tr> -<td><a href="#get_statistics">get_statistics</a></td> -<td>Get statistics for message codes that start with the prefix.</td> -</tr><tr> -<td><a href="#ignore_code">ignore_code</a></td> -<td>Check if the error code should be ignored.</td> -</tr><tr> <td><a href="#imports_on_separate_lines">imports_on_separate_lines</a></td> <td>Place imports on separate lines.</td> </tr><tr> -<td><a href="#increment_logical_line">increment_logical_line</a></td> -<td>Signal a new logical line.</td> -</tr><tr> <td><a href="#indentation">indentation</a></td> <td>Use 4 spaces per indentation level.</td> </tr><tr> -<td><a href="#init_checker_state">init_checker_state</a></td> -<td>Prepare custom state for the specific checker plugin.</td> -</tr><tr> -<td><a href="#init_file">init_file</a></td> -<td>Signal a new file.</td> -</tr><tr> -<td><a href="#init_file_1">init_file</a></td> -<td>Signal a new file.</td> -</tr><tr> -<td><a href="#init_report">init_report</a></td> -<td>Initialize the report instance.</td> -</tr><tr> -<td><a href="#input_dir">input_dir</a></td> -<td>Check all files in this directory and all subdirectories.</td> -</tr><tr> -<td><a href="#input_file">input_file</a></td> -<td>Run all checks on a Python source file.</td> -</tr><tr> <td><a href="#is_string_literal">is_string_literal</a></td> <td></td> </tr><tr> <td><a href="#lru_cache">lru_cache</a></td> <td></td> </tr><tr> +<td><a href="#maximum_doc_length">maximum_doc_length</a></td> +<td>Limit all doc lines to a maximum of 72 characters.</td> +</tr><tr> <td><a href="#maximum_line_length">maximum_line_length</a></td> <td>Limit all lines to a maximum of 79 characters.</td> </tr><tr> -<td><a href="#maybe_check_physical">maybe_check_physical</a></td> -<td>If appropriate (based on token), check current physical line(s).</td> -</tr><tr> <td><a href="#missing_whitespace">missing_whitespace</a></td> <td>Each comma, semicolon or colon should be followed by whitespace.</td> </tr><tr> @@ -251,17 +155,11 @@ <td><a href="#parse_udiff">parse_udiff</a></td> <td>Return a dictionary of matching lines.</td> </tr><tr> -<td><a href="#print_benchmark">print_benchmark</a></td> -<td>Print benchmark numbers.</td> -</tr><tr> -<td><a href="#print_statistics">print_statistics</a></td> -<td>Print overall statistics (number of errors and warnings).</td> -</tr><tr> <td><a href="#process_options">process_options</a></td> -<td>Process options passed either via arglist or via command line args.</td> +<td>Process options passed either via arglist or command line args.</td> </tr><tr> <td><a href="#python_3000_async_await_keywords">python_3000_async_await_keywords</a></td> -<td>'async' and 'await' are reserved keywords starting with Python 3.7</td> +<td>'async' and 'await' are reserved keywords starting at Python 3.7.</td> </tr><tr> <td><a href="#python_3000_backticks">python_3000_backticks</a></td> <td>Use repr() instead of backticks in Python 3.</td> @@ -281,9 +179,6 @@ <td><a href="#read_config">read_config</a></td> <td>Read and parse configurations.</td> </tr><tr> -<td><a href="#readline">readline</a></td> -<td>Get the next line from the input buffer.</td> -</tr><tr> <td><a href="#readlines">readlines</a></td> <td>Read the source code.</td> </tr><tr> @@ -293,23 +188,11 @@ <td><a href="#register_check">register_check</a></td> <td>Register a new check object.</td> </tr><tr> -<td><a href="#report_invalid_syntax">report_invalid_syntax</a></td> -<td>Check if the syntax is valid.</td> -</tr><tr> -<td><a href="#run_check">run_check</a></td> -<td>Run a check plugin.</td> -</tr><tr> -<td><a href="#start">start</a></td> -<td>Start the timer.</td> -</tr><tr> <td><a href="#stdin_get_value">stdin_get_value</a></td> <td>Read the value from stdin.</td> </tr><tr> -<td><a href="#stop">stop</a></td> -<td>Stop the timer.</td> -</tr><tr> <td><a href="#tabs_obsolete">tabs_obsolete</a></td> -<td>For new projects, spaces-only are strongly recommended over tabs.</td> +<td>On new projects, spaces-only are strongly recommended over tabs.</td> </tr><tr> <td><a href="#tabs_or_spaces">tabs_or_spaces</a></td> <td>Never mix tabs and spaces.</td> @@ -360,13 +243,112 @@ </table> <h3>Methods</h3> <table> -<tr><td>None</td></tr> +<tr> +<td><a href="#BaseReport.__init__">BaseReport</a></td> +<td></td> +</tr><tr> +<td><a href="#BaseReport.error">error</a></td> +<td>Report an error, according to options.</td> +</tr><tr> +<td><a href="#BaseReport.error_args">error_args</a></td> +<td>Report an error, according to options.</td> +</tr><tr> +<td><a href="#BaseReport.get_count">get_count</a></td> +<td>Return the total count of errors and warnings.</td> +</tr><tr> +<td><a href="#BaseReport.get_file_results">get_file_results</a></td> +<td>Return the count of errors and warnings for this file.</td> +</tr><tr> +<td><a href="#BaseReport.get_statistics">get_statistics</a></td> +<td>Get statistics for message codes that start with the prefix.</td> +</tr><tr> +<td><a href="#BaseReport.increment_logical_line">increment_logical_line</a></td> +<td>Signal a new logical line.</td> +</tr><tr> +<td><a href="#BaseReport.init_file">init_file</a></td> +<td>Signal a new file.</td> +</tr><tr> +<td><a href="#BaseReport.print_benchmark">print_benchmark</a></td> +<td>Print benchmark numbers.</td> +</tr><tr> +<td><a href="#BaseReport.print_statistics">print_statistics</a></td> +<td>Print overall statistics (number of errors and warnings).</td> +</tr><tr> +<td><a href="#BaseReport.start">start</a></td> +<td>Start the timer.</td> +</tr><tr> +<td><a href="#BaseReport.stop">stop</a></td> +<td>Stop the timer.</td> +</tr> </table> <h3>Static Methods</h3> <table> <tr><td>None</td></tr> </table> - +<a NAME="BaseReport.__init__" ID="BaseReport.__init__"></a> +<h4>BaseReport (Constructor)</h4> +<b>BaseReport</b>(<i>options</i>) +<a NAME="BaseReport.error" ID="BaseReport.error"></a> +<h4>BaseReport.error</h4> +<b>error</b>(<i>line_number, offset, text, check</i>) +<p> +Report an error, according to options. +</p><a NAME="BaseReport.error_args" ID="BaseReport.error_args"></a> +<h4>BaseReport.error_args</h4> +<b>error_args</b>(<i>line_number, offset, text, check, *args</i>) +<p> +Report an error, according to options. +</p><a NAME="BaseReport.get_count" ID="BaseReport.get_count"></a> +<h4>BaseReport.get_count</h4> +<b>get_count</b>(<i>prefix=''</i>) +<p> +Return the total count of errors and warnings. +</p><a NAME="BaseReport.get_file_results" ID="BaseReport.get_file_results"></a> +<h4>BaseReport.get_file_results</h4> +<b>get_file_results</b>(<i></i>) +<p> +Return the count of errors and warnings for this file. +</p><a NAME="BaseReport.get_statistics" ID="BaseReport.get_statistics"></a> +<h4>BaseReport.get_statistics</h4> +<b>get_statistics</b>(<i>prefix=''</i>) +<p> +Get statistics for message codes that start with the prefix. +</p><p> + prefix='' matches all errors and warnings + prefix='E' matches all errors + prefix='W' matches all warnings + prefix='E4' matches all errors that have to do with imports +</p><a NAME="BaseReport.increment_logical_line" ID="BaseReport.increment_logical_line"></a> +<h4>BaseReport.increment_logical_line</h4> +<b>increment_logical_line</b>(<i></i>) +<p> +Signal a new logical line. +</p><a NAME="BaseReport.init_file" ID="BaseReport.init_file"></a> +<h4>BaseReport.init_file</h4> +<b>init_file</b>(<i>filename, lines, expected, line_offset</i>) +<p> +Signal a new file. +</p><a NAME="BaseReport.print_benchmark" ID="BaseReport.print_benchmark"></a> +<h4>BaseReport.print_benchmark</h4> +<b>print_benchmark</b>(<i></i>) +<p> +Print benchmark numbers. +</p><a NAME="BaseReport.print_statistics" ID="BaseReport.print_statistics"></a> +<h4>BaseReport.print_statistics</h4> +<b>print_statistics</b>(<i>prefix=''</i>) +<p> +Print overall statistics (number of errors and warnings). +</p><a NAME="BaseReport.start" ID="BaseReport.start"></a> +<h4>BaseReport.start</h4> +<b>start</b>(<i></i>) +<p> +Start the timer. +</p><a NAME="BaseReport.stop" ID="BaseReport.stop"></a> +<h4>BaseReport.stop</h4> +<b>stop</b>(<i></i>) +<p> +Stop the timer. +</p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> <a NAME="Checker" ID="Checker"></a> @@ -386,13 +368,107 @@ </table> <h3>Methods</h3> <table> -<tr><td>None</td></tr> +<tr> +<td><a href="#Checker.__init__">Checker</a></td> +<td></td> +</tr><tr> +<td><a href="#Checker.build_tokens_line">build_tokens_line</a></td> +<td>Build a logical line from tokens.</td> +</tr><tr> +<td><a href="#Checker.check_all">check_all</a></td> +<td>Run all checks on the input file.</td> +</tr><tr> +<td><a href="#Checker.check_ast">check_ast</a></td> +<td>Build the file's AST and run all AST checks.</td> +</tr><tr> +<td><a href="#Checker.check_logical">check_logical</a></td> +<td>Build a line from tokens and run all logical checks on it.</td> +</tr><tr> +<td><a href="#Checker.check_physical">check_physical</a></td> +<td>Run all physical checks on a raw input line.</td> +</tr><tr> +<td><a href="#Checker.generate_tokens">generate_tokens</a></td> +<td>Tokenize file, run physical line checks and yield tokens.</td> +</tr><tr> +<td><a href="#Checker.init_checker_state">init_checker_state</a></td> +<td>Prepare custom state for the specific checker plugin.</td> +</tr><tr> +<td><a href="#Checker.maybe_check_physical">maybe_check_physical</a></td> +<td>If appropriate for token, check current physical line(s).</td> +</tr><tr> +<td><a href="#Checker.readline">readline</a></td> +<td>Get the next line from the input buffer.</td> +</tr><tr> +<td><a href="#Checker.report_invalid_syntax">report_invalid_syntax</a></td> +<td>Check if the syntax is valid.</td> +</tr><tr> +<td><a href="#Checker.run_check">run_check</a></td> +<td>Run a check plugin.</td> +</tr> </table> <h3>Static Methods</h3> <table> <tr><td>None</td></tr> </table> - +<a NAME="Checker.__init__" ID="Checker.__init__"></a> +<h4>Checker (Constructor)</h4> +<b>Checker</b>(<i>filename=None, lines=None, options=None, report=None, **kwargs</i>) +<a NAME="Checker.build_tokens_line" ID="Checker.build_tokens_line"></a> +<h4>Checker.build_tokens_line</h4> +<b>build_tokens_line</b>(<i></i>) +<p> +Build a logical line from tokens. +</p><a NAME="Checker.check_all" ID="Checker.check_all"></a> +<h4>Checker.check_all</h4> +<b>check_all</b>(<i>expected=None, line_offset=0</i>) +<p> +Run all checks on the input file. +</p><a NAME="Checker.check_ast" ID="Checker.check_ast"></a> +<h4>Checker.check_ast</h4> +<b>check_ast</b>(<i></i>) +<p> +Build the file's AST and run all AST checks. +</p><a NAME="Checker.check_logical" ID="Checker.check_logical"></a> +<h4>Checker.check_logical</h4> +<b>check_logical</b>(<i></i>) +<p> +Build a line from tokens and run all logical checks on it. +</p><a NAME="Checker.check_physical" ID="Checker.check_physical"></a> +<h4>Checker.check_physical</h4> +<b>check_physical</b>(<i>line</i>) +<p> +Run all physical checks on a raw input line. +</p><a NAME="Checker.generate_tokens" ID="Checker.generate_tokens"></a> +<h4>Checker.generate_tokens</h4> +<b>generate_tokens</b>(<i></i>) +<p> +Tokenize file, run physical line checks and yield tokens. +</p><a NAME="Checker.init_checker_state" ID="Checker.init_checker_state"></a> +<h4>Checker.init_checker_state</h4> +<b>init_checker_state</b>(<i>name, argument_names</i>) +<p> +Prepare custom state for the specific checker plugin. +</p><a NAME="Checker.maybe_check_physical" ID="Checker.maybe_check_physical"></a> +<h4>Checker.maybe_check_physical</h4> +<b>maybe_check_physical</b>(<i>token</i>) +<p> +If appropriate for token, check current physical line(s). +</p><a NAME="Checker.readline" ID="Checker.readline"></a> +<h4>Checker.readline</h4> +<b>readline</b>(<i></i>) +<p> +Get the next line from the input buffer. +</p><a NAME="Checker.report_invalid_syntax" ID="Checker.report_invalid_syntax"></a> +<h4>Checker.report_invalid_syntax</h4> +<b>report_invalid_syntax</b>(<i></i>) +<p> +Check if the syntax is valid. +</p><a NAME="Checker.run_check" ID="Checker.run_check"></a> +<h4>Checker.run_check</h4> +<b>run_check</b>(<i>check, argument_names</i>) +<p> +Run a check plugin. +</p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> <a NAME="DiffReport" ID="DiffReport"></a> @@ -412,19 +488,31 @@ </table> <h3>Methods</h3> <table> -<tr><td>None</td></tr> +<tr> +<td><a href="#DiffReport.__init__">DiffReport</a></td> +<td></td> +</tr><tr> +<td><a href="#DiffReport.error">error</a></td> +<td></td> +</tr> </table> <h3>Static Methods</h3> <table> <tr><td>None</td></tr> </table> +<a NAME="DiffReport.__init__" ID="DiffReport.__init__"></a> +<h4>DiffReport (Constructor)</h4> +<b>DiffReport</b>(<i>options</i>) +<a NAME="DiffReport.error" ID="DiffReport.error"></a> +<h4>DiffReport.error</h4> +<b>error</b>(<i>line_number, offset, text, check</i>) <div align="right"><a href="#top">Up</a></div> <hr /><hr /> <a NAME="FileReport" ID="FileReport"></a> <h2>FileReport</h2> <p> -Collect the results of the checks and print only the filenames. +Collect the results of the checks and print the filenames. </p> <h3>Derived from</h3> BaseReport @@ -464,13 +552,51 @@ </table> <h3>Methods</h3> <table> -<tr><td>None</td></tr> +<tr> +<td><a href="#StandardReport.__init__">StandardReport</a></td> +<td></td> +</tr><tr> +<td><a href="#StandardReport.error">error</a></td> +<td>Report an error, according to options.</td> +</tr><tr> +<td><a href="#StandardReport.error_args">error_args</a></td> +<td>Report an error, according to options.</td> +</tr><tr> +<td><a href="#StandardReport.get_file_results">get_file_results</a></td> +<td>Print results and return the overall count for this file.</td> +</tr><tr> +<td><a href="#StandardReport.init_file">init_file</a></td> +<td>Signal a new file.</td> +</tr> </table> <h3>Static Methods</h3> <table> <tr><td>None</td></tr> </table> - +<a NAME="StandardReport.__init__" ID="StandardReport.__init__"></a> +<h4>StandardReport (Constructor)</h4> +<b>StandardReport</b>(<i>options</i>) +<a NAME="StandardReport.error" ID="StandardReport.error"></a> +<h4>StandardReport.error</h4> +<b>error</b>(<i>line_number, offset, text, check</i>) +<p> +Report an error, according to options. +</p><a NAME="StandardReport.error_args" ID="StandardReport.error_args"></a> +<h4>StandardReport.error_args</h4> +<b>error_args</b>(<i>line_number, offset, code, check, *args</i>) +<p> +Report an error, according to options. +</p><a NAME="StandardReport.get_file_results" ID="StandardReport.get_file_results"></a> +<h4>StandardReport.get_file_results</h4> +<b>get_file_results</b>(<i></i>) +<p> +Print results and return the overall count for this file. +</p><a NAME="StandardReport.init_file" ID="StandardReport.init_file"></a> +<h4>StandardReport.init_file</h4> +<b>init_file</b>(<i>filename, lines, expected, line_offset</i>) +<p> +Signal a new file. +</p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> <a NAME="StyleGuide" ID="StyleGuide"></a> @@ -490,43 +616,84 @@ </table> <h3>Methods</h3> <table> -<tr><td>None</td></tr> +<tr> +<td><a href="#StyleGuide.__init__">StyleGuide</a></td> +<td></td> +</tr><tr> +<td><a href="#StyleGuide.check_files">check_files</a></td> +<td>Run all checks on the paths.</td> +</tr><tr> +<td><a href="#StyleGuide.excluded">excluded</a></td> +<td>Check if the file should be excluded.</td> +</tr><tr> +<td><a href="#StyleGuide.get_checks">get_checks</a></td> +<td>Get all the checks for this category.</td> +</tr><tr> +<td><a href="#StyleGuide.ignore_code">ignore_code</a></td> +<td>Check if the error code should be ignored.</td> +</tr><tr> +<td><a href="#StyleGuide.init_report">init_report</a></td> +<td>Initialize the report instance.</td> +</tr><tr> +<td><a href="#StyleGuide.input_dir">input_dir</a></td> +<td>Check all files in this directory and all subdirectories.</td> +</tr><tr> +<td><a href="#StyleGuide.input_file">input_file</a></td> +<td>Run all checks on a Python source file.</td> +</tr> </table> <h3>Static Methods</h3> <table> <tr><td>None</td></tr> </table> - -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="__init__" ID="__init__"></a> -<h2>__init__</h2> -<b>__init__</b>(<i>self, filename=None, lines=None, options=None, report=None, **kwargs</i>) - -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="__init___1" ID="__init___1"></a> -<h2>__init__</h2> -<b>__init__</b>(<i>self, options</i>) - -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="__init___2" ID="__init___2"></a> -<h2>__init__</h2> -<b>__init__</b>(<i>self, options</i>) - -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="__init___3" ID="__init___3"></a> -<h2>__init__</h2> -<b>__init__</b>(<i>self, options</i>) - -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="__init___4" ID="__init___4"></a> -<h2>__init__</h2> -<b>__init__</b>(<i>self, *args, **kwargs</i>) - +<a NAME="StyleGuide.__init__" ID="StyleGuide.__init__"></a> +<h4>StyleGuide (Constructor)</h4> +<b>StyleGuide</b>(<i>*args, **kwargs</i>) +<a NAME="StyleGuide.check_files" ID="StyleGuide.check_files"></a> +<h4>StyleGuide.check_files</h4> +<b>check_files</b>(<i>paths=None</i>) +<p> +Run all checks on the paths. +</p><a NAME="StyleGuide.excluded" ID="StyleGuide.excluded"></a> +<h4>StyleGuide.excluded</h4> +<b>excluded</b>(<i>filename, parent=None</i>) +<p> +Check if the file should be excluded. +</p><p> + Check if 'options.exclude' contains a pattern matching filename. +</p><a NAME="StyleGuide.get_checks" ID="StyleGuide.get_checks"></a> +<h4>StyleGuide.get_checks</h4> +<b>get_checks</b>(<i>argument_name</i>) +<p> +Get all the checks for this category. +</p><p> + Find all globally visible functions where the first argument + name starts with argument_name and which contain selected tests. +</p><a NAME="StyleGuide.ignore_code" ID="StyleGuide.ignore_code"></a> +<h4>StyleGuide.ignore_code</h4> +<b>ignore_code</b>(<i>code</i>) +<p> +Check if the error code should be ignored. +</p><p> + If 'options.select' contains a prefix of the error code, + return False. Else, if 'options.ignore' contains a prefix of + the error code, return True. +</p><a NAME="StyleGuide.init_report" ID="StyleGuide.init_report"></a> +<h4>StyleGuide.init_report</h4> +<b>init_report</b>(<i>reporter=None</i>) +<p> +Initialize the report instance. +</p><a NAME="StyleGuide.input_dir" ID="StyleGuide.input_dir"></a> +<h4>StyleGuide.input_dir</h4> +<b>input_dir</b>(<i>dirname</i>) +<p> +Check all files in this directory and all subdirectories. +</p><a NAME="StyleGuide.input_file" ID="StyleGuide.input_file"></a> +<h4>StyleGuide.input_file</h4> +<b>input_file</b>(<i>filename, lines=None, expected=None, line_offset=0</i>) +<p> +Run all checks on a Python source file. +</p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> <a NAME="_add_check" ID="_add_check"></a> @@ -565,12 +732,6 @@ <div align="right"><a href="#top">Up</a></div> <hr /><hr /> -<a NAME="_is_eol_token_1" ID="_is_eol_token_1"></a> -<h2>_is_eol_token</h2> -<b>_is_eol_token</b>(<i>token, _eol_token=_is_eol_token</i>) - -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> <a NAME="_main" ID="_main"></a> <h2>_main</h2> <b>_main</b>(<i></i>) @@ -600,8 +761,8 @@ <p> Never use the characters 'l', 'O', or 'I' as variable names. </p><p> - In some fonts, these characters are indistinguishable from the numerals - one and zero. When tempted to use 'l', use 'L' instead. + In some fonts, these characters are indistinguishable from the + numerals one and zero. When tempted to use 'l', use 'L' instead. </p><p> Okay: L = 0 Okay: o = 123 @@ -610,9 +771,9 @@ E741: O = 123 E741: I = 42 </p><p> - Variables can be bound in several other contexts, including class and - function definitions, 'global' and 'nonlocal' statements, exception - handlers, and 'with' statements. + Variables can be bound in several other contexts, including class + and function definitions, 'global' and 'nonlocal' statements, + exception handlers, and 'with' statements. </p><p> Okay: except AttributeError as o: Okay: with lock as L: @@ -629,7 +790,8 @@ <h2>bare_except</h2> <b>bare_except</b>(<i>logical_line, noqa</i>) <p> -When catching exceptions, mention specific exceptions when possible. +When catching exceptions, mention specific exceptions when + possible. </p><p> Okay: except Exception: Okay: except BaseException: @@ -641,15 +803,18 @@ <h2>blank_lines</h2> <b>blank_lines</b>(<i>logical_line, blank_lines, indent_level, line_number, blank_before, previous_logical, previous_unindented_logical_line, previous_indent_level, lines</i>) <p> -Separate top-level function and class definitions with two blank lines. +Separate top-level function and class definitions with two blank + lines. </p><p> - Method definitions inside a class are separated by a single blank line. + Method definitions inside a class are separated by a single blank + line. </p><p> - Extra blank lines may be used (sparingly) to separate groups of related - functions. Blank lines may be omitted between a bunch of related - one-liners (e.g. a set of dummy implementations). + Extra blank lines may be used (sparingly) to separate groups of + related functions. Blank lines may be omitted between a bunch of + related one-liners (e.g. a set of dummy implementations). </p><p> - Use blank lines in functions, sparingly, to indicate logical sections. + Use blank lines in functions, sparingly, to indicate logical + sections. </p><p> Okay: def a():\n pass\n\n\ndef b():\n pass Okay: def a():\n pass\n\n\nasync def b():\n pass @@ -718,54 +883,6 @@ </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> -<a NAME="build_tokens_line" ID="build_tokens_line"></a> -<h2>build_tokens_line</h2> -<b>build_tokens_line</b>(<i>self</i>) -<p> -Build a logical line from tokens. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="check_all" ID="check_all"></a> -<h2>check_all</h2> -<b>check_all</b>(<i>self, expected=None, line_offset=0</i>) -<p> -Run all checks on the input file. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="check_ast" ID="check_ast"></a> -<h2>check_ast</h2> -<b>check_ast</b>(<i>self</i>) -<p> -Build the file's AST and run all AST checks. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="check_files" ID="check_files"></a> -<h2>check_files</h2> -<b>check_files</b>(<i>self, paths=None</i>) -<p> -Run all checks on the paths. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="check_logical" ID="check_logical"></a> -<h2>check_logical</h2> -<b>check_logical</b>(<i>self</i>) -<p> -Build a line from tokens and run all logical checks on it. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="check_physical" ID="check_physical"></a> -<h2>check_physical</h2> -<b>check_physical</b>(<i>self, line</i>) -<p> -Run all physical checks on a raw input line. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> <a NAME="comparison_negative" ID="comparison_negative"></a> <h2>comparison_negative</h2> <b>comparison_negative</b>(<i>logical_line</i>) @@ -798,10 +915,10 @@ E712: if arg == True: E712: if False == arg: </p><p> - Also, beware of writing if x when you really mean if x is not None -- - e.g. when testing whether a variable or argument that defaults to None was - set to some other value. The other value might have a type (such as a - container) that could be false in a boolean context! + Also, beware of writing if x when you really mean if x is not None + -- e.g. when testing whether a variable or argument that defaults to + None was set to some other value. The other value might have a type + (such as a container) that could be false in a boolean context! </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> @@ -816,9 +933,9 @@ Okay: if isinstance(obj, int): E721: if type(obj) is type(1): </p><p> - When checking if an object is a string, keep in mind that it might be a - unicode string too! In Python 2.3, str and unicode have a common base - class, basestring, so you can do: + When checking if an object is a string, keep in mind that it might + be a unicode string too! In Python 2.3, str and unicode have a + common base class, basestring, so you can do: </p><p> Okay: if isinstance(obj, basestring): Okay: if type(a1) is type(b1): @@ -829,7 +946,8 @@ <h2>compound_statements</h2> <b>compound_statements</b>(<i>logical_line</i>) <p> -Compound statements (on the same line) are generally discouraged. +Compound statements (on the same line) are generally + discouraged. </p><p> While sometimes it's okay to put an if/for/while with a small body on the same line, never do this for multi-clause statements. @@ -870,8 +988,8 @@ </p><p> When using a hanging indent these considerations should be applied: - there should be no arguments on the first line, and - - further indentation should be used to clearly distinguish itself as a - continuation line. + - further indentation should be used to clearly distinguish itself + as a continuation line. </p><p> Okay: a = (\n) E123: a = (\n ) @@ -890,54 +1008,6 @@ </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> -<a NAME="error" ID="error"></a> -<h2>error</h2> -<b>error</b>(<i>self, line_number, offset, text, check</i>) -<p> -Report an error, according to options. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="error_1" ID="error_1"></a> -<h2>error</h2> -<b>error</b>(<i>self, line_number, offset, text, check</i>) -<p> -Report an error, according to options. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="error_2" ID="error_2"></a> -<h2>error</h2> -<b>error</b>(<i>self, line_number, offset, text, check</i>) - -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="error_args" ID="error_args"></a> -<h2>error_args</h2> -<b>error_args</b>(<i>self, line_number, offset, text, check, *args</i>) -<p> -Report an error, according to options. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="error_args_1" ID="error_args_1"></a> -<h2>error_args</h2> -<b>error_args</b>(<i>self, line_number, offset, code, check, *args</i>) -<p> -Report an error, according to options. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="excluded" ID="excluded"></a> -<h2>excluded</h2> -<b>excluded</b>(<i>self, filename, parent=None</i>) -<p> -Check if the file should be excluded. -</p><p> - Check if 'options.exclude' contains a pattern that matches filename. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> <a NAME="expand_indent" ID="expand_indent"></a> <h2>expand_indent</h2> <b>expand_indent</b>(<i>line</i>) @@ -963,10 +1033,11 @@ <p> Avoid explicit line join between brackets. </p><p> - The preferred way of wrapping long lines is by using Python's implied line - continuation inside parentheses, brackets and braces. Long lines can be - broken over multiple lines by wrapping expressions in parentheses. These - should be used in preference to using a backslash for line continuation. + The preferred way of wrapping long lines is by using Python's + implied line continuation inside parentheses, brackets and braces. + Long lines can be broken over multiple lines by wrapping expressions + in parentheses. These should be used in preference to using a + backslash for line continuation. </p><p> E502: aaa = [123, \\n 123] E502: aaa = ("bbb " \\n "ccc") @@ -1012,49 +1083,6 @@ </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> -<a NAME="generate_tokens" ID="generate_tokens"></a> -<h2>generate_tokens</h2> -<b>generate_tokens</b>(<i>self</i>) -<p> -Tokenize the file, run physical line checks and yield tokens. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="get_checks" ID="get_checks"></a> -<h2>get_checks</h2> -<b>get_checks</b>(<i>self, argument_name</i>) -<p> -Get all the checks for this category. -</p><p> - Find all globally visible functions where the first argument name - starts with argument_name and which contain selected tests. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="get_count" ID="get_count"></a> -<h2>get_count</h2> -<b>get_count</b>(<i>self, prefix=''</i>) -<p> -Return the total count of errors and warnings. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="get_file_results" ID="get_file_results"></a> -<h2>get_file_results</h2> -<b>get_file_results</b>(<i>self</i>) -<p> -Return the count of errors and warnings for this file. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="get_file_results_1" ID="get_file_results_1"></a> -<h2>get_file_results</h2> -<b>get_file_results</b>(<i>self</i>) -<p> -Print the result and return the overall count for this file. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> <a NAME="get_parser" ID="get_parser"></a> <h2>get_parser</h2> <b>get_parser</b>(<i>prog='pycodestyle', version=__version__</i>) @@ -1063,31 +1091,6 @@ </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> -<a NAME="get_statistics" ID="get_statistics"></a> -<h2>get_statistics</h2> -<b>get_statistics</b>(<i>self, prefix=''</i>) -<p> -Get statistics for message codes that start with the prefix. -</p><p> - prefix='' matches all errors and warnings - prefix='E' matches all errors - prefix='W' matches all warnings - prefix='E4' matches all errors that have to do with imports -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="ignore_code" ID="ignore_code"></a> -<h2>ignore_code</h2> -<b>ignore_code</b>(<i>self, code</i>) -<p> -Check if the error code should be ignored. -</p><p> - If 'options.select' contains a prefix of the error code, - return False. Else, if 'options.ignore' contains a prefix of - the error code, return True. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> <a NAME="imports_on_separate_lines" ID="imports_on_separate_lines"></a> <h2>imports_on_separate_lines</h2> <b>imports_on_separate_lines</b>(<i>logical_line</i>) @@ -1105,22 +1108,14 @@ </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> -<a NAME="increment_logical_line" ID="increment_logical_line"></a> -<h2>increment_logical_line</h2> -<b>increment_logical_line</b>(<i>self</i>) -<p> -Signal a new logical line. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> <a NAME="indentation" ID="indentation"></a> <h2>indentation</h2> <b>indentation</b>(<i>logical_line, previous_logical, indent_char, indent_level, previous_indent_level</i>) <p> Use 4 spaces per indentation level. </p><p> - For really old code that you don't want to mess up, you can continue to - use 8-space tabs. + For really old code that you don't want to mess up, you can continue + to use 8-space tabs. </p><p> Okay: a = 1 Okay: if a == 0:\n a = 1 @@ -1137,54 +1132,6 @@ </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> -<a NAME="init_checker_state" ID="init_checker_state"></a> -<h2>init_checker_state</h2> -<b>init_checker_state</b>(<i>self, name, argument_names</i>) -<p> -Prepare custom state for the specific checker plugin. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="init_file" ID="init_file"></a> -<h2>init_file</h2> -<b>init_file</b>(<i>self, filename, lines, expected, line_offset</i>) -<p> -Signal a new file. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="init_file_1" ID="init_file_1"></a> -<h2>init_file</h2> -<b>init_file</b>(<i>self, filename, lines, expected, line_offset</i>) -<p> -Signal a new file. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="init_report" ID="init_report"></a> -<h2>init_report</h2> -<b>init_report</b>(<i>self, reporter=None</i>) -<p> -Initialize the report instance. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="input_dir" ID="input_dir"></a> -<h2>input_dir</h2> -<b>input_dir</b>(<i>self, dirname</i>) -<p> -Check all files in this directory and all subdirectories. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="input_file" ID="input_file"></a> -<h2>input_file</h2> -<b>input_file</b>(<i>self, filename, lines=None, expected=None, line_offset=0</i>) -<p> -Run all checks on a Python source file. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> <a NAME="is_string_literal" ID="is_string_literal"></a> <h2>is_string_literal</h2> <b>is_string_literal</b>(<i>line</i>) @@ -1197,6 +1144,19 @@ <div align="right"><a href="#top">Up</a></div> <hr /><hr /> +<a NAME="maximum_doc_length" ID="maximum_doc_length"></a> +<h2>maximum_doc_length</h2> +<b>maximum_doc_length</b>(<i>logical_line, max_doc_length, noqa, tokens</i>) +<p> +Limit all doc lines to a maximum of 72 characters. +</p><p> + For flowing long blocks of text (docstrings or comments), limiting + the length to 72 characters is recommended. +</p><p> + Reports warning W505 +</p> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> <a NAME="maximum_line_length" ID="maximum_line_length"></a> <h2>maximum_line_length</h2> <b>maximum_line_length</b>(<i>physical_line, max_line_length, multiline, line_number, noqa</i>) @@ -1204,24 +1164,16 @@ Limit all lines to a maximum of 79 characters. </p><p> There are still many devices around that are limited to 80 character - lines; plus, limiting windows to 80 characters makes it possible to have - several windows side-by-side. The default wrapping on such devices looks - ugly. Therefore, please limit all lines to a maximum of 79 characters. - For flowing long blocks of text (docstrings or comments), limiting the - length to 72 characters is recommended. + lines; plus, limiting windows to 80 characters makes it possible to + have several windows side-by-side. The default wrapping on such + devices looks ugly. Therefore, please limit all lines to a maximum + of 79 characters. For flowing long blocks of text (docstrings or + comments), limiting the length to 72 characters is recommended. </p><p> Reports error E501. </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> -<a NAME="maybe_check_physical" ID="maybe_check_physical"></a> -<h2>maybe_check_physical</h2> -<b>maybe_check_physical</b>(<i>self, token</i>) -<p> -If appropriate (based on token), check current physical line(s). -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> <a NAME="missing_whitespace" ID="missing_whitespace"></a> <h2>missing_whitespace</h2> <b>missing_whitespace</b>(<i>logical_line</i>) @@ -1244,8 +1196,8 @@ <h2>missing_whitespace_after_import_keyword</h2> <b>missing_whitespace_after_import_keyword</b>(<i>logical_line</i>) <p> -Multiple imports in form from x import (a, b, c) should have space - between import statement and parenthesised name list. +Multiple imports in form from x import (a, b, c) should have + space between import statement and parenthesised name list. </p><p> Okay: from foo import (bar, baz) E275: from foo import(bar, baz) @@ -1292,8 +1244,8 @@ <p> Place imports at the top of the file. </p><p> - Always put imports at the top of the file, just after any module comments - and docstrings, and before module globals and constants. + Always put imports at the top of the file, just after any module + comments and docstrings, and before module globals and constants. </p><p> Okay: import os Okay: # this is a comment\nimport os @@ -1345,30 +1297,14 @@ </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> -<a NAME="print_benchmark" ID="print_benchmark"></a> -<h2>print_benchmark</h2> -<b>print_benchmark</b>(<i>self</i>) -<p> -Print benchmark numbers. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="print_statistics" ID="print_statistics"></a> -<h2>print_statistics</h2> -<b>print_statistics</b>(<i>self, prefix=''</i>) -<p> -Print overall statistics (number of errors and warnings). -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> <a NAME="process_options" ID="process_options"></a> <h2>process_options</h2> <b>process_options</b>(<i>arglist=None, parse_argv=False, config_file=None, parser=None, verbose=None</i>) <p> -Process options passed either via arglist or via command line args. +Process options passed either via arglist or command line args. </p><p> - Passing in the ``config_file`` parameter allows other tools, such as flake8 - to specify their own options to be processed in pycodestyle. + Passing in the ``config_file`` parameter allows other tools, such as + flake8 to specify their own options to be processed in pycodestyle. </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> @@ -1376,11 +1312,11 @@ <h2>python_3000_async_await_keywords</h2> <b>python_3000_async_await_keywords</b>(<i>logical_line, tokens</i>) <p> -'async' and 'await' are reserved keywords starting with Python 3.7 +'async' and 'await' are reserved keywords starting at Python 3.7. </p><p> W606: async = 42 W606: await = 42 - Okay: async def read_data(db):\n data = await db.fetch('SELECT ...') + Okay: async def read(db):\n data = await db.fetch('SELECT ...') </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> @@ -1399,7 +1335,8 @@ <h2>python_3000_has_key</h2> <b>python_3000_has_key</b>(<i>logical_line, noqa</i>) <p> -The {}.has_key() method is removed in Python 3: use the 'in' operator. +The {}.has_key() method is removed in Python 3: use the 'in' + operator. </p><p> Okay: if "alph" in d:\n print d["alph"] W601: assert d.has_key('alph') @@ -1408,7 +1345,7 @@ <hr /><hr /> <a NAME="python_3000_invalid_escape_sequence" ID="python_3000_invalid_escape_sequence"></a> <h2>python_3000_invalid_escape_sequence</h2> -<b>python_3000_invalid_escape_sequence</b>(<i>logical_line, tokens</i>) +<b>python_3000_invalid_escape_sequence</b>(<i>logical_line, tokens, noqa</i>) <p> Invalid escape sequences are deprecated in Python 3.6. </p><p> @@ -1449,20 +1386,13 @@ <p> Read and parse configurations. </p><p> - If a config file is specified on the command line with the "--config" - option, then only it is used for configuration. + If a config file is specified on the command line with the + "--config" option, then only it is used for configuration. </p><p> - Otherwise, the user configuration (~/.config/pycodestyle) and any local - configurations in the current directory or above will be merged together - (in that order) using the read method of ConfigParser. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="readline" ID="readline"></a> -<h2>readline</h2> -<b>readline</b>(<i>self</i>) -<p> -Get the next line from the input buffer. + Otherwise, the user configuration (~/.config/pycodestyle) and any + local configurations in the current directory or above will be + merged together (in that order) using the read method of + ConfigParser. </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> @@ -1490,30 +1420,6 @@ </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> -<a NAME="report_invalid_syntax" ID="report_invalid_syntax"></a> -<h2>report_invalid_syntax</h2> -<b>report_invalid_syntax</b>(<i>self</i>) -<p> -Check if the syntax is valid. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="run_check" ID="run_check"></a> -<h2>run_check</h2> -<b>run_check</b>(<i>self, check, argument_names</i>) -<p> -Run a check plugin. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> -<a NAME="start" ID="start"></a> -<h2>start</h2> -<b>start</b>(<i>self</i>) -<p> -Start the timer. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> <a NAME="stdin_get_value" ID="stdin_get_value"></a> <h2>stdin_get_value</h2> <b>stdin_get_value</b>(<i></i>) @@ -1522,19 +1428,11 @@ </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> -<a NAME="stop" ID="stop"></a> -<h2>stop</h2> -<b>stop</b>(<i>self</i>) -<p> -Stop the timer. -</p> -<div align="right"><a href="#top">Up</a></div> -<hr /><hr /> <a NAME="tabs_obsolete" ID="tabs_obsolete"></a> <h2>tabs_obsolete</h2> <b>tabs_obsolete</b>(<i>physical_line</i>) <p> -For new projects, spaces-only are strongly recommended over tabs. +On new projects, spaces-only are strongly recommended over tabs. </p><p> Okay: if True:\n return W191: if True:\n\treturn @@ -1548,13 +1446,14 @@ Never mix tabs and spaces. </p><p> The most popular way of indenting Python is with spaces only. The - second-most popular way is with tabs only. Code indented with a mixture - of tabs and spaces should be converted to using spaces exclusively. When - invoking the Python command line interpreter with the -t option, it issues - warnings about code that illegally mixes tabs and spaces. When using -tt - these warnings become errors. These options are highly recommended! + second-most popular way is with tabs only. Code indented with a + mixture of tabs and spaces should be converted to using spaces + exclusively. When invoking the Python command line interpreter with + the -t option, it issues warnings about code that illegally mixes + tabs and spaces. When using -tt these warnings become errors. + These options are highly recommended! </p><p> - Okay: if a == 0:\n a = 1\n b = 1 + Okay: if a == 0:\n a = 1\n b = 1 E101: if a == 0:\n a = 1\n\tb = 1 </p> <div align="right"><a href="#top">Up</a></div> @@ -1578,8 +1477,8 @@ <p> Trailing whitespace is superfluous. </p><p> - The warning returned varies on whether the line itself is blank, for easier - filtering for those who want to indent their blank lines. + The warning returned varies on whether the line itself is blank, + for easier filtering for those who want to indent their blank lines. </p><p> Okay: spam(1)\n# W291: spam(1) \n# @@ -1631,8 +1530,8 @@ Don't use spaces around the '=' sign in function arguments. </p><p> Don't use spaces around the '=' sign when used to indicate a - keyword argument or a default parameter value, except when using a type - annotation. + keyword argument or a default parameter value, except when + using a type annotation. </p><p> Okay: def complex(real, imag=0.0): Okay: return magic(r=real, i=imag) @@ -1669,9 +1568,9 @@ <p> Separate inline comments by at least two spaces. </p><p> - An inline comment is a comment on the same line as a statement. Inline - comments should be separated by at least two spaces from the statement. - They should start with a # and a single space. + An inline comment is a comment on the same line as a statement. + Inline comments should be separated by at least two spaces from the + statement. They should start with a # and a single space. </p><p> Each line of a block comment starts with a # and a single space (unless it is indented text inside the comment).