MCPcopy Create free account
hub / github.com/numpy/numpy / print_cancast_table

Function print_cancast_table

numpy/testing/print_coercion_tables.py:21–40  ·  view source on GitHub ↗
(ntypes)

Source from the content-addressed store, hash-verified

19 dtype = np.dtype('O')
20
21def print_cancast_table(ntypes):
22 print('X', end=' ')
23 for char in ntypes:
24 print(char, end=' ')
25 print()
26 for row in ntypes:
27 print(row, end=' ')
28 for col in ntypes:
29 if np.can_cast(row, col, "equiv"):
30 cast = "#"
31 elif np.can_cast(row, col, "safe"):
32 cast = "="
33 elif np.can_cast(row, col, "same_kind"):
34 cast = "~"
35 elif np.can_cast(row, col, "unsafe"):
36 cast = "."
37 else:
38 cast = " "
39 print(cast, end=' ')
40 print()
41
42def print_coercion_table(ntypes, inputfirstvalue, inputsecondvalue, firstarray, use_promote_types=False):
43 print('+', end=' ')

Callers 1

Calls 1

printFunction · 0.85

Tested by

no test coverage detected