File: dummy_module.py

package info (click to toggle)
pypy3 7.3.19%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 212,236 kB
  • sloc: python: 2,098,316; ansic: 540,565; sh: 21,462; asm: 14,419; cpp: 4,451; makefile: 4,209; objc: 761; xml: 530; exp: 499; javascript: 314; pascal: 244; lisp: 45; csh: 12; awk: 4
file content (46 lines) | stat: -rw-r--r-- 1,308 bytes parent folder | download | duplicates (5)
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])