pylint fixes in lbry/extras/daemon

This commit is contained in:
Lex Berezhny 2020-01-03 01:39:34 -05:00
parent 5dc15be98a
commit f170da3e78
4 changed files with 11 additions and 7 deletions

View file

@ -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 = [

View file

@ -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

View file

@ -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:

View file

@ -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