From fd21204559bd8fcac6a1b321adda163cd88aa149 Mon Sep 17 00:00:00 2001 From: Florence Blanc-Renaud Date: Jan 10 2023 09:11:45 +0000 Subject: pylint: remove unneeded disable=unused-private-member pylint fixed issue https://github.com/PyCQA/pylint/issues/4756 and we don't need anymore to disable this check. Related: https://pagure.io/freeipa/issue/9278 Signed-off-by: Florence Blanc-Renaud Reviewed-By: Stanislav Levin --- diff --git a/ipaclient/frontend.py b/ipaclient/frontend.py index 0ecae44..7c249ba 100644 --- a/ipaclient/frontend.py +++ b/ipaclient/frontend.py @@ -126,25 +126,25 @@ class CommandOverride(Command): return api.get_plugin_next(cls) @classmethod - def __doc_getter(cls): # pylint: disable=unused-private-member, #4756 + def __doc_getter(cls): return cls.__get_next().doc doc = classproperty(__doc_getter) @classmethod - def __summary_getter(cls): # pylint: disable=unused-private-member, #4756 + def __summary_getter(cls): return cls.__get_next().summary summary = classproperty(__summary_getter) @classmethod - def __NO_CLI_getter(cls): # pylint: disable=unused-private-member, #4756 + def __NO_CLI_getter(cls): return cls.__get_next().NO_CLI NO_CLI = classproperty(__NO_CLI_getter) @classmethod - def __topic_getter(cls): # pylint: disable=unused-private-member, #4756 + def __topic_getter(cls): return cls.__get_next().topic topic = classproperty(__topic_getter) diff --git a/ipaclient/plugins/automount.py b/ipaclient/plugins/automount.py index 921c4b0..d1a6ced 100644 --- a/ipaclient/plugins/automount.py +++ b/ipaclient/plugins/automount.py @@ -54,7 +54,7 @@ class _fake_automountlocation_show(Method): @register(override=True, no_fail=True) class automountlocation_tofiles(MethodOverride): @classmethod - def __NO_CLI_getter(cls): # pylint: disable=unused-private-member, #4756 + def __NO_CLI_getter(cls): return (api.Command.get_plugin('automountlocation_show') is _fake_automountlocation_show) diff --git a/ipaclient/plugins/otptoken_yubikey.py b/ipaclient/plugins/otptoken_yubikey.py index a017895..89ee30d 100644 --- a/ipaclient/plugins/otptoken_yubikey.py +++ b/ipaclient/plugins/otptoken_yubikey.py @@ -81,7 +81,7 @@ class otptoken_add_yubikey(Command): has_output_params = takes_options @classmethod - def __NO_CLI_getter(cls): # pylint: disable=unused-private-member, #4756 + def __NO_CLI_getter(cls): return api.Command.get_plugin('otptoken_add') is _fake_otptoken_add NO_CLI = classproperty(__NO_CLI_getter) diff --git a/ipaclient/plugins/vault.py b/ipaclient/plugins/vault.py index d4c84eb..664278a 100644 --- a/ipaclient/plugins/vault.py +++ b/ipaclient/plugins/vault.py @@ -200,7 +200,7 @@ class vault_add(Local): ) @classmethod - def __NO_CLI_getter(cls): # pylint: disable=unused-private-member, #4756 + def __NO_CLI_getter(cls): return (api.Command.get_plugin('vault_add_internal') is _fake_vault_add_internal) @@ -411,7 +411,7 @@ class vault_mod(Local): ) @classmethod - def __NO_CLI_getter(cls): # pylint: disable=unused-private-member, #4756 + def __NO_CLI_getter(cls): return (api.Command.get_plugin('vault_mod_internal') is _fake_vault_mod_internal) @@ -780,7 +780,7 @@ class vault_archive(ModVaultData): ) @classmethod - def __NO_CLI_getter(cls): # pylint: disable=unused-private-member, #4756 + def __NO_CLI_getter(cls): return (api.Command.get_plugin('vault_archive_internal') is _fake_vault_archive_internal) @@ -1036,7 +1036,7 @@ class vault_retrieve(ModVaultData): ) @classmethod - def __NO_CLI_getter(cls): # pylint: disable=unused-private-member, #4756 + def __NO_CLI_getter(cls): return (api.Command.get_plugin('vault_retrieve_internal') is _fake_vault_retrieve_internal) diff --git a/ipalib/backend.py b/ipalib/backend.py index 6be7836..6e27090 100644 --- a/ipalib/backend.py +++ b/ipalib/backend.py @@ -96,7 +96,7 @@ class Connectible(Backend): """ return hasattr(context, self.id) - def __get_conn(self): # pylint: disable=unused-private-member, #4756 + def __get_conn(self): """ Return thread-local connection. """ diff --git a/ipalib/frontend.py b/ipalib/frontend.py index 519c329..9a6b35a 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -429,7 +429,7 @@ class Command(HasParam): api_version = API_VERSION @classmethod - def __topic_getter(cls): # pylint: disable=unused-private-member, #4756 + def __topic_getter(cls): return cls.__module__.rpartition('.')[2] topic = classproperty(__topic_getter) diff --git a/ipalib/plugable.py b/ipalib/plugable.py index 1680781..2e2861d 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -140,32 +140,32 @@ class Plugin(ReadOnly): self.__finalize_lock = threading.RLock() @classmethod - def __name_getter(cls): # pylint: disable=unused-private-member, #4756 + def __name_getter(cls): return cls.__name__ # you know nothing, pylint name = classproperty(__name_getter) @classmethod - def __full_name_getter(cls): # pylint: disable=unused-private-member + def __full_name_getter(cls): return '{}/{}'.format(cls.name, cls.version) full_name = classproperty(__full_name_getter) @classmethod - def __bases_getter(cls): # pylint: disable=unused-private-member, #4756 + def __bases_getter(cls): return cls.__bases__ bases = classproperty(__bases_getter) @classmethod - def __doc_getter(cls): # pylint: disable=unused-private-member, #4756 + def __doc_getter(cls): return cls.__doc__ doc = classproperty(__doc_getter) @classmethod - def __summary_getter(cls): # pylint: disable=unused-private-member, #4756 + def __summary_getter(cls): doc = cls.doc if not _(doc).msg: return '<%s.%s>' % (cls.__module__, cls.__name__) diff --git a/ipatests/test_ipalib/test_cli.py b/ipatests/test_ipalib/test_cli.py index b23224b..51ea230 100644 --- a/ipatests/test_ipalib/test_cli.py +++ b/ipatests/test_ipalib/test_cli.py @@ -80,7 +80,7 @@ class DummyCommand: def __init__(self, name): self.__name = name - def __get_name(self): # pylint: disable=unused-private-member, #4756 + def __get_name(self): return self.__name name = property(__get_name) @@ -89,7 +89,7 @@ class DummyAPI: def __init__(self, cnt): self.__cmd = plugable.APINameSpace(self.__cmd_iter(cnt), DummyCommand) - def __get_cmd(self): # pylint: disable=unused-private-member, #4756 + def __get_cmd(self): return self.__cmd Command = property(__get_cmd) diff --git a/ipatests/test_ipalib/test_errors.py b/ipatests/test_ipalib/test_errors.py index 041b023..3b0ee7b 100644 --- a/ipatests/test_ipalib/test_errors.py +++ b/ipatests/test_ipalib/test_errors.py @@ -45,7 +45,7 @@ class PrivateExceptionTester: _klass = None __klass = None - def __get_klass(self): # pylint: disable=unused-private-member, #4756 + def __get_klass(self): if self.__klass is None: self.__klass = self._klass assert issubclass(self.__klass, Exception) @@ -199,7 +199,7 @@ class PublicExceptionTester: _klass = None __klass = None - def __get_klass(self): # pylint: disable=unused-private-member, #4756 + def __get_klass(self): if self.__klass is None: self.__klass = self._klass assert issubclass(self.__klass, Exception) diff --git a/ipatests/test_util.py b/ipatests/test_util.py index fc3c398..047e7ec 100644 --- a/ipatests/test_util.py +++ b/ipatests/test_util.py @@ -41,17 +41,17 @@ class Prop: self.__ops = frozenset(ops) self.__prop = 'prop value' - def __get_prop(self): # pylint: disable=unused-private-member, #4756 + def __get_prop(self): if 'get' not in self.__ops: raise AttributeError('get prop') return self.__prop - def __set_prop(self, value): # pylint: disable=unused-private-member, #4756 + def __set_prop(self, value): if 'set' not in self.__ops: raise AttributeError('set prop') self.__prop = value - def __del_prop(self): # pylint: disable=unused-private-member, #4756 + def __del_prop(self): if 'del' not in self.__ops: raise AttributeError('del prop') self.__prop = None diff --git a/ipatests/util.py b/ipatests/util.py index 5c0152b..929c3e8 100644 --- a/ipatests/util.py +++ b/ipatests/util.py @@ -94,7 +94,7 @@ class TempDir: self.__path = tempfile.mkdtemp(prefix='ipa.tests.') assert self.path == self.__path - def __get_path(self): # pylint: disable=unused-private-member, pylint#4756 + def __get_path(self): assert path.abspath(self.__path) == self.__path assert self.__path.startswith(path.join(tempfile.gettempdir(), 'ipa.tests.')) @@ -516,14 +516,14 @@ class ClassChecker: __cls = None __subcls = None - def __get_cls(self): # pylint: disable=unused-private-member, #4756 + def __get_cls(self): if self.__cls is None: self.__cls = self._cls # pylint: disable=E1101 assert inspect.isclass(self.__cls) return self.__cls cls = property(__get_cls) - def __get_subcls(self): # pylint: disable=unused-private-member, #4756 + def __get_subcls(self): if self.__subcls is None: self.__subcls = self.get_subcls() assert inspect.isclass(self.__subcls) @@ -576,7 +576,7 @@ def create_test_api(**kw): class PluginTester: __plugin = None - def __get_plugin(self): # pylint: disable=unused-private-member, #4756 + def __get_plugin(self): if self.__plugin is None: self.__plugin = self._plugin # pylint: disable=E1101 assert issubclass(self.__plugin, Plugin)