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

Method __repr__

numpy/_core/getlimits.py:305–325  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

303 return fmt
304
305 def __repr__(self):
306 if (repr_str := getattr(self, "_repr", None)) is not None:
307 return repr_str
308
309 c = self.__class__.__name__
310
311 # Use precision+1 digits in exponential notation
312 fmt_str = _MACHAR_PARAMS.get(self.dtype.type, {}).get('fmt', '%s')
313 if fmt_str != '%s' and hasattr(self, 'max') and hasattr(self, 'min'):
314 max_str = (fmt_str % self.max).strip()
315 min_str = (fmt_str % self.min).strip()
316 else:
317 max_str = str(self.max)
318 min_str = str(self.min)
319
320 resolution_str = str(self.resolution)
321
322 repr_str = (f"{c}(resolution={resolution_str}, min={min_str},"
323 f" max={max_str}, dtype={self.dtype})")
324 self._repr = repr_str
325 return repr_str
326
327 @cached_property
328 def tiny(self):

Callers

nothing calls this directly

Calls 2

stripMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected