diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-06-20 18:46:15 +0300 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-06-20 18:46:15 +0300 |
commit | 6d274c4398061f4405cebf36c9412f5b77d9c937 (patch) | |
tree | 3f2970dea713b723cbb04397ad4e16f388d20210 /pylint/checkers/typecheck.py | |
parent | 7d3758fccc9bc31f70900451d8a14103bf41f702 (diff) | |
download | pylint-6d274c4398061f4405cebf36c9412f5b77d9c937.tar.gz |
Don't emit not-context-manager for instances with unknown bases.
Diffstat (limited to 'pylint/checkers/typecheck.py')
-rw-r--r-- | pylint/checkers/typecheck.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pylint/checkers/typecheck.py b/pylint/checkers/typecheck.py index 5dd3ff9..6c34eaf 100644 --- a/pylint/checkers/typecheck.py +++ b/pylint/checkers/typecheck.py @@ -703,6 +703,11 @@ accessed. Python regular expressions are accepted.'} infered.getattr('__enter__') infered.getattr('__exit__') except astroid.NotFoundError: + if isinstance(infered, astroid.Instance): + # If we do not know the bases of this class, + # just skip it. + if not has_known_bases(infered): + continue self.add_message('not-context-manager', node=node, args=(infered.name, )) |