[Pkg-bitcoin-commits] [python-quamash] 262/269: style fixes
Jonas Smedegaard
dr at jones.dk
Fri Nov 24 11:26:42 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 652ecdab27b294aec4759b09284f2210a8959454
Author: Mark Harviston <mark.harviston at gmail.com>
Date: Fri Jan 1 19:41:58 2016 -0800
style fixes
---
quamash/__init__.py | 7 ++++---
quamash/_unix.py | 11 +++++++----
quamash/_windows.py | 2 ++
tests/test_qeventloop.py | 10 ++++++++--
tox.ini | 2 +-
5 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/quamash/__init__.py b/quamash/__init__.py
index fb883a3..ee8e45c 100644
--- a/quamash/__init__.py
+++ b/quamash/__init__.py
@@ -57,8 +57,9 @@ from ._common import with_logger
@with_logger
class _QThreadWorker(QtCore.QThread):
+
"""
- Read from the queue.
+ Read jobs from the queue and then execute them.
For use by the QThreadExecutor
"""
@@ -104,6 +105,7 @@ class _QThreadWorker(QtCore.QThread):
@with_logger
class QThreadExecutor:
+
"""
ThreadExecutor that produces QThreads.
@@ -225,6 +227,7 @@ else:
@with_logger
class QEventLoop(_baseclass):
+
"""
Implementation of asyncio event loop that uses the Qt Event loop.
@@ -404,7 +407,6 @@ class QEventLoop(_baseclass):
def remove_reader(self, fd):
"""Remove reader callback."""
-
if self.is_closed():
return
@@ -441,7 +443,6 @@ class QEventLoop(_baseclass):
def remove_writer(self, fd):
"""Remove writer callback."""
-
if self.is_closed():
return
diff --git a/quamash/_unix.py b/quamash/_unix.py
index d50054b..fafed92 100644
--- a/quamash/_unix.py
+++ b/quamash/_unix.py
@@ -16,7 +16,8 @@ EVENT_WRITE = (1 << 1)
def _fileobj_to_fd(fileobj):
- """Return a file descriptor from a file object.
+ """
+ Return a file descriptor from a file object.
Parameters:
fileobj -- file object or file descriptor
@@ -32,14 +33,15 @@ def _fileobj_to_fd(fileobj):
else:
try:
fd = int(fileobj.fileno())
- except (AttributeError, TypeError, ValueError):
- raise ValueError("Invalid file object: {!r}".format(fileobj)) from None
+ except (AttributeError, TypeError, ValueError) as ex:
+ raise ValueError("Invalid file object: {!r}".format(fileobj)) from ex
if fd < 0:
raise ValueError("Invalid file descriptor: {}".format(fd))
return fd
class _SelectorMapping(collections.Mapping):
+
"""Mapping of file objects to selector keys."""
def __init__(self, selector):
@@ -170,7 +172,8 @@ class _Selector(selectors.BaseSelector):
return self.__map
def _key_from_fd(self, fd):
- """Return the key associated to a given file descriptor.
+ """
+ Return the key associated to a given file descriptor.
Parameters:
fd -- file descriptor
diff --git a/quamash/_windows.py b/quamash/_windows.py
index 18afe81..f442a63 100644
--- a/quamash/_windows.py
+++ b/quamash/_windows.py
@@ -22,6 +22,7 @@ UINT32_MAX = 0xffffffff
class _ProactorEventLoop(asyncio.ProactorEventLoop):
+
"""Proactor based event loop."""
def __init__(self):
@@ -166,6 +167,7 @@ class _EventWorker(QtCore.QThread):
@with_logger
class _EventPoller(QtCore.QObject):
+
"""Polling of events in separate thread."""
sig_events = QtCore.Signal(list)
diff --git a/tests/test_qeventloop.py b/tests/test_qeventloop.py
index 3adafc7..a7098c7 100644
--- a/tests/test_qeventloop.py
+++ b/tests/test_qeventloop.py
@@ -88,6 +88,7 @@ ExceptionTester = type('ExceptionTester', (Exception,), {}) # to make flake8 no
class TestCanRunTasksInExecutor:
+
"""
Test Cases Concerning running jobs in Executors.
@@ -399,6 +400,7 @@ def test_can_remove_reader(loop, sock_pair):
assert got_msg is None, 'Should not have received a read notification'
+
def test_remove_reader_after_closing(loop, sock_pair):
"""Verify that we can remove a reader callback from an event loop."""
client_sock, srv_sock = sock_pair
@@ -407,6 +409,7 @@ def test_remove_reader_after_closing(loop, sock_pair):
loop.close()
loop.remove_reader(srv_sock.fileno())
+
def test_remove_writer_after_closing(loop, sock_pair):
"""Verify that we can remove a reader callback from an event loop."""
client_sock, srv_sock = sock_pair
@@ -415,13 +418,15 @@ def test_remove_writer_after_closing(loop, sock_pair):
loop.close()
loop.remove_writer(client_sock.fileno())
+
def test_add_reader_after_closing(loop, sock_pair):
"""Verify that we can remove a reader callback from an event loop."""
client_sock, srv_sock = sock_pair
loop.close()
with pytest.raises(RuntimeError):
- loop.add_reader(srv_sock.fileno(), lambda:None)
+ loop.add_reader(srv_sock.fileno(), lambda: None)
+
def test_add_writer_after_closing(loop, sock_pair):
"""Verify that we can remove a reader callback from an event loop."""
@@ -429,7 +434,8 @@ def test_add_writer_after_closing(loop, sock_pair):
loop.close()
with pytest.raises(RuntimeError):
- loop.add_writer(client_sock.fileno(), lambda:None)
+ loop.add_writer(client_sock.fileno(), lambda: None)
+
def test_can_add_writer(loop, sock_pair):
"""Verify that we can add a writer callback to an event loop."""
diff --git a/tox.ini b/tox.ini
index ca5d531..64bd23f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -46,5 +46,5 @@ commands=py.test --cov quamash
[flake8]
max-complexity=15
-ignore=D1,W191,E501,E402,E704,E701
+ignore=D1,W191,E501,E402,E704,E701,D211
exclude=build,.git,__pycache__,wheelhouse,htmlcov,dist,.cache,*.egg-info,appveyor
--
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