forked from LBRYCommunity/lbry-sdk
pylint fixes in lbry/extras/daemon
This commit is contained in:
parent
5dc15be98a
commit
f170da3e78
4 changed files with 11 additions and 7 deletions
|
@ -12,7 +12,7 @@ log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def get_encoded_signature(signature):
|
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)
|
r = int(signature[:int(len(signature) / 2)], 16)
|
||||||
s = 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)
|
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):
|
def is_comment_signed_by_channel(comment: dict, channel: Output, abandon=False):
|
||||||
if type(channel) is Output:
|
if isinstance(channel, Output):
|
||||||
try:
|
try:
|
||||||
signing_field = comment['comment_id'] if abandon else comment['comment']
|
signing_field = comment['comment_id'] if abandon else comment['comment']
|
||||||
pieces = [
|
pieces = [
|
||||||
|
|
|
@ -117,7 +117,7 @@ class JSONResponseEncoder(JSONEncoder):
|
||||||
self.ledger = ledger
|
self.ledger = ledger
|
||||||
self.include_protobuf = include_protobuf
|
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):
|
if isinstance(obj, Account):
|
||||||
return self.encode_account(obj)
|
return self.encode_account(obj)
|
||||||
if isinstance(obj, Wallet):
|
if isinstance(obj, Wallet):
|
||||||
|
@ -248,7 +248,8 @@ class JSONResponseEncoder(JSONEncoder):
|
||||||
result['is_default'] = self.ledger.accounts[0] == account
|
result['is_default'] = self.ledger.accounts[0] == account
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def encode_wallet(self, wallet):
|
@staticmethod
|
||||||
|
def encode_wallet(wallet):
|
||||||
return {
|
return {
|
||||||
'id': wallet.id,
|
'id': wallet.id,
|
||||||
'name': wallet.name
|
'name': wallet.name
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
from aiohttp.client_exceptions import ClientError
|
|
||||||
import json
|
import json
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
from aiohttp.client_exceptions import ClientError
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from lbry import utils, __version__
|
from lbry import utils, __version__
|
||||||
|
|
||||||
|
@ -14,6 +15,7 @@ class JsonFormatter(logging.Formatter):
|
||||||
"""Format log records using json serialization"""
|
"""Format log records using json serialization"""
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
super().__init__()
|
||||||
self.attributes = kwargs
|
self.attributes = kwargs
|
||||||
|
|
||||||
def format(self, record):
|
def format(self, record):
|
||||||
|
@ -46,7 +48,8 @@ class HTTPSLogglyHandler(logging.Handler):
|
||||||
self._loop = asyncio.get_event_loop()
|
self._loop = asyncio.get_event_loop()
|
||||||
self._session = aiohttp.ClientSession()
|
self._session = aiohttp.ClientSession()
|
||||||
|
|
||||||
def get_full_message(self, record):
|
@staticmethod
|
||||||
|
def get_full_message(record):
|
||||||
if record.exc_info:
|
if record.exc_info:
|
||||||
return '\n'.join(traceback.format_exception(*record.exc_info))
|
return '\n'.join(traceback.format_exception(*record.exc_info))
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -10,7 +10,7 @@ source =
|
||||||
ignore_missing_imports = True
|
ignore_missing_imports = True
|
||||||
|
|
||||||
[pylint]
|
[pylint]
|
||||||
ignore=words,server,rpc,schema,winpaths.py,migrator
|
ignore=words,server,rpc,schema,winpaths.py,migrator,undecorated.py
|
||||||
max-parents=10
|
max-parents=10
|
||||||
max-args=10
|
max-args=10
|
||||||
max-line-length=120
|
max-line-length=120
|
||||||
|
|
Loading…
Add table
Reference in a new issue