From 602dcb11d788ca26bd62ed3375b5b73264679972 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sun, 2 Jul 2017 22:50:37 +0200 Subject: [PATCH] Get all tests passing except those E12* tests. You can reproduce this with "pytest -k 'not E12'". --- parso/python/normalizer.py | 14 +++++++------- test/normalizer_issue_files/E25.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/parso/python/normalizer.py b/parso/python/normalizer.py index 96a526e..d6a1e5b 100644 --- a/parso/python/normalizer.py +++ b/parso/python/normalizer.py @@ -502,11 +502,6 @@ class PEP8Normalizer(Normalizer): elif leaf in _CLOSING_BRACKETS: message = "Whitespace before '%s'" % leaf.value add_if_spaces(202, message, spacing) - #elif leaf in _OPENING_BRACKETS: - # TODO - # if False: - # message = "Whitespace before '%s'" % leaf.value - # add_if_spaces(211, message, spacing) elif leaf in (',', ';') or leaf == ':' \ and leaf.parent.type not in ('subscript', 'subscriptlist'): message = "Whitespace before '%s'" % leaf.value @@ -547,13 +542,18 @@ class PEP8Normalizer(Normalizer): add_not_spaces(275, 'Missing whitespace around keyword', spacing) else: prev_spacing = self._previous_spacing - message_225 = 'Missing whitespace between tokens' if prev in _ALLOW_SPACE and spaces != prev_spacing.value: message = "Whitespace before operator doesn't match with whitespace after" self.add_issue(229, message, spacing) if spaces and leaf not in _ALLOW_SPACE and prev not in _ALLOW_SPACE: - self.add_issue(225, message_225, spacing) + message_225 = 'Missing whitespace between tokens' + #print('xy', spacing) + #self.add_issue(225, message_225, spacing) + # TODO why only brackets? + if leaf in _OPENING_BRACKETS: + message = "Whitespace before '%s'" % leaf.value + add_if_spaces(211, message, spacing) def _analyse_non_prefix(self, leaf): typ = leaf.type diff --git a/test/normalizer_issue_files/E25.py b/test/normalizer_issue_files/E25.py index baf34b3..92afe57 100644 --- a/test/normalizer_issue_files/E25.py +++ b/test/normalizer_issue_files/E25.py @@ -51,6 +51,6 @@ async def add(a: int = 0, b: int = 0) -> int: def x(b: tuple = (1, 2))->int: return a + b -#: E252:11 E252:12 +#: E252:11 E252:12 E231:8 def b(a:int=1): pass