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

Method __init__

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

Source from the content-addressed store, hash-verified

905class FloatingFormat:
906 """ Formatter for subtypes of np.floating """
907 def __init__(self, data, precision, floatmode, suppress_small, sign=False,
908 *, legacy=None):
909 # for backcompatibility, accept bools
910 if isinstance(sign, bool):
911 sign = '+' if sign else '-'
912
913 self._legacy = legacy
914 if self._legacy <= 113:
915 # when not 0d, legacy does not support '-'
916 if data.shape != () and sign == '-':
917 sign = ' '
918
919 self.floatmode = floatmode
920 if floatmode == 'unique':
921 self.precision = None
922 else:
923 self.precision = precision
924
925 self.precision = _none_or_positive_arg(self.precision, 'precision')
926
927 self.suppress_small = suppress_small
928 self.sign = sign
929 self.exp_format = False
930 self.large_exponent = False
931
932 self.fillFormat(data)
933
934 def fillFormat(self, data):
935 # only the finite values are used to compute the number of digits

Callers

nothing calls this directly

Calls 2

fillFormatMethod · 0.95
_none_or_positive_argFunction · 0.85

Tested by

no test coverage detected