Commits

Ralph Bean committed 8481dc7

changed sampled to use tw2.core

  • Participants
  • Parent commits 4f53e16

Comments (0)

Files changed (1)

tw2/protovis/hierarchies/samples.py

 import math
 import random
 import os
-def build_tree(root, depth=0):
+
+tw2core_location = "/".join(
+    __import__('tw2.core', fromlist=['core']).__file__.split('/')[:-1])
+
+def build_tree(root=tw2core_location, depth=0):
     result = {}
-    if depth > 3 or 'development-deps' in root:
+    if depth > 3:
         return result
     tups = os.walk(root)
     d, dirs, files = [e for e in tups][0]
     for dir in dirs:
         result[dir] = build_tree("%s/%s" % (d, dir), depth=depth+1)
     for file in files:
+        if file.endswith('.pyc') or file.endswith('.pyo'):
+            continue
         result[file] = int(os.path.getsize("%s/%s" % (d, file))) + 1
     return result
 
     p_height = 500
     p_width = 500
     p_orient = 'radial'
-    p_breadth = 25
-    p_depth = 60
+    p_breadth = 29 
+    p_depth = 100
     def prepare(self):
-        self.p_data = build_tree('.')
+        self.p_data = build_tree() # of tw2.core
         super(DemoNodeLinkTree, self).prepare()