[pypy-commit] pypy python-numpy: add empty function definitions

mattip noreply at buildbot.pypy.org
Sun Aug 12 22:45:44 CEST 2012


Author: mattip <matti.picus at gmail.com>
Branch: python-numpy
Changeset: r56711:e86621c24b45
Date: 2012-08-12 20:16 +0300
http://bitbucket.org/pypy/pypy/changeset/e86621c24b45/

Log:	add empty function definitions

diff --git a/lib_pypy/numpypy/__init__.py b/lib_pypy/numpypy/__init__.py
--- a/lib_pypy/numpypy/__init__.py
+++ b/lib_pypy/numpypy/__init__.py
@@ -1,15 +1,14 @@
 #from _numpypy import *
 #from .core import *
 
-import sys, types
+import sys
 #sys.modules.setdefault('numpy', sys.modules['numpypy'])
 
-nt = types.ModuleType('numerictype','fake numerictypes module')
-setattr(nt, 'sctypeDict',{})
 import _numpypy as umath
 import multiarray
+import numerictypes
 sys.modules['numpy.core.multiarray'] = multiarray
 sys.modules['numpy.core.umath'] = umath
 
-sys.modules['numerictypes'] = nt
-sys.modules['numpy.core.numerictypes'] = nt
+sys.modules['numerictypes'] = numerictypes
+sys.modules['numpy.core.numerictypes'] = numerictypes
diff --git a/lib_pypy/numpypy/multiarray/__init__.py b/lib_pypy/numpypy/multiarray/__init__.py
--- a/lib_pypy/numpypy/multiarray/__init__.py
+++ b/lib_pypy/numpypy/multiarray/__init__.py
@@ -50,8 +50,6 @@
     return 1
 
 def empty_like(a, dtype=None, order='K', subok=True):
-    if not hasattr(a,'dtype'):
-        a = ndarray(a)
     if dtype is None:
         dtype = a.dtype
     if order != 'K' and order != 'C':
@@ -78,3 +76,74 @@
 
 def fromfile(_file, dtype=float, count=-1, sep=''):
     raise ValueError('not implemented yet')
+
+def frombuffer(buffer, dtype=float, count=-1, offset=0):
+    raise ValueError('not implemented yet')
+
+def newbuffer(size):
+    return bytearray(size)
+
+def getbuffer(a, *args):
+    if not hasattr(a,'size'):
+        a = ndarray(a)
+    offset = 0
+    size = a.size
+    if len(args)>0:
+        offset = args[0]
+    if len(args)>1:
+        size = args[1]
+    raise ValueError('not implemented yet')
+
+def int_asbuffer(*args, **kwargs):
+    raise ValueError('not implemented yet')
+
+def _fastCopyAndTranspose(*args, **kwargs):
+    raise ValueError('not implemented yet')
+
+def set_numeric_ops(**kwargw):
+    raise ValueError('not implemented yet')
+
+def can_cast(fromtype, totype, casting = 'safe'):
+    if not isinstance(fromtype, dtype):
+        raise ValueError('improper call to can_cast')
+    if not isinstance(totype, dtype):
+        raise ValueError('improper call to can_cast')
+    if casting not in ('no', 'equiv', 'safe', 'same_kind', 'unsafe'):
+        raise ValueError('improper call to can_cast')
+    raise ValueError('not implemented yet')
+
+def promote_types(type1, type2):
+    if not isinstance(type1, dtype):
+        raise ValueError('improper call to can_cast')
+    if not isinstance(type2, dtype):
+        raise ValueError('improper call to can_cast')
+    raise ValueError('not implemented yet')
+
+def min_scalar_type(a):
+    raise ValueError('not implemented yet')
+
+def result_type(*args):
+    raise ValueError('not implemented yet')
+
+def lexsort(keys, axis=-1):
+    raise ValueError('not implemented yet')
+
+def compare_chararrays(*args, **kwargs):
+    raise ValueError('not implemented yet')
+
+def putmask(a, mask, values):
+    raise ValueError('not implemented yet')
+
+def einsum(subscripts, *operands, **kwargs):
+    #kwargs is out=None, dtype=None, order='K', casting='safe'
+    raise ValueError('not implemented yet')
+
+def inner(a,b):
+    raise ValueError('not implemented yet')
+
+def format_longfloat(*args, **kwargs):
+    raise ValueError('not implemented yet')
+
+def datetime_as_string(*args, **kwargs):
+    raise ValueError('not implemented yet')
+
diff --git a/lib_pypy/numpypy/numerictypes.py b/lib_pypy/numpypy/numerictypes.py
new file mode 100644
--- /dev/null
+++ b/lib_pypy/numpypy/numerictypes.py
@@ -0,0 +1,5 @@
+sctypeDict = {}
+
+def sctype2char(sctype):
+    raise ValueError('not implemented yet')
+


More information about the pypy-commit mailing list