commit b92d6ab9e16e03747c4ac7b9f093a268b43a3c43
parent 28f771b68b7cab7a304cc7d8adccf2e3b9254bea
Author: parazyd <parazyd@dyne.org>
Date: Tue, 13 Apr 2021 17:42:10 +0200
Apply some linting.
Diffstat:
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/obelisk/protocol.py b/obelisk/protocol.py
@@ -155,28 +155,28 @@ class ElectrumProtocol(asyncio.Protocol): # pylint: disable=R0904,R0902
except (UnicodeDecodeError, json.JSONDecodeError) as err:
self.log.debug("Got error: %s", repr(err))
break
- self.log.debug("=> " + line)
+ self.log.debug("=> %s", line)
await self.handle_query(writer, query)
async def _send_notification(self, writer, method, params):
"""Send JSON-RPC notification to given writer"""
response = {"jsonrpc": "2.0", "method": method, "params": params}
self.log.debug("<= %s", response)
- writer.write(json.dumps(response).encode("utf-8") + b"\n")
+ writer.write(json.dumps(response).encode("utf-8").append("\n"))
await writer.drain()
async def _send_response(self, writer, result, nid):
"""Send successful JSON-RPC response to given writer"""
response = {"jsonrpc": "2.0", "result": result, "id": nid}
self.log.debug("<= %s", response)
- writer.write(json.dumps(response).encode("utf-8") + b"\n")
+ writer.write(json.dumps(response).encode("utf-8").append("\n"))
await writer.drain()
async def _send_error(self, writer, error, nid):
"""Send JSON-RPC error to given writer"""
response = {"jsonrpc": "2.0", "error": error, "id": nid}
self.log.debug("<= %s", response)
- writer.write(json.dumps(response).encode("utf-8") + b"\n")
+ writer.write(json.dumps(response).encode("utf-8").append("\n"))
await writer.drain()
async def _send_reply(self, writer, resp, query):
@@ -202,7 +202,7 @@ class ElectrumProtocol(asyncio.Protocol): # pylint: disable=R0904,R0902
resp = await func(writer, query)
return await self._send_reply(writer, resp, query)
- async def blockchain_block_header(self, writer, query): # pylint: disable=W0613
+ async def blockchain_block_header(self, writer, query): # pylint: disable=W0613,R0911
"""Method: blockchain.block.header
Return the block header at the given height.
"""
diff --git a/obelisk/zeromq.py b/obelisk/zeromq.py
@@ -25,7 +25,6 @@ import zmq
import zmq.asyncio
from obelisk.libbitcoin_errors import make_error_code, ErrorCode
-from obelisk.util import bh2u
def create_random_id():