The branch, master has been updated via a52d0c3 python/samba/netcmd: Py2/Py3 misc replace range with enumerate from d42f467 s3: smbtorture: Add new SMB2-DIR-FSYNC test to show behavior of FSYNC on directories.
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit a52d0c3a14729b923f5488c67255ab069791b268 Author: Noel Power <noel.po...@suse.com> Date: Fri May 4 12:20:36 2018 +0100 python/samba/netcmd: Py2/Py3 misc replace range with enumerate Replace various instances of xrange with enumerate. Signed-off-by: Noel Power <noel.po...@suse.com> Autobuild-User(master): Gary Lockyer <g...@samba.org> Autobuild-Date(master): Fri May 18 05:24:42 CEST 2018 on sn-devel-144 ----------------------------------------------------------------------- Summary of changes: python/samba/netcmd/domain.py | 70 +++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 46 deletions(-) Changeset truncated at 500 lines: diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py index 24159fc..f4a689b 100644 --- a/python/samba/netcmd/domain.py +++ b/python/samba/netcmd/domain.py @@ -2034,8 +2034,7 @@ class DomainTrustCommand(Command): self.outf.write("Namespaces[%d]%s:\n" % ( len(fti.entries), tln_string)) - for i in xrange(0, len(fti.entries)): - e = fti.entries[i] + for i, e in enumerate(fti.entries): flags = e.flags collision_string = "" @@ -3425,22 +3424,17 @@ class cmd_domain_trust_namespaces(DomainTrustCommand): update_spn_vals.extend(stored_spn_vals) for upn in add_upn: - idx = None - for i in xrange(0, len(update_upn_vals)): - v = update_upn_vals[i] - if v.lower() != upn.lower(): - continue - idx = i - break - if idx is not None: - raise CommandError("Entry already present for value[%s] specified for --add-upn-suffix" % upn) + for i, v in enumerate(update_upn_vals): + if v.lower() == upn.lower(): + raise CommandError("Entry already present for " + "value[%s] specified for " + "--add-upn-suffix" % upn) update_upn_vals.append(upn) replace_upn = True for upn in delete_upn: idx = None - for i in xrange(0, len(update_upn_vals)): - v = update_upn_vals[i] + for i, v in enumerate(update_upn_vals): if v.lower() != upn.lower(): continue idx = i @@ -3452,22 +3446,17 @@ class cmd_domain_trust_namespaces(DomainTrustCommand): replace_upn = True for spn in add_spn: - idx = None - for i in xrange(0, len(update_spn_vals)): - v = update_spn_vals[i] - if v.lower() != spn.lower(): - continue - idx = i - break - if idx is not None: - raise CommandError("Entry already present for value[%s] specified for --add-spn-suffix" % spn) + for i, v in enumerate(update_spn_vals): + if v.lower() == spn.lower(): + raise CommandError("Entry already present for " + "value[%s] specified for " + "--add-spn-suffix" % spn) update_spn_vals.append(spn) replace_spn = True for spn in delete_spn: idx = None - for i in xrange(0, len(update_spn_vals)): - v = update_spn_vals[i] + for i, v in enumerate(update_spn_vals): if v.lower() != spn.lower(): continue idx = i @@ -3618,16 +3607,14 @@ class cmd_domain_trust_namespaces(DomainTrustCommand): update_forest_info.entries = entries if enable_all: - for i in xrange(0, len(update_forest_info.entries)): - r = update_forest_info.entries[i] + for i, r in enumerate(update_forest_info.entries): if r.type != lsa.LSA_FOREST_TRUST_TOP_LEVEL_NAME: continue if update_forest_info.entries[i].flags == 0: continue update_forest_info.entries[i].time = 0 update_forest_info.entries[i].flags &= ~lsa.LSA_TLN_DISABLED_MASK - for i in xrange(0, len(update_forest_info.entries)): - r = update_forest_info.entries[i] + for i, r in enumerate(update_forest_info.entries): if r.type != lsa.LSA_FOREST_TRUST_DOMAIN_INFO: continue if update_forest_info.entries[i].flags == 0: @@ -3638,8 +3625,7 @@ class cmd_domain_trust_namespaces(DomainTrustCommand): for tln in enable_tln: idx = None - for i in xrange(0, len(update_forest_info.entries)): - r = update_forest_info.entries[i] + for i, r in enumerate(update_forest_info.entries): if r.type != lsa.LSA_FOREST_TRUST_TOP_LEVEL_NAME: continue if r.forest_trust_data.string.lower() != tln.lower(): @@ -3655,8 +3641,7 @@ class cmd_domain_trust_namespaces(DomainTrustCommand): for tln in disable_tln: idx = None - for i in xrange(0, len(update_forest_info.entries)): - r = update_forest_info.entries[i] + for i, r in enumerate(update_forest_info.entries): if r.type != lsa.LSA_FOREST_TRUST_TOP_LEVEL_NAME: continue if r.forest_trust_data.string.lower() != tln.lower(): @@ -3673,8 +3658,7 @@ class cmd_domain_trust_namespaces(DomainTrustCommand): for tln_ex in add_tln_ex: idx = None - for i in xrange(0, len(update_forest_info.entries)): - r = update_forest_info.entries[i] + for i, r in enumerate(update_forest_info.entries): if r.type != lsa.LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX: continue if r.forest_trust_data.string.lower() != tln_ex.lower(): @@ -3686,8 +3670,7 @@ class cmd_domain_trust_namespaces(DomainTrustCommand): tln_dot = ".%s" % tln_ex.lower() idx = None - for i in xrange(0, len(update_forest_info.entries)): - r = update_forest_info.entries[i] + for i, r in enumerate(update_forest_info.entries): if r.type != lsa.LSA_FOREST_TRUST_TOP_LEVEL_NAME: continue r_dot = ".%s" % r.forest_trust_data.string.lower() @@ -3715,8 +3698,7 @@ class cmd_domain_trust_namespaces(DomainTrustCommand): for tln_ex in delete_tln_ex: idx = None - for i in xrange(0, len(update_forest_info.entries)): - r = update_forest_info.entries[i] + for i, r in enumerate(update_forest_info.entries): if r.type != lsa.LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX: continue if r.forest_trust_data.string.lower() != tln_ex.lower(): @@ -3734,8 +3716,7 @@ class cmd_domain_trust_namespaces(DomainTrustCommand): for nb in enable_nb: idx = None - for i in xrange(0, len(update_forest_info.entries)): - r = update_forest_info.entries[i] + for i, r in enumerate(update_forest_info.entries): if r.type != lsa.LSA_FOREST_TRUST_DOMAIN_INFO: continue if r.forest_trust_data.netbios_domain_name.string.upper() != nb.upper(): @@ -3751,8 +3732,7 @@ class cmd_domain_trust_namespaces(DomainTrustCommand): for nb in disable_nb: idx = None - for i in xrange(0, len(update_forest_info.entries)): - r = update_forest_info.entries[i] + for i, r in enumerate(update_forest_info.entries): if r.type != lsa.LSA_FOREST_TRUST_DOMAIN_INFO: continue if r.forest_trust_data.netbios_domain_name.string.upper() != nb.upper(): @@ -3769,8 +3749,7 @@ class cmd_domain_trust_namespaces(DomainTrustCommand): for sid in enable_sid: idx = None - for i in xrange(0, len(update_forest_info.entries)): - r = update_forest_info.entries[i] + for i, r in enumerate(update_forest_info.entries): if r.type != lsa.LSA_FOREST_TRUST_DOMAIN_INFO: continue if r.forest_trust_data.domain_sid != sid: @@ -3786,8 +3765,7 @@ class cmd_domain_trust_namespaces(DomainTrustCommand): for sid in disable_sid: idx = None - for i in xrange(0, len(update_forest_info.entries)): - r = update_forest_info.entries[i] + for i, r in enumerate(update_forest_info.entries): if r.type != lsa.LSA_FOREST_TRUST_DOMAIN_INFO: continue if r.forest_trust_data.domain_sid != sid: -- Samba Shared Repository