diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-07-05 15:34:34 +0300 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-07-05 15:34:34 +0300 |
commit | 4c5377ce1b4f59c96147851567b6c95d5ef7cd2e (patch) | |
tree | b9dfad5518a2eee1549758cd14324a2eed17497c /pylint/checkers/utils.py | |
parent | 412e23c21d27800427f2c5a78958447e81421ac7 (diff) | |
download | pylint-4c5377ce1b4f59c96147851567b6c95d5ef7cd2e.tar.gz |
Simplify error_of_type by using ExceptHandler.catch.
Diffstat (limited to 'pylint/checkers/utils.py')
-rw-r--r-- | pylint/checkers/utils.py | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index f241b66..b3ff019 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -469,25 +469,8 @@ def error_of_type(handler, error_type): if not isinstance(error_type, tuple): error_type = (error_type, ) expected_errors = {error.__name__ for error in error_type} + return handler.catch(expected_errors) - names = None - if isinstance(handler.type, astroid.Tuple): - names = [name for name in handler.type.elts - if isinstance(name, astroid.Name)] - elif isinstance(handler.type, astroid.Name): - names = [handler.type] - else: - # Don't try to infer that. - return - for name in names: - try: - for infered in name.infer(): - if (isinstance(infered, astroid.Class) and - inherit_from_std_ex(infered) and - infered.name in expected_errors): - return True - except astroid.InferenceError: - continue def is_import_error(handler): warnings.warn("This function is deprecated in the favour of " |