File: dummy_module.py

package info (click to toggle)
pypy3 7.0.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 111,848 kB
  • sloc: python: 1,291,746; ansic: 74,281; asm: 5,187; cpp: 3,017; sh: 2,533; makefile: 544; xml: 243; lisp: 45; csh: 21; awk: 4
file content (46 lines) | stat: -rw-r--r-- 1,308 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from _numpypy.multiarray import *
from _numpypy.umath import *

inf = float('inf')
nan = float('nan')
newaxis = None
ufunc = type(sin)

types = ['bool8', 'byte', 'ubyte', 'short', 'ushort', 'longlong', 'ulonglong',
         'single', 'double', 'longfloat', 'longdouble',
         'csingle', 'cdouble', 'cfloat', 'clongdouble',
         'void']
for t in ('int', 'uint'):
    for s in (8, 16, 32, 64, 'p'):
        types.append(t + str(s))
for s in (16, 32, 64):
    types.append('float' + str(s))
for s in (64, 128):
    types.append('complex' + str(s))
for t in types:
    globals()[t] = dtype(t).type

# removed 'string' and 'unicode' from that list to handle an error in
# make_new_dtype (micronumpy/descriptor.py)
types = ['bool', 'int', 'float', 'complex', 'str', 'object']
for t in types:
    globals()[t + '_'] = dtype(t).type
del types
globals()['uint'] = dtype('uint').type

types = ['Generic', 'Number', 'Integer', 'SignedInteger', 'UnsignedInteger',
         'Inexact', 'Floating', 'ComplexFloating', 'Flexible', 'Character',
        ]
for t in types:
    globals()[t.lower()] = typeinfo[t]

True_ = bool_(True)
False_ = bool_(False)

def ones(*args, **kwargs):
    a = zeros(*args, **kwargs)
    a.fill(1)
    return a

def isscalar(a):
    return any([isinstance(a, typeinfo[t]) for t in types])