summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorethan-leba <ethanleba5@gmail.com>2020-11-27 09:58:39 -0500
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2020-11-30 09:57:09 +0100
commitd37894d4c54a34e71e86bb882293a4e6d6bbf6c4 (patch)
tree9f48c0d97d609d554552147eb8ae9bfa1105fe55
parentb1f2204b178c9193455731e8a229c3af57128145 (diff)
downloadpylint-git-d37894d4c54a34e71e86bb882293a4e6d6bbf6c4.tar.gz
Remove hardcoded error for `bad-reversed-sequence` on dicts
As a consequence, pylint will only emit `bad-reversed-sequence` on dictionaries if below py3.8, as a `__reversed__` dunder was added to dicts on py3.8
-rw-r--r--pylint/checkers/base.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/pylint/checkers/base.py b/pylint/checkers/base.py
index 791bca53f..56aca1e71 100644
--- a/pylint/checkers/base.py
+++ b/pylint/checkers/base.py
@@ -1524,14 +1524,11 @@ class BasicChecker(_BasicChecker):
return
if isinstance(argument, astroid.Instance):
- if argument._proxied.name == "dict" and utils.is_builtin_object(
- argument._proxied
- ):
- self.add_message("bad-reversed-sequence", node=node)
- return
if any(
ancestor.name == "dict" and utils.is_builtin_object(ancestor)
- for ancestor in argument._proxied.ancestors()
+ for ancestor in itertools.chain(
+ (argument._proxied,), argument._proxied.ancestors()
+ )
):
# Mappings aren't accepted by reversed(), unless
# they provide explicitly a __reversed__ method.