[Pkg-bitcoin-commits] [python-quamash] 17/269: Fix some module refereces
Jonas Smedegaard
dr at jones.dk
Fri Nov 24 11:26:11 UTC 2017
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository python-quamash.
commit 804422785a7de403a6ca28c72a6687d7eec709ef
Author: Arve Knudsen <arve.knudsen at gmail.com>
Date: Mon Jun 30 11:50:03 2014 +0200
Fix some module refereces
---
quamash/__init__.py | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/quamash/__init__.py b/quamash/__init__.py
index 817e501..fbef822 100644
--- a/quamash/__init__.py
+++ b/quamash/__init__.py
@@ -14,7 +14,6 @@ import sys
import os
import asyncio
from asyncio import futures
-import asyncio.events
import socket
import time
from functools import partial, wraps
@@ -172,7 +171,7 @@ class QEventLoop(QtCore.QObject, _baseclass):
def run_until_complete(self, future):
"""Run until Future is complete."""
future = asyncio.async(future, loop=self)
- future.add_done_callback(self.stop)
+ future.add_done_callback(lambda *args: self.stop)
try:
self.run_forever()
finally:
@@ -184,6 +183,10 @@ class QEventLoop(QtCore.QObject, _baseclass):
def stop(self):
"""Stop event loop."""
+ if not self.__is_running:
+ _logger.debug('Not running')
+ return
+
_logger.debug('Stopping eventloop...')
self.__app.exit()
_logger.debug('Stopped eventloop')
@@ -202,11 +205,13 @@ class QEventLoop(QtCore.QObject, _baseclass):
def call_later(self, delay, callback, *args):
"""Register callback to be invoked after a certain delay."""
+ if asyncio.iscoroutinefunction(callback):
+ raise TypeError("coroutines cannot be used with call_later")
if not callable(callback):
raise TypeError('callback must be callable: {}'.format(type(callback).__name__))
- _logger.debug('Invoking callback {} after {} seconds'.format(
- callback, delay
+ _logger.debug('Invoking callback {} with arguments {} after {} second(s)'.format(
+ callback, args, delay
))
def upon_timeout():
@@ -241,9 +246,9 @@ class QEventLoop(QtCore.QObject, _baseclass):
self.call_soon(callback, *args)
def run_in_executor(self, executor, callback, *args):
- if isinstance(callback, events.Handle):
+ if isinstance(callback, asyncio.Handle):
assert not args
- assert not isinstance(callback, events.TimerHandle)
+ assert not isinstance(callback, asyncio.TimerHandle)
if callback.cancelled:
f = futures.Future()
f.set_result(None)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bitcoin/python-quamash.git
More information about the Pkg-bitcoin-commits
mailing list