From 3d1bca890fcb83537725307342501a5577366294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20K=C3=A4ufl?= Date: Tue, 24 Sep 2019 17:27:32 +0200 Subject: [PATCH 1/3] Import exception from pylint.exceptions instead of utils Also tries to use the newer name (already over three years old) first. Fixes PyCQA/pylint-plugin-utils#15 --- pylint_plugin_utils/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pylint_plugin_utils/__init__.py b/pylint_plugin_utils/__init__.py index a76bcf4..5b81bd4 100644 --- a/pylint_plugin_utils/__init__.py +++ b/pylint_plugin_utils/__init__.py @@ -1,8 +1,8 @@ import sys try: - from pylint.utils import UnknownMessage + from pylint.exceptions import UnknownMessageError as UnknownMessage except ImportError: - from pylint.utils import UnknownMessageError as UnknownMessage + from pylint.exceptions import UnknownMessage def get_class(module_name, kls): From 9ecd039bf4334745b50ef6fef19fef67b0038ce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20K=C3=A4ufl?= Date: Wed, 25 Sep 2019 13:08:00 +0200 Subject: [PATCH 2/3] Cleanup import and drop support for pylint < 1.7 --- pylint_plugin_utils/__init__.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pylint_plugin_utils/__init__.py b/pylint_plugin_utils/__init__.py index 5b81bd4..e871dbc 100644 --- a/pylint_plugin_utils/__init__.py +++ b/pylint_plugin_utils/__init__.py @@ -1,8 +1,6 @@ import sys -try: - from pylint.exceptions import UnknownMessageError as UnknownMessage -except ImportError: - from pylint.exceptions import UnknownMessage + +from pylint.exceptions import UnknownMessageError def get_class(module_name, kls): @@ -137,7 +135,7 @@ def get_message_definitions(message_id_or_symbol): for pylint_message in pylint_messages for symbol in (pylint_message.msgid, pylint_message.symbol) if symbol is not None] - except UnknownMessage: + except UnknownMessageError: # This can happen due to mismatches of pylint versions and plugin expectations of available messages symbols = [message_id_or_symbol] From 43e8347386999a04e57445ee9de8968cab67d974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20K=C3=A4ufl?= Date: Thu, 26 Sep 2019 16:40:43 +0200 Subject: [PATCH 3/3] Add minimal required version of pylint to setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index fa76138..be0f406 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ author_email='code@landscape.io', description=_short_description, version=_version, - install_requires=['pylint'], + install_requires=['pylint>=1.7'], packages=_packages, license='GPLv2', classifiers=_classifiers,