1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-02 00:22:11 +03:00

PEP8: fix E713: test for membership should be 'not in'

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Joe Guo
2018-07-30 18:22:34 +12:00
committed by Douglas Bagnall
parent 1676a4dcae
commit 9f5bbcc10a
32 changed files with 94 additions and 94 deletions

View File

@ -1774,7 +1774,7 @@ host = args[0]
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
if not "://" in host:
if "://" not in host:
if os.path.isfile(host):
host = "tdb://%s" % host
else:

View File

@ -340,7 +340,7 @@ def import_bundled_package(modulename, location, source_tree_container,
if in_source_tree():
extra_path = os.path.join(source_tree_topdir(), source_tree_container,
location)
if not extra_path in sys.path:
if extra_path not in sys.path:
sys.path.insert(0, extra_path)
sys.modules[modulename] = __import__(modulename)
else:

View File

@ -1232,7 +1232,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
is_deleted = 'isDeleted' in obj and obj['isDeleted'][0].upper() == 'TRUE'
target_is_deleted = 'isDeleted' in res[0] and res[0]['isDeleted'][0].upper() == 'TRUE'
if is_deleted and not obj.dn in self.deleted_objects_containers and linkID:
if is_deleted and obj.dn not in self.deleted_objects_containers and linkID:
# A fully deleted object should not have any linked
# attributes. (MS-ADTS 3.1.1.5.5.1.1 Tombstone
# Requirements and 3.1.1.5.5.1.3 Recycled-Object
@ -2470,7 +2470,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
error_count = 0
# check that the dsServiceName is in GUID form
if not 'dsServiceName' in obj:
if 'dsServiceName' not in obj:
self.report('ERROR: dsServiceName missing in @ROOTDSE')
return error_count + 1

View File

@ -448,7 +448,7 @@ def check_safe_path(path):
dirs = re.split('/|\\\\', path)
if 'sysvol' in path:
dirs = dirs[dirs.index('sysvol') + 1:]
if not '..' in dirs:
if '..' not in dirs:
return os.path.join(*dirs)
raise OSError(path)
@ -567,7 +567,7 @@ def register_gp_extension(guid, name, path,
return False
lp, parser = parse_gpext_conf(smb_conf)
if not guid in parser.sections():
if guid not in parser.sections():
parser.add_section(guid)
parser.set(guid, 'DllName', path)
parser.set(guid, 'ProcessGroupPolicy', name)

View File

@ -381,7 +381,7 @@ class DCJoinContext(object):
'''get the parent domain partition DN from parent DNS name'''
res = ctx.samdb.search(base='CN=Partitions,%s' % ctx.config_dn, attrs=['fSMORoleOwner'],
scope=ldb.SCOPE_BASE, controls=["extended_dn:1:1"])
if not 'fSMORoleOwner' in res[0]:
if 'fSMORoleOwner' not in res[0]:
raise DCJoinException("Can't find naming master on partition DN %s in %s" % (ctx.partition_dn, ctx.samdb.url))
try:
master_guid = str(misc.GUID(ldb.Dn(ctx.samdb, res[0]['fSMORoleOwner'][0].decode('utf8')).get_extended_component('GUID')))

View File

@ -2056,7 +2056,7 @@ class KCC(object):
for dc_s in self.my_site.dsa_table.values():
# If this partition (nc_x) doesn't appear as a
# replica (f_of_x) on (dc_s) then continue
if not nc_x.nc_dnstr in dc_s.current_rep_table:
if nc_x.nc_dnstr not in dc_s.current_rep_table:
continue
# Pull out the NCReplica (f) of (x) with the dn
@ -2138,7 +2138,7 @@ class KCC(object):
# If this partition NC (x) doesn't appear as a
# replica (p) of NC (x) on the dsa DC (s) then
# continue
if not nc_x.nc_dnstr in dc_s.current_rep_table:
if nc_x.nc_dnstr not in dc_s.current_rep_table:
continue
# Pull out the NCReplica with the dn that

View File

@ -744,7 +744,7 @@ class DirectoryServiceAgent(object):
flags = dsdn.get_binary_integer()
dnstr = str(dsdn.dn)
if not dnstr in tmp_table:
if dnstr not in tmp_table:
rep = NCReplica(self, dnstr)
tmp_table[dnstr] = rep
else:

View File

@ -110,7 +110,7 @@ class cmd_dbcheck(Command):
scope_map = {"SUB": ldb.SCOPE_SUBTREE, "BASE": ldb.SCOPE_BASE, "ONE": ldb.SCOPE_ONELEVEL}
scope = scope.upper()
if not scope in scope_map:
if scope not in scope_map:
raise CommandError("Unknown scope %s" % scope)
search_scope = scope_map[scope]

View File

@ -49,7 +49,7 @@ class LDAPBase(object):
outf=sys.stdout, errf=sys.stderr, skip_missing_dn=True):
ldb_options = []
samdb_url = host
if not "://" in host:
if "://" not in host:
if os.path.isfile(host):
samdb_url = "tdb://%s" % host
else:
@ -580,7 +580,7 @@ class LDAPObject(object):
#
title = 4 * " " + "Attributes found only in %s:" % self.con.host
for x in self.attributes.keys():
if not x in other.attributes.keys() and \
if x not in other.attributes.keys() and \
not x.upper() in [q.upper() for q in other.ignore_attributes]:
if title:
res += title + "\n"
@ -590,7 +590,7 @@ class LDAPObject(object):
#
title = 4 *" " + "Attributes found only in %s:" % other.con.host
for x in other.attributes.keys():
if not x in self.attributes.keys() and \
if x not in self.attributes.keys() and \
not x.upper() in [q.upper() for q in self.ignore_attributes]:
if title:
res += title + "\n"

View File

@ -337,7 +337,7 @@ class WinsDatabase(object):
ips.append(entries[i])
i += 1
nb_flags = int(entries[i][:-1], 16)
assert not name in self.entries, "Name %s exists twice" % name
assert name not in self.entries, "Name %s exists twice" % name
self.entries[name] = (ttl, ips, nb_flags)
f.close()

View File

@ -929,7 +929,7 @@ schemaUpdateNow: 1
res = self.search(self.domain_dn(), scope=ldb.SCOPE_BASE, attrs=["minPwdAge"])
if len(res) == 0:
return None
elif not "minPwdAge" in res[0]:
elif "minPwdAge" not in res[0]:
return None
else:
return int(res[0]["minPwdAge"][0])
@ -945,7 +945,7 @@ schemaUpdateNow: 1
res = self.search(self.domain_dn(), scope=ldb.SCOPE_BASE, attrs=["maxPwdAge"])
if len(res) == 0:
return None
elif not "maxPwdAge" in res[0]:
elif "maxPwdAge" not in res[0]:
return None
else:
return int(res[0]["maxPwdAge"][0])
@ -961,7 +961,7 @@ schemaUpdateNow: 1
res = self.search(self.domain_dn(), scope=ldb.SCOPE_BASE, attrs=["minPwdLength"])
if len(res) == 0:
return None
elif not "minPwdLength" in res[0]:
elif "minPwdLength" not in res[0]:
return None
else:
return int(res[0]["minPwdLength"][0])
@ -977,7 +977,7 @@ schemaUpdateNow: 1
res = self.search(self.domain_dn(), scope=ldb.SCOPE_BASE, attrs=["pwdProperties"])
if len(res) == 0:
return None
elif not "pwdProperties" in res[0]:
elif "pwdProperties" not in res[0]:
return None
else:
return int(res[0]["pwdProperties"][0])

View File

@ -417,7 +417,7 @@ def connect_samdb(samdb_url, lp=None, session_info=None, credentials=None,
to make proper URL for ldb.connect() while using default
parameters for connection based on test environment
"""
if not "://" in samdb_url:
if "://" not in samdb_url:
if not ldap_only and os.path.isfile(samdb_url):
samdb_url = "tdb://%s" % samdb_url
else:

View File

@ -285,7 +285,7 @@ delete: description
# Checking whether changes are no longer there...
msg = self.ldb.search(expression="(cn=Niemand)")
self.assertTrue(len(msg) >= 1)
self.assertTrue(not "description" in msg[0])
self.assertTrue("description" not in msg[0])
# Renaming record...
self.ldb.rename("cn=Niemand,cn=Users,dc=vernstok,dc=nl",
@ -411,7 +411,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
attrs=["dnsHostName", "lastLogon"])
self.assertEquals(len(res), 1)
self.assertEquals(str(res[0].dn), dn)
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertEquals(str(res[0]["lastLogon"]), "x")
# Search remote record by remote DN
@ -420,8 +420,8 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
attrs=["dnsHostName", "lastLogon", "sambaLogonTime"])
self.assertEquals(len(res), 1)
self.assertEquals(str(res[0].dn), dn)
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue(not "lastLogon" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertTrue("lastLogon" not in res[0])
self.assertEquals(str(res[0]["sambaLogonTime"]), "x")
# Search split record by local DN
@ -439,8 +439,8 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
attrs=["dnsHostName", "lastLogon", "sambaLogonTime"])
self.assertEquals(len(res), 1)
self.assertEquals(str(res[0].dn), dn)
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue(not "lastLogon" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertTrue("lastLogon" not in res[0])
self.assertEquals(str(res[0]["sambaLogonTime"]), "x")
# Testing search by attribute
@ -463,7 +463,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
self.assertEquals(len(res), 2)
res = sorted(res, key=attrgetter('dn'))
self.assertEquals(str(res[0].dn), self.samba4.dn("cn=C"))
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertEquals(str(res[0]["lastLogon"]), "z")
self.assertEquals(str(res[1].dn), self.samba4.dn("cn=Z"))
self.assertEquals(str(res[1]["dnsHostName"]), "z")
@ -475,10 +475,10 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
self.assertEquals(len(res), 2)
res = sorted(res, key=attrgetter('dn'))
self.assertEquals(str(res[0].dn), self.samba4.dn("cn=A"))
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertEquals(str(res[0]["lastLogon"]), "x")
self.assertEquals(str(res[1].dn), self.samba4.dn("cn=B"))
self.assertTrue(not "dnsHostName" in res[1])
self.assertTrue("dnsHostName" not in res[1])
self.assertEquals(str(res[1]["lastLogon"]), "y")
# Search by converted attribute
@ -496,7 +496,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
res[1]["objectSid"])
self.assertTrue("objectSid" in res[1])
self.assertEquals(str(res[0].dn), self.samba4.dn("cn=A"))
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertEquals(str(res[0]["lastLogon"]), "x")
self.assertSidEquals("S-1-5-21-4231626423-2410014848-2360679739-1052",
res[0]["objectSid"])
@ -509,7 +509,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
attrs=["dnsHostName", "lastLogon", "primaryGroupID"])
self.assertEquals(len(res), 1)
self.assertEquals(str(res[0].dn), self.samba4.dn("cn=A"))
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertEquals(str(res[0]["lastLogon"]), "x")
self.assertEquals(str(res[0]["primaryGroupID"]), "512")
@ -535,7 +535,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
self.assertEquals(len(res), 2)
res = sorted(res, key=attrgetter('dn'))
self.assertEquals(str(res[0].dn), self.samba4.dn("cn=A"))
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertEquals(str(res[0]["lastLogon"]), "x")
self.assertEquals(str(res[0]["objectClass"][0]), "user")
self.assertEquals(str(res[1].dn), self.samba4.dn("cn=X"))
@ -549,11 +549,11 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
self.assertEquals(len(res), 3)
res = sorted(res, key=attrgetter('dn'))
self.assertEquals(str(res[0].dn), self.samba4.dn("cn=A"))
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertEquals(str(res[0]["lastLogon"]), "x")
self.assertEquals(res[0]["objectClass"][0], "user")
self.assertEquals(str(res[1].dn), self.samba4.dn("cn=B"))
self.assertTrue(not "dnsHostName" in res[1])
self.assertTrue("dnsHostName" not in res[1])
self.assertEquals(str(res[1]["lastLogon"]), "y")
self.assertEquals(set(res[1]["objectClass"]), set(["top"]))
self.assertEquals(str(res[2].dn), self.samba4.dn("cn=X"))
@ -581,7 +581,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
self.assertEquals(len(res), 2)
res = sorted(res, key=attrgetter('dn'))
self.assertEquals(str(res[0].dn), self.samba4.dn("cn=A"))
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertEquals(str(res[0]["lastLogon"]), "x")
self.assertEquals(str(res[1].dn), self.samba4.dn("cn=X"))
self.assertEquals(str(res[1]["dnsHostName"]), "x")
@ -661,13 +661,13 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
self.assertEquals(len(res), 6)
res = sorted(res, key=attrgetter('dn'))
self.assertEquals(str(res[0].dn), self.samba4.dn("cn=A"))
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertEquals(str(res[0]["lastLogon"]), "x")
self.assertEquals(str(res[1].dn), self.samba4.dn("cn=B"))
self.assertTrue(not "dnsHostName" in res[1])
self.assertTrue("dnsHostName" not in res[1])
self.assertEquals(str(res[1]["lastLogon"]), "y")
self.assertEquals(str(res[2].dn), self.samba4.dn("cn=C"))
self.assertTrue(not "dnsHostName" in res[2])
self.assertTrue("dnsHostName" not in res[2])
self.assertEquals(str(res[2]["lastLogon"]), "z")
self.assertEquals(str(res[3].dn), self.samba4.dn("cn=Z"))
self.assertEquals(str(res[3]["dnsHostName"]), "z")
@ -679,7 +679,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
self.assertEquals(len(res), 4)
res = sorted(res, key=attrgetter('dn'))
self.assertEquals(str(res[0].dn), self.samba4.dn("cn=C"))
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertEquals(str(res[0]["lastLogon"]), "z")
self.assertEquals(str(res[1].dn), self.samba4.dn("cn=Z"))
self.assertEquals(str(res[1]["dnsHostName"]), "z")
@ -691,13 +691,13 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
self.assertEquals(len(res), 6)
res = sorted(res, key=attrgetter('dn'))
self.assertEquals(str(res[0].dn), self.samba4.dn("cn=A"))
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertEquals(str(res[0]["lastLogon"]), "x")
self.assertEquals(str(res[1].dn), self.samba4.dn("cn=B"))
self.assertTrue(not "dnsHostName" in res[1])
self.assertTrue("dnsHostName" not in res[1])
self.assertEquals(str(res[1]["lastLogon"]), "y")
self.assertEquals(str(res[2].dn), self.samba4.dn("cn=C"))
self.assertTrue(not "dnsHostName" in res[2])
self.assertTrue("dnsHostName" not in res[2])
self.assertEquals(str(res[2]["lastLogon"]), "z")
self.assertEquals(str(res[3].dn), self.samba4.dn("cn=Z"))
self.assertEquals(str(res[3]["dnsHostName"]), "z")
@ -709,10 +709,10 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
self.assertEquals(len(res), 6)
res = sorted(res, key=attrgetter('dn'))
self.assertEquals(str(res[0].dn), self.samba4.dn("cn=B"))
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertEquals(str(res[0]["lastLogon"]), "y")
self.assertEquals(str(res[1].dn), self.samba4.dn("cn=C"))
self.assertTrue(not "dnsHostName" in res[1])
self.assertTrue("dnsHostName" not in res[1])
self.assertEquals(str(res[1]["lastLogon"]), "z")
self.assertEquals(str(res[2].dn), self.samba4.dn("cn=Y"))
self.assertEquals(str(res[2]["dnsHostName"]), "y")
@ -727,13 +727,13 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
self.assertEquals(len(res), 6)
res = sorted(res, key=attrgetter('dn'))
self.assertEquals(str(res[0].dn), self.samba4.dn("cn=A"))
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertEquals(str(res[0]["lastLogon"]), "x")
self.assertEquals(str(res[1].dn), self.samba4.dn("cn=B"))
self.assertTrue(not "dnsHostName" in res[1])
self.assertTrue("dnsHostName" not in res[1])
self.assertEquals(str(res[1]["lastLogon"]), "y")
self.assertEquals(str(res[2].dn), self.samba4.dn("cn=C"))
self.assertTrue(not "dnsHostName" in res[2])
self.assertTrue("dnsHostName" not in res[2])
self.assertEquals(str(res[2]["lastLogon"]), "z")
self.assertEquals(str(res[3].dn), self.samba4.dn("cn=Z"))
self.assertEquals(str(res[3]["dnsHostName"]), "z")
@ -744,13 +744,13 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
attrs=["dnsHostName", "lastLogon"])
res = sorted(res, key=attrgetter('dn'))
self.assertEquals(str(res[0].dn), self.samba4.dn("cn=A"))
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertEquals(str(res[0]["lastLogon"]), "x")
self.assertEquals(str(res[1].dn), self.samba4.dn("cn=B"))
self.assertTrue(not "dnsHostName" in res[1])
self.assertTrue("dnsHostName" not in res[1])
self.assertEquals(str(res[1]["lastLogon"]), "y")
self.assertEquals(str(res[2].dn), self.samba4.dn("cn=C"))
self.assertTrue(not "dnsHostName" in res[2])
self.assertTrue("dnsHostName" not in res[2])
self.assertEquals(str(res[2]["lastLogon"]), "z")
self.assertEquals(str(res[3].dn), self.samba4.dn("cn=Z"))
self.assertEquals(str(res[3]["dnsHostName"]), "z")
@ -762,7 +762,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
self.assertEquals(len(res), 5)
res = sorted(res, key=attrgetter('dn'))
self.assertEquals(str(res[0].dn), self.samba4.dn("cn=C"))
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertEquals(str(res[0]["lastLogon"]), "z")
self.assertEquals(str(res[1].dn), self.samba4.dn("cn=Y"))
self.assertEquals(str(res[1]["dnsHostName"]), "y")
@ -777,10 +777,10 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
self.assertEquals(len(res), 5)
res = sorted(res, key=attrgetter('dn'))
self.assertEquals(str(res[0].dn), self.samba4.dn("cn=A"))
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertEquals(str(res[0]["lastLogon"]), "x")
self.assertEquals(str(res[1].dn), self.samba4.dn("cn=C"))
self.assertTrue(not "dnsHostName" in res[1])
self.assertTrue("dnsHostName" not in res[1])
self.assertEquals(str(res[1]["lastLogon"]), "z")
self.assertEquals(str(res[2].dn), self.samba4.dn("cn=Z"))
self.assertEquals(str(res[2]["dnsHostName"]), "z")
@ -791,13 +791,13 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-1052
self.assertEquals(len(res), 7)
res = sorted(res, key=attrgetter('dn'))
self.assertEquals(str(res[0].dn), self.samba4.dn("cn=A"))
self.assertTrue(not "dnsHostName" in res[0])
self.assertTrue("dnsHostName" not in res[0])
self.assertEquals(str(res[0]["lastLogon"]), "x")
self.assertEquals(str(res[1].dn), self.samba4.dn("cn=B"))
self.assertTrue(not "dnsHostName" in res[1])
self.assertTrue("dnsHostName" not in res[1])
self.assertEquals(str(res[1]["lastLogon"]), "y")
self.assertEquals(str(res[2].dn), self.samba4.dn("cn=C"))
self.assertTrue(not "dnsHostName" in res[2])
self.assertTrue("dnsHostName" not in res[2])
self.assertEquals(str(res[2]["lastLogon"]), "z")
self.assertEquals(str(res[3].dn), self.samba4.dn("cn=X"))
self.assertEquals(str(res[3]["dnsHostName"]), "x")
@ -991,12 +991,12 @@ description: test
self.assertEquals(len(res), 1)
self.assertEquals(str(res[0].dn), dn2)
self.assertEquals(str(res[0]["description"]), "test")
self.assertTrue(not "revision" in res[0])
self.assertTrue("revision" not in res[0])
# Check in local db
res = self.samba4.db.search(dn, scope=SCOPE_BASE, attrs=attrs)
self.assertEquals(len(res), 1)
self.assertEquals(str(res[0].dn), dn)
self.assertTrue(not "description" in res[0])
self.assertTrue("description" not in res[0])
self.assertEquals(str(res[0]["revision"]), "1")
# Delete (newly) split record
@ -1027,9 +1027,9 @@ description: test
res = self.samba4.db.search(dn, scope=SCOPE_BASE, attrs=attrs)
self.assertEquals(len(res), 1)
self.assertEquals(str(res[0].dn), dn)
self.assertTrue(not "description" in res[0])
self.assertTrue(not "badPwdCount" in res[0])
self.assertTrue(not "nextRid" in res[0])
self.assertTrue("description" not in res[0])
self.assertTrue("badPwdCount" not in res[0])
self.assertTrue("nextRid" not in res[0])
self.assertEquals(str(res[0]["revision"]), "1")
# Check in remote db
attrs = ["description", "sambaBadPasswordCount", "sambaNextRid",
@ -1040,7 +1040,7 @@ description: test
self.assertEquals(str(res[0]["description"]), "foo")
self.assertEquals(str(res[0]["sambaBadPasswordCount"]), "3")
self.assertEquals(str(res[0]["sambaNextRid"]), "1001")
self.assertTrue(not "revision" in res[0])
self.assertTrue("revision" not in res[0])
# Modify of split record
ldif = """
@ -1066,9 +1066,9 @@ revision: 2
res = self.samba4.db.search(dn, scope=SCOPE_BASE, attrs=attrs)
self.assertEquals(len(res), 1)
self.assertEquals(str(res[0].dn), dn)
self.assertTrue(not "description" in res[0])
self.assertTrue(not "badPwdCount" in res[0])
self.assertTrue(not "nextRid" in res[0])
self.assertTrue("description" not in res[0])
self.assertTrue("badPwdCount" not in res[0])
self.assertTrue("nextRid" not in res[0])
self.assertEquals(str(res[0]["revision"]), "2")
# Check in remote db
attrs = ["description", "sambaBadPasswordCount", "sambaNextRid",
@ -1079,7 +1079,7 @@ revision: 2
self.assertEquals(str(res[0]["description"]), "test")
self.assertEquals(str(res[0]["sambaBadPasswordCount"]), "4")
self.assertEquals(str(res[0]["sambaNextRid"]), "1001")
self.assertTrue(not "revision" in res[0])
self.assertTrue("revision" not in res[0])
# Rename split record
dn2 = self.samba4.dn("cn=toast")
@ -1098,9 +1098,9 @@ revision: 2
res = self.samba4.db.search(dn, scope=SCOPE_BASE, attrs=attrs)
self.assertEquals(len(res), 1)
self.assertEquals(str(res[0].dn), dn)
self.assertTrue(not "description" in res[0])
self.assertTrue(not "badPwdCount" in res[0])
self.assertTrue(not "nextRid" in res[0])
self.assertTrue("description" not in res[0])
self.assertTrue("badPwdCount" not in res[0])
self.assertTrue("nextRid" not in res[0])
self.assertEquals(str(res[0]["revision"]), "2")
# Check in remote db
dn2 = self.samba3.dn("cn=toast")
@ -1112,7 +1112,7 @@ revision: 2
self.assertEquals(str(res[0]["description"]), "test")
self.assertEquals(str(res[0]["sambaBadPasswordCount"]), "4")
self.assertEquals(str(res[0]["sambaNextRid"]), "1001")
self.assertTrue(not "revision" in res[0])
self.assertTrue("revision" not in res[0])
# Delete split record
self.ldb.delete(dn)

View File

@ -106,9 +106,9 @@ def plantestsuite_loadlist(name, env, cmdline):
if isinstance(cmdline, list):
cmdline = " ".join(cmdline)
support_list = ("$LISTOPT" in cmdline)
if not "$LISTOPT" in cmdline:
if "$LISTOPT" not in cmdline:
raise AssertionError("loadlist test %s does not support not --list" % name)
if not "$LOADLIST" in cmdline:
if "$LOADLIST" not in cmdline:
raise AssertionError("loadlist test %s does not support --load-list" % name)
print(("%s | %s" % (cmdline.replace("$LOADLIST", ""), add_prefix(name, env, support_list))).replace("$LISTOPT", "--list"))
print(cmdline.replace("$LISTOPT", "") + " 2>&1 " + " | " + add_prefix(name, env, False))

View File

@ -601,7 +601,7 @@ class PlainFormatter(TestsuiteEnabledTestResult):
out = ""
unexpected = False
if not name in self.test_output:
if name not in self.test_output:
print("no output for name[%s]" % name)
if result in ("success", "xfail"):
@ -655,7 +655,7 @@ class PlainFormatter(TestsuiteEnabledTestResult):
'success': '.'}.get(result, "?(%s)" % result))
return
if not self.name in self.test_output:
if self.name not in self.test_output:
self.test_output[self.name] = ""
self.test_output[self.name] += "UNEXPECTED(%s): %s\n" % (result, testname)

View File

@ -51,7 +51,7 @@ if len(args) < 1:
sys.exit(1)
host = args[0]
if not "://" in host:
if "://" not in host:
ldaphost = "ldap://%s" % host
else:
ldaphost = host

View File

@ -556,7 +556,7 @@ class BasicTreeDeleteTests(BasicDeleteTests):
self.assertFalse("CN=Deleted Objects" in str(objDeleted7.dn))
if not "://" in host:
if "://" not in host:
if os.path.isfile(host):
host = "tdb://%s" % host
else:

View File

@ -58,7 +58,7 @@ if len(args) < 1:
sys.exit(1)
host = args.pop()
if not "://" in host:
if "://" not in host:
ldaphost = "ldap://%s" % host
ldapshost = "ldaps://%s" % host
else:

View File

@ -3271,14 +3271,14 @@ class BaseDnTests(samba.tests.TestCase):
self.assertEquals(given, expected)
if not "://" in host:
if "://" not in host:
if os.path.isfile(host):
host = "tdb://%s" % host
else:
host = "ldap://%s" % host
ldb = SamDB(host, credentials=creds, session_info=system_session(lp), lp=lp)
if not "tdb://" in host:
if "tdb://" not in host:
gc_ldb = Ldb("%s:3268" % host, credentials=creds,
session_info=system_session(lp), lp=lp)
else:

View File

@ -1646,7 +1646,7 @@ class SchemaTests_msDS_isRODC(samba.tests.TestCase):
self.assertTrue("msDS-isRODC" in ldb_msg)
if not "://" in host:
if "://" not in host:
if os.path.isfile(host):
host = "tdb://%s" % host
else:

View File

@ -365,7 +365,7 @@ delete: otherLoginWorkstations
self.assertEquals(num, ERR_UNWILLING_TO_PERFORM)
if not "://" in url:
if "://" not in url:
if os.path.isfile(url):
url = "tdb://%s" % url
else:

View File

@ -1134,7 +1134,7 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS3\"".encode('utf-16-le')).
self.ldb2 = None
if not "://" in host:
if "://" not in host:
if os.path.isfile(host):
host = "tdb://%s" % host
else:

