1. Pypy
  2. Untitled project
  3. pypy

Commits

Brian Kearns  committed 5e89772

move _numpypy.average to numpypy.lib.function_base

  • Participants
  • Parent commits 88878ea
  • Branches default

Comments (0)

Files changed (7)

File lib_pypy/numpypy/__init__.py

View file
  • Ignore whitespace
 from _numpypy import *
 from .core import *
+from .lib import *
 
 import _numpypy
 __all__ = _numpypy.__all__

File lib_pypy/numpypy/lib/__init__.py

View file
  • Ignore whitespace
+from .function_base import *

File lib_pypy/numpypy/lib/function_base.py

View file
  • Ignore whitespace
+from _numpypy import array
+
+def average(a):
+    # This implements a weighted average, for now we don't implement the
+    # weighting, just the average part!
+    if not hasattr(a, "mean"):
+        a = array(a)
+    return a.mean()

File pypy/module/micronumpy/__init__.py

View file
  • Ignore whitespace
         interpleveldefs[exposed] = "interp_ufuncs.get(space).%s" % impl
 
     appleveldefs = {
-        'average': 'app_numpy.average',
         'eye': 'app_numpy.eye',
         'arange': 'app_numpy.arange',
     }

File pypy/module/micronumpy/app_numpy.py

View file
  • Ignore whitespace
 
 import _numpypy
 
-def average(a):
-    # This implements a weighted average, for now we don't implement the
-    # weighting, just the average part!
-    if not hasattr(a, "mean"):
-        a = _numpypy.array(a)
-    return a.mean()
-
 def eye(n, m=None, k=0, dtype=None):
     if m is None:
         m = n

File pypy/module/micronumpy/test/test_module.py

  • Ignore whitespace
-from pypy.module.micronumpy.test.test_base import BaseNumpyAppTest
-
-
-class AppTestNumPyModule(BaseNumpyAppTest):
-    def test_average(self):
-        from _numpypy import array, average
-        assert average(range(10)) == 4.5
-        assert average(array(range(10))) == 4.5

File pypy/module/test_lib_pypy/numpypy/lib/test_function_base.py

View file
  • Ignore whitespace
+from pypy.module.micronumpy.test.test_base import BaseNumpyAppTest
+
+class AppTestFunctionBase(BaseNumpyAppTest):
+    def test_average(self):
+        from numpypy import array, average
+        assert average(range(10)) == 4.5
+        assert average(array(range(10))) == 4.5