From aaad91d32ee855813bac5f57f8af128cfee327a5 Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Mar 02 2016 13:57:00 +0000 Subject: pylint: supress false positive no-member errors pylint 1.5 prints many false positive no-member errors which are supressed by this commit. https://fedorahosted.org/freeipa/ticket/5615 Reviewed-By: David Kupka --- diff --git a/install/tools/ipactl b/install/tools/ipactl index 60db587..b8ffe53 100755 --- a/install/tools/ipactl +++ b/install/tools/ipactl @@ -288,7 +288,7 @@ def ipa_start(options): if isinstance(e, IpactlError): # do not display any other error message - raise IpactlError(rval=e.rval) + raise IpactlError(rval=e.rval) # pylint: disable=no-member else: raise IpactlError() @@ -385,7 +385,7 @@ def ipa_restart(options): pass if isinstance(e, IpactlError): # do not display any other error message - raise IpactlError(rval=e.rval) + raise IpactlError(rval=e.rval) # pylint: disable=no-member else: raise IpactlError() diff --git a/ipalib/plugins/batch.py b/ipalib/plugins/batch.py index 2002eef..20a849b 100644 --- a/ipalib/plugins/batch.py +++ b/ipalib/plugins/batch.py @@ -110,11 +110,16 @@ class batch(Command): if isinstance(e, errors.RequirementError) or \ isinstance(e, errors.CommandError): self.info( - '%s: batch: %s', context.principal, e.__class__.__name__ + '%s: batch: %s', + context.principal, # pylint: disable=no-member + e.__class__.__name__ ) else: self.info( - '%s: batch: %s(%s): %s', context.principal, name, ', '.join(api.Command[name]._repr_iter(**params)), e.__class__.__name__ + '%s: batch: %s(%s): %s', + context.principal, name, # pylint: disable=no-member + ', '.join(api.Command[name]._repr_iter(**params)), + e.__class__.__name__ ) if isinstance(e, errors.PublicError): reported_error = e diff --git a/ipapython/ipaldap.py b/ipapython/ipaldap.py index 4443db0..73d44cc 100644 --- a/ipapython/ipaldap.py +++ b/ipapython/ipaldap.py @@ -207,7 +207,7 @@ class LDAPEntry(collections.MutableMapping): Keyword arguments can be used to override values of specific attributes. """ - super(LDAPEntry, self).__init__() + super(LDAPEntry, self).__init__() # pylint: disable=no-member if isinstance(_conn, LDAPEntry): assert _dn is None diff --git a/ipapython/nsslib.py b/ipapython/nsslib.py index 79b8dc5..ba29e2e 100644 --- a/ipapython/nsslib.py +++ b/ipapython/nsslib.py @@ -57,7 +57,9 @@ def auth_certificate_callback(sock, check_sig, is_server, certdb): # and the strerror attribute will contain a string describing the reason. approved_usage = cert.verify_now(certdb, check_sig, intended_usage, *pin_args) except Exception, e: - root_logger.error('cert validation failed for "%s" (%s)', cert.subject, e.strerror) + root_logger.error( + 'cert validation failed for "%s" (%s)', cert.subject, + e.strerror) # pylint: disable=no-member cert_is_valid = False return cert_is_valid @@ -87,7 +89,8 @@ def auth_certificate_callback(sock, check_sig, is_server, certdb): cert_is_valid = cert.verify_hostname(hostname) except Exception, e: root_logger.error('failed verifying socket hostname "%s" matches cert subject "%s" (%s)', - hostname, cert.subject, e.strerror) + hostname, cert.subject, + e.strerror) # pylint: disable=no-member cert_is_valid = False return cert_is_valid diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py index 1231b09..c1d5194 100644 --- a/ipaserver/install/installutils.py +++ b/ipaserver/install/installutils.py @@ -158,7 +158,9 @@ def verify_fqdn(host_name, no_host_dns=False, local_hostname=True): except socket.gaierror: pass except socket.error, e: - root_logger.debug('socket.gethostbyaddr() error: %d: %s' % (e.errno, e.strerror)) + root_logger.debug( + 'socket.gethostbyaddr() error: %d: %s', + e.errno, e.strerror) # pylint: disable=no-member if no_host_dns: print "Warning: skipping DNS resolution of host", host_name @@ -732,7 +734,10 @@ def run_script(main_function, operation_name, log_file_name=None, try: return_value = main_function() except BaseException, e: - if isinstance(e, SystemExit) and (e.code is None or e.code == 0): + if ( + isinstance(e, SystemExit) and + (e.code is None or e.code == 0) # pylint: disable=no-member + ): # Not an error after all root_logger.info('The %s command was successful', operation_name) diff --git a/ipaserver/install/ipa_otptoken_import.py b/ipaserver/install/ipa_otptoken_import.py index 9be44cf..efe1841 100644 --- a/ipaserver/install/ipa_otptoken_import.py +++ b/ipaserver/install/ipa_otptoken_import.py @@ -496,11 +496,12 @@ class OTPTokenImport(admintool.AdminTool): # Verify a key is provided if one is needed. if self.doc.keyname is not None: - if self.safe_options.keyfile is None: + if self.safe_options.keyfile is None: # pylint: disable=no-member raise admintool.ScriptError("Encryption key required: %s!" % self.doc.keyname) # Load the keyfile. - with open(self.safe_options.keyfile) as f: + keyfile = self.safe_options.keyfile # pylint: disable=no-member + with open(keyfile) as f: self.doc.setKey(f.read()) def run(self): diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py index e59e82c..9846a37 100644 --- a/ipaserver/install/service.py +++ b/ipaserver/install/service.py @@ -418,7 +418,8 @@ class Service(object): run_step(full_msg, method) step += 1 except BaseException as e: - if not (isinstance(e, SystemExit) and e.code == 0): + if not (isinstance(e, SystemExit) and + e.code == 0): # pylint: disable=no-member # show the traceback, so it's not lost if cleanup method fails root_logger.debug("%s" % traceback.format_exc()) self.print_msg(' [error] %s: %s' % (type(e).__name__, e)) diff --git a/ipatests/test_xmlrpc/xmlrpc_test.py b/ipatests/test_xmlrpc/xmlrpc_test.py index d6a0b61..85587ad 100644 --- a/ipatests/test_xmlrpc/xmlrpc_test.py +++ b/ipatests/test_xmlrpc/xmlrpc_test.py @@ -343,7 +343,8 @@ class Declarative(XMLRPC_test): # client side. However, if we switch to using JSON-RPC for the default # transport, the exception is a free-form data structure (dict). # For now just compare the strings - assert_deepequal(expected.strerror, e.strerror) + assert_deepequal(expected.strerror, + e.strerror) # pylint: disable=no-member def check_callable(self, nice, cmd, args, options, expected): name = expected.__class__.__name__