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

Method __init__

numpy/core/arrayprint.py:1247–1265  ·  view source on GitHub ↗
(self, x, precision, floatmode, suppress_small,
                 sign=False, *, legacy=None)

Source from the content-addressed store, hash-verified

1245class ComplexFloatingFormat:
1246 """ Formatter for subtypes of np.complexfloating """
1247 def __init__(self, x, precision, floatmode, suppress_small,
1248 sign=False, *, legacy=None):
1249 # for backcompatibility, accept bools
1250 if isinstance(sign, bool):
1251 sign = '+' if sign else '-'
1252
1253 floatmode_real = floatmode_imag = floatmode
1254 if legacy <= 113:
1255 floatmode_real = 'maxprec_equal'
1256 floatmode_imag = 'maxprec'
1257
1258 self.real_format = FloatingFormat(
1259 x.real, precision, floatmode_real, suppress_small,
1260 sign=sign, legacy=legacy
1261 )
1262 self.imag_format = FloatingFormat(
1263 x.imag, precision, floatmode_imag, suppress_small,
1264 sign='+', legacy=legacy
1265 )
1266
1267 def __call__(self, x):
1268 r = self.real_format(x.real)

Callers

nothing calls this directly

Calls 1

FloatingFormatClass · 0.85

Tested by

no test coverage detected