pylint: Fix consider-using-in

Pylint 2.11.0 extends consider-using-in check to work for
attribute access.

> To check if a variable is equal to one of many values,combine the
  values into a tuple and check if the variable is contained "in" it
  instead of checking for equality against each of the values.This
  is faster and less verbose.

Fixes: https://pagure.io/freeipa/issue/9117
Signed-off-by: Stanislav Levin <slev@altlinux.org>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Stanislav Levin authored and Rob Crittenden committed 2022-03-14 10:44:55 -04:00
1 parent a960adc6c2
commit 3ea0e1bd8d
3 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -611,7 +611,7 @@ class NSSDatabase:
try:
self.run_pk12util(args)
except ipautil.CalledProcessError as e:
if e.returncode == 17 or e.returncode == 18:
if e.returncode in (17, 18):
raise Pkcs12ImportIncorrectPasswordError(
"incorrect password for pkcs#12 file %s" % pkcs12_filename)
elif e.returncode == 10:
+1 -1
View File
@@ -458,7 +458,7 @@ def resolve_ip_addresses_nss(fqdn):
addrinfos = socket.getaddrinfo(fqdn, None,
socket.AF_UNSPEC, socket.SOCK_STREAM)
except socket.error as ex:
if ex.errno == socket.EAI_NODATA or ex.errno == socket.EAI_NONAME:
if ex.errno in (socket.EAI_NODATA, socket.EAI_NONAME):
logger.debug('Name %s does not have any address: %s', fqdn, ex)
return set()
else:
+1 -1
View File
@@ -566,7 +566,7 @@ class automember_default_group(automember):
def get_params(self):
for param in super(automember_default_group, self).get_params():
if param.name == 'cn' or param.name == 'description':
if param.name in ('cn', 'description'):
continue
yield param