summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJoe Guo <joeg@catalyst.net.nz>2018-07-30 18:18:03 +1200
committerDouglas Bagnall <dbagnall@samba.org>2018-08-24 07:49:28 +0200
commit32266d2d48c1c38e54bcfaf1cad36f09e9cff355 (patch)
tree2cd1a3ea1d5c789d770dc2ce18f488464907b5ca /python
parentfb5ea356dd2dcf7651ff2b0fb861042ed828821c (diff)
downloadsamba-32266d2d48c1c38e54bcfaf1cad36f09e9cff355.tar.gz
PEP8: fix E225: missing whitespace around operator
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>
Diffstat (limited to 'python')
-rw-r--r--python/samba/dbchecker.py8
-rw-r--r--python/samba/descriptor.py4
-rw-r--r--python/samba/gpclass.py2
-rw-r--r--python/samba/netcmd/domain.py12
-rw-r--r--python/samba/netcmd/drs.py2
-rw-r--r--python/samba/netcmd/fsmo.py16
-rw-r--r--python/samba/netcmd/gpo.py4
-rw-r--r--python/samba/netcmd/ldapcmp.py4
-rw-r--r--python/samba/netcmd/ntacl.py2
-rw-r--r--python/samba/netcmd/spn.py8
-rw-r--r--python/samba/netcmd/user.py10
-rw-r--r--python/samba/provision/__init__.py8
-rw-r--r--python/samba/samba3/__init__.py2
-rw-r--r--python/samba/samdb.py2
-rw-r--r--python/samba/schema.py2
-rw-r--r--python/samba/tests/__init__.py4
-rw-r--r--python/samba/tests/credentials.py62
-rw-r--r--python/samba/tests/dcerpc/raw_testcase.py4
-rw-r--r--python/samba/tests/ntacls_backup.py2
-rw-r--r--python/samba/tests/samba3sam.py4
-rw-r--r--python/samba/tests/samba_tool/base.py4
-rw-r--r--python/samba/tests/samba_tool/user_virtualCryptSHA.py2
-rw-r--r--python/samba/tests/source.py2
-rw-r--r--python/samba/upgradehelpers.py6
24 files changed, 88 insertions, 88 deletions
diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py
index 843649fa5db..521c8415c1b 100644
--- a/python/samba/dbchecker.py
+++ b/python/samba/dbchecker.py
@@ -597,7 +597,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
def err_missing_dn_GUID_component(self, dn, attrname, val, dsdb_dn, errstr):
"""handle a missing GUID extended DN component"""
self.report("ERROR: %s component for %s in object %s - %s" % (errstr, attrname, dn, val))
- controls=["extended_dn:1:1", "show_recycled:1"]
+ controls = ["extended_dn:1:1", "show_recycled:1"]
try:
res = self.samdb.search(base=str(dsdb_dn.dn), scope=ldb.SCOPE_BASE,
attrs=[], controls=controls)
@@ -629,7 +629,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
def err_incorrect_binary_dn(self, dn, attrname, val, dsdb_dn, errstr):
"""handle an incorrect binary DN component"""
self.report("ERROR: %s binary component for %s in object %s - %s" % (errstr, attrname, dn, val))
- controls=["extended_dn:1:1", "show_recycled:1"]
+ controls = ["extended_dn:1:1", "show_recycled:1"]
if not self.confirm_all('Change DN to %s?' % str(dsdb_dn), 'fix_all_binary_dn'):
self.report("Not fixing %s" % errstr)
@@ -1224,7 +1224,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
dsdb_dn.binary = "%08X" % int(res[0]['instanceType'][0])
if str(dsdb_dn) != val:
- error_count +=1
+ error_count += 1
self.err_incorrect_binary_dn(obj.dn, attrname, val, dsdb_dn, "incorrect instanceType part of Binary DN")
continue
@@ -2097,7 +2097,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
if len(set_attrs_from_md) < len(list_attid_from_md) \
or len(wrong_attids) > 0 \
or sorted(list_attid_from_md) != list_attid_from_md:
- error_count +=1
+ error_count += 1
self.err_replmetadata_incorrect_attid(dn, attrname, obj[attrname], wrong_attids)
else:
diff --git a/python/samba/descriptor.py b/python/samba/descriptor.py
index 7009cf67f52..4aad686bd45 100644
--- a/python/samba/descriptor.py
+++ b/python/samba/descriptor.py
@@ -44,7 +44,7 @@ def sddl2binary(sddl_in, domain_sid, name_map):
return ndr_pack(sec)
def get_empty_descriptor(domain_sid, name_map={}):
- sddl= ""
+ sddl = ""
return sddl2binary(sddl, domain_sid, name_map)
# "get_schema_descriptor" is located in "schema.py"
@@ -127,7 +127,7 @@ def get_config_delete_protected2_descriptor(domain_sid, name_map={}):
return sddl2binary(sddl, domain_sid, name_map)
def get_domain_descriptor(domain_sid, name_map={}):
- sddl= "O:BAG:BAD:AI(OA;CIIO;RP;4c164200-20c0-11d0-a768-00aa006e0529;4828cc14-1437-45bc-9b07-ad6f015e5f28;RU)" \
+ sddl = "O:BAG:BAD:AI(OA;CIIO;RP;4c164200-20c0-11d0-a768-00aa006e0529;4828cc14-1437-45bc-9b07-ad6f015e5f28;RU)" \
"(OA;CIIO;RP;4c164200-20c0-11d0-a768-00aa006e0529;bf967aba-0de6-11d0-a285-00aa003049e2;RU)" \
"(OA;CIIO;RP;5f202010-79a5-11d0-9020-00c04fc2d4cf;4828cc14-1437-45bc-9b07-ad6f015e5f28;RU)" \
"(OA;CIIO;RP;5f202010-79a5-11d0-9020-00c04fc2d4cf;bf967aba-0de6-11d0-a285-00aa003049e2;RU)" \
diff --git a/python/samba/gpclass.py b/python/samba/gpclass.py
index 106bed26cdd..c419c363611 100644
--- a/python/samba/gpclass.py
+++ b/python/samba/gpclass.py
@@ -373,7 +373,7 @@ class gp_inf_ext(gp_ext):
# then we return that boolean at the end.
inf_conf = ConfigParser()
- inf_conf.optionxform=str
+ inf_conf.optionxform = str
try:
inf_conf.readfp(StringIO(policy))
except:
diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py
index e8c2e1de9bb..050a158e2e4 100644
--- a/python/samba/netcmd/domain.py
+++ b/python/samba/netcmd/domain.py
@@ -545,7 +545,7 @@ class cmd_domain_provision(Command):
def _get_nameserver_ip(self):
"""Grab the nameserver IP address from /etc/resolv.conf."""
from os import path
- RESOLV_CONF="/etc/resolv.conf"
+ RESOLV_CONF = "/etc/resolv.conf"
if not path.isfile(RESOLV_CONF):
self.logger.warning("Failed to locate %s" % RESOLV_CONF)
@@ -1226,7 +1226,7 @@ class cmd_domain_level(Command):
# Directly on the base DN
m = ldb.Message()
m.dn = ldb.Dn(samdb, domain_dn)
- m["msDS-Behavior-Version"]= ldb.MessageElement(
+ m["msDS-Behavior-Version"] = ldb.MessageElement(
str(new_level_domain), ldb.FLAG_MOD_REPLACE,
"msDS-Behavior-Version")
samdb.modify(m)
@@ -1234,7 +1234,7 @@ class cmd_domain_level(Command):
m = ldb.Message()
m.dn = ldb.Dn(samdb, "CN=" + lp.get("workgroup")
+ ",CN=Partitions,%s" % samdb.get_config_basedn())
- m["msDS-Behavior-Version"]= ldb.MessageElement(
+ m["msDS-Behavior-Version"] = ldb.MessageElement(
str(new_level_domain), ldb.FLAG_MOD_REPLACE,
"msDS-Behavior-Version")
try:
@@ -1266,7 +1266,7 @@ class cmd_domain_level(Command):
m = ldb.Message()
m.dn = ldb.Dn(samdb, "CN=Partitions,%s" % samdb.get_config_basedn())
- m["msDS-Behavior-Version"]= ldb.MessageElement(
+ m["msDS-Behavior-Version"] = ldb.MessageElement(
str(new_level_forest), ldb.FLAG_MOD_REPLACE,
"msDS-Behavior-Version")
samdb.modify(m)
@@ -1855,7 +1855,7 @@ class DomainTrustCommand(Command):
server_type_string))
self.remote_server = remote_info.pdc_dns_name
- self.remote_binding_string="ncacn_np:%s[%s]" % (self.remote_server, remote_binding_options)
+ self.remote_binding_string = "ncacn_np:%s[%s]" % (self.remote_server, remote_binding_options)
self.remote_creds = remote_creds
return self.remote_server
@@ -3977,7 +3977,7 @@ class ldif_schema_update:
print("Defunct object %s doesn't exist, skipping" % self.dn)
return True
elif self.unknown_oid is not None:
- print("Skipping unknown OID %s for object %s" %(self.unknown_oid, self.dn))
+ print("Skipping unknown OID %s for object %s" % (self.unknown_oid, self.dn))
return True
return False
diff --git a/python/samba/netcmd/drs.py b/python/samba/netcmd/drs.py
index 12cfee02d81..2d4ad9cd501 100644
--- a/python/samba/netcmd/drs.py
+++ b/python/samba/netcmd/drs.py
@@ -729,7 +729,7 @@ class cmd_drs_options(Command):
#save new options
m = ldb.Message()
m.dn = ldb.Dn(self.samdb, ntds_dn)
- m["options"]= ldb.MessageElement(str(dsa_opts), ldb.FLAG_MOD_REPLACE, "options")
+ m["options"] = ldb.MessageElement(str(dsa_opts), ldb.FLAG_MOD_REPLACE, "options")
self.samdb.modify(m)
# print out new DSA options
cur_opts = [x for x in self.option_map if self.option_map[x] & dsa_opts]
diff --git a/python/samba/netcmd/fsmo.py b/python/samba/netcmd/fsmo.py
index e8a64f98513..3dab02407dc 100644
--- a/python/samba/netcmd/fsmo.py
+++ b/python/samba/netcmd/fsmo.py
@@ -118,7 +118,7 @@ def transfer_dns_role(outf, sambaopts, credopts, role, samdb):
m = ldb.Message()
m.dn = ldb.Dn(samdb, role_object)
- m["fSMORoleOwner"]= ldb.MessageElement(new_owner,
+ m["fSMORoleOwner"] = ldb.MessageElement(new_owner,
ldb.FLAG_MOD_ADD,
"fSMORoleOwner")
try:
@@ -164,7 +164,7 @@ def transfer_role(outf, role, samdb):
m.dn = ldb.Dn(samdb, "")
if role == "rid":
master_owner = get_fsmo_roleowner(samdb, rid_dn, role)
- m["becomeRidMaster"]= ldb.MessageElement(
+ m["becomeRidMaster"] = ldb.MessageElement(
"1", ldb.FLAG_MOD_REPLACE,
"becomeRidMaster")
elif role == "pdc":
@@ -174,22 +174,22 @@ def transfer_role(outf, role, samdb):
scope=ldb.SCOPE_BASE, attrs=["objectSid"])
assert len(res) == 1
sid = res[0]["objectSid"][0]
- m["becomePdc"]= ldb.MessageElement(
+ m["becomePdc"] = ldb.MessageElement(
sid, ldb.FLAG_MOD_REPLACE,
"becomePdc")
elif role == "naming":
master_owner = get_fsmo_roleowner(samdb, naming_dn, role)
- m["becomeDomainMaster"]= ldb.MessageElement(
+ m["becomeDomainMaster"] = ldb.MessageElement(
"1", ldb.FLAG_MOD_REPLACE,
"becomeDomainMaster")
elif role == "infrastructure":
master_owner = get_fsmo_roleowner(samdb, infrastructure_dn, role)
- m["becomeInfrastructureMaster"]= ldb.MessageElement(
+ m["becomeInfrastructureMaster"] = ldb.MessageElement(
"1", ldb.FLAG_MOD_REPLACE,
"becomeInfrastructureMaster")
elif role == "schema":
master_owner = get_fsmo_roleowner(samdb, schema_dn, role)
- m["becomeSchemaMaster"]= ldb.MessageElement(
+ m["becomeSchemaMaster"] = ldb.MessageElement(
"1", ldb.FLAG_MOD_REPLACE,
"becomeSchemaMaster")
else:
@@ -297,7 +297,7 @@ You must provide an Admin user and password."""),
if force is not None or seize == True:
self.message("Seizing %s FSMO role..." % role)
- m["fSMORoleOwner"]= ldb.MessageElement(
+ m["fSMORoleOwner"] = ldb.MessageElement(
serviceName, ldb.FLAG_MOD_REPLACE,
"fSMORoleOwner")
@@ -380,7 +380,7 @@ You must provide an Admin user and password."""),
if force is not None or seize == True:
self.message("Seizing %s FSMO role..." % role)
- m["fSMORoleOwner"]= ldb.MessageElement(
+ m["fSMORoleOwner"] = ldb.MessageElement(
serviceName, ldb.FLAG_MOD_REPLACE,
"fSMORoleOwner")
try:
diff --git a/python/samba/netcmd/gpo.py b/python/samba/netcmd/gpo.py
index bbe4834e135..75a6ca77d53 100644
--- a/python/samba/netcmd/gpo.py
+++ b/python/samba/netcmd/gpo.py
@@ -471,7 +471,7 @@ class cmd_list(Command):
continue
try:
- sd_flags=security.SECINFO_OWNER|security.SECINFO_GROUP|security.SECINFO_DACL
+ sd_flags = security.SECINFO_OWNER|security.SECINFO_GROUP|security.SECINFO_DACL
gmsg = self.samdb.search(base=g['dn'], scope=ldb.SCOPE_BASE,
attrs=['name', 'displayName', 'flags',
'nTSecurityDescriptor'],
@@ -1250,7 +1250,7 @@ class cmd_create(Command):
m['a05'] = ldb.MessageElement("0", ldb.FLAG_MOD_REPLACE, "versionNumber")
m['a07'] = ldb.MessageElement("2", ldb.FLAG_MOD_REPLACE, "gpcFunctionalityVersion")
m['a04'] = ldb.MessageElement("0", ldb.FLAG_MOD_REPLACE, "flags")
- controls=["permissive_modify:0"]
+ controls = ["permissive_modify:0"]
self.samdb.modify(m, controls=controls)
except Exception:
self.samdb.transaction_cancel()
diff --git a/python/samba/netcmd/ldapcmp.py b/python/samba/netcmd/ldapcmp.py
index 88fe857c825..0a00c452d98 100644
--- a/python/samba/netcmd/ldapcmp.py
+++ b/python/samba/netcmd/ldapcmp.py
@@ -748,7 +748,7 @@ class LDAPBundel(object):
# It does not matter if they are in the same DC, in two DC in one domain or in two
# different domains.
if self.search_scope != SCOPE_BASE:
- title= "\n* DNs found only in %s:" % self.con.host
+ title = "\n* DNs found only in %s:" % self.con.host
for x in self.dn_list:
if not x.upper() in [q.upper() for q in other.dn_list]:
if title and not self.skip_missing_dn:
@@ -759,7 +759,7 @@ class LDAPBundel(object):
self.dn_list[self.dn_list.index(x)] = ""
self.dn_list = [x for x in self.dn_list if x]
#
- title= "\n* DNs found only in %s:" % other.con.host
+ title = "\n* DNs found only in %s:" % other.con.host
for x in other.dn_list:
if not x.upper() in [q.upper() for q in self.dn_list]:
if title and not self.skip_missing_dn:
diff --git a/python/samba/netcmd/ntacl.py b/python/samba/netcmd/ntacl.py
index d2a232d8a63..30410b16bf1 100644
--- a/python/samba/netcmd/ntacl.py
+++ b/python/samba/netcmd/ntacl.py
@@ -215,7 +215,7 @@ class cmd_ntacl_sysvolreset(Command):
s3conf.set("passdb backend", "samba_dsdb:%s" % samdb.url)
LA_sid = security.dom_sid(str(domain_sid)
- +"-"+str(security.DOMAIN_RID_ADMINISTRATOR))
+ + "-"+str(security.DOMAIN_RID_ADMINISTRATOR))
BA_sid = security.dom_sid(security.SID_BUILTIN_ADMINISTRATORS)
s4_passdb = passdb.PDB(s3conf.get("passdb backend"))
diff --git a/python/samba/netcmd/spn.py b/python/samba/netcmd/spn.py
index b4125e18d90..86d73f451df 100644
--- a/python/samba/netcmd/spn.py
+++ b/python/samba/netcmd/spn.py
@@ -56,7 +56,7 @@ class cmd_spn_list(Command):
res = sam.search(
expression="samaccountname=%s" % ldb.binary_encode(cleaneduser),
scope=ldb.SCOPE_SUBTREE, attrs=["servicePrincipalName"])
- if len(res) >0:
+ if len(res) > 0:
spns = res[0].get("servicePrincipalName")
found = False
flag = ldb.FLAG_MOD_ADD
@@ -107,7 +107,7 @@ class cmd_spn_add(Command):
res = sam.search(
expression="samaccountname=%s" % ldb.binary_encode(cleaneduser),
scope=ldb.SCOPE_SUBTREE, attrs=["servicePrincipalName"])
- if len(res) >0:
+ if len(res) > 0:
res[0].dn
msg = ldb.Message()
spns = res[0].get("servicePrincipalName")
@@ -157,7 +157,7 @@ class cmd_spn_delete(Command):
expression="servicePrincipalName=%s" % ldb.binary_encode(name),
scope=ldb.SCOPE_SUBTREE,
attrs=["servicePrincipalName", "samAccountName"])
- if len(res) >0:
+ if len(res) > 0:
result = None
if user is not None:
(cleaneduser, realm, domain) = _get_user_realm_domain(user)
@@ -176,7 +176,7 @@ class cmd_spn_delete(Command):
"and no specific user was specified, list of users"
" with this spn:%s" % (name, listUser))
else:
- result=res[0]
+ result = res[0]
msg = ldb.Message()
diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py
index 868f23c63b1..c2af4923adb 100644
--- a/python/samba/netcmd/user.py
+++ b/python/samba/netcmd/user.py
@@ -1065,7 +1065,7 @@ class GetPasswordCommand(Command):
domain, dns_domain):
if i == 1:
user = account_name
- realm= domain
+ realm = domain
elif i == 2:
user = account_name.lower()
realm = domain.lower()
@@ -1950,7 +1950,7 @@ samba-tool user syncpasswords --terminate \\
del dirsync_obj[a]
dirsync_obj["# %s::" % a] = ["REDACTED SECRET ATTRIBUTE"]
dirsync_ldif = self.samdb.write_ldif(dirsync_obj, ldb.CHANGETYPE_NONE)
- log_msg("# Dirsync[%d] %s %s\n%s" %(idx, guid, sid, dirsync_ldif))
+ log_msg("# Dirsync[%d] %s %s\n%s" % (idx, guid, sid, dirsync_ldif))
obj = self.get_account_attributes(self.samdb,
username="%s" % sid,
basedn="<GUID=%s>" % guid,
@@ -2401,19 +2401,19 @@ LDAP server using the 'nano' editor.
line = line[2:]
plus_lines.append(line)
- user_ldif="dn: %s\n" % user_dn
+ user_ldif = "dn: %s\n" % user_dn
user_ldif += "changetype: modify\n"
for line in minus_lines:
attr, val = line.split(':', 1)
- search_attr="%s:" % attr
+ search_attr = "%s:" % attr
if not re.search(r'^' + search_attr, str(plus_lines)):
user_ldif += "delete: %s\n" % attr
user_ldif += "%s: %s\n" % (attr, val)
for line in plus_lines:
attr, val = line.split(':', 1)
- search_attr="%s:" % attr
+ search_attr = "%s:" % attr
if re.search(r'^' + search_attr, str(minus_lines)):
user_ldif += "replace: %s\n" % attr
user_ldif += "%s: %s\n" % (attr, val)
diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py
index 664c170fcae..4dc6a5a75d9 100644
--- a/python/samba/provision/__init__.py
+++ b/python/samba/provision/__init__.py
@@ -227,9 +227,9 @@ def find_provision_key_parameters(samdb, secretsdb, idmapdb, paths, smbconf,
str(current[0]["defaultNamingContext"][0].decode('utf8')),
paths.smbconf, basedn)))
- names.domaindn=current[0]["defaultNamingContext"][0]
- names.rootdn=current[0]["rootDomainNamingContext"][0]
- names.ncs=current[0]["namingContexts"]
+ names.domaindn = current[0]["defaultNamingContext"][0]
+ names.rootdn = current[0]["rootDomainNamingContext"][0]
+ names.ncs = current[0]["namingContexts"]
names.dnsforestdn = None
names.dnsdomaindn = None
@@ -1580,7 +1580,7 @@ def fill_samdb(samdb, lp, names, logger, policyguid,
SYSVOL_ACL = "O:LAG:BAD:P(A;OICI;0x001f01ff;;;BA)(A;OICI;0x001200a9;;;SO)(A;OICI;0x001f01ff;;;SY)(A;OICI;0x001200a9;;;AU)"
POLICIES_ACL = "O:LAG:BAD:P(A;OICI;0x001f01ff;;;BA)(A;OICI;0x001200a9;;;SO)(A;OICI;0x001f01ff;;;SY)(A;OICI;0x001200a9;;;AU)(A;OICI;0x001301bf;;;PA)"
-SYSVOL_SERVICE="sysvol"
+SYSVOL_SERVICE = "sysvol"
def set_dir_acl(path, acl, lp, domsid, use_ntvfs, passdb, service=SYSVOL_SERVICE):
setntacl(lp, path, acl, domsid, use_ntvfs=use_ntvfs, skip_invalid_chown=True, passdb=passdb, service=service)
diff --git a/python/samba/samba3/__init__.py b/python/samba/samba3/__init__.py
index 053c113715d..950b3c28479 100644
--- a/python/samba/samba3/__init__.py
+++ b/python/samba/samba3/__init__.py
@@ -333,7 +333,7 @@ class WinsDatabase(object):
ips = []
while "." in entries[i]:
ips.append(entries[i])
- i+=1
+ i += 1
nb_flags = int(entries[i][:-1], 16)
assert not name in self.entries, "Name %s exists twice" % name
self.entries[name] = (ttl, ips, nb_flags)
diff --git a/python/samba/samdb.py b/python/samba/samdb.py
index 0cf595345ac..ae758ac9d4d 100644
--- a/python/samba/samdb.py
+++ b/python/samba/samdb.py
@@ -867,7 +867,7 @@ schemaUpdateNow: 1
o.originating_usn = seq
o.local_usn = seq
- if not found and addifnotexist and len(ctr.array) >0:
+ if not found and addifnotexist and len(ctr.array) > 0:
o2 = drsblobs.replPropertyMetaData1()
o2.attid = 589914
att_oid = self.get_oid_from_attid(o2.attid)
diff --git a/python/samba/schema.py b/python/samba/schema.py
index 08c77c04e52..61561f199f6 100644
--- a/python/samba/schema.py
+++ b/python/samba/schema.py
@@ -214,7 +214,7 @@ def get_linked_attributes(schemadn, schemaldb):
attribute="lDAPDisplayName",
scope=SCOPE_SUBTREE)
if target is not None:
- attributes[str(res[i]["lDAPDisplayName"])]=str(target)
+ attributes[str(res[i]["lDAPDisplayName"])] = str(target)
return attributes
diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py
index a3caba6472c..60c18c73234 100644
--- a/python/samba/tests/__init__.py
+++ b/python/samba/tests/__init__.py
@@ -56,7 +56,7 @@ except ImportError:
class SkipTest(Exception):
"""Test skipped."""
-HEXDUMP_FILTER=bytearray([x if ((len(repr(chr(x)))==3) and (x < 127)) else ord('.') for x in range(256)])
+HEXDUMP_FILTER = bytearray([x if ((len(repr(chr(x))) == 3) and (x < 127)) else ord('.') for x in range(256)])
class TestCase(unittest.TestCase):
"""A Samba test case."""
@@ -498,6 +498,6 @@ def create_test_ou(samdb, name):
# objects can be slow to replicate out. So the OU created by a previous
# testenv may still exist at the point that tests start on another testenv.
rand = randint(1, 10000000)
- dn = ldb.Dn(samdb, "OU=%s%d,%s" %(name, rand, samdb.get_default_basedn()))
+ dn = ldb.Dn(samdb, "OU=%s%d,%s" % (name, rand, samdb.get_default_basedn()))
samdb.add({"dn": dn, "objectclass": "organizationalUnit"})
return dn
diff --git a/python/samba/tests/credentials.py b/python/samba/tests/credentials.py
index bddbc46b94e..7c89da54ee3 100644
--- a/python/samba/tests/credentials.py
+++ b/python/samba/tests/credentials.py
@@ -124,19 +124,19 @@ class CredentialsTests(samba.tests.TestCaseInTempDir):
self.creds.get_secure_channel_type())
def test_get_nt_hash(self):
- password="geheim"
- hex_nthash="c2ae1fe6e648846352453e816f2aeb93"
+ password = "geheim"
+ hex_nthash = "c2ae1fe6e648846352453e816f2aeb93"
self.creds.set_password(password)
self.assertEqual(password, self.creds.get_password())
self.assertEqual(binascii.a2b_hex(hex_nthash),
self.creds.get_nt_hash())
def test_get_ntlm_response(self):
- password="SecREt01"
- hex_challenge="0123456789abcdef"
- hex_nthash="cd06ca7c7e10c99b1d33b7485a2ed808"
- hex_session_key="3f373ea8e4af954f14faa506f8eebdc4"
- hex_ntlm_response="25a98c1c31e81847466b29b2df4680f39958fb8c213a9cc6"
+ password = "SecREt01"
+ hex_challenge = "0123456789abcdef"
+ hex_nthash = "cd06ca7c7e10c99b1d33b7485a2ed808"
+ hex_session_key = "3f373ea8e4af954f14faa506f8eebdc4"
+ hex_ntlm_response = "25a98c1c31e81847466b29b2df4680f39958fb8c213a9cc6"
self.creds.set_username("fred")
self.creds.set_domain("nurk")
self.creds.set_password(password)
@@ -154,7 +154,7 @@ class CredentialsTests(samba.tests.TestCaseInTempDir):
def test_get_nt_hash_string(self):
self.creds.set_password_will_be_nt_hash(True)
- hex_nthash="c2ae1fe6e648846352453e816f2aeb93"
+ hex_nthash = "c2ae1fe6e648846352453e816f2aeb93"
self.creds.set_password(hex_nthash)
self.assertEqual(None, self.creds.get_password())
self.assertEqual(binascii.a2b_hex(hex_nthash),
@@ -198,10 +198,10 @@ class CredentialsTests(samba.tests.TestCaseInTempDir):
self.assertEqual(creds.authentication_requested(), False)
def test_parse_file_1(self):
- realm="realm.example.com"
- domain="dom"
- password="pass"
- username="user"
+ realm = "realm.example.com"
+ domain = "dom"
+ password = "pass"
+ username = "user"
passwd_file_name = os.path.join(self.tempdir, "parse_file")
passwd_file_fd = open(passwd_file_name, self.open_mode)
@@ -221,10 +221,10 @@ class CredentialsTests(samba.tests.TestCaseInTempDir):
os.unlink(passwd_file_name)
def test_parse_file_2(self):
- realm="realm.example.com"
- domain="dom"
- password="pass"
- username="user"
+ realm = "realm.example.com"
+ domain = "dom"
+ password = "pass"
+ username = "user"
passwd_file_name = os.path.join(self.tempdir, "parse_file")
passwd_file_fd = open(passwd_file_name, self.open_mode)
@@ -244,12 +244,12 @@ class CredentialsTests(samba.tests.TestCaseInTempDir):
os.unlink(passwd_file_name)
def test_parse_file_3(self):
- realm="realm.example.com"
- domain="domain"
- password="password"
- username="username"
+ realm = "realm.example.com"
+ domain = "domain"
+ password = "password"
+ username = "username"
- userdom="userdom"
+ userdom = "userdom"
passwd_file_name = os.path.join(self.tempdir, "parse_file")
passwd_file_fd = open(passwd_file_name, self.open_mode)
@@ -269,12 +269,12 @@ class CredentialsTests(samba.tests.TestCaseInTempDir):
os.unlink(passwd_file_name)
def test_parse_file_4(self):
- realm="realm.example.com"
- domain="domain"
- password="password"
- username="username"
+ realm = "realm.example.com"
+ domain = "domain"
+ password = "password"
+ username = "username"
- userdom="userdom"
+ userdom = "userdom"
passwd_file_name = os.path.join(self.tempdir, "parse_file")
passwd_file_fd = open(passwd_file_name, self.open_mode)
@@ -294,12 +294,12 @@ class CredentialsTests(samba.tests.TestCaseInTempDir):
os.unlink(passwd_file_name)
def test_parse_file_5(self):
- realm="realm.example.com"
- domain="domain"
- password="password"
- username="username"
+ realm = "realm.example.com"
+ domain = "domain"
+ password = "password"
+ username = "username"
- userdom="userdom"
+ userdom = "userdom"
passwd_file_name = os.path.join(self.tempdir, "parse_file")
passwd_file_fd = open(passwd_file_name, self.open_mode)
diff --git a/python/samba/tests/dcerpc/raw_testcase.py b/python/samba/tests/dcerpc/raw_testcase.py
index 7726f9b3f7b..7c99f8d807d 100644
--- a/python/samba/tests/dcerpc/raw_testcase.py
+++ b/python/samba/tests/dcerpc/raw_testcase.py
@@ -338,7 +338,7 @@ class RawDCERPCTest(TestCase):
auth_context_id=auth_context["auth_context_id"],
auth_blob=zero_sig)
else:
- auth_info=""
+ auth_info = ""
pfc_flags = samba.dcerpc.dcerpc.DCERPC_PFC_FLAG_FIRST
pfc_flags |= samba.dcerpc.dcerpc.DCERPC_PFC_FLAG_LAST
@@ -604,7 +604,7 @@ class RawDCERPCTest(TestCase):
a.auth_type = auth_type
a.auth_level = auth_level
a.auth_pad_length = auth_pad_length
- a.auth_context_id= auth_context_id
+ a.auth_context_id = auth_context_id
a.credentials = auth_blob
ai = ndr_pack(a)
diff --git a/python/samba/tests/ntacls_backup.py b/python/samba/tests/ntacls_backup.py
index 9ab264a27fd..bb1bc97ef43 100644
--- a/python/samba/tests/ntacls_backup.py
+++ b/python/samba/tests/ntacls_backup.py
@@ -39,7 +39,7 @@ class NtaclsBackupRestoreTests(TestCaseInTempDir):
super(NtaclsBackupRestoreTests, self).setUp()
self.server = os.environ["SERVER"] # addc
- samdb_url='ldap://' + self.server
+ samdb_url = 'ldap://' + self.server
self.service = 'test1' # service/share to test
# root path for service
diff --git a/python/samba/tests/samba3sam.py b/python/samba/tests/samba3sam.py
index c8f4fb026a8..a5e39eebe59 100644
--- a/python/samba/tests/samba3sam.py
+++ b/python/samba/tests/samba3sam.py
@@ -329,7 +329,7 @@ class MapTestCase(MapBaseTestCase):
# Add a set of split records
self.ldb.add_ldif("""
-dn: """+ self.samba4.dn("cn=Domain Users") + """
+dn: """ + self.samba4.dn("cn=Domain Users") + """
objectClass: group
cn: Domain Users
objectSid: S-1-5-21-4231626423-2410014848-2360679739-513
@@ -337,7 +337,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-513
# Add a set of split records
self.ldb.add_ldif("""
-dn: """+ self.samba4.dn("cn=X") + """
+dn: """ + self.samba4.dn("cn=X") + """
objectClass: user
cn: X
codePage: x
diff --git a/python/samba/tests/samba_tool/base.py b/python/samba/tests/samba_tool/base.py
index 06e19c19087..8e2e2457e12 100644
--- a/python/samba/tests/samba_tool/base.py
+++ b/python/samba/tests/samba_tool/base.py
@@ -122,14 +122,14 @@ class SambaToolCmdTest(samba.tests.BlackboxTestCase):
def randomName(self, count=8):
"""Create a random name, cap letters and numbers, and always starting with a letter"""
name = random.choice(string.ascii_uppercase)
- name += ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase+ string.digits) for x in range(count - 1))
+ name += ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for x in range(count - 1))
return name
def randomPass(self, count=16):
name = random.choice(string.ascii_uppercase)
name += random.choice(string.digits)
name += random.choice(string.ascii_lowercase)
- name += ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase+ string.digits) for x in range(count - 3))
+ name += ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for x in range(count - 3))
return name
def randomXid(self):
diff --git a/python/samba/tests/samba_tool/user_virtualCryptSHA.py b/python/samba/tests/samba_tool/user_virtualCryptSHA.py
index a25bf5e6eb8..be3316bd3bf 100644
--- a/python/samba/tests/samba_tool/user_virtualCryptSHA.py
+++ b/python/samba/tests/samba_tool/user_virtualCryptSHA.py
@@ -478,7 +478,7 @@ class UserCmdCryptShaTestCase(SambaToolCmdTest):
"virtualCryptSHA512;rounds=5129",
True)
self.assertFalse(sha256 == _get_attribute(out, "virtualCryptSHA256"))
- self.assertFalse(sha512 ==_get_attribute(out, "virtualCryptSHA512"))
+ self.assertFalse(sha512 == _get_attribute(out, "virtualCryptSHA512"))
# The returned hashes should specify the correct number of rounds
self.assertTrue(sha256.startswith("{CRYPT}$5$rounds=2561"))
diff --git a/python/samba/tests/source.py b/python/samba/tests/source.py
index 378c6a2e9fd..5a62dbf8a33 100644
--- a/python/samba/tests/source.py
+++ b/python/samba/tests/source.py
@@ -196,7 +196,7 @@ class TestSource(TestCase):
def test_shebang_lines(self):
"""Check that files with shebang lines and only those are executable."""
files_with_shebang = {}
- files_without_shebang= {}
+ files_without_shebang = {}
for fname, line_no, line in self._iter_source_files_lines():
if line_no >= 1:
continue
diff --git a/python/samba/upgradehelpers.py b/python/samba/upgradehelpers.py
index 90c65377d40..1dda2915be1 100644
--- a/python/samba/upgradehelpers.py
+++ b/python/samba/upgradehelpers.py
@@ -177,7 +177,7 @@ def usn_in_range(usn, range):
cont = False
continue
if usn < int(range[idx]):
- if idx %2 == 1:
+ if idx % 2 == 1:
ok = True
cont = False
if usn == int(range[idx]):
@@ -290,7 +290,7 @@ def dn_sort(x, y):
return ret
else:
if i == minimum-1:
- assert len1!=len2,"PB PB PB" + " ".join(tab1)+" / " + " ".join(tab2)
+ assert len1 != len2,"PB PB PB" + " ".join(tab1)+" / " + " ".join(tab2)
if len1 > len2:
return 1
else:
@@ -725,7 +725,7 @@ def findprovisionrange(samdb, basedn):
for o in obj.array:
# like a timestamp but with the resolution of 1 minute
- minutestamp =_glue.nttime2unix(o.originating_change_time) // 60
+ minutestamp = _glue.nttime2unix(o.originating_change_time) // 60
hash_ts = hash_id.get(str(o.originating_invocation_id))
if hash_ts is None: