Have the executor stats object repr look like the watcher repr
Avoid having different repr styles and just unify the executor stats one to look like the one used in the watcher object, which is the style more commonly used in other libraries also. Change-Id: Ibd98094371f57ecb8bca78b8446ca28727da84e9
This commit is contained in:
parent
24166d23da
commit
a72c6603a9
|
@ -407,8 +407,10 @@ class ExecutorStatistics(object):
|
|||
|
||||
__slots__ = ['_failures', '_executed', '_runtime', '_cancelled']
|
||||
|
||||
__repr_format = ("failures=%(failures)s, executed=%(executed)s, "
|
||||
"runtime=%(runtime)s, cancelled=%(cancelled)s")
|
||||
_REPR_MSG_TPL = ("<ExecutorStatistics object at 0x%(ident)x"
|
||||
" (failures=%(failures)s,"
|
||||
" executed=%(executed)s, runtime=%(runtime)0.2f,"
|
||||
" cancelled=%(cancelled)s)>")
|
||||
|
||||
def __init__(self, failures=0, executed=0, runtime=0.0, cancelled=0):
|
||||
self._failures = failures
|
||||
|
@ -463,13 +465,10 @@ class ExecutorStatistics(object):
|
|||
return self._runtime / self._executed
|
||||
|
||||
def __repr__(self):
|
||||
r = self.__class__.__name__
|
||||
r += "("
|
||||
r += self.__repr_format % ({
|
||||
return self._REPR_MSG_TPL % ({
|
||||
'ident': id(self),
|
||||
'failures': self._failures,
|
||||
'executed': self._executed,
|
||||
'runtime': self._runtime,
|
||||
'cancelled': self._cancelled,
|
||||
})
|
||||
r += ")"
|
||||
return r
|
||||
|
|
Loading…
Reference in New Issue