From b5f245d9b6a983e27aca08e14f74f3d0880361d9 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Wed, 5 Dec 2018 01:01:11 -0500 Subject: [PATCH] made pylint and mypy happy --- setup.cfg | 2 +- torba/client/basenetwork.py | 2 +- torba/rpc/jsonrpc.py | 8 ++++---- torba/rpc/session.py | 8 ++++++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/setup.cfg b/setup.cfg index 60a6219bf..b9c236991 100644 --- a/setup.cfg +++ b/setup.cfg @@ -10,7 +10,7 @@ source = ignore_missing_imports = True [pylint] -ignore=words,server,workbench +ignore=words,server,workbench,rpc max-args=10 max-line-length=110 good-names=T,t,n,i,j,k,x,y,s,f,d,h,c,e,op,db,tx,io,cachedproperty,log,id diff --git a/torba/client/basenetwork.py b/torba/client/basenetwork.py index d193d6d47..4147cc42b 100644 --- a/torba/client/basenetwork.py +++ b/torba/client/basenetwork.py @@ -3,7 +3,7 @@ import asyncio from asyncio import CancelledError from itertools import cycle -from aiorpcx import RPCSession as BaseClientSession, Connector, RPCError +from torba.rpc import RPCSession as BaseClientSession, Connector, RPCError from torba import __version__ from torba.stream import StreamController diff --git a/torba/rpc/jsonrpc.py b/torba/rpc/jsonrpc.py index 6cbd5f11a..3aaa95e83 100644 --- a/torba/rpc/jsonrpc.py +++ b/torba/rpc/jsonrpc.py @@ -70,7 +70,7 @@ class Notification(SingleRequest): pass -class Batch(object): +class Batch: __slots__ = ('items', ) def __init__(self, items): @@ -646,9 +646,9 @@ class JSONRPCConnection(object): parts.append(error.error_message) if not items and parts: - error = ProtocolError(0, "") - error.error_message = protocol.batch_message_from_parts(parts) - raise error + protocol_error = ProtocolError(0, "") + protocol_error.error_message = protocol.batch_message_from_parts(parts) + raise protocol_error return items def _receive_response_batch(self, payloads): diff --git a/torba/rpc/session.py b/torba/rpc/session.py index 144cc2f02..655f4145b 100644 --- a/torba/rpc/session.py +++ b/torba/rpc/session.py @@ -29,15 +29,19 @@ __all__ = ('Connector', 'RPCSession', 'MessageSession', 'Server', import asyncio +from asyncio import Event, CancelledError import logging import time from contextlib import suppress -from . import * +from .jsonrpc import Request, JSONRPCConnection, JSONRPCv2, JSONRPC, Batch, Notification +from .jsonrpc import RPCError, ProtocolError +from .curio import TaskGroup, TaskTimeout, spawn_sync, ignore_after, timeout_after +from .framing import BadMagicError, BadChecksumError, OversizedPayloadError from .util import Concurrency -class Connector(object): +class Connector: def __init__(self, session_factory, host=None, port=None, proxy=None, **kwargs):