client: Do not create instance just to check isinstance

Checking that classes are idenical gives the same result and
avoids unnecessary instantiation.

https://fedorahosted.org/freeipa/ticket/6048

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
David Kupka 2016-08-11 14:30:00 +02:00 committed by Jan Cholasta
parent 87a6f746bc
commit 1b79ac67d7
3 changed files with 11 additions and 12 deletions

View File

@ -55,8 +55,8 @@ class _fake_automountlocation_show(Method):
class automountlocation_tofiles(MethodOverride):
@classmethod
def __NO_CLI_getter(cls):
return isinstance(api.Command.automountlocation_show,
_fake_automountlocation_show)
return (api.Command.get_plugin('automountlocation_show') is
_fake_automountlocation_show)
NO_CLI = classproperty(__NO_CLI_getter)

View File

@ -77,8 +77,7 @@ class otptoken_add_yubikey(Command):
@classmethod
def __NO_CLI_getter(cls):
return isinstance(api.Command.otptoken_add,
_fake_otptoken_add)
return api.Command.get_plugin('otptoken_add') is _fake_otptoken_add
NO_CLI = classproperty(__NO_CLI_getter)

View File

@ -205,8 +205,8 @@ class vault_add(Local):
@classmethod
def __NO_CLI_getter(cls):
return isinstance(api.Command.vault_add_internal,
_fake_vault_add_internal)
return (api.Command.get_plugin('vault_add_internal') is
_fake_vault_add_internal)
NO_CLI = classproperty(__NO_CLI_getter)
@ -411,8 +411,8 @@ class vault_mod(Local):
@classmethod
def __NO_CLI_getter(cls):
return isinstance(api.Command.vault_mod_internal,
_fake_vault_mod_internal)
return (api.Command.get_plugin('vault_mod_internal') is
_fake_vault_mod_internal)
NO_CLI = classproperty(__NO_CLI_getter)
@ -598,8 +598,8 @@ class vault_archive(Local):
@classmethod
def __NO_CLI_getter(cls):
return isinstance(api.Command.vault_archive_internal,
_fake_vault_archive_internal)
return (api.Command.get_plugin('vault_archive_internal') is
_fake_vault_archive_internal)
NO_CLI = classproperty(__NO_CLI_getter)
@ -855,8 +855,8 @@ class vault_retrieve(Local):
@classmethod
def __NO_CLI_getter(cls):
return isinstance(api.Command.vault_retrieve_internal,
_fake_vault_retrieve_internal)
return (api.Command.get_plugin('vault_retrieve_internal') is
_fake_vault_retrieve_internal)
NO_CLI = classproperty(__NO_CLI_getter)