s4-python: Remove more unused imports, fix use of sets in upgradehelpers.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 20 Jun 2010 11:15:09 +0000 (13:15 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 20 Jun 2010 11:15:09 +0000 (13:15 +0200)
source4/scripting/bin/fullschema
source4/scripting/bin/get-descriptors
source4/scripting/python/samba/upgradehelpers.py

index 2f7d32c075f3f74c6f94123067338fd8000f7d71..2987136a40df99e16c21a3e09e1ec5771e20472a 100755 (executable)
@@ -5,7 +5,6 @@
 
 import base64
 import optparse
-import os
 import sys
 
 # Find right directory when running from source tree
@@ -13,7 +12,7 @@ sys.path.insert(0, "bin/python")
 
 import samba
 from samba import getopt as options, Ldb
-from ldb import SCOPE_SUBTREE, SCOPE_BASE, LdbError
+from ldb import SCOPE_SUBTREE, SCOPE_BASE
 import sys
 
 parser = optparse.OptionParser("fullschema <URL>")
index 65be2fee6c6d123e716d18485374274e0b6645a4..73295b0c3834e869d5e2db95f0e07cfe3ce0ea22 100755 (executable)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-import getopt
 import optparse
 import sys
-import os
 import base64
-import re
 
 sys.path.insert(0, "bin/python")
 
 import samba
 from samba.auth import system_session
 import samba.getopt as options
-from samba import param
 from samba.ndr import ndr_pack, ndr_unpack
 from samba.dcerpc import security
 from samba import Ldb
 from samba.samdb import SamDB
-from ldb import SCOPE_SUBTREE, SCOPE_ONELEVEL, SCOPE_BASE, LdbError
+from ldb import SCOPE_SUBTREE, SCOPE_BASE
 
 parser = optparse.OptionParser("get-descriptor [options]")
 sambaopts = options.SambaOptions(parser)
@@ -65,6 +61,7 @@ creds = credopts.get_credentials(lp)
 opts = parser.parse_args()[0]
 
 class DescrGetter:
+
     def __init__(self, localdomain, remotedomain):
         self.samdb = SamDB(session_info=system_session(), lp=lp, options=["modules:paged_searches"])
         self.remote_ldb= Ldb("ldap://" + opts.host + ":389", credentials=creds, lp=lp,
index 7c6afaec5b195104c16045cba1819775ad3cab28..58907458ed9866f0acc7c491f7ef9170eb7221c6 100755 (executable)
@@ -506,8 +506,8 @@ def get_diff_sddls(refsddl, cursddl):
             for elem in c_ref["aces"]:
                 h_ref.add(elem)
 
-            for k in h_ref:
-                if h_new.has_key(k):
+            for k in set(h_ref):
+                if k in h_new:
                     h_new.remove(k)
                     h_ref.remove(k)