diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-11-08 23:00:32 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-11-08 23:00:33 +0000 |
commit | a74b8d50b8b8c14c97fc528c903fa59a8f555b58 (patch) | |
tree | dea0cb95501522f0f98ea1b87cdc9da7f552cd1e | |
parent | fca6f5e6364ad5515ddaef81ddce3113450f9ca9 (diff) | |
parent | 616d56bc62a0fda62770b1deaedd6471e1073e9a (diff) | |
download | gear-a74b8d50b8b8c14c97fc528c903fa59a8f555b58.tar.gz |
Merge "Re-enable flake8"
-rw-r--r-- | gear/__init__.py | 25 | ||||
-rw-r--r-- | gear/acl.py | 4 | ||||
-rw-r--r-- | gear/cmd/geard.py | 4 | ||||
-rw-r--r-- | gear/constants.py | 2 | ||||
-rw-r--r-- | gear/tests/test_gear.py | 2 | ||||
-rw-r--r-- | tox.ini | 1 |
6 files changed, 19 insertions, 19 deletions
diff --git a/gear/__init__.py b/gear/__init__.py index fecce32..537a5b2 100644 --- a/gear/__init__.py +++ b/gear/__init__.py @@ -27,9 +27,9 @@ from gear import constants from gear.acl import ACLError, ACLEntry, ACL # noqa try: - import Queue as queue + import Queue as queue_mod except ImportError: - import queue as queue + import queue as queue_mod try: import statsd @@ -608,8 +608,8 @@ class Packet(object): if not isinstance(other, Packet): return False if (self.code == other.code and - self.ptype == other.ptype and - self.data == other.data): + self.ptype == other.ptype and + self.data == other.data): return True return False @@ -1286,7 +1286,7 @@ class BaseClient(BaseClientServer): except Exception: self.log.exception("Exception while sending packet %s to %s" % (packet, connection)) - # If we can't send the packet, discard the connection + # If we can't send the packet, discard the connection self._lostConnection(connection) raise @@ -1718,7 +1718,7 @@ class Worker(BaseClient): self.functions = {} self.job_lock = threading.Lock() self.waiting_for_jobs = 0 - self.job_queue = queue.Queue() + self.job_queue = queue_mod.Queue() def __repr__(self): return '<gear.Worker 0x%x>' % id(self) @@ -1885,7 +1885,7 @@ class Worker(BaseClient): try: job = self.job_queue.get(False) - except queue.Empty: + except queue_mod.Empty: job = None if not job: @@ -2046,7 +2046,7 @@ class BaseJob(object): def __init__(self, name, arguments, unique=None, handle=None): self.name = convert_to_bytes(name) if (not isinstance(arguments, bytes) and - not isinstance(arguments, bytearray)): + not isinstance(arguments, bytearray)): raise TypeError("arguments must be of type bytes or bytearray") self.arguments = arguments self.unique = convert_to_bytes(unique) @@ -2972,9 +2972,10 @@ class Server(BaseClientServer): def handleStatus(self, request): functions = self._getFunctionStats() for name, values in functions.items(): - request.connection.sendRaw(("%s\t%s\t%s\t%s\n" % - (name.decode('utf-8'), values[0], values[1], - values[2])).encode('utf8')) + request.connection.sendRaw( + ("%s\t%s\t%s\t%s\n" % + (name.decode('utf-8'), values[0], values[1], + values[2])).encode('utf8')) request.connection.sendRaw(b'.\n') def handleWorkers(self, request): @@ -2999,7 +3000,7 @@ class Server(BaseClientServer): for connection in self.active_connections: if connection.state == 'SLEEP': if ((job and job.name in connection.functions) or - (job is None)): + (job is None)): connection.changeState("AWAKE") connection.sendPacket(p) diff --git a/gear/acl.py b/gear/acl.py index 631ef80..07c9e10 100644 --- a/gear/acl.py +++ b/gear/acl.py @@ -56,8 +56,8 @@ class ACLEntry(object): :returns: False if any permission is granted, otherwise True. """ if (self.register is None and - self.invoke is None and - self.grant is False): + self.invoke is None and + self.grant is False): return True return False diff --git a/gear/cmd/geard.py b/gear/cmd/geard.py index d35dc25..dff28f8 100644 --- a/gear/cmd/geard.py +++ b/gear/cmd/geard.py @@ -66,8 +66,8 @@ support. parser.add_argument('--keepalive-idle', dest='tcp_keepidle', type=int, default=7200, action='store', help='TCP keepalive idle time') - parser.add_argument('--keepalive-interval', dest='tcp_keepintvl', type=int, - default=75, action='store', + parser.add_argument('--keepalive-interval', dest='tcp_keepintvl', + type=int, default=75, action='store', help='TCP keepalive probe interval') parser.add_argument('--keepalive-count', dest='tcp_keepcnt', type=int, default=9, action='store', diff --git a/gear/constants.py b/gear/constants.py index e10eba4..2751278 100644 --- a/gear/constants.py +++ b/gear/constants.py @@ -41,7 +41,7 @@ types = { 2: 'CANT_DO', 3: 'RESET_ABILITIES', 4: 'PRE_SLEEP', - #unused + # unused 6: 'NOOP', 7: 'SUBMIT_JOB', 8: 'JOB_CREATED', diff --git a/gear/tests/test_gear.py b/gear/tests/test_gear.py index 546d4c4..c700431 100644 --- a/gear/tests/test_gear.py +++ b/gear/tests/test_gear.py @@ -62,7 +62,7 @@ class AdminRequestTestCase(tests.BaseTestCase): def test_partial_packet(self): req = gear.StatusAdminRequest() - for i in range(len(self.response)-len(self.remainder)): + for i in range(len(self.response) - len(self.remainder)): ret = req.isComplete(self.response[:i]) self.assertFalse(ret[0]) self.assertIsNone(ret[1]) @@ -31,7 +31,6 @@ exclude = .venv,.tox,dist,doc,*.egg show-source = true # E123, E125, and H ignored intentionally in this code-base ignore = E123,E125,H -select = H231 [testenv:docs] commands = python setup.py build_sphinx |