[Pkg-bitcoin-commits] [python-quamash] 94/269: Style changes found by pyflakes or coverage.py (or by old-fashioned code review)

Jonas Smedegaard dr at jones.dk
Fri Nov 24 11:26:19 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 22d8f4bda8cb4859c55e1fea7fb35872c76d034c
Author: Mark Harviston <mark.harviston at gmail.com>
Date:   Thu Jul 17 12:54:55 2014 -0700

    Style changes found by pyflakes or coverage.py (or by old-fashioned code review)
---
 quamash/__init__.py | 22 ++++++++++------------
 quamash/_common.py  |  2 ++
 quamash/_windows.py |  1 -
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/quamash/__init__.py b/quamash/__init__.py
index 3c2ec50..a8622fa 100644
--- a/quamash/__init__.py
+++ b/quamash/__init__.py
@@ -17,7 +17,6 @@ import time
 from functools import wraps
 from queue import Queue
 from concurrent.futures import Future
-import threading
 
 try:
 	from PySide import QtCore
@@ -108,7 +107,7 @@ class QThreadExecutor(QtCore.QObject):
 		return future
 
 	def map(self, func, *iterables, timeout=None):
-		raise NotImplemented("use as_completed on the event loop")
+		raise NotImplementedError("use as_completed on the event loop")
 
 	def shutdown(self):
 		if self.__been_shutdown:
@@ -333,12 +332,11 @@ class QEventLoop(_baseclass):
 				return f
 			callback, args = callback.callback, callback.args
 
+		executor = executor or self.__default_executor
 		if executor is None:
-			executor = self.__default_executor
-			if executor is None:
-				self._logger.debug('Creating default executor')
-				executor = self.__default_executor = QThreadExecutor()
-			self._logger.debug('Using default executor')
+			self._logger.debug('Creating default executor')
+			executor = self.__default_executor = QThreadExecutor()
+		self._logger.debug('Using default executor')
 
 		return asyncio.wrap_future(executor.submit(callback, *args))
 
@@ -414,7 +412,7 @@ class QEventLoop(_baseclass):
 		return self.__debug_enabled
 
 	def set_debug(self, enabled):
-		super(QEventLoop, self).set_debug(enabled)
+		super().set_debug(enabled)
 		self.__debug_enabled = enabled
 
 	def __enter__(self):
@@ -428,13 +426,13 @@ class QEventLoop(_baseclass):
 		finally:
 			asyncio.set_event_loop(None)
 
-	@staticmethod
-	def __log_error(*args, **kwds):
+	@classmethod
+	def __log_error(cls, *args, **kwds):
 		# In some cases, the error method itself fails, don't have a lot of options in that case
 		try:
-			self._logger.error(*args, **kwds)
+			cls._logger.error(*args, **kwds)
 		except:
-			sys.stderr.write('{}, {}\n'.format(args, kwds))
+			sys.stderr.write('{!r}, {!r}\n'.format(args, kwds))
 
 
 class _Cancellable:
diff --git a/quamash/_common.py b/quamash/_common.py
index b3fbcb0..1a46f5a 100644
--- a/quamash/_common.py
+++ b/quamash/_common.py
@@ -13,5 +13,7 @@ def with_logger(cls):
 	module = cls.__module__
 	if module is not None:
 		cls_name = module + '.' + cls_name
+	else:
+		raise AssertionError
 	setattr(cls, attr_name, logging.getLogger(cls_name))
 	return cls
diff --git a/quamash/_windows.py b/quamash/_windows.py
index fcd9080..fd2b5ad 100644
--- a/quamash/_windows.py
+++ b/quamash/_windows.py
@@ -1,4 +1,3 @@
-import threading
 import _winapi
 import asyncio
 from asyncio import windows_events

-- 
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