From 275e85d076607ce317b3aeca467167fac55bf396 Mon Sep 17 00:00:00 2001 From: Jan Barta <55042barta@sstebrno.eu> Date: Fri, 3 Jun 2016 10:05:34 +0200 Subject: [PATCH] pylint: fix unneeded-not Reviewed-By: Tomas Krizek Reviewed-By: Florence Blanc-Renaud --- ipalib/aci.py | 6 +++--- ipalib/parameters.py | 4 ++-- ipaserver/plugins/baseldap.py | 2 +- ipaserver/plugins/delegation.py | 2 +- ipaserver/plugins/group.py | 4 ++-- ipaserver/plugins/host.py | 2 +- ipaserver/plugins/selfservice.py | 2 +- ipatests/test_ipalib/test_aci.py | 2 +- ipatests/test_webui/ui_driver.py | 2 +- ipatests/test_xmlrpc/tracker/user_plugin.py | 2 +- pylintrc | 1 - 11 files changed, 14 insertions(+), 15 deletions(-) diff --git a/ipalib/aci.py b/ipalib/aci.py index a76435f0a..97ed0c371 100755 --- a/ipalib/aci.py +++ b/ipalib/aci.py @@ -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 diff --git a/ipalib/parameters.py b/ipalib/parameters.py index 37f9650ea..6a289ac52 100644 --- a/ipalib/parameters.py +++ b/ipalib/parameters.py @@ -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 diff --git a/ipaserver/plugins/baseldap.py b/ipaserver/plugins/baseldap.py index f7844e3e7..1df8da455 100644 --- a/ipaserver/plugins/baseldap.py +++ b/ipaserver/plugins/baseldap.py @@ -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) diff --git a/ipaserver/plugins/delegation.py b/ipaserver/plugins/delegation.py index 6340d1aba..28a8f3019 100644 --- a/ipaserver/plugins/delegation.py +++ b/ipaserver/plugins/delegation.py @@ -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'] diff --git a/ipaserver/plugins/group.py b/ipaserver/plugins/group.py index 6677634f3..115db9d16 100644 --- a/ipaserver/plugins/group.py +++ b/ipaserver/plugins/group.py @@ -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']: diff --git a/ipaserver/plugins/host.py b/ipaserver/plugins/host.py index 2362b6247..d3e3c2788 100644 --- a/ipaserver/plugins/host.py +++ b/ipaserver/plugins/host.py @@ -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'] diff --git a/ipaserver/plugins/selfservice.py b/ipaserver/plugins/selfservice.py index 9697493b9..9009b7a64 100644 --- a/ipaserver/plugins/selfservice.py +++ b/ipaserver/plugins/selfservice.py @@ -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 diff --git a/ipatests/test_ipalib/test_aci.py b/ipatests/test_ipalib/test_aci.py index 8ced2a93c..5ce23dbcc 100644 --- a/ipatests/test_ipalib/test_aci.py +++ b/ipatests/test_ipalib/test_aci.py @@ -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): diff --git a/ipatests/test_webui/ui_driver.py b/ipatests/test_webui/ui_driver.py index 4bbb90c5a..ab917d849 100644 --- a/ipatests/test_webui/ui_driver.py +++ b/ipatests/test_webui/ui_driver.py @@ -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"] diff --git a/ipatests/test_xmlrpc/tracker/user_plugin.py b/ipatests/test_xmlrpc/tracker/user_plugin.py index b55deb9f3..6bc0ce19c 100644 --- a/ipatests/test_xmlrpc/tracker/user_plugin.py +++ b/ipatests/test_xmlrpc/tracker/user_plugin.py @@ -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] diff --git a/pylintrc b/pylintrc index 1f7e49f9f..140621eb3 100644 --- a/pylintrc +++ b/pylintrc @@ -84,7 +84,6 @@ disable= not-an-iterable, singleton-comparison, misplaced-comparison-constant, - unneeded-not, not-a-mapping, singleton-comparison