diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-05-16 17:26:01 +0300 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-05-16 17:26:01 +0300 |
commit | 4ef6e29eb67f9f15634ccc3358369d17cbff809e (patch) | |
tree | 3985478b588a30b6f354f778a7b76797f85dee35 /pylint/checkers/utils.py | |
parent | dcf461b92a4d30db09ed6c9bfc9bc757e924fc79 (diff) | |
download | pylint-4ef6e29eb67f9f15634ccc3358369d17cbff809e.tar.gz |
Don't emit no-name-in-module if the import is guarded by an ImportError handler.
Diffstat (limited to 'pylint/checkers/utils.py')
-rw-r--r-- | pylint/checkers/utils.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index 9c28aac..3cdf439 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -576,3 +576,12 @@ def unimplemented_abstract_methods(node, is_abstract_cb=None): elif not abstract and obj.name in visited: del visited[obj.name] return visited + +def excepts_import_error(node): + """ + Check if the try-except node has an ImportError handler. + Return True if an ImportError handler was infered, False otherwise. + """ + if not isinstance(node, astroid.TryExcept): + return + return any(map(is_import_error, node.handlers)) |