summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDebian Python Modules Team <python-modules-team@lists.alioth.debian.org>2019-12-19 15:17:11 +0100
committerAndrej Shadura <andrewsh@debian.org>2019-12-19 15:17:11 +0100
commit5413730714314b8d4a585310913a773c013c6cb5 (patch)
tree4c80a12c1ea80cedc6d7f2b10d3ae24a26777ff6
parent606355414250bf3884f290e332a31268e6b09bcf (diff)
compatibility with Python3.7
Origin: https://github.com/PyCQA/pycodestyle/commit/3d37ea0aa2e369852c98bbbcaef8a89ed00996dc Acked-By: Mattia Rizzolo <mattia@debian.org> Bug-Debian: https://bugs.debian.org/908700 Last-Update: 2018-12-20 Gbp-Pq: Name pytho3.7.patch
-rwxr-xr-xpep8.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/pep8.py b/pep8.py
index 86c1d01..556af32 100755
--- a/pep8.py
+++ b/pep8.py
@@ -107,7 +107,7 @@ RAISE_COMMA_REGEX = re.compile(r'raise\s+\w+\s*,')
RERAISE_COMMA_REGEX = re.compile(r'raise\s+\w+\s*,.*,\s*\w+\s*$')
ERRORCODE_REGEX = re.compile(r'\b[A-Z]\d{3}\b')
DOCSTRING_REGEX = re.compile(r'u?r?["\']')
-EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
+EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[\[({] | [\]}),;:]')
WHITESPACE_AFTER_COMMA_REGEX = re.compile(r'[,;:]\s*(?: |\t)')
COMPARE_SINGLETON_REGEX = re.compile(r'(\bNone|\bFalse|\bTrue)?\s*([=!]=)'
r'\s*(?(1)|(None|False|True))\b')
@@ -190,10 +190,10 @@ def trailing_blank_lines(physical_line, lines, line_number, total_lines):
"""
if line_number == total_lines:
stripped_last_line = physical_line.rstrip()
- if not stripped_last_line:
+ if physical_line and not stripped_last_line:
return 0, "W391 blank line at end of file"
if stripped_last_line == physical_line:
- return len(physical_line), "W292 no newline at end of file"
+ return len(lines[-1]), "W292 no newline at end of file"
def maximum_line_length(physical_line, max_line_length, multiline):