diff --git a/lbry/extras/daemon/comment_client.py b/lbry/extras/daemon/comment_client.py index 5556d130d..840c4a8aa 100644 --- a/lbry/extras/daemon/comment_client.py +++ b/lbry/extras/daemon/comment_client.py @@ -12,7 +12,7 @@ log = logging.getLogger(__name__) def get_encoded_signature(signature): - signature = signature.encode() if type(signature) is str else signature + signature = signature.encode() if isinstance(signature, str) else signature r = int(signature[:int(len(signature) / 2)], 16) s = int(signature[int(len(signature) / 2):], 16) return ecdsa.util.sigencode_der(r, s, len(signature) * 4) @@ -23,7 +23,7 @@ def cid2hash(claim_id: str) -> bytes: def is_comment_signed_by_channel(comment: dict, channel: Output, abandon=False): - if type(channel) is Output: + if isinstance(channel, Output): try: signing_field = comment['comment_id'] if abandon else comment['comment'] pieces = [ diff --git a/lbry/extras/daemon/json_response_encoder.py b/lbry/extras/daemon/json_response_encoder.py index 864ce16b2..6799ebd57 100644 --- a/lbry/extras/daemon/json_response_encoder.py +++ b/lbry/extras/daemon/json_response_encoder.py @@ -117,7 +117,7 @@ class JSONResponseEncoder(JSONEncoder): self.ledger = ledger self.include_protobuf = include_protobuf - def default(self, obj): # pylint: disable=method-hidden + def default(self, obj): # pylint: disable=method-hidden,arguments-differ,too-many-return-statements if isinstance(obj, Account): return self.encode_account(obj) if isinstance(obj, Wallet): @@ -248,7 +248,8 @@ class JSONResponseEncoder(JSONEncoder): result['is_default'] = self.ledger.accounts[0] == account return result - def encode_wallet(self, wallet): + @staticmethod + def encode_wallet(wallet): return { 'id': wallet.id, 'name': wallet.name diff --git a/lbry/extras/daemon/loggly_handler.py b/lbry/extras/daemon/loggly_handler.py index 896507f0a..4e5888d52 100644 --- a/lbry/extras/daemon/loggly_handler.py +++ b/lbry/extras/daemon/loggly_handler.py @@ -1,8 +1,9 @@ import asyncio -from aiohttp.client_exceptions import ClientError import json import logging.handlers import traceback + +from aiohttp.client_exceptions import ClientError import aiohttp from lbry import utils, __version__ @@ -14,6 +15,7 @@ class JsonFormatter(logging.Formatter): """Format log records using json serialization""" def __init__(self, **kwargs): + super().__init__() self.attributes = kwargs def format(self, record): @@ -46,7 +48,8 @@ class HTTPSLogglyHandler(logging.Handler): self._loop = asyncio.get_event_loop() self._session = aiohttp.ClientSession() - def get_full_message(self, record): + @staticmethod + def get_full_message(record): if record.exc_info: return '\n'.join(traceback.format_exception(*record.exc_info)) else: diff --git a/setup.cfg b/setup.cfg index f7c5a2495..398b9c191 100644 --- a/setup.cfg +++ b/setup.cfg @@ -10,7 +10,7 @@ source = ignore_missing_imports = True [pylint] -ignore=words,server,rpc,schema,winpaths.py,migrator +ignore=words,server,rpc,schema,winpaths.py,migrator,undecorated.py max-parents=10 max-args=10 max-line-length=120