From 9ca818b1797e03dd41f05eb14d9181546995c246 Mon Sep 17 00:00:00 2001 From: Stanislav Levin Date: Fri, 18 Feb 2022 16:44:37 +0300 Subject: [PATCH] pylint: Skip unused-private-member for property case See https://github.com/PyCQA/pylint/issues/4756 for details Fixes: https://pagure.io/freeipa/issue/9117 Signed-off-by: Stanislav Levin Reviewed-By: Rob Crittenden --- ipaclient/frontend.py | 8 ++++---- ipaclient/plugins/automount.py | 2 +- ipaclient/plugins/otptoken_yubikey.py | 2 +- ipaclient/plugins/vault.py | 8 ++++---- ipalib/backend.py | 2 +- ipalib/frontend.py | 2 +- ipalib/plugable.py | 10 +++++----- ipatests/test_ipalib/test_cli.py | 4 ++-- ipatests/test_ipalib/test_errors.py | 4 ++-- ipatests/test_util.py | 6 +++--- ipatests/util.py | 8 ++++---- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/ipaclient/frontend.py b/ipaclient/frontend.py index 7c249badd..0ecae4445 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): + def __doc_getter(cls): # pylint: disable=unused-private-member, #4756 return cls.__get_next().doc doc = classproperty(__doc_getter) @classmethod - def __summary_getter(cls): + def __summary_getter(cls): # pylint: disable=unused-private-member, #4756 return cls.__get_next().summary summary = classproperty(__summary_getter) @classmethod - def __NO_CLI_getter(cls): + def __NO_CLI_getter(cls): # pylint: disable=unused-private-member, #4756 return cls.__get_next().NO_CLI NO_CLI = classproperty(__NO_CLI_getter) @classmethod - def __topic_getter(cls): + def __topic_getter(cls): # pylint: disable=unused-private-member, #4756 return cls.__get_next().topic topic = classproperty(__topic_getter) diff --git a/ipaclient/plugins/automount.py b/ipaclient/plugins/automount.py index b4be17e64..81b2665a6 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): + def __NO_CLI_getter(cls): # pylint: disable=unused-private-member, #4756 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 89ee30da1..a01789574 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): + def __NO_CLI_getter(cls): # pylint: disable=unused-private-member, #4756 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 b21c3ce1f..d3a1d370e 100644 --- a/ipaclient/plugins/vault.py +++ b/ipaclient/plugins/vault.py @@ -199,7 +199,7 @@ class vault_add(Local): ) @classmethod - def __NO_CLI_getter(cls): + def __NO_CLI_getter(cls): # pylint: disable=unused-private-member, #4756 return (api.Command.get_plugin('vault_add_internal') is _fake_vault_add_internal) @@ -410,7 +410,7 @@ class vault_mod(Local): ) @classmethod - def __NO_CLI_getter(cls): + def __NO_CLI_getter(cls): # pylint: disable=unused-private-member, #4756 return (api.Command.get_plugin('vault_mod_internal') is _fake_vault_mod_internal) @@ -739,7 +739,7 @@ class vault_archive(ModVaultData): ) @classmethod - def __NO_CLI_getter(cls): + def __NO_CLI_getter(cls): # pylint: disable=unused-private-member, #4756 return (api.Command.get_plugin('vault_archive_internal') is _fake_vault_archive_internal) @@ -985,7 +985,7 @@ class vault_retrieve(ModVaultData): ) @classmethod - def __NO_CLI_getter(cls): + def __NO_CLI_getter(cls): # pylint: disable=unused-private-member, #4756 return (api.Command.get_plugin('vault_retrieve_internal') is _fake_vault_retrieve_internal) diff --git a/ipalib/backend.py b/ipalib/backend.py index 58c808f44..89c9a5a67 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): + def __get_conn(self): # pylint: disable=unused-private-member, #4756 """ Return thread-local connection. """ diff --git a/ipalib/frontend.py b/ipalib/frontend.py index bca586d37..7fcac57b9 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): + def __topic_getter(cls): # pylint: disable=unused-private-member, #4756 return cls.__module__.rpartition('.')[2] topic = classproperty(__topic_getter) diff --git a/ipalib/plugable.py b/ipalib/plugable.py index e6170178e..f5d141fb9 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -146,32 +146,32 @@ class Plugin(ReadOnly): self.__finalize_lock = threading.RLock() @classmethod - def __name_getter(cls): + def __name_getter(cls): # pylint: disable=unused-private-member, #4756 return cls.__name__ # you know nothing, pylint name = classproperty(__name_getter) @classmethod - def __full_name_getter(cls): + def __full_name_getter(cls): # pylint: disable=unused-private-member return '{}/{}'.format(cls.name, cls.version) full_name = classproperty(__full_name_getter) @classmethod - def __bases_getter(cls): + def __bases_getter(cls): # pylint: disable=unused-private-member, #4756 return cls.__bases__ bases = classproperty(__bases_getter) @classmethod - def __doc_getter(cls): + def __doc_getter(cls): # pylint: disable=unused-private-member, #4756 return cls.__doc__ doc = classproperty(__doc_getter) @classmethod - def __summary_getter(cls): + def __summary_getter(cls): # pylint: disable=unused-private-member, #4756 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 51ea230c4..b23224b3d 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): + def __get_name(self): # pylint: disable=unused-private-member, #4756 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): + def __get_cmd(self): # pylint: disable=unused-private-member, #4756 return self.__cmd Command = property(__get_cmd) diff --git a/ipatests/test_ipalib/test_errors.py b/ipatests/test_ipalib/test_errors.py index c83d0c87a..bc4337b04 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): + def __get_klass(self): # pylint: disable=unused-private-member, #4756 if self.__klass is None: self.__klass = self._klass assert issubclass(self.__klass, Exception) @@ -197,7 +197,7 @@ class PublicExceptionTester: _klass = None __klass = None - def __get_klass(self): + def __get_klass(self): # pylint: disable=unused-private-member, #4756 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 047e7ec43..fc3c39810 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): + def __get_prop(self): # pylint: disable=unused-private-member, #4756 if 'get' not in self.__ops: raise AttributeError('get prop') return self.__prop - def __set_prop(self, value): + def __set_prop(self, value): # pylint: disable=unused-private-member, #4756 if 'set' not in self.__ops: raise AttributeError('set prop') self.__prop = value - def __del_prop(self): + def __del_prop(self): # pylint: disable=unused-private-member, #4756 if 'del' not in self.__ops: raise AttributeError('del prop') self.__prop = None diff --git a/ipatests/util.py b/ipatests/util.py index ea9ed8056..f705f646f 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): + def __get_path(self): # pylint: disable=unused-private-member, pylint#4756 assert path.abspath(self.__path) == self.__path assert self.__path.startswith(path.join(tempfile.gettempdir(), 'ipa.tests.')) @@ -517,14 +517,14 @@ class ClassChecker: __cls = None __subcls = None - def __get_cls(self): + def __get_cls(self): # pylint: disable=unused-private-member, #4756 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): + def __get_subcls(self): # pylint: disable=unused-private-member, #4756 if self.__subcls is None: self.__subcls = self.get_subcls() assert inspect.isclass(self.__subcls) @@ -577,7 +577,7 @@ def create_test_api(**kw): class PluginTester: __plugin = None - def __get_plugin(self): + def __get_plugin(self): # pylint: disable=unused-private-member, #4756 if self.__plugin is None: self.__plugin = self._plugin # pylint: disable=E1101 assert issubclass(self.__plugin, Plugin)