Classes | |
class | BaseReport |
class | Checker |
Framework to run all checks. More... | |
class | DiffReport |
class | FileReport |
class | StandardReport |
class | StyleGuide |
Functions | |
def | _break_around_binary_operators (tokens) |
def | _get_parameters (function) |
def | _is_binary_operator (token_type, text) |
def | _is_eol_token (token) |
def | _main () |
def | _parse_multi_options (options, split_token=') |
def | ambiguous_identifier (logical_line, tokens) |
def | bare_except (logical_line, noqa) |
def | blank_lines (logical_line, blank_lines, indent_level, line_number, blank_before, previous_logical, previous_unindented_logical_line, previous_indent_level, lines) |
Plugins (check functions) for logical lines. More... | |
def | break_after_binary_operator (logical_line, tokens) |
def | break_before_binary_operator (logical_line, tokens) |
def | comparison_negative (logical_line) |
def | comparison_to_singleton (logical_line, noqa) |
def | comparison_type (logical_line, noqa) |
def | compound_statements (logical_line) |
def | continued_indentation (logical_line, tokens, indent_level, hang_closing, indent_char, noqa, verbose) |
def | expand_indent (line) |
def | explicit_line_join (logical_line, tokens) |
def | extraneous_whitespace (logical_line) |
def | filename_match (filename, patterns, default=True) |
def | get_parser (prog='pycodestyle', version=__version__) |
def | imports_on_separate_lines (logical_line) |
def | indentation (logical_line, previous_logical, indent_char, indent_level, previous_indent_level) |
def | lru_cache (maxsize=128) |
def | maximum_doc_length (logical_line, max_doc_length, noqa, tokens) |
def | maximum_line_length (physical_line, max_line_length, multiline, line_number, noqa) |
def | missing_whitespace (logical_line) |
def | missing_whitespace_after_import_keyword (logical_line) |
def | missing_whitespace_around_operator (logical_line, tokens) |
def | module_imports_on_top_of_file (logical_line, indent_level, checker_state, noqa) |
def | mute_string (text) |
def | normalize_paths (value, parent=os.curdir) |
def | parse_udiff (diff, patterns=None, parent='.') |
def | process_options (arglist=None, parse_argv=False, config_file=None, parser=None, verbose=None) |
def | python_3000_async_await_keywords (logical_line, tokens) |
def | python_3000_backticks (logical_line) |
def | python_3000_has_key (logical_line, noqa) |
def | python_3000_invalid_escape_sequence (logical_line, tokens, noqa) |
def | python_3000_not_equal (logical_line) |
def | python_3000_raise_comma (logical_line) |
def | read_config (options, args, arglist, parser) |
def | readlines (filename) |
Helper functions. More... | |
def | register_check (check, codes=None) |
def | stdin_get_value () |
def | tabs_obsolete (physical_line) |
def | tabs_or_spaces (physical_line, indent_char) |
Plugins (check functions) for physical lines. More... | |
def | trailing_blank_lines (physical_line, lines, line_number, total_lines) |
def | trailing_whitespace (physical_line) |
def | update_counts (s, counts) |
def | whitespace_around_comma (logical_line) |
def | whitespace_around_keywords (logical_line) |
def | whitespace_around_named_parameter_equals (logical_line, tokens) |
def | whitespace_around_operator (logical_line) |
def | whitespace_before_comment (logical_line, tokens) |
def | whitespace_before_parameters (logical_line, tokens) |
Variables | |
string | __version__ = '2.5.0' |
dictionary | _checks = {'physical_line': {}, 'logical_line': {}, 'tree': {}} |
_SYMBOLIC_OPS = frozenset("()[]{},:.;@=%~")|frozenset(("...",)) | |
ARITHMETIC_OP = frozenset(['**', '*', '/', '//', '+', '-']) | |
tuple | ASSIGNMENT_EXPRESSION_OP = (3, 8)else[] |
list | BENCHMARK_KEYS = ['directories', 'files', 'logical lines', 'physical lines'] |
dictionary | BLANK_LINES_CONFIG |
COMPARE_NEGATIVE_REGEX = re.compile(r'\b(not)\s+[^][)(}{ ]+\s+(in|is)\s') | |
COMPARE_SINGLETON_REGEX | |
COMPARE_TYPE_REGEX | |
string | DEFAULT_EXCLUDE = '.svn,CVS,.bzr,.hg,.git,__pycache__,.tox' |
string | DEFAULT_IGNORE = 'E121,E123,E126,E226,E24,E704,W503,W504' |
DOCSTRING_REGEX = re.compile(r'u?r?["\']') | |
DUNDER_REGEX = re.compile(r'^__([^\s]+)__ = ') | |
ERRORCODE_REGEX = re.compile(r'\b[A-Z]\d{3}\b') | |
EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[\[({] | [\]}),;]| :(?!=)') | |
tuple | FUNCTION_RETURN_ANNOTATION_OP = (3, 5)else[] |
HUNK_REGEX = re.compile(r'^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@.*$') | |
INDENT_REGEX = re.compile(r'([ \t]*)') | |
isidentifier = re.compile(r'[a-zA-Z_]\w*$').match | |
KEYWORD_REGEX = re.compile(r'(\s*)\b(?:%s)\b(\s*)' % r'|'.join(KEYWORDS)) | |
KEYWORDS = frozenset(keyword.kwlist + ['print', 'async'])-SINGLETONS | |
LAMBDA_REGEX = re.compile(r'\blambda\b') | |
int | MAX_DOC_LENGTH = 72 |
int | MAX_LINE_LENGTH = 79 |
NEWLINE = frozenset([tokenize.NL, tokenize.NEWLINE]) | |
noqa = lru_cache(512)(re.compile(r'# no(?:qa|pep8)\b', re.I).search) | |
OPERATOR_REGEX = re.compile(r'(?:[^,\s])(\s*)(?:[-+*/|!<=>%&^]+)(\s*)') | |
tuple | PROJECT_CONFIG = ('setup.cfg', 'tox.ini') |
int | PyCF_ONLY_AST = 1024 |
RAISE_COMMA_REGEX = re.compile(r'raise\s+\w+\s*,') | |
dictionary | REPORT_FORMAT |
RERAISE_COMMA_REGEX = re.compile(r'raise\s+\w+\s*,.*,\s*\w+\s*$') | |
SINGLETONS = frozenset(['False', 'None', 'True']) | |
SKIP_COMMENTS = SKIP_TOKENS.union([tokenize.COMMENT, tokenize.ERRORTOKEN]) | |
SKIP_TOKENS = NEWLINE.union([tokenize.INDENT, tokenize.DEDENT]) | |
STARTSWITH_DEF_REGEX = re.compile(r'^(async\s+def|def)\b') | |
STARTSWITH_INDENT_STATEMENT_REGEX | |
STARTSWITH_TOP_LEVEL_REGEX = re.compile(r'^(async\s+def\s+|def\s+|class\s+|@)') | |
stdin_get_value = sys.stdin.read | |
TESTSUITE_PATH = os.path.join(os.path.dirname(__file__), 'testsuite') | |
UNARY_OPERATORS = frozenset(['>>', '**', '*', '+', '-']) | |
USER_CONFIG = os.path.expanduser(r'~\.pycodestyle') | |
WHITESPACE = frozenset(' \t') | |
WHITESPACE_AFTER_COMMA_REGEX = re.compile(r'[,;:]\s*(?: |\t)') | |
WS_NEEDED_OPERATORS | |
WS_OPTIONAL_OPERATORS = ARITHMETIC_OP.union(['^', '&', '|', '<<', '>>', '%']) | |
|
private |
Private function to reduce duplication. This factors out the shared details between :func:`break_before_binary_operator` and :func:`break_after_binary_operator`.
Definition at line 1236 of file pycodestyle.py.
|
private |
Definition at line 168 of file pycodestyle.py.
|
private |
Definition at line 1223 of file pycodestyle.py.
|
private |
Definition at line 1895 of file pycodestyle.py.
|
private |
Parse options and run checks on Python source.
Definition at line 2684 of file pycodestyle.py.
|
private |
Definition at line 2668 of file pycodestyle.py.
def roslint.pycodestyle.ambiguous_identifier | ( | logical_line, | |
tokens | |||
) |
Definition at line 1427 of file pycodestyle.py.
def roslint.pycodestyle.bare_except | ( | logical_line, | |
noqa | |||
) |
Definition at line 1409 of file pycodestyle.py.
def roslint.pycodestyle.blank_lines | ( | logical_line, | |
blank_lines, | |||
indent_level, | |||
line_number, | |||
blank_before, | |||
previous_logical, | |||
previous_unindented_logical_line, | |||
previous_indent_level, | |||
lines | |||
) |
Plugins (check functions) for logical lines.
Definition at line 321 of file pycodestyle.py.
def roslint.pycodestyle.break_after_binary_operator | ( | logical_line, | |
tokens | |||
) |
Definition at line 1293 of file pycodestyle.py.
def roslint.pycodestyle.break_before_binary_operator | ( | logical_line, | |
tokens | |||
) |
Definition at line 1263 of file pycodestyle.py.
def roslint.pycodestyle.comparison_negative | ( | logical_line | ) |
Definition at line 1363 of file pycodestyle.py.
def roslint.pycodestyle.comparison_to_singleton | ( | logical_line, | |
noqa | |||
) |
Definition at line 1328 of file pycodestyle.py.
def roslint.pycodestyle.comparison_type | ( | logical_line, | |
noqa | |||
) |
Definition at line 1385 of file pycodestyle.py.
def roslint.pycodestyle.compound_statements | ( | logical_line | ) |
Definition at line 1116 of file pycodestyle.py.
def roslint.pycodestyle.continued_indentation | ( | logical_line, | |
tokens, | |||
indent_level, | |||
hang_closing, | |||
indent_char, | |||
noqa, | |||
verbose | |||
) |
Definition at line 553 of file pycodestyle.py.
def roslint.pycodestyle.expand_indent | ( | line | ) |
Definition at line 1783 of file pycodestyle.py.
def roslint.pycodestyle.explicit_line_join | ( | logical_line, | |
tokens | |||
) |
Definition at line 1180 of file pycodestyle.py.
def roslint.pycodestyle.extraneous_whitespace | ( | logical_line | ) |
Definition at line 409 of file pycodestyle.py.
def roslint.pycodestyle.filename_match | ( | filename, | |
patterns, | |||
default = True |
|||
) |
Check if patterns contains a pattern that matches filename. If patterns is unspecified, this always returns True.
Definition at line 1877 of file pycodestyle.py.
def roslint.pycodestyle.get_parser | ( | prog = 'pycodestyle' , |
|
version = __version__ |
|||
) |
Create the parser for the program.
Definition at line 2472 of file pycodestyle.py.
def roslint.pycodestyle.imports_on_separate_lines | ( | logical_line | ) |
Definition at line 1037 of file pycodestyle.py.
def roslint.pycodestyle.indentation | ( | logical_line, | |
previous_logical, | |||
indent_char, | |||
indent_level, | |||
previous_indent_level | |||
) |
Definition at line 515 of file pycodestyle.py.
def roslint.pycodestyle.lru_cache | ( | maxsize = 128 | ) |
Does not really need a real a lru_cache, it's just optimization, so let's just do nothing here. Python 3.2+ will just get better performances, time to upgrade?
Definition at line 65 of file pycodestyle.py.
def roslint.pycodestyle.maximum_doc_length | ( | logical_line, | |
max_doc_length, | |||
noqa, | |||
tokens | |||
) |
Definition at line 1695 of file pycodestyle.py.
def roslint.pycodestyle.maximum_line_length | ( | physical_line, | |
max_line_length, | |||
multiline, | |||
line_number, | |||
noqa | |||
) |
Definition at line 275 of file pycodestyle.py.
def roslint.pycodestyle.missing_whitespace | ( | logical_line | ) |
Definition at line 484 of file pycodestyle.py.
def roslint.pycodestyle.missing_whitespace_after_import_keyword | ( | logical_line | ) |
Definition at line 466 of file pycodestyle.py.
def roslint.pycodestyle.missing_whitespace_around_operator | ( | logical_line, | |
tokens | |||
) |
Definition at line 811 of file pycodestyle.py.
def roslint.pycodestyle.module_imports_on_top_of_file | ( | logical_line, | |
indent_level, | |||
checker_state, | |||
noqa | |||
) |
Definition at line 1058 of file pycodestyle.py.
def roslint.pycodestyle.mute_string | ( | text | ) |
Replace contents with 'xxx' to prevent syntax matching. >>> mute_string('"abc"') '"xxx"' >>> mute_string("'''abc'''") "'''xxx'''" >>> mute_string("r'abc'") "r'xxx'"
Definition at line 1810 of file pycodestyle.py.
def roslint.pycodestyle.normalize_paths | ( | value, | |
parent = os.curdir |
|||
) |
Parse a comma-separated list of paths. Return a list of absolute paths.
Definition at line 1859 of file pycodestyle.py.
def roslint.pycodestyle.parse_udiff | ( | diff, | |
patterns = None , |
|||
parent = '.' |
|||
) |
Return a dictionary of matching lines.
Definition at line 1830 of file pycodestyle.py.
def roslint.pycodestyle.process_options | ( | arglist = None , |
|
parse_argv = False , |
|||
config_file = None , |
|||
parser = None , |
|||
verbose = None |
|||
) |
Process options passed either via arglist or command line args. Passing in the ``config_file`` parameter allows other tools, such as flake8 to specify their own options to be processed in pycodestyle.
Definition at line 2614 of file pycodestyle.py.
def roslint.pycodestyle.python_3000_async_await_keywords | ( | logical_line, | |
tokens | |||
) |
'async' and 'await' are reserved keywords starting at Python 3.7. W606: async = 42 W606: await = 42 Okay: async def read(db):\n data = await db.fetch('SELECT ...')
Definition at line 1624 of file pycodestyle.py.
def roslint.pycodestyle.python_3000_backticks | ( | logical_line | ) |
Definition at line 1552 of file pycodestyle.py.
def roslint.pycodestyle.python_3000_has_key | ( | logical_line, | |
noqa | |||
) |
Definition at line 1511 of file pycodestyle.py.
def roslint.pycodestyle.python_3000_invalid_escape_sequence | ( | logical_line, | |
tokens, | |||
noqa | |||
) |
Definition at line 1564 of file pycodestyle.py.
def roslint.pycodestyle.python_3000_not_equal | ( | logical_line | ) |
Definition at line 1538 of file pycodestyle.py.
def roslint.pycodestyle.python_3000_raise_comma | ( | logical_line | ) |
Definition at line 1524 of file pycodestyle.py.
def roslint.pycodestyle.read_config | ( | options, | |
args, | |||
arglist, | |||
parser | |||
) |
Read and parse configurations. If a config file is specified on the command line with the "--config" option, then only it is used for configuration. 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.
Definition at line 2538 of file pycodestyle.py.
def roslint.pycodestyle.readlines | ( | filename | ) |
def roslint.pycodestyle.register_check | ( | check, | |
codes = None |
|||
) |
Register a new check object.
Definition at line 178 of file pycodestyle.py.
def roslint.pycodestyle.stdin_get_value | ( | ) |
Read the value from stdin.
Definition at line 1776 of file pycodestyle.py.
def roslint.pycodestyle.tabs_obsolete | ( | physical_line | ) |
Definition at line 223 of file pycodestyle.py.
def roslint.pycodestyle.tabs_or_spaces | ( | physical_line, | |
indent_char | |||
) |
Plugins (check functions) for physical lines.
Definition at line 202 of file pycodestyle.py.
def roslint.pycodestyle.trailing_blank_lines | ( | physical_line, | |
lines, | |||
line_number, | |||
total_lines | |||
) |
Definition at line 257 of file pycodestyle.py.
def roslint.pycodestyle.trailing_whitespace | ( | physical_line | ) |
Definition at line 235 of file pycodestyle.py.
def roslint.pycodestyle.update_counts | ( | s, | |
counts | |||
) |
Definition at line 1887 of file pycodestyle.py.
def roslint.pycodestyle.whitespace_around_comma | ( | logical_line | ) |
Definition at line 910 of file pycodestyle.py.
def roslint.pycodestyle.whitespace_around_keywords | ( | logical_line | ) |
Definition at line 442 of file pycodestyle.py.
def roslint.pycodestyle.whitespace_around_named_parameter_equals | ( | logical_line, | |
tokens | |||
) |
Definition at line 929 of file pycodestyle.py.
def roslint.pycodestyle.whitespace_around_operator | ( | logical_line | ) |
Definition at line 787 of file pycodestyle.py.
def roslint.pycodestyle.whitespace_before_comment | ( | logical_line, | |
tokens | |||
) |
Definition at line 995 of file pycodestyle.py.
def roslint.pycodestyle.whitespace_before_parameters | ( | logical_line, | |
tokens | |||
) |
Definition at line 754 of file pycodestyle.py.
|
private |
Definition at line 81 of file pycodestyle.py.
|
private |
Definition at line 165 of file pycodestyle.py.
|
private |
Definition at line 1220 of file pycodestyle.py.
roslint.pycodestyle.ARITHMETIC_OP = frozenset(['**', '*', '/', '//', '+', '-']) |
Definition at line 116 of file pycodestyle.py.
tuple roslint.pycodestyle.ASSIGNMENT_EXPRESSION_OP = (3, 8)else[] |
Definition at line 120 of file pycodestyle.py.
list roslint.pycodestyle.BENCHMARK_KEYS = ['directories', 'files', 'logical lines', 'physical lines'] |
Definition at line 132 of file pycodestyle.py.
dictionary roslint.pycodestyle.BLANK_LINES_CONFIG |
Definition at line 100 of file pycodestyle.py.
roslint.pycodestyle.COMPARE_NEGATIVE_REGEX = re.compile(r'\b(not)\s+[^][)(}{ ]+\s+(in|is)\s') |
Definition at line 143 of file pycodestyle.py.
roslint.pycodestyle.COMPARE_SINGLETON_REGEX |
Definition at line 141 of file pycodestyle.py.
roslint.pycodestyle.COMPARE_TYPE_REGEX |
Definition at line 144 of file pycodestyle.py.
string roslint.pycodestyle.DEFAULT_EXCLUDE = '.svn,CVS,.bzr,.hg,.git,__pycache__,.tox' |
Definition at line 83 of file pycodestyle.py.
string roslint.pycodestyle.DEFAULT_IGNORE = 'E121,E123,E126,E226,E24,E704,W503,W504' |
Definition at line 84 of file pycodestyle.py.
roslint.pycodestyle.DOCSTRING_REGEX = re.compile(r'u?r?["\']') |
Definition at line 138 of file pycodestyle.py.
roslint.pycodestyle.DUNDER_REGEX = re.compile(r'^__([^\s]+)__ = ') |
Definition at line 163 of file pycodestyle.py.
roslint.pycodestyle.ERRORCODE_REGEX = re.compile(r'\b[A-Z]\d{3}\b') |
Definition at line 137 of file pycodestyle.py.
roslint.pycodestyle.EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[\[({] | [\]}),;]| :(?!=)') |
Definition at line 139 of file pycodestyle.py.
tuple roslint.pycodestyle.FUNCTION_RETURN_ANNOTATION_OP = (3, 5)else[] |
Definition at line 119 of file pycodestyle.py.
roslint.pycodestyle.HUNK_REGEX = re.compile(r'^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@.*$') |
Definition at line 149 of file pycodestyle.py.
roslint.pycodestyle.INDENT_REGEX = re.compile(r'([ \t]*)') |
Definition at line 134 of file pycodestyle.py.
roslint.pycodestyle.isidentifier = re.compile(r'[a-zA-Z_]\w*$').match |
Definition at line 1759 of file pycodestyle.py.
roslint.pycodestyle.KEYWORD_REGEX = re.compile(r'(\s*)\b(?:%s)\b(\s*)' % r'|'.join(KEYWORDS)) |
Definition at line 146 of file pycodestyle.py.
roslint.pycodestyle.KEYWORDS = frozenset(keyword.kwlist + ['print', 'async'])-SINGLETONS |
Definition at line 114 of file pycodestyle.py.
roslint.pycodestyle.LAMBDA_REGEX = re.compile(r'\blambda\b') |
Definition at line 148 of file pycodestyle.py.
int roslint.pycodestyle.MAX_DOC_LENGTH = 72 |
Definition at line 106 of file pycodestyle.py.
int roslint.pycodestyle.MAX_LINE_LENGTH = 79 |
Definition at line 98 of file pycodestyle.py.
roslint.pycodestyle.NEWLINE = frozenset([tokenize.NL, tokenize.NEWLINE]) |
Definition at line 128 of file pycodestyle.py.
roslint.pycodestyle.noqa = lru_cache(512)(re.compile(r'# no(?:qa|pep8)\b', re.I).search) |
Definition at line 1780 of file pycodestyle.py.
roslint.pycodestyle.OPERATOR_REGEX = re.compile(r'(?:[^,\s])(\s*)(?:[-+*/|!<=>%&^]+)(\s*)') |
Definition at line 147 of file pycodestyle.py.
tuple roslint.pycodestyle.PROJECT_CONFIG = ('setup.cfg', 'tox.ini') |
Definition at line 96 of file pycodestyle.py.
int roslint.pycodestyle.PyCF_ONLY_AST = 1024 |
Definition at line 112 of file pycodestyle.py.
roslint.pycodestyle.RAISE_COMMA_REGEX = re.compile(r'raise\s+\w+\s*,') |
Definition at line 135 of file pycodestyle.py.
dictionary roslint.pycodestyle.REPORT_FORMAT |
Definition at line 107 of file pycodestyle.py.
roslint.pycodestyle.RERAISE_COMMA_REGEX = re.compile(r'raise\s+\w+\s*,.*,\s*\w+\s*$') |
Definition at line 136 of file pycodestyle.py.
roslint.pycodestyle.SINGLETONS = frozenset(['False', 'None', 'True']) |
Definition at line 113 of file pycodestyle.py.
roslint.pycodestyle.SKIP_COMMENTS = SKIP_TOKENS.union([tokenize.COMMENT, tokenize.ERRORTOKEN]) |
Definition at line 131 of file pycodestyle.py.
roslint.pycodestyle.SKIP_TOKENS = NEWLINE.union([tokenize.INDENT, tokenize.DEDENT]) |
Definition at line 129 of file pycodestyle.py.
roslint.pycodestyle.STARTSWITH_DEF_REGEX = re.compile(r'^(async\s+def|def)\b') |
Definition at line 150 of file pycodestyle.py.
roslint.pycodestyle.STARTSWITH_INDENT_STATEMENT_REGEX |
Definition at line 152 of file pycodestyle.py.
roslint.pycodestyle.STARTSWITH_TOP_LEVEL_REGEX = re.compile(r'^(async\s+def\s+|def\s+|class\s+|@)') |
Definition at line 151 of file pycodestyle.py.
roslint.pycodestyle.stdin_get_value = sys.stdin.read |
Definition at line 1760 of file pycodestyle.py.
roslint.pycodestyle.TESTSUITE_PATH = os.path.join(os.path.dirname(__file__), 'testsuite') |
Definition at line 97 of file pycodestyle.py.
roslint.pycodestyle.UNARY_OPERATORS = frozenset(['>>', '**', '*', '+', '-']) |
Definition at line 115 of file pycodestyle.py.
roslint.pycodestyle.USER_CONFIG = os.path.expanduser(r'~\.pycodestyle') |
Definition at line 87 of file pycodestyle.py.
roslint.pycodestyle.WHITESPACE = frozenset(' \t') |
Definition at line 127 of file pycodestyle.py.
roslint.pycodestyle.WHITESPACE_AFTER_COMMA_REGEX = re.compile(r'[,;:]\s*(?: |\t)') |
Definition at line 140 of file pycodestyle.py.
roslint.pycodestyle.WS_NEEDED_OPERATORS |
Definition at line 121 of file pycodestyle.py.
roslint.pycodestyle.WS_OPTIONAL_OPERATORS = ARITHMETIC_OP.union(['^', '&', '|', '<<', '>>', '%']) |
Definition at line 117 of file pycodestyle.py.