From 5a00882eab54573b1f9880b99e85eafbccfa9691 Mon Sep 17 00:00:00 2001 From: Stanislav Levin Date: Mon, 21 Feb 2022 15:36:10 +0300 Subject: [PATCH] pylint: Fix useless-suppression Cleanup up no longer used Pylint's disables where possible. Fixes: https://pagure.io/freeipa/issue/9117 Signed-off-by: Stanislav Levin Reviewed-By: Rob Crittenden --- daemons/ipa-otpd/test.py | 2 +- .../dogtag-ipa-ca-renew-agent-submit.in | 2 +- install/certmonger/ipa-server-guard.in | 4 +- install/tools/ipa-pki-retrieve-key.in | 1 - install/tools/ipa-replica-conncheck.in | 4 +- ipaclient/install/client.py | 3 +- ipaclient/install/ipa_certupdate.py | 4 +- ipaclient/install/ipa_client_automount.py | 2 - ipaclient/plugins/otptoken.py | 4 -- ipaclient/remote_plugins/__init__.py | 3 ++ ipaclient/remote_plugins/schema.py | 4 +- ipalib/__init__.py | 8 +++- ipalib/backend.py | 2 +- ipalib/cli.py | 10 ++--- ipalib/config.py | 6 +-- ipalib/install/hostname.py | 1 - ipalib/install/service.py | 2 - ipalib/plugable.py | 8 ++-- ipalib/rpc.py | 7 +--- ipalib/text.py | 8 ++-- ipalib/util.py | 7 +--- ipalib/x509.py | 2 - ipapython/admintool.py | 5 +-- ipapython/dnsutil.py | 1 - ipapython/dogtag.py | 3 +- ipapython/ipachangeconf.py | 2 +- ipapython/ipaldap.py | 7 +--- ipapython/ipautil.py | 4 +- ipapython/ssh.py | 2 +- ipaserver/custodia/httpd/authenticators.py | 1 - ipaserver/custodia/httpd/authorizers.py | 3 +- ipaserver/custodia/httpd/server.py | 4 +- ipaserver/custodia/log.py | 1 - ipaserver/custodia/plugin.py | 17 ++------ ipaserver/custodia/server/__init__.py | 4 +- ipaserver/dnssec/ldapkeydb.py | 1 - ipaserver/install/ca.py | 1 - ipaserver/install/certs.py | 2 +- ipaserver/install/dns.py | 2 - ipaserver/install/dsinstance.py | 1 - ipaserver/install/installutils.py | 2 +- ipaserver/install/ipa_otptoken_import.py | 5 +-- ipaserver/install/ipa_replica_install.py | 6 +-- ipaserver/install/ipa_restore.py | 2 - ipaserver/install/ipa_server_install.py | 5 +-- ipaserver/install/ipactl.py | 4 +- ipaserver/install/replication.py | 4 +- ipaserver/install/server/__init__.py | 6 +-- ipaserver/install/server/replicainstall.py | 2 - ipaserver/plugins/batch.py | 4 +- ipaserver/plugins/cert.py | 2 +- ipaserver/plugins/hbactest.py | 2 +- ipaserver/plugins/permission.py | 4 +- ipaserver/plugins/privilege.py | 2 +- ipaserver/plugins/vault.py | 2 - ipatests/azure/scripts/setup_containers.py | 2 +- ipatests/conftest.py | 2 - ipatests/i18n.py | 2 - ipatests/pytest_ipa/declarative.py | 2 +- ipatests/pytest_ipa/integration/tasks.py | 4 +- ipatests/test_custodia/test_server.py | 2 - ipatests/test_integration/base.py | 2 +- ipatests/test_integration/test_automember.py | 6 +-- ipatests/test_integration/test_caless.py | 4 +- ipatests/test_integration/test_commands.py | 18 ++++----- .../test_integration/test_installation.py | 2 +- .../test_integration/test_ipahealthcheck.py | 40 +++++++++---------- ipatests/test_integration/test_otp.py | 4 +- ipatests/test_integration/test_smb.py | 2 - ipatests/test_integration/test_sssd.py | 2 +- ipatests/test_integration/test_trust.py | 8 ++-- ipatests/test_integration/test_upgrade.py | 6 +-- ipatests/test_ipalib/test_frontend.py | 2 +- ipatests/test_ipalib/test_parameters.py | 2 +- ipatests/test_ipalib/test_rpc.py | 2 - ipatests/test_ipapython/test_dn.py | 3 -- ipatests/test_ipaserver/httptest.py | 2 - .../test_install/test_installer.py | 1 - ipatests/test_xmlrpc/test_automount_plugin.py | 2 +- ipatests/test_xmlrpc/test_baseldap_plugin.py | 6 +-- 80 files changed, 131 insertions(+), 204 deletions(-) diff --git a/daemons/ipa-otpd/test.py b/daemons/ipa-otpd/test.py index 8537cf711..43d9e6faa 100644 --- a/daemons/ipa-otpd/test.py +++ b/daemons/ipa-otpd/test.py @@ -59,7 +59,7 @@ def main(): rsp.DecodePacket(buf) pkt.VerifyReply(rsp) - proc.terminate() # pylint: disable=E1101 + proc.terminate() proc.wait() if __name__ == '__main__': diff --git a/install/certmonger/dogtag-ipa-ca-renew-agent-submit.in b/install/certmonger/dogtag-ipa-ca-renew-agent-submit.in index 95886e5a3..00a6b65e4 100644 --- a/install/certmonger/dogtag-ipa-ca-renew-agent-submit.in +++ b/install/certmonger/dogtag-ipa-ca-renew-agent-submit.in @@ -220,7 +220,7 @@ def request_cert(reuse_existing, **kwargs): sys.stderr.write(result.raw_error_output) else: # Write bytes directly - sys.stderr.buffer.write(result.raw_error_output) #pylint: disable=no-member + sys.stderr.buffer.write(result.raw_error_output) sys.stderr.flush() syslog.syslog(syslog.LOG_NOTICE, diff --git a/install/certmonger/ipa-server-guard.in b/install/certmonger/ipa-server-guard.in index 499088297..ca98c0fd3 100644 --- a/install/certmonger/ipa-server-guard.in +++ b/install/certmonger/ipa-server-guard.in @@ -36,8 +36,8 @@ def run_operation(cmd): result = ipautil.run(cmd, raiseonerr=False, env=os.environ) # Write bytes directly - sys.stdout.buffer.write(result.raw_output) #pylint: disable=no-member - sys.stderr.buffer.write(result.raw_error_output) #pylint: disable=no-member + sys.stdout.buffer.write(result.raw_output) + sys.stderr.buffer.write(result.raw_error_output) sys.stdout.flush() sys.stderr.flush() diff --git a/install/tools/ipa-pki-retrieve-key.in b/install/tools/ipa-pki-retrieve-key.in index ff76055ce..cf2110a12 100644 --- a/install/tools/ipa-pki-retrieve-key.in +++ b/install/tools/ipa-pki-retrieve-key.in @@ -34,7 +34,6 @@ def main(): "File '{}' missing or not readable.\n".format(filename) ) - # pylint: disable=no-member client = CustodiaClient( client_service="{}@{}".format(service, env.host), server=args.servername, diff --git a/install/tools/ipa-replica-conncheck.in b/install/tools/ipa-replica-conncheck.in index a7497789f..948fc5a0c 100644 --- a/install/tools/ipa-replica-conncheck.in +++ b/install/tools/ipa-replica-conncheck.in @@ -319,7 +319,7 @@ class PortResponder(threading.Thread): logger.debug('%d %s: Stopped listening', port, proto) def _is_closing(self): - with self._close_lock: # pylint: disable=not-context-manager + with self._close_lock: return self._close def _bind_to_port(self, port, socket_type): @@ -370,7 +370,7 @@ class PortResponder(threading.Thread): def stop(self): logger.debug('Stopping listening thread.') - with self._close_lock: # pylint: disable=not-context-manager + with self._close_lock: self._close = True diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py index bb528d3d3..36e0eae66 100644 --- a/ipaclient/install/client.py +++ b/ipaclient/install/client.py @@ -3667,7 +3667,7 @@ def init(installer): root_logger = logging.getLogger() for handler in root_logger.handlers: if (isinstance(handler, logging.StreamHandler) and - handler.stream is sys.stderr): # pylint: disable=no-member + handler.stream is sys.stderr): installer.debug = handler.level == logging.DEBUG break else: @@ -3749,7 +3749,6 @@ class ClientInstallInterface(hostname_.HostNameInstallInterface, force_join = enroll_only(force_join) ntp_servers = knob( - # pylint: disable=invalid-sequence-index typing.List[str], None, description="ntp server to use. This option can be used multiple " "times", diff --git a/ipaclient/install/ipa_certupdate.py b/ipaclient/install/ipa_certupdate.py index 42ad68436..3ff58ca76 100644 --- a/ipaclient/install/ipa_certupdate.py +++ b/ipaclient/install/ipa_certupdate.py @@ -113,9 +113,9 @@ def run_with_args(api): update_server(certs) - # pylint: disable=import-error,ipa-forbidden-import + # pylint: disable=ipa-forbidden-import from ipaserver.install import cainstance, custodiainstance - # pylint: enable=import-error,ipa-forbidden-import + # pylint: enable=ipa-forbidden-import # Add LWCA tracking requests. Only execute if *this server* # has CA installed (ca_enabled indicates CA-ful topology). diff --git a/ipaclient/install/ipa_client_automount.py b/ipaclient/install/ipa_client_automount.py index 2b7c67093..e025c1633 100644 --- a/ipaclient/install/ipa_client_automount.py +++ b/ipaclient/install/ipa_client_automount.py @@ -37,10 +37,8 @@ except ImportError: from xml.etree import ElementTree as etree import SSSDConfig -# pylint: disable=import-error from six.moves.urllib.parse import urlsplit -# pylint: enable=import-error from optparse import OptionParser # pylint: disable=deprecated-module from ipapython import ipachangeconf from ipaclient.install import ipadiscovery diff --git a/ipaclient/plugins/otptoken.py b/ipaclient/plugins/otptoken.py index 6c9dec615..10b050712 100644 --- a/ipaclient/plugins/otptoken.py +++ b/ipaclient/plugins/otptoken.py @@ -129,7 +129,6 @@ class HTTPSHandler(urllib.request.HTTPSHandler): return create_https_connection(host, **tmp) def https_open(self, req): - # pylint: disable=no-member return self.do_open(self.__inner, req) @register() @@ -156,8 +155,6 @@ class otptoken_sync(Local): segments = list(urllib.parse.urlparse(self.api.env.xmlrpc_uri)) assert segments[0] == 'https' # Ensure encryption. segments[2] = segments[2].replace('/xml', '/session/sync_token') - # urlunparse *can* take one argument - # pylint: disable=too-many-function-args sync_uri = urllib.parse.urlunparse(segments) # Prepare the query. @@ -170,7 +167,6 @@ class otptoken_sync(Local): query = query.encode('utf-8') # Sync the token. - # pylint: disable=E1101 handler = HTTPSHandler( cafile=api.env.tls_ca_cert, tls_version_min=api.env.tls_version_min, diff --git a/ipaclient/remote_plugins/__init__.py b/ipaclient/remote_plugins/__init__.py index dcd441a29..5c0836aff 100644 --- a/ipaclient/remote_plugins/__init__.py +++ b/ipaclient/remote_plugins/__init__.py @@ -109,9 +109,12 @@ class ServerInfo(MutableMapping): def get_package(api): if api.env.in_tree: + # server packages are not published on pypi.org + # pylint: disable=useless-suppression # pylint: disable=import-error,ipa-forbidden-import from ipaserver import plugins # pylint: enable=import-error,ipa-forbidden-import + # pylint: enable=useless-suppression else: try: plugins = api._remote_plugins diff --git a/ipaclient/remote_plugins/schema.py b/ipaclient/remote_plugins/schema.py index 4dcdad4ca..2433bf268 100644 --- a/ipaclient/remote_plugins/schema.py +++ b/ipaclient/remote_plugins/schema.py @@ -526,7 +526,7 @@ class Schema: def get_help(self, namespace, member): if isinstance(self._help, bytes): self._help = json.loads( - self._help.decode('utf-8') # pylint: disable=no-member + self._help.decode('utf-8') ) return self._help[namespace][member] @@ -585,7 +585,7 @@ def get_package(server_info, client): for plugin_cls in (_SchemaCommandPlugin, _SchemaObjectPlugin): for full_name in schema[plugin_cls.schema_key]: plugin = plugin_cls(schema, str(full_name)) - plugin = module.register()(plugin) # pylint: disable=no-member + plugin = module.register()(plugin) sys.modules[module_name] = module for full_name, topic in six.iteritems(schema['topics']): diff --git a/ipalib/__init__.py b/ipalib/__init__.py index f0780aa1f..9b9136819 100644 --- a/ipalib/__init__.py +++ b/ipalib/__init__.py @@ -890,7 +890,7 @@ def _enable_warnings(error=False): import warnings # get reference to Py_BytesWarningFlag from Python CAPI - byteswarnings = ctypes.c_int.in_dll( # pylint: disable=no-member + byteswarnings = ctypes.c_int.in_dll( ctypes.pythonapi, 'Py_BytesWarningFlag') if byteswarnings.value >= 2: @@ -936,9 +936,12 @@ class API(plugable.API): @property def packages(self): if self.env.in_server: + # server packages are not published on pypi.org + # pylint: disable=useless-suppression # pylint: disable=import-error,ipa-forbidden-import import ipaserver.plugins # pylint: enable=import-error,ipa-forbidden-import + # pylint: enable=useless-suppression result = ( ipaserver.plugins, ) @@ -951,9 +954,12 @@ class API(plugable.API): ) if self.env.context in ('installer', 'updates'): + # server packages are not published on pypi.org + # pylint: disable=useless-suppression # pylint: disable=import-error,ipa-forbidden-import import ipaserver.install.plugins # pylint: enable=import-error,ipa-forbidden-import + # pylint: enable=useless-suppression result += (ipaserver.install.plugins,) return result diff --git a/ipalib/backend.py b/ipalib/backend.py index 553dbff29..6be7836da 100644 --- a/ipalib/backend.py +++ b/ipalib/backend.py @@ -139,7 +139,7 @@ class Executioner(Backend): if _name not in self.Command: raise CommandError(name=_name) return self.Command[_name](*args, **options) - except PublicError: # pylint: disable=try-except-raise + except PublicError: raise except Exception as e: logger.exception( diff --git a/ipalib/cli.py b/ipalib/cli.py index 9d08143cd..fe022eb9f 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -68,7 +68,7 @@ from ipalib.errors import (PublicError, CommandError, HelpError, InternalError, from ipalib.constants import CLI_TAB, LDAP_GENERALIZED_TIME_FORMAT from ipalib.parameters import File, BinaryFile, Str, Enum, Any, Flag from ipalib.text import _ -from ipalib import api # pylint: disable=unused-import +from ipalib import api from ipapython.dnsutil import DNSName from ipapython.admintool import ScriptError @@ -609,7 +609,7 @@ class textui(backend.Backend): prompt = u'%s Yes/No: ' % label while True: - data = self.prompt_helper(prompt, label).lower() #pylint: disable=E1103 + data = self.prompt_helper(prompt, label).lower() if data in (u'yes', u'y'): return True @@ -680,9 +680,9 @@ class textui(backend.Backend): except EOFError: return -2 - if resp.lower() == "q": #pylint: disable=E1103 + if resp.lower() == "q": return -2 - if resp.lower() == "a": #pylint: disable=E1103 + if resp.lower() == "a": return -1 try: selection = int(resp) - 1 @@ -1411,9 +1411,7 @@ class cli(backend.Executioner): elif p.stdin_if_missing: try: if six.PY3 and p.type is bytes: - # pylint: disable=no-member raw = sys.stdin.buffer.read() - # pylint: enable=no-member else: raw = sys.stdin.read() except IOError as e: diff --git a/ipalib/config.py b/ipalib/config.py index fac14932b..e21394f14 100644 --- a/ipalib/config.py +++ b/ipalib/config.py @@ -270,9 +270,9 @@ class Env: if type(value) not in (unicode, int, float, bool, type(None), DN): raise TypeError(key, value) object.__setattr__(self, key, value) - # pylint: disable=unsupported-assignment-operation, no-member + # pylint: disable=no-member self.__d[key] = value - # pylint: enable=unsupported-assignment-operation, no-member + # pylint: enable=no-member def __getitem__(self, key): """ @@ -600,12 +600,10 @@ class Env: # and server from jsonrpc_uri so that when only server or xmlrpc_uri # is specified, all 3 keys have a value.) if 'xmlrpc_uri' not in self and 'server' in self: - # pylint: disable=no-member, access-member-before-definition self.xmlrpc_uri = 'https://{}/ipa/xml'.format(self.server) # Derive ldap_uri from server if 'ldap_uri' not in self and 'server' in self: - # pylint: disable=no-member, access-member-before-definition self.ldap_uri = 'ldap://{}'.format(self.server) # Derive jsonrpc_uri from xmlrpc_uri diff --git a/ipalib/install/hostname.py b/ipalib/install/hostname.py index 25ac21e09..ff27b0e1b 100644 --- a/ipalib/install/hostname.py +++ b/ipalib/install/hostname.py @@ -21,7 +21,6 @@ class HostNameInstallInterface(service.ServiceInstallInterface): """ ip_addresses = knob( - # pylint: disable=invalid-sequence-index typing.List[CheckedIPAddress], None, description="Specify IP address that should be added to DNS. This " "option can be used multiple times", diff --git a/ipalib/install/service.py b/ipalib/install/service.py index d74d53eb7..6b7dc524c 100644 --- a/ipalib/install/service.py +++ b/ipalib/install/service.py @@ -115,7 +115,6 @@ class ServiceInstallInterface(common.Installable, validate_domain_name(value) servers = knob( - # pylint: disable=invalid-sequence-index typing.List[str], None, description="FQDN of IPA server", cli_names='--server', @@ -143,7 +142,6 @@ class ServiceInstallInterface(common.Installable, ) ca_cert_files = knob( - # pylint: disable=invalid-sequence-index typing.List[str], None, description="load the CA certificate from this file", cli_names='--ca-cert-file', diff --git a/ipalib/plugable.py b/ipalib/plugable.py index cc7acd82f..168078148 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -454,7 +454,7 @@ class API(ReadOnly): if root_logger.handlers or self.env.validate_api: return - if self.env.debug: # pylint: disable=using-constant-test + if self.env.debug: level = logging.DEBUG else: level = logging.INFO @@ -478,7 +478,7 @@ class API(ReadOnly): # Add stderr handler: level = logging.INFO - if self.env.debug: # pylint: disable=using-constant-test + if self.env.debug: level = logging.DEBUG else: if self.env.context == 'cli': @@ -510,7 +510,7 @@ class API(ReadOnly): return level = logging.INFO - if self.env.debug: # pylint: disable=using-constant-test + if self.env.debug: level = logging.DEBUG if self.env.log is not None: try: @@ -663,7 +663,7 @@ class API(ReadOnly): continue except Exception: tb = self.env.startup_traceback - if tb: # pylint: disable=using-constant-test + if tb: logger.exception("could not load plugin module %s", name) raise diff --git a/ipalib/rpc.py b/ipalib/rpc.py index 49e25670c..69756cea0 100644 --- a/ipalib/rpc.py +++ b/ipalib/rpc.py @@ -77,7 +77,6 @@ try: from xmlrpclib import (Binary, Fault, DateTime, dumps, loads, ServerProxy, Transport, ProtocolError, MININT, MAXINT) except ImportError: - # pylint: disable=import-error from xmlrpc.client import (Binary, Fault, DateTime, dumps, loads, ServerProxy, Transport, ProtocolError, MININT, MAXINT) @@ -763,7 +762,7 @@ class KerbTransport(SSLTransport): else: connection.putrequest("POST", handler) headers.append(("User-Agent", self.user_agent)) - self.send_headers(connection, headers) # pylint: disable=E1101 + self.send_headers(connection, headers) self.send_content(connection, request_body) return connection @@ -996,8 +995,6 @@ class RPCClient(Connectible): # Form the session URL by substituting the session path into the original URL scheme, netloc, path, params, query, fragment = urllib.parse.urlparse(original_url) path = self.session_path - # urlencode *can* take one argument - # pylint: disable=too-many-function-args session_url = urllib.parse.urlunparse((scheme, netloc, path, params, query, fragment)) return session_url @@ -1078,11 +1075,9 @@ class RPCClient(Connectible): ) # We don't care about the response, just that we got one return serverproxy - # pylint: disable=try-except-raise except errors.KerberosError: # kerberos error on one server is likely on all raise - # pylint: enable=try-except-raise except ProtocolError as e: if hasattr(context, 'session_cookie') and e.errcode == 401: # Unauthorized. Remove the session and try again. diff --git a/ipalib/text.py b/ipalib/text.py index 74f2cca66..f09b88c5a 100644 --- a/ipalib/text.py +++ b/ipalib/text.py @@ -288,7 +288,7 @@ class Gettext(LazyText): else: t = create_translation(self.key) if six.PY2: - return t.ugettext(self.msg) # pylint: disable=no-member + return t.ugettext(self.msg) else: return t.gettext(self.msg) @@ -296,10 +296,10 @@ class Gettext(LazyText): return unicode(self.as_unicode()) def __json__(self): - return unicode(self) #pylint: disable=no-member + return unicode(self) def __mod__(self, kw): - return unicode(self) % kw #pylint: disable=no-member + return unicode(self) % kw def format(self, *args, **kwargs): return unicode(self).format(*args, **kwargs) @@ -481,9 +481,7 @@ class NGettext(LazyText): else: t = create_translation(self.key) if six.PY2: - # pylint: disable=no-member return t.ungettext(self.singular, self.plural, count) - # pylint: enable=no-member else: return t.ngettext(self.singular, self.plural, count) diff --git a/ipalib/util.py b/ipalib/util.py index affe72921..48bc6df18 100644 --- a/ipalib/util.py +++ b/ipalib/util.py @@ -60,7 +60,6 @@ from ipalib.constants import ( TLS_VERSIONS, TLS_VERSION_MINIMAL, TLS_VERSION_MAXIMAL, TLS_VERSION_DEFAULT_MIN, TLS_VERSION_DEFAULT_MAX, ) -# pylint: disable=ipa-forbidden-import from ipalib.facts import is_ipa_client_configured from ipalib.text import _ from ipaplatform.constants import constants @@ -77,7 +76,7 @@ from ipapython.dnsutil import ( from ipapython.admintool import ScriptError if sys.version_info >= (3, 2): - import reprlib # pylint: disable=import-error + import reprlib else: reprlib = None @@ -321,7 +320,6 @@ def create_https_connection( is not encrypted. :returns An established HTTPS connection to host:port """ - # pylint: disable=no-member tls_cutoff_map = { "ssl2": ssl.OP_NO_SSLv2, "ssl3": ssl.OP_NO_SSLv3, @@ -330,7 +328,6 @@ def create_https_connection( "tls1.2": ssl.OP_NO_TLSv1_2, "tls1.3": getattr(ssl, "OP_NO_TLSv1_3", 0), } - # pylint: enable=no-member if cafile is None: raise RuntimeError("cafile argument is required to perform server " @@ -343,7 +340,6 @@ def create_https_connection( # official Python documentation states that the best option to get # TLSv1 and later is to setup SSLContext with PROTOCOL_SSLv23 # and then negate the insecure SSLv2 and SSLv3 - # pylint: disable=no-member ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) ctx.options |= ( ssl.OP_ALL | ssl.OP_NO_COMPRESSION | ssl.OP_SINGLE_DH_USE | @@ -357,7 +353,6 @@ def create_https_connection( # remove the slice of negating protocol options according to options tls_span = get_proper_tls_version_span(tls_version_min, tls_version_max) - # pylint: enable=no-member # set up the correct TLS version flags for the SSL context if tls_span is not None: for version in TLS_VERSIONS: diff --git a/ipalib/x509.py b/ipalib/x509.py index 05b15dad7..740cd0ac0 100644 --- a/ipalib/x509.py +++ b/ipalib/x509.py @@ -809,12 +809,10 @@ class ExternalCAProfile: _oid = univ.ObjectIdentifier(parts[0]) # It is; construct a V2 template - # pylint: disable=too-many-function-args return MSCSTemplateV2.__new__(MSCSTemplateV2, s) except pyasn1.error.PyAsn1Error: # It is not an OID; treat as a template name - # pylint: disable=too-many-function-args return MSCSTemplateV1.__new__(MSCSTemplateV1, s) def __getstate__(self): diff --git a/ipapython/admintool.py b/ipapython/admintool.py index 991e85e01..fdb4400d8 100644 --- a/ipapython/admintool.py +++ b/ipapython/admintool.py @@ -180,9 +180,8 @@ class AdminTool: return_value = self.run() except BaseException as exception: if isinstance(exception, ScriptError): - # pylint: disable=no-member if exception.rval and exception.rval > return_value: - return_value = exception.rval # pylint: disable=no-member + return_value = exception.rval traceback = sys.exc_info()[2] error_message, return_value = self.handle_error(exception) if return_value: @@ -244,7 +243,7 @@ class AdminTool: root_logger = logging.getLogger() for handler in root_logger.handlers: if (isinstance(handler, logging.StreamHandler) and - handler.stream is sys.stderr): # pylint: disable=no-member + handler.stream is sys.stderr): root_logger.removeHandler(handler) break diff --git a/ipapython/dnsutil.py b/ipapython/dnsutil.py index 4abe5101f..4baeaf8cc 100644 --- a/ipapython/dnsutil.py +++ b/ipapython/dnsutil.py @@ -162,7 +162,6 @@ class DNSName(dns.name.Name): def __init__(self, labels, origin=None): try: if isinstance(labels, str): - #pylint: disable=E1101 labels = dns.name.from_text(unicode(labels), origin).labels elif isinstance(labels, dns.name.Name): labels = labels.labels diff --git a/ipapython/dogtag.py b/ipapython/dogtag.py index 8f0f0473a..795bf681a 100644 --- a/ipapython/dogtag.py +++ b/ipapython/dogtag.py @@ -41,7 +41,6 @@ from ipapython import ipautil try: import httplib except ImportError: - # pylint: disable=import-error import http.client as httplib if six.PY3: @@ -67,7 +66,7 @@ KDC_PROFILE = u'KDCs_PKINIT_Certs' if six.PY3: - gzip_decompress = gzip.decompress # pylint: disable=no-member + gzip_decompress = gzip.decompress else: # note: gzip.decompress available in Python >= 3.2 def gzip_decompress(data): diff --git a/ipapython/ipachangeconf.py b/ipapython/ipachangeconf.py index e1ed16101..de5dc3562 100644 --- a/ipapython/ipachangeconf.py +++ b/ipapython/ipachangeconf.py @@ -216,7 +216,7 @@ class IPAChangeConf: if value: return {'name': 'comment', 'type': 'comment', - 'value': value.rstrip()} # pylint: disable=E1103 + 'value': value.rstrip()} o = dict() parts = line.split(self.dassign, 1) diff --git a/ipapython/ipaldap.py b/ipapython/ipaldap.py index e64847b6a..f785bf0d8 100644 --- a/ipapython/ipaldap.py +++ b/ipapython/ipaldap.py @@ -84,7 +84,7 @@ if six.PY2 and hasattr(ldap, 'LDAPBytesWarning'): # XXX silence python-ldap's BytesWarnings warnings.filterwarnings( action="ignore", - category=ldap.LDAPBytesWarning, # pylint: disable=no-member + category=ldap.LDAPBytesWarning, ) @@ -255,7 +255,7 @@ class LDAPEntry(MutableMapping): Keyword arguments can be used to override values of specific attributes. """ - super(LDAPEntry, self).__init__() # pylint: disable=no-member + super(LDAPEntry, self).__init__() if isinstance(_conn, LDAPEntry): assert _dn is None @@ -284,7 +284,6 @@ class LDAPEntry(MutableMapping): self._single_value_view = None if isinstance(_obj, LDAPEntry): - #pylint: disable=E1103 self._not_list = set(_obj._not_list) self._orig_raw = dict(_obj._orig_raw) if _obj.conn is _conn: @@ -1933,7 +1932,6 @@ class LDAPCache(LDAPClient): def get_entry(self, dn, attrs_list=None, time_limit=None, size_limit=None, get_effective_rights=False): - # pylint: disable=no-member if not self._enable_cache: return super(LDAPCache, self).get_entry( dn, attrs_list, time_limit, size_limit, get_effective_rights @@ -1971,7 +1969,6 @@ class LDAPCache(LDAPClient): get_all = True if entry and entry.all and get_all: - # self.hit # pylint: disable=pointless-statement hits = self._cache_hits + 1 # pylint: disable=no-member object.__setattr__(self, '_cache_hits', hits) self.cache_status('HIT') diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py index b5685f1e6..b1c2c1815 100644 --- a/ipapython/ipautil.py +++ b/ipapython/ipautil.py @@ -544,7 +544,7 @@ def run(args, stdin=None, raiseonerr=True, nolog=(), env=None, raise finally: if skip_output: - p_out.close() # pylint: disable=E1103 + p_out.close() logger.debug('Process finished, return code=%s', p.returncode) @@ -1513,7 +1513,7 @@ if six.PY2: str.__name__, type(value).__name__)) else: - fsdecode = os.fsdecode #pylint: disable=no-member + fsdecode = os.fsdecode def unescape_seq(seq, *args): diff --git a/ipapython/ssh.py b/ipapython/ssh.py index 6a594b04c..2b2a98bd6 100644 --- a/ipapython/ssh.py +++ b/ipapython/ssh.py @@ -26,7 +26,7 @@ import base64 import re import struct from hashlib import sha1 -from hashlib import sha256 # pylint: disable=E0611 +from hashlib import sha256 import six diff --git a/ipaserver/custodia/httpd/authenticators.py b/ipaserver/custodia/httpd/authenticators.py index a679066a9..d2dbc4d3b 100644 --- a/ipaserver/custodia/httpd/authenticators.py +++ b/ipaserver/custodia/httpd/authenticators.py @@ -41,7 +41,6 @@ class SimpleHeaderAuth(HTTPAuthenticator): return None value = request['headers'][self.header] if self.value is not None: - # pylint: disable=unsupported-membership-test if value not in self.value: self.audit_svc_access(log.AUDIT_SVC_AUTH_FAIL, request['client_id'], value) diff --git a/ipaserver/custodia/httpd/authorizers.py b/ipaserver/custodia/httpd/authorizers.py index 0061904cb..7513a804d 100644 --- a/ipaserver/custodia/httpd/authorizers.py +++ b/ipaserver/custodia/httpd/authorizers.py @@ -22,7 +22,7 @@ class SimplePathAuthz(HTTPAuthorizer): # if an authorized path does not end in / # check if it matches fullpath for strict match - for authz in self.paths: # pylint: disable=not-an-iterable + for authz in self.paths: if authz.endswith('/'): continue if authz.endswith('.'): @@ -34,7 +34,6 @@ class SimplePathAuthz(HTTPAuthorizer): return True while path != '': - # pylint: disable=unsupported-membership-test if path in self.paths: self.audit_svc_access(log.AUDIT_SVC_AUTHZ_PASS, request['client_id'], path) diff --git a/ipaserver/custodia/httpd/server.py b/ipaserver/custodia/httpd/server.py index 218b66017..35a32716b 100644 --- a/ipaserver/custodia/httpd/server.py +++ b/ipaserver/custodia/httpd/server.py @@ -20,7 +20,7 @@ from ipaserver.custodia import log from ipaserver.custodia.plugin import HTTPError try: - from systemd import daemon as sd # pylint: disable=import-error + from systemd import daemon as sd except ImportError: sd = None if 'NOTIFY_SOCKET' in os.environ: @@ -61,7 +61,7 @@ class ForkingHTTPServer(ForkingTCPServer): def __init__(self, server_address, handler_class, config, bind_and_activate=True): - # pylint: disable=super-init-not-called, non-parent-init-called + # pylint: disable=non-parent-init-called # Init just BaseServer, TCPServer creates a socket. BaseServer.__init__(self, server_address, handler_class) diff --git a/ipaserver/custodia/log.py b/ipaserver/custodia/log.py index 3e814069f..7c15b0cb1 100644 --- a/ipaserver/custodia/log.py +++ b/ipaserver/custodia/log.py @@ -55,7 +55,6 @@ class CustodiaLoggingAdapter(logging.LoggerAdapter): extra = {'origin': plugin.origin} super(CustodiaLoggingAdapter, self).__init__(logger, extra=extra) - # pylint: disable=arguments-differ def exception(self, msg, *args, **kwargs): """Like standard exception() logger but only print stack in debug mode """ diff --git a/ipaserver/custodia/plugin.py b/ipaserver/custodia/plugin.py index 45243ac74..c3d6fc6f0 100644 --- a/ipaserver/custodia/plugin.py +++ b/ipaserver/custodia/plugin.py @@ -8,7 +8,6 @@ import inspect import json import pwd import re -import sys from jwcrypto.common import json_encode @@ -262,17 +261,12 @@ class CustodiaPluginMeta(abc.ABCMeta): ncls = super(CustodiaPluginMeta, cls).__new__( cls, name, bases, namespace, **kwargs) - if sys.version_info < (3, 0): - # pylint: disable=deprecated-method - args = inspect.getargspec(ncls.__init__).args - # pylint: enable=deprecated-method - else: - sig = inspect.signature(ncls.__init__) # pylint: disable=no-member - args = list(sig.parameters) + sig = inspect.signature(ncls.__init__) + args = list(sig.parameters) if args[1:3] != ['config', 'section']: # old-style plugin class - ncls._options = None # pylint: disable=protected-access + ncls._options = None return ncls # new-style plugin class @@ -288,7 +282,7 @@ class CustodiaPluginMeta(abc.ABCMeta): value.name = name options.append(value) - ncls._options = tuple(options) # pylint: disable=protected-access + ncls._options = tuple(options) return ncls @@ -315,7 +309,6 @@ class CustodiaPlugin: if section is not None and self._options is not None: # new style configuration opt = OptionHandler(config, section) - # pylint: disable=not-an-iterable for option in self._options: value = opt.get(option) # special case for store @@ -359,9 +352,7 @@ class CustodiaPlugin: raise ValueError( "'{}' references non-existing store '{}'".format( self.section, self.store_name)) - # pylint: disable=attribute-defined-outside-init self.store = store_plugin - # pylint: enable=attribute-defined-outside-init store_plugin.finalize_init(config, cfgparser, context=self) def finalize_init(self, config, cfgparser, context=None): diff --git a/ipaserver/custodia/server/__init__.py b/ipaserver/custodia/server/__init__.py index 5face3733..e713de20d 100644 --- a/ipaserver/custodia/server/__init__.py +++ b/ipaserver/custodia/server/__init__.py @@ -67,11 +67,11 @@ def _create_plugin(cfgparser, section, menu): handler = _load_plugin_class(menu, handler_name) classname = handler.__name__ hconf['facility_name'] = '%s-[%s]' % (classname, section) - except Exception as e: # pylint: disable=broad-except + except Exception as e: raise ValueError('Invalid format for "handler" option ' '[%r]: %s' % (e, handler_name)) - if handler._options is not None: # pylint: disable=protected-access + if handler._options is not None: # new-style plugin with parser and section plugin = handler(cfgparser, section) else: diff --git a/ipaserver/dnssec/ldapkeydb.py b/ipaserver/dnssec/ldapkeydb.py index ef604f763..bfe8d5c52 100644 --- a/ipaserver/dnssec/ldapkeydb.py +++ b/ipaserver/dnssec/ldapkeydb.py @@ -32,7 +32,6 @@ def uri_escape(val): raise ValueError("zero-length URI component detected") hexval = str_hexlify(val) out = '%' - # pylint: disable=E1127 out += '%'.join(hexval[i:i+2] for i in range(0, len(hexval), 2)) return out diff --git a/ipaserver/install/ca.py b/ipaserver/install/ca.py index e0ca7f4b9..eb0206289 100644 --- a/ipaserver/install/ca.py +++ b/ipaserver/install/ca.py @@ -491,7 +491,6 @@ class CAInstallInterface(dogtag.DogtagInstallInterface, external_ca_profile = master_install_only(external_ca_profile) external_cert_files = knob( - # pylint: disable=invalid-sequence-index typing.List[str], None, description=("File containing the IPA CA certificate and the external " "CA certificate chain"), diff --git a/ipaserver/install/certs.py b/ipaserver/install/certs.py index 0acab92b0..f01295da1 100644 --- a/ipaserver/install/certs.py +++ b/ipaserver/install/certs.py @@ -774,7 +774,7 @@ class _CrossProcessLock: if six.PY2: p.readfp(fileobj) # pylint: disable=deprecated-method else: - p.read_file(fileobj) # pylint: disable=no-member + p.read_file(fileobj) try: self._locked = p.getboolean('lock', 'locked') diff --git a/ipaserver/install/dns.py b/ipaserver/install/dns.py index b51b92bfd..47d79af9c 100644 --- a/ipaserver/install/dns.py +++ b/ipaserver/install/dns.py @@ -444,7 +444,6 @@ class DNSInstallInterface(hostname.HostNameInstallInterface): allow_zone_overlap = prepare_only(allow_zone_overlap) reverse_zones = knob( - # pylint: disable=invalid-sequence-index typing.List[str], [], description=("The reverse DNS zone to use. This option can be used " "multiple times"), @@ -506,7 +505,6 @@ class DNSInstallInterface(hostname.HostNameInstallInterface): raise ValueError(error) forwarders = knob( - # pylint: disable=invalid-sequence-index typing.List[ipautil.CheckedIPAddressLoopback], None, description=("Add a DNS forwarder. This option can be used multiple " "times"), diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py index 57fc4870f..04d26452d 100644 --- a/ipaserver/install/dsinstance.py +++ b/ipaserver/install/dsinstance.py @@ -993,7 +993,6 @@ class DsInstance(service.Service): def __setup_s4u2proxy(self): - # pylint: disable=unused-private-member def __add_principal(last_cn, principal, self): dn = DN(('cn', last_cn), ('cn', 's4u2proxy'), ('cn', 'etc'), self.suffix) diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py index 179f87337..b791d0943 100644 --- a/ipaserver/install/installutils.py +++ b/ipaserver/install/installutils.py @@ -171,7 +171,7 @@ def verify_fqdn(host_name, no_host_dns=False, local_hostname=True): except socket.error as e: logger.debug( 'socket.gethostbyaddr() error: %d: %s', - e.errno, e.strerror) # pylint: disable=no-member + e.errno, e.strerror) if no_host_dns: print("Warning: skipping DNS resolution of host", host_name) diff --git a/ipaserver/install/ipa_otptoken_import.py b/ipaserver/install/ipa_otptoken_import.py index 2f658ea69..b3f934706 100644 --- a/ipaserver/install/ipa_otptoken_import.py +++ b/ipaserver/install/ipa_otptoken_import.py @@ -75,7 +75,6 @@ def convertDate(value): dt = dateutil.parser.parse(value) - # pylint: disable=E1101 if dt.tzinfo is None: dt = datetime.datetime(*dt.timetuple()[0:6], tzinfo=dateutil.tz.tzlocal()) @@ -535,11 +534,11 @@ 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: # pylint: disable=no-member + if self.safe_options.keyfile is None: raise admintool.ScriptError("Encryption key required: %s!" % self.doc.keyname) # Load the keyfile. - keyfile = self.safe_options.keyfile # pylint: disable=no-member + keyfile = self.safe_options.keyfile with open(keyfile) as f: self.doc.setKey(f.read()) diff --git a/ipaserver/install/ipa_replica_install.py b/ipaserver/install/ipa_replica_install.py index 3953cda05..0b5d484b7 100644 --- a/ipaserver/install/ipa_replica_install.py +++ b/ipaserver/install/ipa_replica_install.py @@ -47,14 +47,12 @@ class CompatServerReplicaInstall(ServerReplicaInstall): self.__dm_password = value ip_addresses = extend_knob( - ServerReplicaInstall.ip_addresses, # pylint: disable=no-member + ServerReplicaInstall.ip_addresses, description="Replica server IP Address. This option can be used " "multiple times", ) - admin_password = ( - ServerReplicaInstall.admin_password # pylint: disable=no-member - ) + admin_password = ServerReplicaInstall.admin_password admin_password = extend_knob( admin_password, cli_names=list(admin_password.cli_names) + ['-w'], diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py index c6ba2d93a..5b7ac61d0 100644 --- a/ipaserver/install/ipa_restore.py +++ b/ipaserver/install/ipa_restore.py @@ -798,11 +798,9 @@ class Restore(admintool.AdminTool): self.backup_host = config.get('ipa', 'host') self.backup_ipa_version = config.get('ipa', 'ipa_version') self.backup_version = config.get('ipa', 'version') - # pylint: disable=no-member # we can assume that returned object is string and it has .split() # method self.backup_services = config.get('ipa', 'services').split(',') - # pylint: enable=no-member def extract_backup(self): ''' diff --git a/ipaserver/install/ipa_server_install.py b/ipaserver/install/ipa_server_install.py index 99d230d41..3858bf588 100644 --- a/ipaserver/install/ipa_server_install.py +++ b/ipaserver/install/ipa_server_install.py @@ -18,19 +18,18 @@ class CompatServerMasterInstall(ServerMasterInstall): request_cert = False dm_password = extend_knob( - ServerMasterInstall.dm_password, # pylint: disable=no-member + ServerMasterInstall.dm_password, cli_names=['--ds-password', '-p'], ) admin_password = ServerMasterInstall.admin_password admin_password = extend_knob( admin_password, - # pylint: disable=no-member cli_names=list(admin_password.cli_names) + ['-a'], ) ip_addresses = extend_knob( - ServerMasterInstall.ip_addresses, # pylint: disable=no-member + ServerMasterInstall.ip_addresses, description="Master Server IP Address. This option can be used " "multiple times", ) diff --git a/ipaserver/install/ipactl.py b/ipaserver/install/ipactl.py index 7f0361d37..9c9e7e7cf 100644 --- a/ipaserver/install/ipactl.py +++ b/ipaserver/install/ipactl.py @@ -395,7 +395,7 @@ def ipa_start(options): if isinstance(e, IpactlError): # do not display any other error message - raise IpactlError(rval=e.rval) # pylint: disable=no-member + raise IpactlError(rval=e.rval) else: raise IpactlError() @@ -509,7 +509,7 @@ def ipa_restart(options): pass if isinstance(e, IpactlError): # do not display any other error message - raise IpactlError(rval=e.rval) # pylint: disable=no-member + raise IpactlError(rval=e.rval) else: raise IpactlError() diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py index a9dd6ea60..71b327a64 100644 --- a/ipaserver/install/replication.py +++ b/ipaserver/install/replication.py @@ -1593,12 +1593,12 @@ class ReplicationManager: pass except Exception as e: if force and err: - raise err #pylint: disable=E0702 + raise err else: raise e if err: - raise err #pylint: disable=E0702 + raise err def set_readonly(self, readonly, critical=False): """ diff --git a/ipaserver/install/server/__init__.py b/ipaserver/install/server/__init__.py index dd104fa0a..f8d4b238f 100644 --- a/ipaserver/install/server/__init__.py +++ b/ipaserver/install/server/__init__.py @@ -60,7 +60,6 @@ class ServerCertificateInstallInterface(service.ServiceInstallInterface): description = "SSL certificate" dirsrv_cert_files = knob( - # pylint: disable=invalid-sequence-index typing.List[str], None, description=("File containing the Directory Server SSL certificate " "and private key"), @@ -71,7 +70,6 @@ class ServerCertificateInstallInterface(service.ServiceInstallInterface): dirsrv_cert_files = prepare_only(dirsrv_cert_files) http_cert_files = knob( - # pylint: disable=invalid-sequence-index typing.List[str], None, description=("File containing the Apache Server SSL certificate and " "private key"), @@ -82,7 +80,6 @@ class ServerCertificateInstallInterface(service.ServiceInstallInterface): http_cert_files = prepare_only(http_cert_files) pkinit_cert_files = knob( - # pylint: disable=invalid-sequence-index typing.List[str], None, description=("File containing the Kerberos KDC SSL certificate and " "private key"), @@ -171,7 +168,6 @@ class ServerInstallInterface(ServerCertificateInstallInterface, domain_name = client.ClientInstallInterface.domain_name domain_name = extend_knob( domain_name, - # pylint: disable=no-member cli_names=list(domain_name.cli_names) + ['-n'], ) @@ -453,7 +449,7 @@ class ServerInstallInterface(ServerCertificateInstallInterface, "You cannot specify --external-ca-profile without " "--external-ca") - if self.uninstalling: # pylint: disable=using-constant-test + if self.uninstalling: if (self.realm_name or self.admin_password or self.master_password): raise RuntimeError( diff --git a/ipaserver/install/server/replicainstall.py b/ipaserver/install/server/replicainstall.py index 1857813c0..8b79a79a0 100644 --- a/ipaserver/install/server/replicainstall.py +++ b/ipaserver/install/server/replicainstall.py @@ -823,14 +823,12 @@ def promote_check(installer): env._bootstrap(context='installer', confdir=paths.ETC_IPA, log=None) env._finalize_core(**dict(constants.DEFAULT_CONFIG)) - # pylint: disable=no-member xmlrpc_uri = 'https://{}/ipa/xml'.format(ipautil.format_netloc(env.host)) api.bootstrap(in_server=True, context='installer', confdir=paths.ETC_IPA, ldap_uri=ipaldap.realm_to_ldapi_uri(env.realm), xmlrpc_uri=xmlrpc_uri) - # pylint: enable=no-member api.finalize() config = ReplicaConfig() diff --git a/ipaserver/plugins/batch.py b/ipaserver/plugins/batch.py index b95944c54..b7fe157d6 100644 --- a/ipaserver/plugins/batch.py +++ b/ipaserver/plugins/batch.py @@ -185,13 +185,13 @@ class batch(Command): isinstance(e, errors.ConversionError)): logger.info( '%s: batch: %s', - context.principal, # pylint: disable=no-member + context.principal, e.__class__.__name__ ) else: logger.info( '%s: batch: %s(%s): %s', - context.principal, name, # pylint: disable=no-member + context.principal, name, ', '.join(api.Command[name]._repr_iter(**params)), e.__class__.__name__ ) diff --git a/ipaserver/plugins/cert.py b/ipaserver/plugins/cert.py index 93ed9fa33..850e6d3f5 100644 --- a/ipaserver/plugins/cert.py +++ b/ipaserver/plugins/cert.py @@ -1380,7 +1380,7 @@ class cert_show(Retrieve, CertMethod, VirtualCommand): logger.debug("Not granted by ACI to retrieve certificate, " "looking at principal") if not bind_principal_can_manage_cert(cert): - raise acierr # pylint: disable=E0702 + raise acierr ca_obj = api.Command.ca_show( options['cacn'], diff --git a/ipaserver/plugins/hbactest.py b/ipaserver/plugins/hbactest.py index e213c2c9a..887a35b7e 100644 --- a/ipaserver/plugins/hbactest.py +++ b/ipaserver/plugins/hbactest.py @@ -247,7 +247,7 @@ def _convert_to_ipa_rule(rule): if attr_name in rule: element[4].groups = rule[attr_name] if 'externalhost' in rule: - ipa_rule.srchosts.names.extend(rule['externalhost']) #pylint: disable=E1101 + ipa_rule.srchosts.names.extend(rule['externalhost']) return ipa_rule diff --git a/ipaserver/plugins/permission.py b/ipaserver/plugins/permission.py index 751bde50c..afd913756 100644 --- a/ipaserver/plugins/permission.py +++ b/ipaserver/plugins/permission.py @@ -658,7 +658,7 @@ class permission(baseldap.LDAPObject): permission_entry, old_name, notfound_ok=True) # (pylint thinks `acientry` is just a dict, but it's an LDAPEntry) - acidn = acientry.dn # pylint: disable=E1103 + acidn = acientry.dn if acistring is not None: logger.debug('Removing ACI %r from %s', acistring, acidn) @@ -746,7 +746,7 @@ class permission(baseldap.LDAPObject): # The DN of old permissions is always basedn # (pylint thinks `base` is just a dict, but it's an LDAPEntry) - assert base.dn == self.api.env.basedn, base # pylint: disable=E1103 + assert base.dn == self.api.env.basedn, base aci = ACI(acistring) diff --git a/ipaserver/plugins/privilege.py b/ipaserver/plugins/privilege.py index 22786e855..a0e68684e 100644 --- a/ipaserver/plugins/privilege.py +++ b/ipaserver/plugins/privilege.py @@ -87,7 +87,7 @@ def principal_has_privilege(api, principal, privilege): privilege_dn = api.Object.privilege.get_dn(privilege) ldap = api.Backend.ldap2 filter = ldap.make_filter({ - 'krbprincipalname': principal, # pylint: disable=no-member + 'krbprincipalname': principal, 'memberof': privilege_dn}, rules=ldap.MATCH_ALL) try: diff --git a/ipaserver/plugins/vault.py b/ipaserver/plugins/vault.py index 490c0cf1e..aebac7dff 100644 --- a/ipaserver/plugins/vault.py +++ b/ipaserver/plugins/vault.py @@ -39,13 +39,11 @@ from ipaserver.masters import is_service_enabled if api.env.in_server: import pki.account import pki.key - # pylint: disable=no-member try: # pki >= 10.4.0 from pki.crypto import DES_EDE3_CBC_OID except ImportError: DES_EDE3_CBC_OID = pki.key.KeyClient.DES_EDE3_CBC_OID - # pylint: enable=no-member if six.PY3: diff --git a/ipatests/azure/scripts/setup_containers.py b/ipatests/azure/scripts/setup_containers.py index 71963a2c8..475dd854d 100644 --- a/ipatests/azure/scripts/setup_containers.py +++ b/ipatests/azure/scripts/setup_containers.py @@ -34,7 +34,7 @@ IPA_TESTS_ENV_DIR = os.path.join(IPA_TESTS_ENV_WORKING_DIR, IPA_TESTS_ENV_NAME) IPA_TEST_CONFIG = "ipa-test-config.yaml" -class ExecRunReturn(NamedTuple): # pylint: disable=inherit-non-class #3876 +class ExecRunReturn(NamedTuple): exit_code: int output: Tuple[bytes, bytes] diff --git a/ipatests/conftest.py b/ipatests/conftest.py index 1fed59542..b2b13168c 100644 --- a/ipatests/conftest.py +++ b/ipatests/conftest.py @@ -151,11 +151,9 @@ def pytest_cmdline_main(config): def pytest_runtest_setup(item): if isinstance(item, pytest.Function): if item.get_closest_marker('skip_ipaclient_unittest'): - # pylint: disable=no-member if item.config.option.ipaclient_unittests: pytest.skip("Skip in ipaclient unittest mode") if item.get_closest_marker('needs_ipaapi'): - # pylint: disable=no-member if item.config.option.skip_ipaapi: pytest.skip("Skip tests that needs an IPA API") if osinfo is not None: diff --git a/ipatests/i18n.py b/ipatests/i18n.py index 9967d5a10..49f5c4c32 100644 --- a/ipatests/i18n.py +++ b/ipatests/i18n.py @@ -624,10 +624,8 @@ def test_translations(po_file, lang, domain, locale_dir): t = gettext.translation(domain, locale_dir) if six.PY2: - # pylint: disable=no-member get_msgstr = t.ugettext get_msgstr_plural = t.ungettext - # pylint: enable=no-member else: get_msgstr = t.gettext get_msgstr_plural = t.ngettext diff --git a/ipatests/pytest_ipa/declarative.py b/ipatests/pytest_ipa/declarative.py index 529856b60..17e365ac1 100644 --- a/ipatests/pytest_ipa/declarative.py +++ b/ipatests/pytest_ipa/declarative.py @@ -29,7 +29,7 @@ def pytest_generate_tests(metafunc): if callable(test): description = '%s: %s' % ( str(i).zfill(4), - test.__name__, # test is not a dict. pylint: disable=E1103 + test.__name__, ) else: description = '%s: %s: %s' % (str(i).zfill(4), diff --git a/ipatests/pytest_ipa/integration/tasks.py b/ipatests/pytest_ipa/integration/tasks.py index d06f8eb2c..1119f55ef 100755 --- a/ipatests/pytest_ipa/integration/tasks.py +++ b/ipatests/pytest_ipa/integration/tasks.py @@ -1904,7 +1904,7 @@ def ldappasswd_user_change(user, oldpw, newpw, master, use_dirman=False, if use_dirman: args = [paths.LDAPPASSWD, '-D', - str(master.config.dirman_dn), # pylint: disable=no-member + str(master.config.dirman_dn), '-w', master.config.dirman_password, '-s', newpw, '-x', '-ZZ', '-H', master_ldap_uri, userdn] else: @@ -1922,7 +1922,7 @@ def ldappasswd_sysaccount_change(user, oldpw, newpw, master, use_dirman=False): if use_dirman: args = [paths.LDAPPASSWD, '-D', - str(master.config.dirman_dn), # pylint: disable=no-member + str(master.config.dirman_dn), '-w', master.config.dirman_password, '-a', oldpw, '-s', newpw, '-x', '-ZZ', '-H', master_ldap_uri, diff --git a/ipatests/test_custodia/test_server.py b/ipatests/test_custodia/test_server.py index 2c6a81c05..9fae2728f 100644 --- a/ipatests/test_custodia/test_server.py +++ b/ipatests/test_custodia/test_server.py @@ -10,8 +10,6 @@ from ipaserver.custodia.server.config import parse_config HERE = os.path.dirname(os.path.abspath(__file__)) EMPTY_CONF = os.path.join(HERE, 'empty.conf') -# pylint: disable=redefined-outer-name - @pytest.fixture() def args(): diff --git a/ipatests/test_integration/base.py b/ipatests/test_integration/base.py index dc91598c0..4b49e47ac 100644 --- a/ipatests/test_integration/base.py +++ b/ipatests/test_integration/base.py @@ -77,7 +77,7 @@ class IntegrationTest: else: domain_level = cls.master.config.domain_level - if cls.master.config.fips_mode: # pylint: disable=using-constant-test + if cls.master.config.fips_mode: cls.fips_mode = True if cls.fips_mode: cls.enable_fips_mode() diff --git a/ipatests/test_integration/test_automember.py b/ipatests/test_integration/test_automember.py index 517ab3712..f01396414 100644 --- a/ipatests/test_integration/test_automember.py +++ b/ipatests/test_integration/test_automember.py @@ -102,15 +102,15 @@ class TestAutounmembership(IntegrationTest): def check_autounmembership_in_ldap(self, state='on'): """Check autounmembership state.""" conn = self.master.ldap_connect() - entry = conn.get_entry(self.dn) # pylint: disable=no-member + entry = conn.get_entry(self.dn) assert state == entry.single_value['automemberprocessmodifyops'] def disable_autounmembership_in_ldap(self): """Disable autounmembership.""" conn = self.master.ldap_connect() - entry = conn.get_entry(self.dn) # pylint: disable=no-member + entry = conn.get_entry(self.dn) entry.single_value['automemberprocessmodifyops'] = 'off' - conn.update_entry(entry) # pylint: disable=no-member + conn.update_entry(entry) self.master.run_command(['ipactl', 'restart']) def test_modify_user_entry_unmembership(self): diff --git a/ipatests/test_integration/test_caless.py b/ipatests/test_integration/test_caless.py index 4481845da..96f477bbe 100644 --- a/ipatests/test_integration/test_caless.py +++ b/ipatests/test_integration/test_caless.py @@ -131,11 +131,11 @@ class CALessBase(IntegrationTest): cls.cert_password = cls.master.config.admin_password cls.crl_path = os.path.join(cls.master.config.test_dir, 'crl') - if cls.replicas: # pylint: disable=using-constant-test + if cls.replicas: replica_hostname = cls.replicas[0].hostname else: replica_hostname = 'unused-replica.test' - if cls.clients: # pylint: disable=using-constant-test + if cls.clients: client_hostname = cls.clients[0].hostname else: client_hostname = 'unused-client.test' diff --git a/ipatests/test_integration/test_commands.py b/ipatests/test_integration/test_commands.py index 64da31c06..7de5ec85f 100644 --- a/ipatests/test_integration/test_commands.py +++ b/ipatests/test_integration/test_commands.py @@ -363,7 +363,7 @@ class TestIPACommand(IntegrationTest): master = self.master # Add a system account and add it to a group managed by the policy - base_dn = str(master.domain.basedn) # pylint: disable=no-member + base_dn = str(master.domain.basedn) entry_ldif = textwrap.dedent(""" dn: uid={account_name},cn=sysaccounts,cn=etc,{base_dn} changetype: add @@ -877,7 +877,7 @@ class TestIPACommand(IntegrationTest): ) conn = self.master.ldap_connect() - entry = conn.get_entry(dn) # pylint: disable=no-member + entry = conn.get_entry(dn) # original setting and all settings without state orig_cfg = list(entry['ipaConfigString']) @@ -888,19 +888,19 @@ class TestIPACommand(IntegrationTest): cfg = [HIDDEN_SERVICE] cfg.extend(other_cfg) entry['ipaConfigString'] = cfg - conn.update_entry(entry) # pylint: disable=no-member + conn.update_entry(entry) self.master.run_command(['ipa', 'config-show']) # test with configured cfg = [CONFIGURED_SERVICE] cfg.extend(other_cfg) entry['ipaConfigString'] = cfg - conn.update_entry(entry) # pylint: disable=no-member + conn.update_entry(entry) self.master.run_command(['ipa', 'config-show']) finally: # reset entry['ipaConfigString'] = orig_cfg - conn.update_entry(entry) # pylint: disable=no-member + conn.update_entry(entry) def test_ssh_from_controller(self): """https://pagure.io/SSSD/sssd/issue/3979 @@ -1255,9 +1255,9 @@ class TestIPACommand(IntegrationTest): ) assert console_msg in result.stdout_text # verify using backend - conn = self.master.ldap_connect() # pylint: disable=no-member + conn = self.master.ldap_connect() dn = DN(('cn', 'NIS Server'), ('cn', 'plugins'), ('cn', 'config')) - entry = conn.get_entry(dn) # pylint: disable=no-member + entry = conn.get_entry(dn) nispluginstring = entry.get('nsslapd-pluginEnabled') assert 'on' in nispluginstring # restart for changes to take effect @@ -1289,9 +1289,9 @@ class TestIPACommand(IntegrationTest): ) assert msg in result.stdout_text # verify using backend - conn = self.master.ldap_connect() # pylint: disable=no-member + conn = self.master.ldap_connect() dn = DN(('cn', 'NIS Server'), ('cn', 'plugins'), ('cn', 'config')) - entry = conn.get_entry(dn) # pylint: disable=no-member + entry = conn.get_entry(dn) nispluginstring = entry.get('nsslapd-pluginEnabled') assert 'off' in nispluginstring # restart dirsrv for changes to take effect diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py index b6e3501cb..c2f3191c4 100644 --- a/ipatests/test_integration/test_installation.py +++ b/ipatests/test_integration/test_installation.py @@ -757,7 +757,7 @@ class TestInstallMaster(IntegrationTest): related: https://pagure.io/freeipa/issue/8193 """ conn = self.master.ldap_connect() - entry = conn.get_entry(DN( # pylint: disable=no-member + entry = conn.get_entry(DN( "cn=groups,cn=Schema Compatibility,cn=plugins,cn=config")) entry_list = list(entry['schema-compat-entry-attribute']) diff --git a/ipatests/test_integration/test_ipahealthcheck.py b/ipatests/test_integration/test_ipahealthcheck.py index 9821639ef..4d893add1 100644 --- a/ipatests/test_integration/test_ipahealthcheck.py +++ b/ipatests/test_integration/test_ipahealthcheck.py @@ -964,15 +964,15 @@ class TestIpaHealthCheck(IntegrationTest): dn = DN( ("cn", "config"), ) - entry = ldap.get_entry(dn) # pylint: disable=no-member + entry = ldap.get_entry(dn) entry.single_value["nsslapd-logging-hr-timestamps-enabled"] = 'off' - ldap.update_entry(entry) # pylint: disable=no-member + ldap.update_entry(entry) yield - entry = ldap.get_entry(dn) # pylint: disable=no-member + entry = ldap.get_entry(dn) entry.single_value["nsslapd-logging-hr-timestamps-enabled"] = 'on' - ldap.update_entry(entry) # pylint: disable=no-member + ldap.update_entry(entry) def test_ipahealthcheck_ds_configcheck(self, update_logging): """ @@ -1104,15 +1104,15 @@ class TestIpaHealthCheck(IntegrationTest): ("cn", "plugins"), ("cn", "config"), ) - entry = ldap.get_entry(dn) # pylint: disable=no-member + entry = ldap.get_entry(dn) entry.single_value["referint-update-delay"] = -1 - ldap.update_entry(entry) # pylint: disable=no-member + ldap.update_entry(entry) yield - entry = ldap.get_entry(dn) # pylint: disable=no-member + entry = ldap.get_entry(dn) entry.single_value["referint-update-delay"] = 0 - ldap.update_entry(entry) # pylint: disable=no-member + ldap.update_entry(entry) def test_ipahealthcheck_ds_riplugincheck(self, update_riplugin): """ @@ -1140,15 +1140,15 @@ class TestIpaHealthCheck(IntegrationTest): """ ldap = self.master.ldap_connect() dn = DN(("cn", "config"),) - entry = ldap.get_entry(dn) # pylint: disable=no-member + entry = ldap.get_entry(dn) entry.single_value["nsslapd-rootpwstoragescheme"] = "MD5" - ldap.update_entry(entry) # pylint: disable=no-member + ldap.update_entry(entry) yield - entry = ldap.get_entry(dn) # pylint: disable=no-member + entry = ldap.get_entry(dn) entry.single_value["nsslapd-rootpwstoragescheme"] = "PBKDF2_SHA256" - ldap.update_entry(entry) # pylint: disable=no-member + ldap.update_entry(entry) def test_ds_configcheck_passwordstorage(self, modify_pwdstoragescheme): """ @@ -1563,16 +1563,16 @@ class TestIpaHealthCheckWithADtrust(IntegrationTest): ("cn", "etc"), basedn, ) - entry = ldap.get_entry(dn) # pylint: disable=no-member + entry = ldap.get_entry(dn) krbprinc = entry['member'] entry['member'] = '' - ldap.update_entry(entry) # pylint: disable=no-member + ldap.update_entry(entry) yield # Add the entry back entry['member'] = krbprinc - ldap.update_entry(entry) # pylint: disable=no-member + ldap.update_entry(entry) def test_trustcontroller_principalcheck(self, modify_cifs_princ): """ @@ -2643,19 +2643,19 @@ class TestIpaHealthCheckWithExternalCA(IntegrationTest): """ ldap = self.master.ldap_connect() dn = DN(("uid", "ipara"), ("ou", "People"), ("o", "ipaca")) - entry = ldap.get_entry(dn) # pylint: disable=no-member + entry = ldap.get_entry(dn) ldap_cert_desc = entry.single_value.get("description") def _update_entry(description): - entry = ldap.get_entry(dn) # pylint: disable=no-member + entry = ldap.get_entry(dn) entry.single_value['description'] = description - ldap.update_entry(entry) # pylint: disable=no-member + ldap.update_entry(entry) yield _update_entry - entry = ldap.get_entry(dn) # pylint: disable=no-member + entry = ldap.get_entry(dn) entry.single_value['description'] = ldap_cert_desc - ldap.update_entry(entry) # pylint: disable=no-member + ldap.update_entry(entry) def test_ipahealthcheck_iparaagent_ldap(self, update_ra_cert_desc): """ diff --git a/ipatests/test_integration/test_otp.py b/ipatests/test_integration/test_otp.py index 6e70ddcb3..bec76d205 100644 --- a/ipatests/test_integration/test_otp.py +++ b/ipatests/test_integration/test_otp.py @@ -276,7 +276,7 @@ class TestOTPToken(IntegrationTest): This requires paramiko until the 2-prompt sshpass RFE is fulfilled: https://sourceforge.net/p/sshpass/feature-requests/5/ """ - if self.master.is_fips_mode: # pylint: disable=no-member + if self.master.is_fips_mode: pytest.skip("paramiko is not compatible with FIPS mode") master = self.master @@ -323,7 +323,7 @@ class TestOTPToken(IntegrationTest): new_limit = 30 conn = self.master.ldap_connect() dn = DN(('cn', 'config')) - entry = conn.get_entry(dn) # pylint: disable=no-member + entry = conn.get_entry(dn) orig_limit = entry.single_value.get('nsslapd-idletimeout') ldap_query = textwrap.dedent(""" dn: cn=config diff --git a/ipatests/test_integration/test_smb.py b/ipatests/test_integration/test_smb.py index b2b7ce2e4..eb3981bdd 100644 --- a/ipatests/test_integration/test_smb.py +++ b/ipatests/test_integration/test_smb.py @@ -211,13 +211,11 @@ class TestSMB(IntegrationTest): \s*SID:\s*S-1-5-21-\d+-\d+-\d+\n \s+ID\ range:\s*\d+\s*-\s*\d+ ''' - # pylint: disable=no-member ipa_regexp = domain_regexp_tpl.format( domain=re.escape(self.master.domain.name), netbios=self.master.netbios) ad_regexp = domain_regexp_tpl.format( domain=re.escape(self.ad.domain.name), netbios=self.ad.netbios) - # pylint: enable=no-member output_regexp = r''' Discovered\ domains.* {} diff --git a/ipatests/test_integration/test_sssd.py b/ipatests/test_integration/test_sssd.py index 309179cca..7c15e8e2d 100644 --- a/ipatests/test_integration/test_sssd.py +++ b/ipatests/test_integration/test_sssd.py @@ -221,7 +221,7 @@ class TestSSSDWithAdTrust(IntegrationTest): master = self.master conn = master.ldap_connect() dn = DN(('cn', 'config')) - entry = conn.get_entry(dn) # pylint: disable=no-member + entry = conn.get_entry(dn) orig_limit = entry.single_value.get('nsslapd-sizelimit') ldap_query = textwrap.dedent(""" dn: cn=config diff --git a/ipatests/test_integration/test_trust.py b/ipatests/test_integration/test_trust.py index c12837815..2f1b25ed7 100644 --- a/ipatests/test_integration/test_trust.py +++ b/ipatests/test_integration/test_trust.py @@ -636,12 +636,12 @@ class TestTrust(BaseTestTrust): client.run_command(test_id) conn = self.master.ldap_connect() - entry = conn.get_entry(extdom_dn) # pylint: disable=no-member + entry = conn.get_entry(extdom_dn) orig_extdom_timeout = entry.single_value.get('ipaextdommaxnsstimeout') # set the extdom plugin timeout to 1s (1000) entry.single_value['ipaextdommaxnsstimeout'] = 1000 - conn.update_entry(entry) # pylint: disable=no-member + conn.update_entry(entry) self.master.run_command(['ipactl', 'restart']) with tasks.remote_sssd_config(self.master) as sssd_conf: @@ -667,9 +667,9 @@ class TestTrust(BaseTestTrust): self.master.run_command('kill -CONT %s' % pid) # reconnect and set back to default extdom plugin conn = self.master.ldap_connect() - entry = conn.get_entry(extdom_dn) # pylint: disable=no-member + entry = conn.get_entry(extdom_dn) entry.single_value['ipaextdommaxnsstimeout'] = orig_extdom_timeout - conn.update_entry(entry) # pylint: disable=no-member + conn.update_entry(entry) tasks.restore_files(self.master) self.master.run_command(['ipactl', 'restart']) diff --git a/ipatests/test_integration/test_upgrade.py b/ipatests/test_integration/test_upgrade.py index 82fe29fc6..ffc36ce30 100644 --- a/ipatests/test_integration/test_upgrade.py +++ b/ipatests/test_integration/test_upgrade.py @@ -129,14 +129,14 @@ class TestUpgrade(IntegrationTest): ldap = self.master.ldap_connect() basedn = self.master.domain.basedn dn = DN(('cn', 'CAcert'), ('cn', 'ipa'), ('cn', 'etc'), basedn) - entry = ldap.get_entry(dn) # pylint: disable=no-member + entry = ldap.get_entry(dn) # Extract the certificate as DER then double-encode cacert = entry['cacertificate;binary'][0] cacert_der = cacert.public_bytes(serialization.Encoding.DER) cacert_b64 = base64.b64encode(cacert_der) # overwrite the value with double-encoded cert entry.single_value['cACertificate;binary'] = cacert_b64 - ldap.update_entry(entry) # pylint: disable=no-member + ldap.update_entry(entry) # try the upgrade self.master.run_command(['ipa-server-upgrade']) @@ -144,7 +144,7 @@ class TestUpgrade(IntegrationTest): # reconnect to the master (upgrade stops 389-ds) ldap = self.master.ldap_connect() # read the value after upgrade, should be fixed - entry = ldap.get_entry(dn) # pylint: disable=no-member + entry = ldap.get_entry(dn) try: _cacert = entry['cacertificate;binary'] except ValueError: diff --git a/ipatests/test_ipalib/test_frontend.py b/ipatests/test_ipalib/test_frontend.py index e9f825cf2..ad2f67dbf 100644 --- a/ipatests/test_ipalib/test_frontend.py +++ b/ipatests/test_ipalib/test_frontend.py @@ -463,7 +463,7 @@ class test_Command(ClassChecker): api.finalize() o = my_cmd(api) o.finalize() - e = o.get_default(**kw) # pylint: disable=not-callable + e = o.get_default(**kw) assert type(e) is dict assert 'option2' in e assert e['option2'] == u'some value' diff --git a/ipatests/test_ipalib/test_parameters.py b/ipatests/test_ipalib/test_parameters.py index 86326c43b..23d966fca 100644 --- a/ipatests/test_ipalib/test_parameters.py +++ b/ipatests/test_ipalib/test_parameters.py @@ -605,7 +605,7 @@ class test_Param(ClassChecker): def __init__(self, name, **kw): # (Pylint complains because the superclass is unknowm) - # pylint: disable=bad-super-call, super-on-old-class + # pylint: disable=super-on-old-class self._convert_scalar = PassThrough() super(Str, self).__init__(name, **kw) diff --git a/ipatests/test_ipalib/test_rpc.py b/ipatests/test_ipalib/test_rpc.py index 424967eb9..7e2e571ab 100644 --- a/ipatests/test_ipalib/test_rpc.py +++ b/ipatests/test_ipalib/test_rpc.py @@ -390,7 +390,5 @@ class test_rpcclient_context(PluginTester): r'^ipa_session=MagBearerToken=[A-Za-z0-9+\/]+=*;$') session_cookie = getattr(context, 'session_cookie', None) - # pylint-2 is incorrectly spewing Too many positional arguments - # pylint: disable=E1121 unquoted = urllib.parse.unquote(session_cookie) assert(unquoted == fuzzy_cookie) diff --git a/ipatests/test_ipapython/test_dn.py b/ipatests/test_ipapython/test_dn.py index ae7c68573..c826814d4 100644 --- a/ipatests/test_ipapython/test_dn.py +++ b/ipatests/test_ipapython/test_dn.py @@ -531,7 +531,6 @@ class TestRDN: def test_assignments(self): rdn = RDN((self.attr1, self.value1)) with pytest.raises(TypeError): - # pylint: disable=unsupported-assignment-operation rdn[0] = self.ava2 def test_iter(self): @@ -997,10 +996,8 @@ class TestDN: def test_assignments(self): dn = DN('t=0,t=1,t=2,t=3,t=4,t=5,t=6,t=7,t=8,t=9') with pytest.raises(TypeError): - # pylint: disable=unsupported-assignment-operation dn[0] = RDN('t=a') with pytest.raises(TypeError): - # pylint: disable=unsupported-assignment-operation dn[0:1] = [RDN('t=a'), RDN('t=b')] def test_iter(self): diff --git a/ipatests/test_ipaserver/httptest.py b/ipatests/test_ipaserver/httptest.py index 15d8bfb88..6cd034a71 100644 --- a/ipatests/test_ipaserver/httptest.py +++ b/ipatests/test_ipaserver/httptest.py @@ -44,8 +44,6 @@ class Unauthorized_HTTP_test: """ if params is not None: if self.content_type == 'application/x-www-form-urlencoded': - # urlencode *can* take two arguments - # pylint: disable=too-many-function-args params = urllib.parse.urlencode(params, True) url = 'https://' + self.host + self.app_uri diff --git a/ipatests/test_ipaserver/test_install/test_installer.py b/ipatests/test_ipaserver/test_install/test_installer.py index c4c633352..b2e1c145c 100644 --- a/ipatests/test_ipaserver/test_install/test_installer.py +++ b/ipatests/test_ipaserver/test_install/test_installer.py @@ -48,7 +48,6 @@ class InstallerTestBase(six.with_metaclass(ABCMeta, object)): "class first.") # add all options from the option groups - # pylint: disable=no-member for opt_group in cls.tested_cls.option_parser.option_groups: for opt in opt_group.option_list: cls.OPTS_DICT[opt.dest] = opt._short_opts + opt._long_opts diff --git a/ipatests/test_xmlrpc/test_automount_plugin.py b/ipatests/test_xmlrpc/test_automount_plugin.py index 90b8a759f..6738882ed 100644 --- a/ipatests/test_xmlrpc/test_automount_plugin.py +++ b/ipatests/test_xmlrpc/test_automount_plugin.py @@ -106,7 +106,7 @@ class AutomountTest(XMLRPC_test): skipped=(), duplicatemaps=(), duplicatekeys=(), - )), res) # pylint: disable=used-before-assignment + )), res) self.check_tofiles() finally: res = api.Command['automountlocation_del'](self.locname)['result'] diff --git a/ipatests/test_xmlrpc/test_baseldap_plugin.py b/ipatests/test_xmlrpc/test_baseldap_plugin.py index 93fae68ca..d4b8a2a47 100644 --- a/ipatests/test_xmlrpc/test_baseldap_plugin.py +++ b/ipatests/test_xmlrpc/test_baseldap_plugin.py @@ -53,7 +53,7 @@ def test_exc_wrapper(): # Test with one callback first @test_callback.register_exc_callback - def handle_exception( # pylint: disable=unused-variable + def handle_exception( self, keys, options, e, call_func, *args, **kwargs): assert args == (1, 2) assert kwargs == dict(a=1, b=2) @@ -151,7 +151,7 @@ def test_exc_callback_registration(): pass @callbacktest_subclass.register_exc_callback - def exc_callback( # pylint: disable=unused-variable + def exc_callback( self, keys, options, exc, call_func, *args, **kwargs): """Subclass's private exception callback""" messages.append('Subclass registered callback') @@ -165,7 +165,7 @@ def test_exc_callback_registration(): @callbacktest_base.register_exc_callback - def exc_callback_2( # pylint: disable=unused-variable + def exc_callback_2( self, keys, options, exc, call_func, *args, **kwargs): """Callback on super class; doesn't affect the subclass""" messages.append('Superclass registered callback')