View File

@ -3760,7 +3760,7 @@ class SamTests(samba.tests.TestCase):
delete_force(self.ldb, "cn=ldaptestuser,cn=users," + self.base_dn)
if not "://" in host:
if "://" not in host:
if os.path.isfile(host):
host = "tdb://%s" % host
else:

View File

@ -2146,7 +2146,7 @@ class SdAutoInheritTests(DescriptorTests):
self.assertTrue(sub_usn2 == sub_usn0)
if not "://" in host:
if "://" not in host:
if os.path.isfile(host):
host = "tdb://%s" % host
else:

View File

@ -55,7 +55,7 @@ if len(args) < 1:
sys.exit(1)
host = args[0]
if not "://" in host:
if "://" not in host:
ldaphost = "ldap://%s" % host
else:
ldaphost = host

View File

@ -649,7 +649,7 @@ class DynamicTokenTest(samba.tests.TestCase):
self.assertEqual(rids.rids[0].rid, user_info.primary_gid)
if not "://" in url:
if "://" not in url:
if os.path.isfile(url):
url = "tdb://%s" % url
else:

View File

@ -58,7 +58,7 @@ if len(args) < 1:
sys.exit(1)
host = args[0]
if not "://" in host:
if "://" not in host:
ldaphost = "ldap://%s" % host
else:
ldaphost = host

