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

Method get_parent_dn

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

Return distinguished name of parent node (if it belongs to tree, else return empty string). dn --- distinguished name of node, which parent to return

(self, dn)

Source from the content-addressed store, hash-verified

87 return []
88
89 def get_parent_dn(self, dn):
90 """Return distinguished name of parent node (if it belongs to tree,
91 else return empty string).
92
93 dn --- distinguished name of node, which parent to return
94 """
95 _len = dn.find(self.delimeter)
96 if _len == -1:
97 return ""
98 else:
99 if dn[_len+1:] in self.dn_set:
100 return dn[_len+1:]
101 else:
102 return ""
103
104 def get_fake_parent_dn(self, dn):
105 """Get distinguished name of node that should be a parent of dn,

Callers 2

addMethod · 0.95
removeMethod · 0.95

Calls 1

findMethod · 0.45

Tested by

no test coverage detected