Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: inercia/evy
base: f4550fcdd1
...
head fork: inercia/evy
compare: b269952114
  • 4 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
Commits on Nov 17, 2012
Alvaro Saurin Fix typo
Use floats for timers
9ee93a0
Alvaro Saurin Minor: code style b5b77a7
Alvaro Saurin Cleanup cd9aa00
Alvaro Saurin __repr__ b269952
View
6 evy/hubs/hub.py
@@ -273,10 +273,10 @@ def wait (self, seconds = None):
"""
if not seconds:
- seconds = self.default_loop()
+ seconds = self.default_sleep()
## create a timer for avoiding exiting the loop for *seconds*
- timer = watchers.Timer(self, seconds * 1000)
+ timer = watchers.Timer(self, seconds * 1000.0)
timer.start(None)
try:
@@ -412,7 +412,7 @@ def add_timer (self, timer):
:param unreferenced: if True, we unreference the timer, so the loop does not wait until it is triggered
:return:
"""
- eventtimer = watchers.Timer(self, timer.seconds * 1000)
+ eventtimer = watchers.Timer(self, timer.seconds * 1000.0)
timer.impltimer = eventtimer
eventtimer.start(self._timer_triggered, timer)
self.timers.add(timer)
View
2  evy/hubs/timer.py
@@ -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
3  evy/timeout.py
@@ -144,7 +144,8 @@ def __exit__ (self, typ, value, tb):
def with_timeout (seconds, function, *args, **kwds):
- """Wrap a call to some (yielding) function with a timeout; if the called
+ """
+ Wrap a call to some (yielding) function with a timeout; if the called
function fails to return before the timeout, cancel it and return a flag
value.
"""
View
8 evy/uv/watchers.py
@@ -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):
"""
View
2  tests/test_event.py
@@ -72,7 +72,6 @@ def test_send (self):
assert result is X, 'Nobody sent anything to event2 yet it received %r' % (result, )
-class TestWaiters(LimitedTestCase):
def test_waiting_for_event (self):
evt = Event()
value = 'some stuff'
@@ -149,6 +148,7 @@ def test_double_exception (self):
evt.send(exc = RuntimeError('from test_double_exception'))
self.assertRaises(RuntimeError, evt.wait)
evt.reset()
+
# shouldn't see the RuntimeError again
evy.Timeout(0.001)
self.assertRaises(evy.Timeout, evt.wait)

No commit comments for this range

Something went wrong with that request. Please try again.