diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-11-25 16:09:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-25 16:09:42 +0100 |
commit | e4a1935d8806657294433dc03c8491dbd45da215 (patch) | |
tree | 908546b41fc055f60478dc68e60d4808dbe30b1e /pylint/checkers/format.py | |
parent | 07a635cd2109bb4a44bd29078a0b5f9fc6f6bd5d (diff) | |
download | pylint-git-e4a1935d8806657294433dc03c8491dbd45da215.tar.gz |
Activate and fix existing use-set-for-membership checks (#5379)
* Activate and fix existing use-set-for-membership checks
Diffstat (limited to 'pylint/checkers/format.py')
-rw-r--r-- | pylint/checkers/format.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pylint/checkers/format.py b/pylint/checkers/format.py index 3756d7d0e..cdbacd4cf 100644 --- a/pylint/checkers/format.py +++ b/pylint/checkers/format.py @@ -411,9 +411,9 @@ class FormatChecker(BaseTokenChecker): contains_double_parens -= 1 continue # ')' can't happen after if (foo), since it would be a syntax error. - if tokens[i + 1].string in (":", ")", "]", "}", "in") or tokens[ + if tokens[i + 1].string in {":", ")", "]", "}", "in"} or tokens[ i + 1 - ].type in (tokenize.NEWLINE, tokenize.ENDMARKER, tokenize.COMMENT): + ].type in {tokenize.NEWLINE, tokenize.ENDMARKER, tokenize.COMMENT}: if contains_walrus_operator and walrus_operator_depth - 1 == depth: return # The empty tuple () is always accepted. @@ -424,7 +424,7 @@ class FormatChecker(BaseTokenChecker): self.add_message( "superfluous-parens", line=line_num, args=keyword_token ) - elif keyword_token in ("return", "yield"): + elif keyword_token in {"return", "yield"}: self.add_message( "superfluous-parens", line=line_num, args=keyword_token ) @@ -439,7 +439,7 @@ class FormatChecker(BaseTokenChecker): return # 'and' and 'or' are the only boolean operators with lower precedence # than 'not', so parens are only required when they are found. - if token[1] in ("and", "or"): + if token[1] in {"and", "or"}: found_and_or = True # A yield inside an expression must always be in parentheses, # quit early without error. |