diff options
author | Bryce Guinta <bryce.guinta@protonmail.com> | 2020-06-16 10:29:33 -0400 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2020-06-17 08:54:17 +0200 |
commit | 95f3fc3b783ab873c1ea2dfb11d0f2fa20dcea1a (patch) | |
tree | a117ed3607827135c8b922f095c27c1b7e5f562c | |
parent | 83a1f49bfa6d0a83d939002c78b791c7600960d0 (diff) | |
download | pylint-git-95f3fc3b783ab873c1ea2dfb11d0f2fa20dcea1a.tar.gz |
Remove unused member variable of FormatChecker
-rw-r--r-- | pylint/checkers/format.py | 11 | ||||
-rw-r--r-- | tests/checkers/unittest_format.py | 4 |
2 files changed, 5 insertions, 10 deletions
diff --git a/pylint/checkers/format.py b/pylint/checkers/format.py index 24618923c..130ddd0c5 100644 --- a/pylint/checkers/format.py +++ b/pylint/checkers/format.py @@ -352,7 +352,7 @@ class FormatChecker(BaseTokenChecker): self.check_lines(line, line_num) def process_module(self, _module): - self._keywords_with_parens = set() + pass def _check_keyword_parentheses(self, tokens: List[TokenInfo], start: int) -> None: """Check that there are not unnecessary parens after a keyword. @@ -401,11 +401,10 @@ class FormatChecker(BaseTokenChecker): self.add_message( "superfluous-parens", line=line_num, args=keyword_token ) - elif keyword_token not in self._keywords_with_parens: - if not found_and_or: - self.add_message( - "superfluous-parens", line=line_num, args=keyword_token - ) + elif not found_and_or: + self.add_message( + "superfluous-parens", line=line_num, args=keyword_token + ) return elif depth == 1: # This is a tuple, which is always acceptable. diff --git a/tests/checkers/unittest_format.py b/tests/checkers/unittest_format.py index 75b0c7967..7c07ac9ed 100644 --- a/tests/checkers/unittest_format.py +++ b/tests/checkers/unittest_format.py @@ -137,7 +137,6 @@ class TestSuperfluousParentheses(CheckerTestCase): CHECKER_CLASS = FormatChecker def testCheckKeywordParensHandlesValidCases(self): - self.checker._keywords_with_parens = set() cases = [ "if foo:", "if foo():", @@ -157,7 +156,6 @@ class TestSuperfluousParentheses(CheckerTestCase): self.checker._check_keyword_parentheses(_tokenize_str(code), 0) def testCheckKeywordParensHandlesUnnecessaryParens(self): - self.checker._keywords_with_parens = set() cases = [ (Message("superfluous-parens", line=1, args="if"), "if (foo):", 0), (Message("superfluous-parens", line=1, args="if"), "if ((foo, bar)):", 0), @@ -187,7 +185,6 @@ class TestSuperfluousParentheses(CheckerTestCase): self.checker._check_keyword_parentheses(_tokenize_str(code), offset) def testCheckIfArgsAreNotUnicode(self): - self.checker._keywords_with_parens = set() cases = [("if (foo):", 0), ("assert (1 == 1)", 0)] for code, offset in cases: @@ -205,7 +202,6 @@ print('Hello world!') self.checker.process_tokens(_tokenize_str(code)) def testKeywordParensFalsePositive(self): - self.checker._keywords_with_parens = set() code = "if 'bar' in (DICT or {}):" with self.assertNoMessages(): self.checker._check_keyword_parentheses(_tokenize_str(code), start=2) |