Plugins/CheckerPlugins/Pep8/pep8.py

changeset 850
8b9f09e7d5d9
parent 848
e2fad77b41ba
child 945
8cd4d08fa9f6
child 1146
8ddb232355b9
equal deleted inserted replaced
849:996367a89673 850:8b9f09e7d5d9
408 return # Don't expect blank lines before the first line 408 return # Don't expect blank lines before the first line
409 max_blank_lines = max(blank_lines, blank_lines_before_comment) 409 max_blank_lines = max(blank_lines, blank_lines_before_comment)
410 if previous_logical.startswith('@'): 410 if previous_logical.startswith('@'):
411 if max_blank_lines: 411 if max_blank_lines:
412 return 0, "E304" 412 return 0, "E304"
413 elif max_blank_lines > 2 or (indent_level and max_blank_lines == 2):
414 return 0, "E303", max_blank_lines
415 elif (logical_line.startswith('def ') or 413 elif (logical_line.startswith('def ') or
416 logical_line.startswith('class ') or 414 logical_line.startswith('class ') or
417 logical_line.startswith('@')): 415 logical_line.startswith('@')):
418 if indent_level: 416 if indent_level:
419 if not (max_blank_lines or previous_indent_level < indent_level or 417 if not (max_blank_lines or previous_indent_level < indent_level or
420 DOCSTRING_REGEX.match(previous_logical)): 418 DOCSTRING_REGEX.match(previous_logical)):
421 return 0, "E301" 419 return 0, "E301"
422 elif max_blank_lines != 2: 420 elif max_blank_lines != 2:
423 return 0, "E302", max_blank_lines 421 return 0, "E302", max_blank_lines
422 elif max_blank_lines > 2 or (indent_level and max_blank_lines == 2):
423 return 0, "E303", max_blank_lines
424 424
425 425
426 def extraneous_whitespace(logical_line): 426 def extraneous_whitespace(logical_line):
427 """ 427 """
428 Avoid extraneous whitespace in the following situations: 428 Avoid extraneous whitespace in the following situations:

eric ide

mercurial