From 6bea7094c8b7beecdeaafadd317387ad7a5e2f0d Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Fri, 23 Jun 2017 09:49:18 +0200 Subject: [PATCH] Add E211. --- parso/python/normalizer.py | 3 +++ test/normalizer_issue_files/E21.py | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 test/normalizer_issue_files/E21.py diff --git a/parso/python/normalizer.py b/parso/python/normalizer.py index 2d2b663..0ce3e88 100644 --- a/parso/python/normalizer.py +++ b/parso/python/normalizer.py @@ -348,6 +348,9 @@ class PEP8Normalizer(Normalizer): and leaf.parent.type not in ('subscript', 'subscriptlist'): message = "Whitespace before '%s'" % leaf.value self.add_issue(203, message, info.indentation_part) + elif leaf in _OPENING_BRACKETS: + message = "Whitespace before '%s'" % leaf.value + self.add_issue(211, message, info.indentation_part) elif self._previous_leaf in _OPENING_BRACKETS: message = "Whitespace after '%s'" % leaf.value self.add_issue(201, message, info.indentation_part) diff --git a/test/normalizer_issue_files/E21.py b/test/normalizer_issue_files/E21.py new file mode 100644 index 0000000..f65616e --- /dev/null +++ b/test/normalizer_issue_files/E21.py @@ -0,0 +1,16 @@ +#: E211:4 +spam (1) +#: E211:4 E211:19 +dict ['key'] = list [index] +#: E211:11 +dict['key'] ['subkey'] = list[index] +# Okay +spam(1) +dict['key'] = list[index] + + +# This is not prohibited by PEP8, but avoid it. +# Dave: I think this is extremely stupid. Use the same convention everywhere. +#: E211:9 +class Foo (Bar, Baz): + pass