From cb69d2e1c7ced951cbf7a31ee286b0ed92cab8a8 Mon Sep 17 00:00:00 2001 From: rcoh Date: Fri, 18 Feb 2011 16:56:43 -0500 Subject: Adding Epydoc generated docs. --- html/SmootLight.util.Search-pysrc.html | 134 +++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 html/SmootLight.util.Search-pysrc.html (limited to 'html/SmootLight.util.Search-pysrc.html') diff --git a/html/SmootLight.util.Search-pysrc.html b/html/SmootLight.util.Search-pysrc.html new file mode 100644 index 0000000..485ec62 --- /dev/null +++ b/html/SmootLight.util.Search-pysrc.html @@ -0,0 +1,134 @@ + + + + + SmootLight.util.Search + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package SmootLight :: + Package util :: + Module Search + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module SmootLight.util.Search

+
+ 1  from bisect import * 
+
2 -def find_le(a, x): +
3 """Find rightmost value less than or equal to x""" + 4 return bisect_right(a, x)-1 +
5 +
6 -def find_ge(a, x): +
7 """Find leftmost value greater than x""" + 8 return bisect_left(a, x) +
9 -def parental_tree_search(root, childrenstr, conditionstr): +
10 """Returns parents of nodes that meed a given condition""" +11 ret = [] +12 queue = [root] +13 while queue: +14 current = queue.pop() +15 children = eval('current'+childrenstr) +16 for child in children: +17 if eval('child'+conditionstr): +18 ret.append(current) +19 #we know have a tree, so there are no back-edges etc, so no checking of that kind is +20 #necessary +21 queue += children +22 return ret +
23 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + -- cgit v1.2.3