From: Joe Guo Date: Mon, 30 Jul 2018 06:18:25 +0000 (+1200) Subject: PEP8: fix E226: missing whitespace around arithmetic operator X-Git-Tag: tdb-1.3.17~2066 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=87bbc2df972d112870bb7d5c8839663affe62b21;p=thirdparty%2Fsamba.git PEP8: fix E226: missing whitespace around arithmetic operator Signed-off-by: Joe Guo Reviewed-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/lib/ldb-samba/tests/match_rules.py b/lib/ldb-samba/tests/match_rules.py index dde787ff68b..6d2ba1b920d 100755 --- a/lib/ldb-samba/tests/match_rules.py +++ b/lib/ldb-samba/tests/match_rules.py @@ -1125,7 +1125,7 @@ class MatchRuleConditionTests(samba.tests.TestCase): FLAG_MOD_ADD, "member") self.ldb.modify(m) - self.question = 6*(9-2) + self.question = 6 * (9 -2) self.answer = 42 def tearDown(self): diff --git a/lib/ldb/tests/python/api.py b/lib/ldb/tests/python/api.py index 0654c2fb971..643cacd0616 100755 --- a/lib/ldb/tests/python/api.py +++ b/lib/ldb/tests/python/api.py @@ -2097,7 +2097,7 @@ class DnTests(TestCase): def test_remove_base_components(self): x = ldb.Dn(self.ldb, "dc=foo24,dc=samba,dc=org") - x.remove_base_components(len(x)-1) + x.remove_base_components(len(x) - 1) self.assertEqual("dc=foo24", str(x)) def test_parse_ldif(self): diff --git a/python/samba/__init__.py b/python/samba/__init__.py index b5d8d1a4cf6..a79b1fdf473 100644 --- a/python/samba/__init__.py +++ b/python/samba/__init__.py @@ -271,7 +271,7 @@ def check_all_substituted(text): var_end = text.find("}", var_start) raise Exception("Not all variables substituted: %s" % - text[var_start:var_end+1]) + text[var_start:var_end + 1]) def read_and_sub_file(file_name, subst_vars): diff --git a/python/samba/common.py b/python/samba/common.py index 10891e4ce7a..fabbcea13df 100644 --- a/python/samba/common.py +++ b/python/samba/common.py @@ -92,7 +92,7 @@ class dsdb_Dn(object): raise RuntimeError("Invalid DN %s" % dnstring) prefix_len = 4 + len(colons[1]) + int(colons[1]) self.prefix = dnstring[0:prefix_len] - self.binary = self.prefix[3+len(colons[1]):-1] + self.binary = self.prefix[3 + len(colons[1]):-1] self.dnstring = dnstring[prefix_len:] else: self.dnstring = dnstring diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py index 521c8415c1b..6e84f1903c8 100644 --- a/python/samba/dbchecker.py +++ b/python/samba/dbchecker.py @@ -2485,7 +2485,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) # check that the dsServiceName is in GUID form if not 'dsServiceName' in obj: self.report('ERROR: dsServiceName missing in @ROOTDSE') - return error_count+1 + return error_count + 1 if not obj['dsServiceName'][0].startswith(' %s\n" % + self.outf.write(4 * " " + "${DOMAIN_DN} => %s\n" % self.base_dn) - self.outf.write(4*" " + "${DOMAIN_NETBIOS} => %s\n" % + self.outf.write(4 * " " + "${DOMAIN_NETBIOS} => %s\n" % self.domain_netbios) - self.outf.write(4*" " + "${SERVER_NAME} => %s\n" % + self.outf.write(4 * " " + "${SERVER_NAME} => %s\n" % self.server_names) - self.outf.write(4*" " + "${DOMAIN_NAME} => %s\n" % + self.outf.write(4 * " " + "${DOMAIN_NAME} => %s\n" % self.domain_name) def find_domain_sid(self): @@ -303,9 +303,9 @@ class Descriptor(object): def diff_1(self, other): res = "" if len(self.dacl_list) != len(other.dacl_list): - res += 4*" " + "Difference in ACE count:\n" - res += 8*" " + "=> %s\n" % len(self.dacl_list) - res += 8*" " + "=> %s\n" % len(other.dacl_list) + res += 4 * " " + "Difference in ACE count:\n" + res += 8 * " " + "=> %s\n" % len(self.dacl_list) + res += 8 * " " + "=> %s\n" % len(other.dacl_list) # i = 0 flag = True @@ -336,9 +336,9 @@ class Descriptor(object): def diff_2(self, other): res = "" if len(self.dacl_list) != len(other.dacl_list): - res += 4*" " + "Difference in ACE count:\n" - res += 8*" " + "=> %s\n" % len(self.dacl_list) - res += 8*" " + "=> %s\n" % len(other.dacl_list) + res += 4 * " " + "Difference in ACE count:\n" + res += 8 * " " + "=> %s\n" % len(self.dacl_list) + res += 8 * " " + "=> %s\n" % len(other.dacl_list) # common_aces = [] self_aces = [] @@ -356,9 +356,9 @@ class Descriptor(object): common_aces.append(ace) self_aces = sorted(self_aces) if len(self_aces) > 0: - res += 4*" " + "ACEs found only in %s:\n" % self.con.host + res += 4 *" " + "ACEs found only in %s:\n" % self.con.host for ace in self_aces: - res += 8*" " + ace + "\n" + res += 8 * " " + ace + "\n" # for ace in other_dacl_list_fixed: try: @@ -369,15 +369,15 @@ class Descriptor(object): common_aces.append(ace) other_aces = sorted(other_aces) if len(other_aces) > 0: - res += 4*" " + "ACEs found only in %s:\n" % other.con.host + res += 4 *" " + "ACEs found only in %s:\n" % other.con.host for ace in other_aces: - res += 8*" " + ace + "\n" + res += 8 * " " + ace + "\n" # common_aces = sorted(list(set(common_aces))) if self.con.verbose: - res += 4*" " + "ACEs found in both:\n" + res += 4 *" " + "ACEs found in both:\n" for ace in common_aces: - res += 8*" " + ace + "\n" + res += 8 * " " + ace + "\n" return (self_aces == [] and other_aces == [], res) class LDAPObject(object): @@ -514,14 +514,14 @@ class LDAPObject(object): Log on the screen if there is no --quiet option set """ if not self.quiet: - self.outf.write(msg+"\n") + self.outf.write(msg +"\n") def fix_dn(self, s): res = "%s" % s if not self.two_domains: return res if res.upper().endswith(self.con.base_dn.upper()): - res = res[:len(res)-len(self.con.base_dn)] + "${DOMAIN_DN}" + res = res[:len(res) - len(self.con.base_dn)] + "${DOMAIN_DN}" return res def fix_domain_name(self, s): @@ -575,29 +575,29 @@ class LDAPObject(object): other.unique_attrs = [] if self.attributes.keys() != other.attributes.keys(): # - title = 4*" " + "Attributes found only in %s:" % self.con.host + title = 4 * " " + "Attributes found only in %s:" % self.con.host for x in self.attributes.keys(): if not x in other.attributes.keys() and \ not x.upper() in [q.upper() for q in other.ignore_attributes]: if title: res += title + "\n" title = None - res += 8*" " + x + "\n" + res += 8 * " " + x + "\n" self.unique_attrs.append(x) # - title = 4*" " + "Attributes found only in %s:" % other.con.host + title = 4 *" " + "Attributes found only in %s:" % other.con.host for x in other.attributes.keys(): if not x in self.attributes.keys() and \ not x.upper() in [q.upper() for q in self.ignore_attributes]: if title: res += title + "\n" title = None - res += 8*" " + x + "\n" + res += 8 * " " + x + "\n" other.unique_attrs.append(x) # missing_attrs = [x.upper() for x in self.unique_attrs] missing_attrs += [x.upper() for x in other.unique_attrs] - title = 4*" " + "Difference in attribute values:" + title = 4 * " " + "Difference in attribute values:" for x in self.attributes.keys(): if x.upper() in self.ignore_attributes or x.upper() in missing_attrs: continue @@ -667,9 +667,9 @@ class LDAPObject(object): res += title + "\n" title = None if p and q: - res += 8*" " + x + " => \n%s\n%s" % (p, q) + "\n" + res += 8 * " " + x + " => \n%s\n%s" % (p, q) + "\n" else: - res += 8*" " + x + " => \n%s\n%s" % (self.attributes[x], other.attributes[x]) + "\n" + res += 8 * " " + x + " => \n%s\n%s" % (self.attributes[x], other.attributes[x]) + "\n" self.df_value_attrs.append(x) # if self.unique_attrs + other.unique_attrs != []: @@ -715,7 +715,7 @@ class LDAPBundel(object): while counter < len(self.dn_list) and self.two_domains: # Use alias reference tmp = self.dn_list[counter] - tmp = tmp[:len(tmp)-len(self.con.base_dn)] + "${DOMAIN_DN}" + tmp = tmp[:len(tmp) -len(self.con.base_dn)] + "${DOMAIN_DN}" tmp = tmp.replace("CN=%s" % self.con.domain_netbios, "CN=${DOMAIN_NETBIOS}") if len(self.con.server_names) == 1: for x in self.con.server_names: @@ -731,7 +731,7 @@ class LDAPBundel(object): Log on the screen if there is no --quiet option set """ if not self.quiet: - self.outf.write(msg+"\n") + self.outf.write(msg + "\n") def update_size(self): self.size = len(self.dn_list) @@ -755,7 +755,7 @@ class LDAPBundel(object): self.log(title) title = None res = False - self.log(4*" " + x) + self.log(4 * " " + x) self.dn_list[self.dn_list.index(x)] = "" self.dn_list = [x for x in self.dn_list if x] # @@ -766,7 +766,7 @@ class LDAPBundel(object): self.log(title) title = None res = False - self.log(4*" " + x) + self.log(4 * " " + x) other.dn_list[other.dn_list.index(x)] = "" other.dn_list = [x for x in other.dn_list if x] # @@ -811,13 +811,13 @@ class LDAPBundel(object): self.log("\nComparing:") self.log("'%s' [%s]" % (object1.dn, object1.con.host)) self.log("'%s' [%s]" % (object2.dn, object2.con.host)) - self.log(4*" " + "OK") + self.log(4 * " " + "OK") else: self.log("\nComparing:") self.log("'%s' [%s]" % (object1.dn, object1.con.host)) self.log("'%s' [%s]" % (object2.dn, object2.con.host)) self.log(object1.screen_output) - self.log(4*" " + "FAILED") + self.log(4 * " " + "FAILED") res = False self.summary = object1.summary other.summary = object2.summary @@ -871,11 +871,11 @@ class LDAPBundel(object): # if self.summary["unique_attrs"]: self.log("\nAttributes found only in %s:" % self.con.host) - self.log("".join([str("\n" + 4*" " + x) for x in self.summary["unique_attrs"]])) + self.log("".join([str("\n" + 4 * " " + x) for x in self.summary["unique_attrs"]])) # if self.summary["df_value_attrs"]: self.log("\nAttributes with different values:") - self.log("".join([str("\n" + 4*" " + x) for x in self.summary["df_value_attrs"]])) + self.log("".join([str("\n" + 4 * " " + x) for x in self.summary["df_value_attrs"]])) self.summary["df_value_attrs"] = [] diff --git a/python/samba/netcmd/nettime.py b/python/samba/netcmd/nettime.py index b204d5e89ad..dcf9f6c5cdf 100644 --- a/python/samba/netcmd/nettime.py +++ b/python/samba/netcmd/nettime.py @@ -56,4 +56,4 @@ Example2 return the date and time of the local server. net = Net(creds, lp, server=credopts.ipaddress) if server_name is None: server_name = common.netcmd_dnsname(lp) - self.outf.write(net.time(server_name)+"\n") + self.outf.write(net.time(server_name) + "\n") diff --git a/python/samba/netcmd/ntacl.py b/python/samba/netcmd/ntacl.py index 30410b16bf1..3957a726689 100644 --- a/python/samba/netcmd/ntacl.py +++ b/python/samba/netcmd/ntacl.py @@ -166,7 +166,7 @@ class cmd_ntacl_get(Command): domain_sid = security.dom_sid(samdb.domain_sid) except: raise CommandError("Unable to read domain SID from configuration files") - self.outf.write(acl.as_sddl(domain_sid)+"\n") + self.outf.write(acl.as_sddl(domain_sid) + "\n") else: self.outf.write(ndr_print(acl)) @@ -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/ou.py b/python/samba/netcmd/ou.py index 3a3a161a73b..9fd9d6bc3ff 100644 --- a/python/samba/netcmd/ou.py +++ b/python/samba/netcmd/ou.py @@ -144,7 +144,7 @@ class cmd_move(Command): (new_parent_dn, e.message)) full_new_ou_dn = ldb.Dn(samdb, str(full_old_ou_dn)) - full_new_ou_dn.remove_base_components(len(full_old_ou_dn)-1) + full_new_ou_dn.remove_base_components(len(full_old_ou_dn) - 1) full_new_ou_dn.add_base(full_new_parent_dn) try: diff --git a/python/samba/netcmd/spn.py b/python/samba/netcmd/spn.py index 86d73f451df..b9069b0e408 100644 --- a/python/samba/netcmd/spn.py +++ b/python/samba/netcmd/spn.py @@ -52,7 +52,7 @@ class cmd_spn_list(Command): # TODO once I understand how, use the domain info to naildown # to the correct domain (cleaneduser, realm, domain) = _get_user_realm_domain(user) - self.outf.write(cleaneduser+"\n") + self.outf.write(cleaneduser + "\n") res = sam.search( expression="samaccountname=%s" % ldb.binary_encode(cleaneduser), scope=ldb.SCOPE_SUBTREE, attrs=["servicePrincipalName"]) diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py index c2af4923adb..d83a7db7ecd 100644 --- a/python/samba/netcmd/user.py +++ b/python/samba/netcmd/user.py @@ -662,7 +662,7 @@ Example4 shows how to set the account expiration so that it will never expire. credentials=creds, lp=lp) try: - samdb.setexpiry(filter, days*24*3600, no_expiry_req=noexpiry) + samdb.setexpiry(filter, days * 24 * 3600, no_expiry_req=noexpiry) except Exception as msg: # FIXME: Catch more specific exception raise CommandError("Failed to set expiry for user '%s': %s" % ( @@ -1158,7 +1158,7 @@ class GetPasswordCommand(Command): digests = ndr_unpack(drsblobs.package_PrimaryWDigestBlob, primary_wdigest) try: - digest = binascii.hexlify(bytearray(digests.hashes[i-1].hash)) + digest = binascii.hexlify(bytearray(digests.hashes[i - 1].hash)) return "%s:%s:%s" % (user, realm, digest) except IndexError: return None @@ -2576,7 +2576,7 @@ class cmd_user_move(Command): (new_parent_dn, e.message)) full_new_user_dn = ldb.Dn(samdb, str(user_dn)) - full_new_user_dn.remove_base_components(len(user_dn)-1) + full_new_user_dn.remove_base_components(len(user_dn) - 1) full_new_user_dn.add_base(full_new_parent_dn) try: diff --git a/python/samba/provision/backend.py b/python/samba/provision/backend.py index 53b03e37acf..d85072a8723 100644 --- a/python/samba/provision/backend.py +++ b/python/samba/provision/backend.py @@ -405,7 +405,7 @@ class OpenLDAPBackend(LDAPBackend): url_list = filter(None,self.ol_mmr_urls.split(',')) for url in url_list: - self.logger.info("Using LDAP-URL: "+url) + self.logger.info("Using LDAP-URL: " + url) if len(url_list) == 1: raise ProvisioningError("At least 2 LDAP-URLs needed for MMR!") diff --git a/python/samba/schema.py b/python/samba/schema.py index 61561f199f6..0958808cc88 100644 --- a/python/samba/schema.py +++ b/python/samba/schema.py @@ -208,7 +208,7 @@ def get_linked_attributes(schemadn, schemaldb): for i in range(0, len(res)): expression = ("(&(objectclass=attributeSchema)(linkID=%d)" "(attributeSyntax=2.5.5.1))" % - (int(res[i]["linkID"][0])+1)) + (int(res[i]["linkID"][0]) + 1)) target = schemaldb.searchone(basedn=schemadn, expression=expression, attribute="lDAPDisplayName", diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py index 60c18c73234..bd17a870d66 100644 --- a/python/samba/tests/__init__.py +++ b/python/samba/tests/__init__.py @@ -101,7 +101,7 @@ class TestCase(unittest.TestCase): hr = ' '.join(["%02X" % x for x in lr]) ll = ll.translate(HEXDUMP_FILTER).decode('utf8') lr = lr.translate(HEXDUMP_FILTER).decode('utf8') - result += "[%04X] %-*s %-*s %s %s\n" % (N, 8*3, hl, 8*3, hr, ll, lr) + result += "[%04X] %-*s %-*s %s %s\n" % (N, 8 * 3, hl, 8 * 3, hr, ll, lr) N += 16 return result @@ -330,7 +330,7 @@ class ValidNetbiosNameTests(TestCase): self.assertTrue(samba.valid_netbios_name("FOO")) def test_too_long(self): - self.assertFalse(samba.valid_netbios_name("FOO"*10)) + self.assertFalse(samba.valid_netbios_name("FOO" * 10)) def test_invalid_characters(self): self.assertFalse(samba.valid_netbios_name("*BLA")) diff --git a/python/samba/tests/blackbox/check_output.py b/python/samba/tests/blackbox/check_output.py index 8b3643d492d..66483548d83 100644 --- a/python/samba/tests/blackbox/check_output.py +++ b/python/samba/tests/blackbox/check_output.py @@ -53,7 +53,7 @@ class TimeoutHelper(): raise TimeoutHelper.Timeout() -def _make_cmdline(data='$', repeat=5*1024*1024, retcode=0): +def _make_cmdline(data='$', repeat=5 *1024 *1024, retcode=0): """Build a command to call gen_output.py to generate large output""" return 'gen_output.py --data {} --repeat {} --retcode {}'.format(data, repeat, retcode) diff --git a/python/samba/tests/dcerpc/dnsserver.py b/python/samba/tests/dcerpc/dnsserver.py index fedda343ebf..f09fad3040d 100644 --- a/python/samba/tests/dcerpc/dnsserver.py +++ b/python/samba/tests/dcerpc/dnsserver.py @@ -35,7 +35,7 @@ class DnsserverTests(RpcInterfaceTestCase): def setUpClass(cls): good_dns = ["SAMDOM.EXAMPLE.COM", "1.EXAMPLE.COM", - "%sEXAMPLE.COM" % ("1."*100), + "%sEXAMPLE.COM" % ("1." * 100), "EXAMPLE", "\n.COM", "!@#$%^&*()_", @@ -103,7 +103,7 @@ class DnsserverTests(RpcInterfaceTestCase): # actually create these records. invalid_mx = ["SAMDOM.EXAMPLE.COM -1", "SAMDOM.EXAMPLE.COM 65536", - "%s 1" % "A"*256] + "%s 1" % "A" *256] invalid_srv = ["SAMDOM.EXAMPLE.COM 0 65536 0", "SAMDOM.EXAMPLE.COM 0 0 65536", "SAMDOM.EXAMPLE.COM 65536 0 0"] @@ -516,7 +516,7 @@ class DnsserverTests(RpcInterfaceTestCase): """ for record_type_str in self.good_records: for i in range(1, len(self.good_records[record_type_str])): - record1 = self.good_records[record_type_str][i-1] + record1 = self.good_records[record_type_str][i - 1] record2 = self.good_records[record_type_str][i] if record_type_str == 'CNAME': diff --git a/python/samba/tests/dcerpc/raw_protocol.py b/python/samba/tests/dcerpc/raw_protocol.py index 006195035c6..3f6e05b0ae0 100755 --- a/python/samba/tests/dcerpc/raw_protocol.py +++ b/python/samba/tests/dcerpc/raw_protocol.py @@ -1734,7 +1734,7 @@ class TestDCERPC_BIND(RawDCERPCTest): req = self.generate_alter(call_id=1, max_xmit_frag=alter_xmit, max_recv_frag=alter_recv, - assoc_group_id=0xffffffff-rep.u.assoc_group_id, + assoc_group_id=0xffffffff - rep.u.assoc_group_id, ctx_list=[ctx1]) self.send_pdu(req) rep = self.recv_pdu() @@ -1936,14 +1936,14 @@ class TestDCERPC_BIND(RawDCERPCTest): computer = 'UNKNOWNCOMPUTER' computer_utf16 = unicode(computer, 'utf-8').encode('utf-16-le') - real_stub = struct.pack(' len2: return 1 else: @@ -777,7 +777,7 @@ def print_provision_ranges(dic, limit_print, dest, samdb_path, invocationid): for k in sorted_keys: obj = hash_ts[k] if obj["num"] > limit_print: - dt = _glue.nttime2string(_glue.unix2nttime(k*60)) + dt = _glue.nttime2string(_glue.unix2nttime(k * 60)) print("%s # of modification: %d \tmin: %d max: %d" % (dt, obj["num"], obj["min"], obj["max"])) @@ -788,7 +788,7 @@ def print_provision_ranges(dic, limit_print, dest, samdb_path, invocationid): for i in range(0, len(kept_record)): if i != 0: key1 = kept_record[i] - key2 = kept_record[i-1] + key2 = kept_record[i - 1] if key1 - key2 == 1: # previous record is just 1 minute away from current if int(hash_ts[key1]["min"]) == int(hash_ts[key2]["max"]) + 1: diff --git a/script/autobuild.py b/script/autobuild.py index 0847df2643f..13671900997 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -802,7 +802,7 @@ The top commit for the tree that was built was: if num_lines < 50: # Also include stderr (compile failures) if < 50 lines of stdout f = open("%s/%s.stderr" % (gitroot, failed_tag), 'r') - log_tail += "".join(f.readlines()[-(50-num_lines):]) + log_tail += "".join(f.readlines()[-(50 - num_lines):]) text += ''' The last 50 lines of log messages: diff --git a/selftest/subunithelper.py b/selftest/subunithelper.py index 25135940c39..cfdaab69789 100644 --- a/selftest/subunithelper.py +++ b/selftest/subunithelper.py @@ -681,7 +681,7 @@ class PlainFormatter(TestsuiteEnabledTestResult): for suite in self.suitesfailed: f.write("== %s ==\n" % suite) if suite in self.test_output: - f.write(self.test_output[suite]+"\n\n") + f.write(self.test_output[suite] + "\n\n") f.write("\n") diff --git a/source4/dsdb/tests/python/acl.py b/source4/dsdb/tests/python/acl.py index 4e479ce8b17..92e0a1a7fe4 100755 --- a/source4/dsdb/tests/python/acl.py +++ b/source4/dsdb/tests/python/acl.py @@ -56,7 +56,7 @@ if not "://" in host: else: ldaphost = host start = host.rindex("://") - host = host.lstrip(start+3) + host = host.lstrip(start + 3) lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp) diff --git a/source4/dsdb/tests/python/deletetest.py b/source4/dsdb/tests/python/deletetest.py index 9edeb2f782f..ca416e642ac 100755 --- a/source4/dsdb/tests/python/deletetest.py +++ b/source4/dsdb/tests/python/deletetest.py @@ -277,7 +277,7 @@ class BasicTreeDeleteTests(BasicDeleteTests): # user current time in ms to make unique objects import time - marker = str(int(round(time.time()*1000))) + marker = str(int(round(time.time() * 1000))) usr1_name = "u_" + marker usr2_name = "u2_" + marker grp_name = "g1_" + marker diff --git a/source4/dsdb/tests/python/dirsync.py b/source4/dsdb/tests/python/dirsync.py index 54ede529d96..ca3a1e936f6 100755 --- a/source4/dsdb/tests/python/dirsync.py +++ b/source4/dsdb/tests/python/dirsync.py @@ -64,7 +64,7 @@ if not "://" in host: else: ldaphost = host start = host.rindex("://") - host = host.lstrip(start+3) + host = host.lstrip(start + 3) lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp) diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py index 62f00547019..9d14e037eb3 100755 --- a/source4/dsdb/tests/python/ldap.py +++ b/source4/dsdb/tests/python/ldap.py @@ -474,7 +474,7 @@ class BasicTests(samba.tests.TestCase): scope=SCOPE_BASE, attrs=["objectClass"]) self.assertTrue(len(res) == 1) self.assertEquals(res[0]["objectClass"][0], "top") - self.assertEquals(res[0]["objectClass"][len(res[0]["objectClass"])-1], "user") + self.assertEquals(res[0]["objectClass"][len(res[0]["objectClass"]) - 1], "user") delete_force(self.ldb, "cn=ldaptestuser,cn=users," + self.base_dn) @@ -1925,7 +1925,7 @@ delete: description res = self.ldb.search(base=self.base_dn, scope=SCOPE_BASE, attrs=["subSchemaSubEntry"]) self.assertEquals(len(res), 1) - self.assertEquals(res[0]["subSchemaSubEntry"][0], "CN=Aggregate,"+self.schema_dn) + self.assertEquals(res[0]["subSchemaSubEntry"][0], "CN=Aggregate," + self.schema_dn) res = self.ldb.search(base=self.base_dn, scope=SCOPE_BASE, attrs=["*"]) self.assertEquals(len(res), 1) diff --git a/source4/dsdb/tests/python/ldap_schema.py b/source4/dsdb/tests/python/ldap_schema.py index bd889325ad3..e98ab4a5656 100755 --- a/source4/dsdb/tests/python/ldap_schema.py +++ b/source4/dsdb/tests/python/ldap_schema.py @@ -80,7 +80,7 @@ class SchemaTests(samba.tests.TestCase): def test_generated_schema(self): """Testing we can read the generated schema via LDAP""" - res = self.ldb.search("cn=aggregate,"+self.schema_dn, scope=SCOPE_BASE, + res = self.ldb.search("cn=aggregate," + self.schema_dn, scope=SCOPE_BASE, attrs=["objectClasses", "attributeTypes", "dITContentRules"]) self.assertEquals(len(res), 1) self.assertTrue("dITContentRules" in res[0]) @@ -90,7 +90,7 @@ class SchemaTests(samba.tests.TestCase): def test_generated_schema_is_operational(self): """Testing we don't get the generated schema via LDAP by default""" # Must keep the "*" form - res = self.ldb.search("cn=aggregate,"+self.schema_dn, scope=SCOPE_BASE, + res = self.ldb.search("cn=aggregate," + self.schema_dn, scope=SCOPE_BASE, attrs=["*"]) self.assertEquals(len(res), 1) self.assertFalse("dITContentRules" in res[0]) @@ -979,7 +979,7 @@ adminDescription: """ + attr_name_3 + """ adminDisplayName: """ + attr_name_3 + """ cn: """ + attr_name_3 + """ attributeId: """ + attributeID_3 + """ -linkID: """ + str(linkID_1+1) + """ +linkID: """ + str(linkID_1 + 1) + """ attributeSyntax: 2.5.5.1 ldapDisplayName: """ + attr_ldap_display_name_3 + """ omSyntax: 127 diff --git a/source4/dsdb/tests/python/password_lockout_base.py b/source4/dsdb/tests/python/password_lockout_base.py index 582e985bea0..eb34c7fe52c 100644 --- a/source4/dsdb/tests/python/password_lockout_base.py +++ b/source4/dsdb/tests/python/password_lockout_base.py @@ -244,7 +244,7 @@ userPassword: """ + userpass + """ use_kerberos = creds.get_kerberos_state() fail_creds = self.insta_creds(self.template_creds, username=username, - userpass=userpass+"X", + userpass=userpass + "X", kerberos_state=use_kerberos) self._check_account_initial(userdn) diff --git a/source4/dsdb/tests/python/rodc_rwdc.py b/source4/dsdb/tests/python/rodc_rwdc.py index 5840dd6d6d9..716bcdda1fa 100644 --- a/source4/dsdb/tests/python/rodc_rwdc.py +++ b/source4/dsdb/tests/python/rodc_rwdc.py @@ -1178,7 +1178,7 @@ class RodcRwdcTests(password_lockout_base.BasePasswordTestCase): use_kerberos = self.lockout1krb5_creds.get_kerberos_state() fail_creds = self.insta_creds(self.template_creds, username=username, - userpass=userpass+"X", + userpass=userpass + "X", kerberos_state=use_kerberos) try: @@ -1208,7 +1208,7 @@ class RodcRwdcTests(password_lockout_base.BasePasswordTestCase): use_kerberos = self.lockout1ntlm_creds.get_kerberos_state() fail_creds = self.insta_creds(self.template_creds, username=username, - userpass=userpass+"X", + userpass=userpass + "X", kerberos_state=use_kerberos) try: @@ -1233,7 +1233,7 @@ class RodcRwdcTests(password_lockout_base.BasePasswordTestCase): use_kerberos = self.lockout1krb5_creds.get_kerberos_state() fail_creds = self.insta_creds(self.template_creds, username=username, - userpass=userpass+"X", + userpass=userpass + "X", kerberos_state=use_kerberos) try: @@ -1263,7 +1263,7 @@ class RodcRwdcTests(password_lockout_base.BasePasswordTestCase): use_kerberos = self.lockout1ntlm_creds.get_kerberos_state() fail_creds = self.insta_creds(self.template_creds, username=username, - userpass=userpass+"X", + userpass=userpass + "X", kerberos_state=use_kerberos) try: diff --git a/source4/dsdb/tests/python/sort.py b/source4/dsdb/tests/python/sort.py index 2939aca3666..f9b6c4cd789 100644 --- a/source4/dsdb/tests/python/sort.py +++ b/source4/dsdb/tests/python/sort.py @@ -103,7 +103,7 @@ class BaseSortTests(samba.tests.TestCase): chr(i & 255), i), "displayNamePrintable": "%d\x00%c" % (i, i & 255), - "adminDisplayName": "%d\x00b" % (n-i), + "adminDisplayName": "%d\x00b" % (n - i), "title": "%d%sb" % (n - i, '\x00' * i), # Names that vary only in case. Windows returns diff --git a/source4/dsdb/tests/python/urgent_replication.py b/source4/dsdb/tests/python/urgent_replication.py index 5d41b1aa23c..191df0d2996 100755 --- a/source4/dsdb/tests/python/urgent_replication.py +++ b/source4/dsdb/tests/python/urgent_replication.py @@ -298,7 +298,7 @@ rIDAvailablePool: 133001-1073741823""", ["relax:0"]) # urgent replication should be enabled when modifying userAccountControl m = Message() m.dn = Dn(self.ldb, "cn=user UrgAttr test,cn=users," + self.base_dn) - m["userAccountControl"] = MessageElement(str(dsdb.UF_NORMAL_ACCOUNT+dsdb.UF_DONT_EXPIRE_PASSWD), FLAG_MOD_REPLACE, + m["userAccountControl"] = MessageElement(str(dsdb.UF_NORMAL_ACCOUNT + dsdb.UF_DONT_EXPIRE_PASSWD), FLAG_MOD_REPLACE, "userAccountControl") self.ldb.modify(m) res = self.ldb.load_partition_usn(self.base_dn) diff --git a/source4/dsdb/tests/python/user_account_control.py b/source4/dsdb/tests/python/user_account_control.py index 242462ad57f..29f5c9ffa24 100755 --- a/source4/dsdb/tests/python/user_account_control.py +++ b/source4/dsdb/tests/python/user_account_control.py @@ -63,7 +63,7 @@ if not "://" in host: else: ldaphost = host start = host.rindex("://") - host = host.lstrip(start+3) + host = host.lstrip(start + 3) lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp) diff --git a/source4/dsdb/tests/python/vlv.py b/source4/dsdb/tests/python/vlv.py index 6e6ed393e41..82616876e20 100644 --- a/source4/dsdb/tests/python/vlv.py +++ b/source4/dsdb/tests/python/vlv.py @@ -120,7 +120,7 @@ class VLVTests(samba.tests.TestCase): "audio": "%sn octet string %s%s ♫♬\x00lalala" % ('Aa'[i & 1], chr(i & 255), i), "displayNamePrintable": "%d\x00%c" % (i, i & 255), - "adminDisplayName": "%d\x00b" % (n-i), + "adminDisplayName": "%d\x00b" % (n - i), "title": "%d%sb" % (n - i, '\x00' * i), "comment": "Favourite colour is %d" % (n % (i + 1)), diff --git a/source4/scripting/devel/repl_cleartext_pwd.py b/source4/scripting/devel/repl_cleartext_pwd.py index 6cfa2a1323a..e8acb90c90f 100755 --- a/source4/scripting/devel/repl_cleartext_pwd.py +++ b/source4/scripting/devel/repl_cleartext_pwd.py @@ -136,9 +136,9 @@ if __name__ == "__main__": store_utdv_len, store_utdv_ofs) = \ struct.unpack("