MCPcopy Create free account
hub / github.com/ipython/ipython / __str__

Method __str__

IPython/core/magics/execution.py:98–116  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

96 return (math.fsum([(x - mean) ** 2 for x in self.timings]) / len(self.timings)) ** 0.5
97
98 def __str__(self):
99 pm = '+-'
100 if hasattr(sys.stdout, 'encoding') and sys.stdout.encoding:
101 try:
102 u'\xb1'.encode(sys.stdout.encoding)
103 pm = u'\xb1'
104 except:
105 pass
106 return (
107 u"{mean} {pm} {std} per loop (mean {pm} std. dev. of {runs} run{run_plural}, {loops} loop{loop_plural} each)"
108 .format(
109 pm = pm,
110 runs = self.repeat,
111 loops = self.loops,
112 loop_plural = "" if self.loops == 1 else "s",
113 run_plural = "" if self.repeat == 1 else "s",
114 mean = _format_time(self.average, self._precision),
115 std = _format_time(self.stdev, self._precision))
116 )
117
118 def _repr_pretty_(self, p , cycle):
119 unic = self.__str__()

Callers 1

_repr_pretty_Method · 0.95

Calls 2

_format_timeFunction · 0.85
formatMethod · 0.45

Tested by

no test coverage detected