diff options
| author | Claudiu Popa <pcmanticore@gmail.com> | 2018-06-14 08:13:31 +0200 |
|---|---|---|
| committer | Claudiu Popa <pcmanticore@gmail.com> | 2018-06-14 08:14:57 +0200 |
| commit | d6cc00063dfd21ee386c3f9e99272b06cb746922 (patch) | |
| tree | da2e5dbb742acadd74765df18bb17473008d18df /pylint/checkers/python3.py | |
| parent | f323a50f68adcd448484467e071cb3ba0492b741 (diff) | |
| download | pylint-git-d6cc00063dfd21ee386c3f9e99272b06cb746922.tar.gz | |
`in` is considered iterating context for some of the Python 3 porting checkers
Close #2186
Diffstat (limited to 'pylint/checkers/python3.py')
| -rw-r--r-- | pylint/checkers/python3.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pylint/checkers/python3.py b/pylint/checkers/python3.py index 2e24af040..07052860c 100644 --- a/pylint/checkers/python3.py +++ b/pylint/checkers/python3.py @@ -115,6 +115,11 @@ def _in_iterating_context(node): isinstance(parent.targets[0], (astroid.List, astroid.Tuple))): if len(parent.targets[0].elts) > 1: return True + # If the call is in a containment check, we consider that to + # be an iterating context + elif (isinstance(parent, astroid.Compare) + and len(parent.ops) == 1 and parent.ops[0][0] == 'in'): + return True return False |
