(self)
| 112 | return (math.fsum([(x - mean) ** 2 for x in self.timings]) / len(self.timings)) ** 0.5 |
| 113 | |
| 114 | def __str__(self): |
| 115 | pm = '+-' |
| 116 | if hasattr(sys.stdout, 'encoding') and sys.stdout.encoding: |
| 117 | try: |
| 118 | "\xb1".encode(sys.stdout.encoding) |
| 119 | pm = "\xb1" |
| 120 | except: |
| 121 | pass |
| 122 | return "{mean} {pm} {std} per loop (mean {pm} std. dev. of {runs} run{run_plural}, {loops:,} loop{loop_plural} each)".format( |
| 123 | pm=pm, |
| 124 | runs=self.repeat, |
| 125 | loops=self.loops, |
| 126 | loop_plural="" if self.loops == 1 else "s", |
| 127 | run_plural="" if self.repeat == 1 else "s", |
| 128 | mean=_format_time(self.average, self._precision), |
| 129 | std=_format_time(self.stdev, self._precision), |
| 130 | ) |
| 131 | |
| 132 | def _repr_pretty_(self, p , cycle): |
| 133 | unic = self.__str__() |
no test coverage detected