Fix E713 test for membership should be 'not in'

Related: https://pagure.io/freeipa/issue/8306
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
Christian Heimes 2020-04-30 15:12:34 +02:00
parent 690b5519f8
commit d0818e1809
11 changed files with 12 additions and 12 deletions

View File

@ -1461,7 +1461,7 @@ def run(api):
for klass in cli_plugins:
api.add_plugin(klass)
api.finalize()
if not 'config_loaded' in api.env and not 'help' in argv:
if 'config_loaded' not in api.env and 'help' not in argv:
raise NotConfiguredError()
sys.exit(api.Backend.cli.run(argv))
except KeyboardInterrupt:

View File

@ -533,7 +533,7 @@ class update_dnsserver_configuration_into_ldap(DNSUpdater):
return False, []
result = self.api.Command.server_show(self.api.env.host)['result']
if not 'DNS server' in result.get('enabled_role_servrole', []):
if 'DNS server' not in result.get('enabled_role_servrole', []):
logger.debug('This server is not DNS server, nothing to upgrade')
sysupgrade.set_upgrade_state('dns', 'server_config_to_ldap', True)
return False, []

View File

@ -24,7 +24,7 @@ class update_ldap_server_list(Updater):
entry = ldap.get_entry(dn)
srvlist = entry.single_value.get('defaultServerList', '')
srvlist = srvlist.split()
if not self.api.env.host in srvlist:
if self.api.env.host not in srvlist:
srvlist.append(self.api.env.host)
attr = ' '.join(srvlist)
entry['defaultServerList'] = attr

View File

@ -742,7 +742,7 @@ def ensure_enrolled(installer):
def promotion_check_ipa_domain(master_ldap_conn, basedn):
entry = master_ldap_conn.get_entry(basedn, ['associatedDomain'])
if not 'associatedDomain' in entry:
if 'associatedDomain' not in entry:
raise RuntimeError('IPA domain not found in LDAP.')
if len(entry['associatedDomain']) > 1:

View File

@ -729,7 +729,7 @@ Search for ACIs.
if kw.get('attrs'):
for a in acis:
if not 'targetattr' in a.target:
if 'targetattr' not in a.target:
results.remove(a)
continue
alist1 = sorted(

View File

@ -94,7 +94,7 @@ def radius_dn2pk(api, entry_attrs):
entry_attrs['ipatokenradiusconfiglink'] = [pk]
def convert_nsaccountlock(entry_attrs):
if not 'nsaccountlock' in entry_attrs:
if 'nsaccountlock' not in entry_attrs:
entry_attrs['nsaccountlock'] = False
else:
nsaccountlock = Bool('temp')

View File

@ -709,7 +709,7 @@ class idrange_mod(LDAPUpdate):
entry_attrs['ipanttrusteddomainsid'])
# Add trusted AD domain range object class, if it wasn't there
if not 'ipatrustedaddomainrange' in old_attrs['objectclass']:
if 'ipatrustedaddomainrange' not in old_attrs['objectclass']:
entry_attrs['objectclass'].append('ipatrustedaddomainrange')
else:

View File

@ -736,7 +736,7 @@ class output(BaseParam):
return obj
def _retrieve(self, commandfull_name, name, **kwargs):
if not commandfull_name in self.api.Command:
if commandfull_name not in self.api.Command:
raise errors.NotFound(
reason=_("%(command_name)s: %(oname)s not found") % {
'command_name': commandfull_name, 'oname': self.name,
@ -754,7 +754,7 @@ class output(BaseParam):
)
def _search(self, commandfull_name, **kwargs):
if not commandfull_name in self.api.Command:
if commandfull_name not in self.api.Command:
return None
cmd = self.api.Command[commandfull_name]

View File

@ -257,7 +257,7 @@ def set_certificate_attrs(entry_attrs):
returns nothing
"""
if not 'usercertificate' in entry_attrs:
if 'usercertificate' not in entry_attrs:
return
if type(entry_attrs['usercertificate']) in (list, tuple):
cert = entry_attrs['usercertificate'][0]

View File

@ -575,7 +575,7 @@ class stageuser_activate(LDAPQuery):
preserved (defined in preserved_DN_syntax_attrs)
see http://www.freeipa.org/page/V3/User_Life-Cycle_Management#Adjustment_of_DN_syntax_attributes
'''
if not attr in entry_to:
if attr not in entry_to:
if isinstance(entry_from[attr], (list, tuple)):
# attr is multi value attribute
entry_to[attr] = []

View File

@ -341,7 +341,7 @@ class WSGIExecutioner(Executioner):
command = None
e = None
if not 'HTTP_REFERER' in environ:
if 'HTTP_REFERER' not in environ:
return self.marshal(result, RefererError(referer='missing'), _id)
if not environ['HTTP_REFERER'].startswith('https://%s/ipa' % self.api.env.host) and not self.env.in_tree:
return self.marshal(result, RefererError(referer=environ['HTTP_REFERER']), _id)