Skip to content

Commit

Permalink
__repr__
Browse files Browse the repository at this point in the history
  • Loading branch information
Alvaro Saurin committed Nov 17, 2012
1 parent cd9aa00 commit b269952
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion evy/hubs/timer.py
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions evy/uv/watchers.py
Expand Up @@ -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


Expand Down Expand Up @@ -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__
Expand Down Expand Up @@ -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):
"""
Expand Down

0 comments on commit b269952

Please sign in to comment.