Permalink
Browse files

__repr__

  • Loading branch information...
Alvaro Saurin
Alvaro Saurin committed Nov 17, 2012
1 parent cd9aa00 commit b2699521148ffa025fa3ad0ade02d8dcb3f5740d
Showing with 7 additions and 3 deletions.
  1. +1 −1 evy/hubs/timer.py
  2. +6 −2 evy/uv/watchers.py
View
@@ -73,7 +73,7 @@ def pending(self):
def __repr__(self):
secs = getattr(self, 'seconds', None)
cb = getattr(self, 'callback', None)
- retval = "Timer(%s, %s)" % (secs, cb)
+ retval = "<Timer at %s (after=%s, callback=%s)>" % (hex(id(self)), secs, cb)
if _g_debug and hasattr(self, 'traceback'):
retval += '\n' + self.traceback.getvalue()
return retval
View
@@ -193,7 +193,7 @@ def _new_libuv_handle(self):
return ffi.new(self.libuv_handle_type)
def __repr__(self):
- retval = "%s (%d)" % (type(self).__name__, self.active)
+ retval = "<%s at %s (%d)>" % (type(self).__name__, hex(id(self)), self.active)
return retval
@@ -319,7 +319,7 @@ def __repr__(self):
if self.read_callback: events += 'R'
if self.write_callback: events += 'W'
- retval = "Poller (%d, '%s')" % (self.fileno, events)
+ retval = "<Poller at %s (%d, '%s')>" % (hex(id(self)), self.fileno, events)
return retval
__str__ = __repr__
@@ -401,6 +401,10 @@ def again(self, callback, *args, **kwargs):
## TODO: if the timer has never been started before it returns -1 and sets the error to UV_EINVAL.
self._python_incref()
+ def __repr__(self):
+ retval = "<Timer at %s (after=%f, repeat=%f)>" % (hex(id(self)), self._after, self._repeat)
+ return retval
+
class Signal(Watcher):
"""

0 comments on commit b269952

Please sign in to comment.