forked from LBRYCommunity/lbry-sdk
pylint and unit test fixes
This commit is contained in:
parent
d5beaa0937
commit
69446491b8
32 changed files with 84 additions and 112 deletions
|
@ -1,7 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from zope.interface import implements
|
|
||||||
from lbrynet.interfaces import IRateLimiter
|
|
||||||
from twisted.internet import task
|
from twisted.internet import task
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,11 @@ from decimal import Decimal
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from twisted.python.failure import Failure
|
from twisted.python.failure import Failure
|
||||||
from twisted.internet.error import ConnectionAborted
|
from twisted.internet.error import ConnectionAborted
|
||||||
from zope.interface import implements
|
|
||||||
|
|
||||||
from lbrynet.core.Error import ConnectionClosedBeforeResponseError
|
from lbrynet.core.Error import ConnectionClosedBeforeResponseError
|
||||||
from lbrynet.core.Error import InvalidResponseError, RequestCanceledError, NoResponseError
|
from lbrynet.core.Error import InvalidResponseError, RequestCanceledError, NoResponseError
|
||||||
from lbrynet.core.Error import PriceDisagreementError, DownloadCanceledError, InsufficientFundsError
|
from lbrynet.core.Error import PriceDisagreementError, DownloadCanceledError, InsufficientFundsError
|
||||||
from lbrynet.core.client.ClientRequest import ClientRequest, ClientBlobRequest
|
from lbrynet.core.client.ClientRequest import ClientRequest, ClientBlobRequest
|
||||||
from lbrynet.interfaces import IRequestCreator
|
|
||||||
from lbrynet.core.Offer import Offer
|
from lbrynet.core.Offer import Offer
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@ from lbrynet.core import utils
|
||||||
from lbrynet.core.Error import ConnectionClosedBeforeResponseError, NoResponseError
|
from lbrynet.core.Error import ConnectionClosedBeforeResponseError, NoResponseError
|
||||||
from lbrynet.core.Error import DownloadCanceledError, MisbehavingPeerError
|
from lbrynet.core.Error import DownloadCanceledError, MisbehavingPeerError
|
||||||
from lbrynet.core.Error import RequestCanceledError
|
from lbrynet.core.Error import RequestCanceledError
|
||||||
from lbrynet.interfaces import IRequestSender, IRateLimited
|
|
||||||
from zope.interface import implements
|
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import random
|
import random
|
||||||
import logging
|
import logging
|
||||||
from twisted.internet import defer, reactor
|
from twisted.internet import defer, reactor
|
||||||
from zope.interface import implements
|
|
||||||
from lbrynet import interfaces
|
|
||||||
from lbrynet import conf
|
from lbrynet import conf
|
||||||
from lbrynet.core.client.ClientProtocol import ClientProtocolFactory
|
from lbrynet.core.client.ClientProtocol import ClientProtocolFactory
|
||||||
from lbrynet.core.Error import InsufficientFundsError
|
from lbrynet.core.Error import InsufficientFundsError
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from zope.interface import implements
|
|
||||||
from lbrynet import interfaces
|
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import logging
|
import logging
|
||||||
from zope.interface import implements
|
|
||||||
from lbrynet import interfaces
|
|
||||||
from lbrynet.core.BlobInfo import BlobInfo
|
from lbrynet.core.BlobInfo import BlobInfo
|
||||||
from lbrynet.core.client.BlobRequester import BlobRequester
|
from lbrynet.core.client.BlobRequester import BlobRequester
|
||||||
from lbrynet.core.client.ConnectionManager import ConnectionManager
|
from lbrynet.core.client.ConnectionManager import ConnectionManager
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
from lbrynet.interfaces import IProgressManager
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from zope.interface import implements
|
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
|
@ -3,11 +3,9 @@ import logging
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from twisted.protocols.basic import FileSender
|
from twisted.protocols.basic import FileSender
|
||||||
from twisted.python.failure import Failure
|
from twisted.python.failure import Failure
|
||||||
from zope.interface import implements
|
|
||||||
|
|
||||||
from lbrynet import analytics
|
from lbrynet import analytics
|
||||||
from lbrynet.core.Offer import Offer
|
from lbrynet.core.Offer import Offer
|
||||||
from lbrynet.interfaces import IQueryHandlerFactory, IQueryHandler, IBlobSender
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
from twisted.internet import interfaces, error
|
from twisted.internet import error
|
||||||
from twisted.internet.protocol import Protocol, ServerFactory
|
from twisted.internet.protocol import Protocol, ServerFactory
|
||||||
from twisted.python import failure
|
from twisted.python import failure
|
||||||
from zope.interface import implements
|
|
||||||
from lbrynet.core.server.ServerRequestHandler import ServerRequestHandler
|
from lbrynet.core.server.ServerRequestHandler import ServerRequestHandler
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from twisted.internet import interfaces, defer
|
from twisted.internet import defer
|
||||||
from zope.interface import implements
|
|
||||||
from lbrynet.interfaces import IRequestHandler
|
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import platform
|
import platform
|
||||||
import json
|
import json
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from six.moves.urllib.request import urlopen
|
from six.moves.urllib import request
|
||||||
from six.moves.urllib.error import URLError
|
from six.moves.urllib.error import URLError
|
||||||
from lbryschema import __version__ as lbryschema_version
|
from lbryschema import __version__ as lbryschema_version
|
||||||
from lbrynet import build_type, __version__ as lbrynet_version
|
from lbrynet import build_type, __version__ as lbrynet_version
|
||||||
|
@ -43,7 +45,7 @@ def get_platform(get_ip=True):
|
||||||
# TODO: remove this from get_platform and add a get_external_ip function using treq
|
# TODO: remove this from get_platform and add a get_external_ip function using treq
|
||||||
if get_ip:
|
if get_ip:
|
||||||
try:
|
try:
|
||||||
response = json.loads(urlopen("https://api.lbry.io/ip").read())
|
response = json.loads(request.urlopen("https://api.lbry.io/ip").read())
|
||||||
if not response['success']:
|
if not response['success']:
|
||||||
raise URLError("failed to get external ip")
|
raise URLError("failed to get external ip")
|
||||||
p['ip'] = response['data']['ip']
|
p['ip'] = response['data']['ip']
|
||||||
|
|
|
@ -5,8 +5,7 @@ import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from cryptography.hazmat.primitives.ciphers.algorithms import AES
|
from cryptography.hazmat.primitives.ciphers.algorithms import AES
|
||||||
from twisted.internet import interfaces, defer
|
from twisted.internet import defer
|
||||||
from zope.interface import implements
|
|
||||||
from lbrynet.cryptstream.CryptBlob import CryptStreamBlobMaker
|
from lbrynet.cryptstream.CryptBlob import CryptStreamBlobMaker
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import binascii
|
import binascii
|
||||||
from zope.interface import implements
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from lbrynet.cryptstream.CryptBlob import StreamBlobDecryptor
|
from lbrynet.cryptstream.CryptBlob import StreamBlobDecryptor
|
||||||
from lbrynet.interfaces import IBlobHandler
|
|
||||||
|
|
||||||
|
|
||||||
class CryptBlobHandler(object):
|
class CryptBlobHandler(object):
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import binascii
|
import binascii
|
||||||
import logging
|
import logging
|
||||||
from zope.interface import implements
|
|
||||||
from lbrynet.interfaces import IStreamDownloader
|
|
||||||
from lbrynet.core.client.BlobRequester import BlobRequester
|
from lbrynet.core.client.BlobRequester import BlobRequester
|
||||||
from lbrynet.core.client.ConnectionManager import ConnectionManager
|
from lbrynet.core.client.ConnectionManager import ConnectionManager
|
||||||
from lbrynet.core.client.DownloadManager import DownloadManager
|
from lbrynet.core.client.DownloadManager import DownloadManager
|
||||||
|
|
|
@ -6,7 +6,6 @@ import urllib
|
||||||
import json
|
import json
|
||||||
import textwrap
|
import textwrap
|
||||||
import signal
|
import signal
|
||||||
import six
|
|
||||||
from binascii import hexlify, unhexlify, b2a_hex
|
from binascii import hexlify, unhexlify, b2a_hex
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from decimal import Decimal, InvalidOperation
|
from decimal import Decimal, InvalidOperation
|
||||||
|
@ -17,7 +16,6 @@ from twisted.python.failure import Failure
|
||||||
|
|
||||||
from torba.constants import COIN
|
from torba.constants import COIN
|
||||||
|
|
||||||
import lbryschema
|
|
||||||
from lbryschema.claim import ClaimDict
|
from lbryschema.claim import ClaimDict
|
||||||
from lbryschema.uri import parse_lbry_uri
|
from lbryschema.uri import parse_lbry_uri
|
||||||
from lbryschema.error import URIParseError, DecodeError
|
from lbryschema.error import URIParseError, DecodeError
|
||||||
|
|
|
@ -6,8 +6,7 @@ import signal
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from zope.interface import implements
|
from twisted.web import server
|
||||||
from twisted.web import server, resource
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from twisted.python.failure import Failure
|
from twisted.python.failure import Failure
|
||||||
from twisted.internet.error import ConnectionDone, ConnectionLost
|
from twisted.internet.error import ConnectionDone, ConnectionLost
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from collections import UserDict
|
from six.moves import UserDict
|
||||||
from . import constants
|
from . import constants
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import print_function
|
||||||
from .error import DecodeError
|
from .error import DecodeError
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
import binascii
|
import binascii
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from zope.interface import implements
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from lbrynet.interfaces import IPeerFinder
|
|
||||||
from lbrynet import conf
|
from lbrynet import conf
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,11 @@
|
||||||
# may be created by processing this file with epydoc: http://epydoc.sf.net
|
# may be created by processing this file with epydoc: http://epydoc.sf.net
|
||||||
|
|
||||||
import random
|
import random
|
||||||
from zope.interface import implements
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from . import constants
|
from . import constants
|
||||||
from . import kbucket
|
from . import kbucket
|
||||||
from .error import TimeoutError
|
from .error import TimeoutError
|
||||||
from .distance import Distance
|
from .distance import Distance
|
||||||
from .interface import IRoutingTable
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
|
@ -4,7 +4,6 @@ Download LBRY Files from LBRYnet and save them to disk.
|
||||||
import logging
|
import logging
|
||||||
import binascii
|
import binascii
|
||||||
|
|
||||||
from zope.interface import implements
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from lbrynet import conf
|
from lbrynet import conf
|
||||||
from lbrynet.core.client.StreamProgressManager import FullStreamProgressManager
|
from lbrynet.core.client.StreamProgressManager import FullStreamProgressManager
|
||||||
|
@ -13,7 +12,6 @@ from lbrynet.core.utils import short_hash
|
||||||
from lbrynet.lbry_file.client.EncryptedFileDownloader import EncryptedFileSaver
|
from lbrynet.lbry_file.client.EncryptedFileDownloader import EncryptedFileSaver
|
||||||
from lbrynet.lbry_file.client.EncryptedFileDownloader import EncryptedFileDownloader
|
from lbrynet.lbry_file.client.EncryptedFileDownloader import EncryptedFileDownloader
|
||||||
from lbrynet.file_manager.EncryptedFileStatusReport import EncryptedFileStatusReport
|
from lbrynet.file_manager.EncryptedFileStatusReport import EncryptedFileStatusReport
|
||||||
from lbrynet.interfaces import IStreamDownloaderFactory
|
|
||||||
from lbrynet.core.StreamDescriptor import save_sd_info
|
from lbrynet.core.StreamDescriptor import save_sd_info
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
|
@ -7,7 +7,6 @@ import logging
|
||||||
from twisted.internet import defer, task, reactor
|
from twisted.internet import defer, task, reactor
|
||||||
from twisted.python.failure import Failure
|
from twisted.python.failure import Failure
|
||||||
from lbrynet.reflector.reupload import reflect_file
|
from lbrynet.reflector.reupload import reflect_file
|
||||||
# from lbrynet.core.PaymentRateManager import NegotiatedPaymentRateManager
|
|
||||||
from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloader
|
from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloader
|
||||||
from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloaderFactory
|
from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloaderFactory
|
||||||
from lbrynet.core.StreamDescriptor import EncryptedFileStreamType, get_sd_info
|
from lbrynet.core.StreamDescriptor import EncryptedFileStreamType, get_sd_info
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
import binascii
|
import binascii
|
||||||
|
|
||||||
from zope.interface import implements
|
|
||||||
|
|
||||||
from lbrynet.core.StreamDescriptor import save_sd_info
|
from lbrynet.core.StreamDescriptor import save_sd_info
|
||||||
from lbrynet.cryptstream.client.CryptStreamDownloader import CryptStreamDownloader
|
from lbrynet.cryptstream.client.CryptStreamDownloader import CryptStreamDownloader
|
||||||
from lbrynet.core.client.StreamProgressManager import FullStreamProgressManager
|
from lbrynet.core.client.StreamProgressManager import FullStreamProgressManager
|
||||||
from lbrynet.interfaces import IStreamDownloaderFactory
|
|
||||||
from lbrynet.lbry_file.client.EncryptedFileMetadataHandler import EncryptedFileMetadataHandler
|
from lbrynet.lbry_file.client.EncryptedFileMetadataHandler import EncryptedFileMetadataHandler
|
||||||
import os
|
import os
|
||||||
from twisted.internet import defer, threads
|
from twisted.internet import defer, threads
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
import logging
|
import logging
|
||||||
from zope.interface import implements
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from lbrynet.interfaces import IMetadataHandler
|
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class EncryptedFileMetadataHandler(object):
|
class EncryptedFileMetadataHandler(object):
|
||||||
#implements(IMetadataHandler)
|
|
||||||
|
|
||||||
def __init__(self, stream_hash, storage, download_manager):
|
def __init__(self, stream_hash, storage, download_manager):
|
||||||
self.stream_hash = stream_hash
|
self.stream_hash = stream_hash
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
# pylint: skip-file
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
import lbryum.wallet
|
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
@ -10,9 +10,9 @@ from twisted.internet import threads, defer
|
||||||
from lbrynet.database.storage import SQLiteStorage
|
from lbrynet.database.storage import SQLiteStorage
|
||||||
from lbrynet.tests.mocks import FakeNetwork
|
from lbrynet.tests.mocks import FakeNetwork
|
||||||
from lbrynet.core.Error import InsufficientFundsError
|
from lbrynet.core.Error import InsufficientFundsError
|
||||||
from lbrynet.core.Wallet import LBRYumWallet, ReservedPoints
|
#from lbrynet.core.Wallet import LBRYumWallet, ReservedPoints
|
||||||
from lbryum.commands import Commands
|
#from lbryum.commands import Commands
|
||||||
from lbryum.simple_config import SimpleConfig
|
#from lbryum.simple_config import SimpleConfig
|
||||||
from lbryschema.claim import ClaimDict
|
from lbryschema.claim import ClaimDict
|
||||||
|
|
||||||
test_metadata = {
|
test_metadata = {
|
||||||
|
@ -36,50 +36,53 @@ test_claim_dict = {
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
||||||
class MocLbryumWallet(LBRYumWallet):
|
#class MocLbryumWallet(LBRYumWallet):
|
||||||
def __init__(self, db_dir, max_usable_balance=3):
|
# def __init__(self, db_dir, max_usable_balance=3):
|
||||||
LBRYumWallet.__init__(self, SQLiteStorage(db_dir), SimpleConfig(
|
# LBRYumWallet.__init__(self, SQLiteStorage(db_dir), SimpleConfig(
|
||||||
{"lbryum_path": db_dir, "wallet_path": os.path.join(db_dir, "testwallet")}
|
# {"lbryum_path": db_dir, "wallet_path": os.path.join(db_dir, "testwallet")}
|
||||||
))
|
# ))
|
||||||
self.db_dir = db_dir
|
# self.db_dir = db_dir
|
||||||
self.wallet_balance = Decimal(10.0)
|
# self.wallet_balance = Decimal(10.0)
|
||||||
self.total_reserved_points = Decimal(0.0)
|
# self.total_reserved_points = Decimal(0.0)
|
||||||
self.queued_payments = defaultdict(Decimal)
|
# self.queued_payments = defaultdict(Decimal)
|
||||||
self.network = FakeNetwork()
|
# self.network = FakeNetwork()
|
||||||
self._mock_max_usable_balance = max_usable_balance
|
# self._mock_max_usable_balance = max_usable_balance
|
||||||
assert self.config.get_wallet_path() == os.path.join(self.db_dir, "testwallet")
|
# assert self.config.get_wallet_path() == os.path.join(self.db_dir, "testwallet")
|
||||||
|
#
|
||||||
|
# @defer.inlineCallbacks
|
||||||
|
# def setup(self, password=None, seed=None):
|
||||||
|
# yield self.storage.setup()
|
||||||
|
# seed = seed or "travel nowhere air position hill peace suffer parent beautiful rise " \
|
||||||
|
# "blood power home crumble teach"
|
||||||
|
# storage = lbryum.wallet.WalletStorage(self.config.get_wallet_path())
|
||||||
|
# self.wallet = lbryum.wallet.NewWallet(storage)
|
||||||
|
# self.wallet.add_seed(seed, password)
|
||||||
|
# self.wallet.create_master_keys(password)
|
||||||
|
# self.wallet.create_main_account()
|
||||||
|
#
|
||||||
|
# @defer.inlineCallbacks
|
||||||
|
# def stop(self):
|
||||||
|
# yield self.storage.stop()
|
||||||
|
# yield threads.deferToThread(shutil.rmtree, self.db_dir)
|
||||||
|
#
|
||||||
|
# def get_least_used_address(self, account=None, for_change=False, max_count=100):
|
||||||
|
# return defer.succeed(None)
|
||||||
|
#
|
||||||
|
# def get_name_claims(self):
|
||||||
|
# return threads.deferToThread(lambda: [])
|
||||||
|
#
|
||||||
|
# def _save_name_metadata(self, name, claim_outpoint, sd_hash):
|
||||||
|
# return defer.succeed(True)
|
||||||
|
#
|
||||||
|
# def get_max_usable_balance_for_claim(self, name):
|
||||||
|
# # The amount is returned on the basis of test_point_reservation_and_claim unittest
|
||||||
|
# # Also affects test_successful_send_name_claim
|
||||||
|
# return defer.succeed(self._mock_max_usable_balance)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
|
||||||
def setup(self, password=None, seed=None):
|
|
||||||
yield self.storage.setup()
|
|
||||||
seed = seed or "travel nowhere air position hill peace suffer parent beautiful rise " \
|
|
||||||
"blood power home crumble teach"
|
|
||||||
storage = lbryum.wallet.WalletStorage(self.config.get_wallet_path())
|
|
||||||
self.wallet = lbryum.wallet.NewWallet(storage)
|
|
||||||
self.wallet.add_seed(seed, password)
|
|
||||||
self.wallet.create_master_keys(password)
|
|
||||||
self.wallet.create_main_account()
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
|
||||||
def stop(self):
|
|
||||||
yield self.storage.stop()
|
|
||||||
yield threads.deferToThread(shutil.rmtree, self.db_dir)
|
|
||||||
|
|
||||||
def get_least_used_address(self, account=None, for_change=False, max_count=100):
|
|
||||||
return defer.succeed(None)
|
|
||||||
|
|
||||||
def get_name_claims(self):
|
|
||||||
return threads.deferToThread(lambda: [])
|
|
||||||
|
|
||||||
def _save_name_metadata(self, name, claim_outpoint, sd_hash):
|
|
||||||
return defer.succeed(True)
|
|
||||||
|
|
||||||
def get_max_usable_balance_for_claim(self, name):
|
|
||||||
# The amount is returned on the basis of test_point_reservation_and_claim unittest
|
|
||||||
# Also affects test_successful_send_name_claim
|
|
||||||
return defer.succeed(self._mock_max_usable_balance)
|
|
||||||
|
|
||||||
class WalletTest(unittest.TestCase):
|
class WalletTest(unittest.TestCase):
|
||||||
|
skip = "Needs to be ported to the new wallet."
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
user_dir = tempfile.mkdtemp()
|
user_dir = tempfile.mkdtemp()
|
||||||
|
@ -246,6 +249,8 @@ class WalletTest(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
class WalletEncryptionTests(unittest.TestCase):
|
class WalletEncryptionTests(unittest.TestCase):
|
||||||
|
skip = "Needs to be ported to the new wallet."
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
user_dir = tempfile.mkdtemp()
|
user_dir = tempfile.mkdtemp()
|
||||||
self.wallet = MocLbryumWallet(user_dir)
|
self.wallet = MocLbryumWallet(user_dir)
|
||||||
|
|
|
@ -9,9 +9,7 @@ from twisted.trial import unittest
|
||||||
from faker import Faker
|
from faker import Faker
|
||||||
|
|
||||||
from lbryschema.decode import smart_decode
|
from lbryschema.decode import smart_decode
|
||||||
from lbryum.wallet import NewWallet
|
|
||||||
from lbrynet import conf
|
from lbrynet import conf
|
||||||
from lbrynet.core import Wallet
|
|
||||||
from lbrynet.database.storage import SQLiteStorage
|
from lbrynet.database.storage import SQLiteStorage
|
||||||
from lbrynet.daemon.ComponentManager import ComponentManager
|
from lbrynet.daemon.ComponentManager import ComponentManager
|
||||||
from lbrynet.daemon.Components import DATABASE_COMPONENT, DHT_COMPONENT, WALLET_COMPONENT, STREAM_IDENTIFIER_COMPONENT
|
from lbrynet.daemon.Components import DATABASE_COMPONENT, DHT_COMPONENT, WALLET_COMPONENT, STREAM_IDENTIFIER_COMPONENT
|
||||||
|
@ -20,6 +18,9 @@ from lbrynet.daemon.Components import PEER_PROTOCOL_SERVER_COMPONENT, EXCHANGE_R
|
||||||
from lbrynet.daemon.Components import RATE_LIMITER_COMPONENT, HEADERS_COMPONENT, FILE_MANAGER_COMPONENT
|
from lbrynet.daemon.Components import RATE_LIMITER_COMPONENT, HEADERS_COMPONENT, FILE_MANAGER_COMPONENT
|
||||||
from lbrynet.daemon.Daemon import Daemon as LBRYDaemon
|
from lbrynet.daemon.Daemon import Daemon as LBRYDaemon
|
||||||
from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloader
|
from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloader
|
||||||
|
from lbrynet.wallet.manager import LbryWalletManager
|
||||||
|
from torba.wallet import Wallet
|
||||||
|
|
||||||
from lbrynet.core.PaymentRateManager import OnlyFreePaymentsManager
|
from lbrynet.core.PaymentRateManager import OnlyFreePaymentsManager
|
||||||
from lbrynet.tests import util
|
from lbrynet.tests import util
|
||||||
from lbrynet.tests.mocks import mock_conf_settings, FakeNetwork, FakeFileManager
|
from lbrynet.tests.mocks import mock_conf_settings, FakeNetwork, FakeFileManager
|
||||||
|
|
|
@ -3,6 +3,8 @@ import mock
|
||||||
from twisted.trial import unittest
|
from twisted.trial import unittest
|
||||||
from twisted.internet import defer, task
|
from twisted.internet import defer, task
|
||||||
|
|
||||||
|
from lbrynet.wallet.manager import LbryWalletManager
|
||||||
|
|
||||||
from lbrynet.core import PaymentRateManager, Wallet
|
from lbrynet.core import PaymentRateManager, Wallet
|
||||||
from lbrynet.core.Error import DownloadDataTimeout, DownloadSDTimeout
|
from lbrynet.core.Error import DownloadDataTimeout, DownloadSDTimeout
|
||||||
from lbrynet.daemon import Downloader
|
from lbrynet.daemon import Downloader
|
||||||
|
@ -66,7 +68,7 @@ class GetStreamTests(unittest.TestCase):
|
||||||
def init_getstream_with_mocs(self):
|
def init_getstream_with_mocs(self):
|
||||||
mock_conf_settings(self)
|
mock_conf_settings(self)
|
||||||
sd_identifier = mock.Mock(spec=StreamDescriptorIdentifier)
|
sd_identifier = mock.Mock(spec=StreamDescriptorIdentifier)
|
||||||
wallet = mock.Mock(spec=Wallet.LBRYumWallet)
|
wallet = mock.Mock(spec=LbryWalletmanager)
|
||||||
prm = mock.Mock(spec=PaymentRateManager.NegotiatedPaymentRateManager)
|
prm = mock.Mock(spec=PaymentRateManager.NegotiatedPaymentRateManager)
|
||||||
exchange_rate_manager = mock.Mock(spec=ExchangeRateManager)
|
exchange_rate_manager = mock.Mock(spec=ExchangeRateManager)
|
||||||
storage = mock.Mock(spec=SQLiteStorage)
|
storage = mock.Mock(spec=SQLiteStorage)
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
from binascii import hexlify
|
|
||||||
from lbryschema.claim import ClaimDict
|
from lbryschema.claim import ClaimDict
|
||||||
from lbryschema.signer import SECP256k1, get_signer
|
from lbryschema.signer import SECP256k1, get_signer
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
import os
|
import os
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
from torba.basetransaction import NULL_HASH
|
|
||||||
from torba.constants import COIN
|
|
||||||
from torba.coinselection import CoinSelector
|
|
||||||
from torba.manager import WalletManager as BaseWalletManager
|
from torba.manager import WalletManager as BaseWalletManager
|
||||||
|
|
||||||
from lbryschema.uri import parse_lbry_uri
|
from lbryschema.uri import parse_lbry_uri
|
||||||
from lbryschema.error import URIParseError
|
from lbryschema.error import URIParseError
|
||||||
|
|
||||||
from .ledger import MainNetLedger
|
from .ledger import MainNetLedger # pylint: disable=unused-import
|
||||||
from .account import generate_certificate
|
from .account import generate_certificate
|
||||||
from .transaction import Transaction
|
from .transaction import Transaction
|
||||||
|
|
||||||
|
|
||||||
class BackwardsCompatibleNetwork:
|
class BackwardsCompatibleNetwork(object):
|
||||||
def __init__(self, manager):
|
def __init__(self, manager):
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
|
|
||||||
|
@ -129,19 +126,19 @@ class LbryWalletManager(BaseWalletManager):
|
||||||
defer.returnValue(tx)
|
defer.returnValue(tx)
|
||||||
|
|
||||||
|
|
||||||
class ReservedPoints:
|
class ReservedPoints(object):
|
||||||
def __init__(self, identifier, amount):
|
def __init__(self, identifier, amount):
|
||||||
self.identifier = identifier
|
self.identifier = identifier
|
||||||
self.amount = amount
|
self.amount = amount
|
||||||
|
|
||||||
|
|
||||||
class ClientRequest:
|
class ClientRequest(object):
|
||||||
def __init__(self, request_dict, response_identifier=None):
|
def __init__(self, request_dict, response_identifier=None):
|
||||||
self.request_dict = request_dict
|
self.request_dict = request_dict
|
||||||
self.response_identifier = response_identifier
|
self.response_identifier = response_identifier
|
||||||
|
|
||||||
|
|
||||||
class LBRYcrdAddressRequester:
|
class LBRYcrdAddressRequester(object):
|
||||||
|
|
||||||
def __init__(self, wallet):
|
def __init__(self, wallet):
|
||||||
self.wallet = wallet
|
self.wallet = wallet
|
||||||
|
@ -167,11 +164,14 @@ class LBRYcrdAddressRequester:
|
||||||
self.wallet.update_peer_address(peer, address)
|
self.wallet.update_peer_address(peer, address)
|
||||||
|
|
||||||
def _request_failed(self, error, peer):
|
def _request_failed(self, error, peer):
|
||||||
raise Exception("A peer failed to send a valid public key response. Error: %s, peer: %s",
|
raise Exception(
|
||||||
error.getErrorMessage(), str(peer))
|
"A peer failed to send a valid public key response. Error: {}, peer: {}".format(
|
||||||
|
error.getErrorMessage(), str(peer)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class LBRYcrdAddressQueryHandlerFactory:
|
class LBRYcrdAddressQueryHandlerFactory(object):
|
||||||
|
|
||||||
def __init__(self, wallet):
|
def __init__(self, wallet):
|
||||||
self.wallet = wallet
|
self.wallet = wallet
|
||||||
|
@ -187,7 +187,7 @@ class LBRYcrdAddressQueryHandlerFactory:
|
||||||
return "LBRYcrd Address - an address for receiving payments via LBRYcrd"
|
return "LBRYcrd Address - an address for receiving payments via LBRYcrd"
|
||||||
|
|
||||||
|
|
||||||
class LBRYcrdAddressQueryHandler:
|
class LBRYcrdAddressQueryHandler(object):
|
||||||
|
|
||||||
def __init__(self, wallet):
|
def __init__(self, wallet):
|
||||||
self.wallet = wallet
|
self.wallet = wallet
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import struct
|
import struct
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
from typing import List
|
from typing import List # pylint: disable=unused-import
|
||||||
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer # pylint: disable=unused-import
|
||||||
|
|
||||||
from torba.baseaccount import BaseAccount
|
from torba.baseaccount import BaseAccount # pylint: disable=unused-import
|
||||||
from torba.basetransaction import BaseTransaction, BaseInput, BaseOutput
|
from torba.basetransaction import BaseTransaction, BaseInput, BaseOutput
|
||||||
from torba.hash import hash160
|
from torba.hash import hash160
|
||||||
|
|
||||||
from lbryschema.claim import ClaimDict
|
from lbryschema.claim import ClaimDict # pylint: disable=unused-import
|
||||||
from .script import InputScript, OutputScript
|
from .script import InputScript, OutputScript
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,3 +27,4 @@ wsgiref==0.1.2
|
||||||
zope.interface==4.3.3
|
zope.interface==4.3.3
|
||||||
treq==17.8.0
|
treq==17.8.0
|
||||||
typing
|
typing
|
||||||
|
git+https://github.com/lbryio/torba.git#egg=torba
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
mock>=2.0,<3.0
|
mock>=2.0,<3.0
|
||||||
Faker==0.8
|
Faker==0.8
|
||||||
|
git+https://github.com/lbryio/orchstr8.git#egg=orchstr8
|
||||||
|
|
Loading…
Reference in a new issue