pylint: fix unneeded-not

Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
Jan Barta 2016-06-03 10:05:34 +02:00 committed by Martin Basti
parent 36484e8672
commit 275e85d076
11 changed files with 14 additions and 15 deletions

View File

@ -156,10 +156,10 @@ class ACI:
returns True if valid
"""
if not type(self.permissions) in (tuple, list):
if type(self.permissions) not in (tuple, list):
raise SyntaxError("permissions must be a list")
for p in self.permissions:
if not p.lower() in PERMISSIONS:
if p.lower() not in PERMISSIONS:
raise SyntaxError("invalid permission: '%s'" % p)
if not self.name:
raise SyntaxError("name must be set")
@ -185,7 +185,7 @@ class ACI:
if 'targetattr' in self.target:
del self.target['targetattr']
return
if not type(attr) in (tuple, list):
if type(attr) not in (tuple, list):
attr = [attr]
self.target['targetattr'] = {}
self.target['targetattr']['expression'] = attr

View File

@ -434,9 +434,9 @@ class Param(ReadOnly):
# Merge in kw from parse_param_spec():
(name, kw_from_spec) = parse_param_spec(name)
check_name(name)
if not 'required' in kw:
if 'required' not in kw:
kw['required'] = kw_from_spec['required']
if not 'multivalue' in kw:
if 'multivalue' not in kw:
kw['multivalue'] = kw_from_spec['multivalue']
# Add 'default' to self.kwargs

View File

@ -909,7 +909,7 @@ last, after all sets and adds."""),
newdict = {}
if attrs is None:
attrs = []
elif not type(attrs) in (list, tuple):
elif type(attrs) not in (list, tuple):
attrs = [attrs]
for a in attrs:
m = re.match("\s*(.*?)\s*=\s*(.*?)\s*$", a)

View File

@ -132,7 +132,7 @@ class delegation_add(crud.Create):
msg_summary = _('Added delegation "%(value)s"')
def execute(self, aciname, **kw):
if not 'permissions' in kw:
if 'permissions' not in kw:
kw['permissions'] = (u'write',)
kw['aciprefix'] = ACI_PREFIX
result = api.Command['aci_add'](aciname, **kw)['result']

View File

@ -314,7 +314,7 @@ class group_add(LDAPCreate):
raise errors.MutuallyExclusiveError(reason=_('gid cannot be set for external group'))
elif not options['nonposix']:
entry_attrs['objectclass'].append('posixgroup')
if not 'gidnumber' in options:
if 'gidnumber' not in options:
entry_attrs['gidnumber'] = baseldap.DNA_MAGIC
return dn
@ -395,7 +395,7 @@ class group_mod(LDAPUpdate):
else:
old_entry_attrs['objectclass'].append('posixgroup')
entry_attrs['objectclass'] = old_entry_attrs['objectclass']
if not 'gidnumber' in options:
if 'gidnumber' not in options:
entry_attrs['gidnumber'] = baseldap.DNA_MAGIC
if options['external']:

View File

@ -666,7 +666,7 @@ class host_add(LDAPCreate):
options['ip_address'],
check_forward=True,
check_reverse=check_reverse)
if not options.get('force', False) and not 'ip_address' in options:
if not options.get('force', False) and 'ip_address' not in options:
util.verify_host_resolvable(keys[-1])
if 'locality' in entry_attrs:
entry_attrs['l'] = entry_attrs['locality']

View File

@ -124,7 +124,7 @@ class selfservice_add(crud.Create):
msg_summary = _('Added selfservice "%(value)s"')
def execute(self, aciname, **kw):
if not 'permissions' in kw:
if 'permissions' not in kw:
kw['permissions'] = (u'write',)
kw['selfaci'] = True
kw['aciprefix'] = ACI_PREFIX

View File

@ -94,7 +94,7 @@ def test_aci_equality():
assert a.isequal(b)
assert a == b
assert not a != b
assert not a != b # pylint: disable=unneeded-not
def check_aci_inequality(b):

View File

@ -183,7 +183,7 @@ class UI_driver(object):
options.binary_location = paths.CHROMIUM_BROWSER
if driver_type == 'remote':
if not 'host' in self.config:
if 'host' not in self.config:
raise nose.SkipTest('Selenium server host not configured')
host = self.config["host"]

View File

@ -172,7 +172,7 @@ class UserTracker(KerberosAliasMixin, Tracker):
self.api.env.realm)
)]
else:
if not type(self.kwargs[key]) is list:
if type(self.kwargs[key]) is not list:
self.attrs[key] = [self.kwargs[key]]
else:
self.attrs[key] = self.kwargs[key]

View File

@ -84,7 +84,6 @@ disable=
not-an-iterable,
singleton-comparison,
misplaced-comparison-constant,
unneeded-not,
not-a-mapping,
singleton-comparison