MCPcopy Index your code
hub / github.com/numpy/numpy / __call__

Method __call__

numpy/_core/arrayprint.py:1104–1136  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

1102 )
1103
1104 def __call__(self, x):
1105 if not np.isfinite(x):
1106 with errstate(invalid='ignore'):
1107 current_options = format_options.get()
1108 if np.isnan(x):
1109 sign = '+' if self.sign == '+' else ''
1110 ret = sign + current_options['nanstr']
1111 else: # isinf
1112 sign = '-' if x < 0 else '+' if self.sign == '+' else ''
1113 ret = sign + current_options['infstr']
1114 return ' ' * (
1115 self.pad_left + self.pad_right + 1 - len(ret)
1116 ) + ret
1117
1118 if self.exp_format:
1119 return dragon4_scientific(x,
1120 precision=self.precision,
1121 min_digits=self.min_digits,
1122 unique=self.unique,
1123 trim=self.trim,
1124 sign=self.sign == '+',
1125 pad_left=self.pad_left,
1126 exp_digits=self.exp_size)
1127 else:
1128 return dragon4_positional(x,
1129 precision=self.precision,
1130 min_digits=self.min_digits,
1131 unique=self.unique,
1132 fractional=True,
1133 trim=self.trim,
1134 sign=self.sign == '+',
1135 pad_left=self.pad_left,
1136 pad_right=self.pad_right)
1137
1138
1139@set_module('numpy')

Callers

nothing calls this directly

Calls 2

errstateClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected