MCPcopy Create free account
hub / github.com/ActiveState/code / __init__

Method __init__

recipes/Python/576966_DnTree/recipe-576966.py:32–54  ·  view source on GitHub ↗

Create new DnTree object. all_dn - set of dn to initially add to a tree delimeter - delimter used to split relative name and parent DN.

(self, all_dn=set(), delimeter=".")

Source from the content-addressed store, hash-verified

30 """
31
32 def __init__(self, all_dn=set(), delimeter="."):
33 """
34 Create new DnTree object.
35
36 all_dn - set of dn to initially add to a tree
37 delimeter - delimter used to split relative name and parent DN.
38 """
39
40 self.delimeter = delimeter
41
42 self.childs = {}
43 self.parent = {}
44 self.fake_parent = {} # distinguished name of a node
45 # that should be a parent
46 # but not exists in a current tree
47
48 self.dn_set = set() # all nodes in a tree
49
50 self.parent[""] = ""
51 self.childs[""] = [] # used by get_roots()
52
53 for dn in all_dn:
54 self.add(dn)
55
56 def __str__(self):
57 "Draw tree in ASCII graphics."

Callers

nothing calls this directly

Calls 2

addMethod · 0.95
setFunction · 0.50

Tested by

no test coverage detected