View File

@ -163,7 +163,7 @@ if __name__ == "__main__":
if len(args) != 1:
import os
if not "DC_SERVER" in os.environ.keys():
if "DC_SERVER" not in os.environ.keys():
parser.error("You must supply a server")
args.append(os.environ["DC_SERVER"])

View File

@ -227,7 +227,7 @@ class AclSearchSpeedTest(SpeedTest):
# Important unit running information
if not "://" in host:
if "://" not in host:
host = "ldap://%s" % host
ldb_options = ["modules:paged_searches"]

View File

@ -73,7 +73,7 @@ def drs_get_rodc_partial_attribute_set(samdb, samdb1, exceptions=[]):
continue
try:
attid = samdb1.get_attid_from_lDAPDisplayName(ldap_display_name)
if not attid in exceptions:
if attid not in exceptions:
attids.append(int(attid))
except:
pass

View File

@ -31,10 +31,10 @@ import os
from samba import net
import samba.tests
if not "ACCOUNT_NAME" in os.environ.keys():
if "ACCOUNT_NAME" not in os.environ.keys():
raise Exception("Please supply ACCOUNT_NAME in environment")
if not "NEW_PASS" in os.environ.keys():
if "NEW_PASS" not in os.environ.keys():
raise Exception("Please supply NEW_PASS in environment")
account_name = os.environ["ACCOUNT_NAME"]

View File

@ -49,7 +49,7 @@ class wintest():
def getvar(self, varname):
'''return a substitution variable'''
if not varname in self.vars:
if varname not in self.vars:
return None
return self.vars[varname]
@ -133,7 +133,7 @@ class wintest():
if var_end == -1:
return text
var_name = text[var_start + 2:var_end]
if not var_name in self.vars:
if var_name not in self.vars:
raise RuntimeError("Unknown substitution variable ${%s}" % var_name)
text = text.replace("${%s}" % var_name, self.vars[var_name])
return text