]> hydra-www.ietfng.org Git - dyna2/commitdiff
drop dep on numpy.
authortimv <tim.f.vieira@gmail.com>
Wed, 12 Jun 2013 17:06:03 +0000 (13:06 -0400)
committertimv <tim.f.vieira@gmail.com>
Wed, 12 Jun 2013 17:06:03 +0000 (13:06 -0400)
src/Dyna/Backend/Python/interpreter.py

index ac2d8cd86346f60967a815d5db3f9d6db38d7d73..0cab7ae7f7813d571809dda112ff7eff06da5922 100644 (file)
@@ -4,6 +4,8 @@
 TODO
 ====
 
+ - AggregatorConflict should now always be raised by Dyna compiler.
+
  - vbench: a script which tracks performace over time (= git commits).
 
  - profiler workflow
@@ -203,8 +205,16 @@ from utils import ip, red, green, blue, magenta, yellow, \
     DynaCompilerError, DynaInitializerException, AggregatorConflict
 from prioritydict import prioritydict
 from config import dotdynadir, dynahome
-from numpy import log, exp, sqrt
-from numpy.random import uniform
+
+try:
+    from numpy import log, exp, sqrt
+    from numpy.random import uniform
+except ImportError:                       # XXX: should probably issue a warning.
+    from math import log, exp, sqrt
+    from random import random as _random
+    def uniform(a=0, b=1):
+        return _random() * (b - a) + a
+
 from time import time