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

Method __call__

numpy/core/arrayprint.py:1018–1047  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

1016 self.pad_left = max(self.pad_left, nanlen - offset, inflen - offset)
1017
1018 def __call__(self, x):
1019 if not np.isfinite(x):
1020 with errstate(invalid='ignore'):
1021 if np.isnan(x):
1022 sign = '+' if self.sign == '+' else ''
1023 ret = sign + _format_options['nanstr']
1024 else: # isinf
1025 sign = '-' if x < 0 else '+' if self.sign == '+' else ''
1026 ret = sign + _format_options['infstr']
1027 return ' '*(self.pad_left + self.pad_right + 1 - len(ret)) + ret
1028
1029 if self.exp_format:
1030 return dragon4_scientific(x,
1031 precision=self.precision,
1032 min_digits=self.min_digits,
1033 unique=self.unique,
1034 trim=self.trim,
1035 sign=self.sign == '+',
1036 pad_left=self.pad_left,
1037 exp_digits=self.exp_size)
1038 else:
1039 return dragon4_positional(x,
1040 precision=self.precision,
1041 min_digits=self.min_digits,
1042 unique=self.unique,
1043 fractional=True,
1044 trim=self.trim,
1045 sign=self.sign == '+',
1046 pad_left=self.pad_left,
1047 pad_right=self.pad_right)
1048
1049
1050@set_module('numpy')

Callers

nothing calls this directly

Calls 3

dragon4_scientificFunction · 0.90
dragon4_positionalFunction · 0.90
errstateClass · 0.85

Tested by

no test coverage detected