1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-28 07:21:54 +03:00

possibleinferiors: Fix formatting.

This commit is contained in:
Jelmer Vernooij 2010-11-03 18:41:49 +01:00
parent d1dd2117db
commit 9ae3c822d1

View File

@ -7,12 +7,12 @@
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or # the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
@ -26,7 +26,6 @@ import sys
# Find right directory when running from source tree # Find right directory when running from source tree
sys.path.insert(0, "bin/python") sys.path.insert(0, "bin/python")
import samba
from samba import getopt as options, Ldb from samba import getopt as options, Ldb
import ldb import ldb
@ -99,7 +98,7 @@ def possible_inferiors_search(db, oc):
# !objectClassCategory=2 # !objectClassCategory=2
# !objectClassCategory=3 # !objectClassCategory=3
def SUPCLASSES(classinfo, oc): def supclasses(classinfo, oc):
list = [] list = []
if oc == "top": if oc == "top":
return list return list
@ -108,11 +107,11 @@ def SUPCLASSES(classinfo, oc):
res = classinfo[oc]["subClassOf"]; res = classinfo[oc]["subClassOf"];
for r in res: for r in res:
list.append(r) list.append(r)
list.extend(SUPCLASSES(classinfo,r)) list.extend(supclasses(classinfo,r))
classinfo[oc]["SUPCLASSES"] = list classinfo[oc]["SUPCLASSES"] = list
return list return list
def AUXCLASSES(classinfo, oclist): def auxclasses(classinfo, oclist):
list = [] list = []
if oclist == []: if oclist == []:
return list return list
@ -122,21 +121,21 @@ def AUXCLASSES(classinfo, oclist):
else: else:
list2 = [] list2 = []
list2.extend(classinfo[oc]["systemAuxiliaryClass"]) list2.extend(classinfo[oc]["systemAuxiliaryClass"])
list2.extend(AUXCLASSES(classinfo, classinfo[oc]["systemAuxiliaryClass"])) list2.extend(auxclasses(classinfo, classinfo[oc]["systemAuxiliaryClass"]))
list2.extend(classinfo[oc]["auxiliaryClass"]) list2.extend(classinfo[oc]["auxiliaryClass"])
list2.extend(AUXCLASSES(classinfo, classinfo[oc]["auxiliaryClass"])) list2.extend(auxclasses(classinfo, classinfo[oc]["auxiliaryClass"]))
list2.extend(AUXCLASSES(classinfo, SUPCLASSES(classinfo, oc))) list2.extend(auxclasses(classinfo, supclasses(classinfo, oc)))
classinfo[oc]["AUXCLASSES"] = list2 classinfo[oc]["AUXCLASSES"] = list2
list.extend(list2) list.extend(list2)
return list return list
def SUBCLASSES(classinfo, oclist): def subclasses(classinfo, oclist):
list = [] list = []
for oc in oclist: for oc in oclist:
list.extend(classinfo[oc]["SUBCLASSES"]) list.extend(classinfo[oc]["SUBCLASSES"])
return list return list
def POSSSUPERIORS(classinfo, oclist): def posssuperiors(classinfo, oclist):
list = [] list = []
for oc in oclist: for oc in oclist:
if classinfo[oc].get("POSSSUPERIORS") is not None: if classinfo[oc].get("POSSSUPERIORS") is not None:
@ -145,13 +144,13 @@ def POSSSUPERIORS(classinfo, oclist):
list2 = [] list2 = []
list2.extend(classinfo[oc]["systemPossSuperiors"]) list2.extend(classinfo[oc]["systemPossSuperiors"])
list2.extend(classinfo[oc]["possSuperiors"]) list2.extend(classinfo[oc]["possSuperiors"])
list2.extend(POSSSUPERIORS(classinfo, SUPCLASSES(classinfo, oc))) list2.extend(posssuperiors(classinfo, supclasses(classinfo, oc)))
if opts.wspp: if opts.wspp:
# the WSPP docs suggest we should do this: # the WSPP docs suggest we should do this:
list2.extend(POSSSUPERIORS(classinfo, AUXCLASSES(classinfo, [oc]))) list2.extend(posssuperiors(classinfo, auxclasses(classinfo, [oc])))
else: else:
# but testing against w2k3 and w2k8 shows that we need to do this instead # but testing against w2k3 and w2k8 shows that we need to do this instead
list2.extend(SUBCLASSES(classinfo, list2)) list2.extend(subclasses(classinfo, list2))
classinfo[oc]["POSSSUPERIORS"] = list2 classinfo[oc]["POSSSUPERIORS"] = list2
list.extend(list2) list.extend(list2)
return list return list
@ -211,7 +210,7 @@ def is_in_list(list, c):
def possible_inferiors_constructed(db, classinfo, c): def possible_inferiors_constructed(db, classinfo, c):
list = [] list = []
for oc in classinfo: for oc in classinfo:
superiors = POSSSUPERIORS(classinfo, [oc]) superiors = posssuperiors(classinfo, [oc])
if (is_in_list(superiors, c) and if (is_in_list(superiors, c) and
classinfo[oc]["systemOnly"] == False and classinfo[oc]["systemOnly"] == False and
classinfo[oc]["objectClassCategory"] != 2 and classinfo[oc]["objectClassCategory"] != 2 and