absolute imports

This commit is contained in:
Jack Robison 2018-11-09 14:02:03 -05:00
parent 1b4230b06e
commit d704336f20
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
52 changed files with 139 additions and 154 deletions

View file

@ -1,4 +0,0 @@
from .blob_file import BlobFile
from .creator import BlobFileCreator
from .writer import HashBlobWriter
from .reader import HashBlobReader

View file

@ -10,7 +10,6 @@ from lbrynet.p2p.client.StreamProgressManager import FullStreamProgressManager
from lbrynet.blob.client.CryptBlobHandler import CryptBlobHandler
log = logging.getLogger(__name__)

View file

@ -15,7 +15,7 @@ from lbrynet.androidhelpers.paths import (
)
try:
from .winpaths import get_path, FOLDERID, UserHandle
from lbrynet.winpaths import get_path, FOLDERID, UserHandle
except (ImportError, ValueError, NameError):
# Android platform: NameError: name 'c_wchar' is not defined
pass

View file

@ -1,7 +1,7 @@
import ipaddress
from binascii import hexlify
from functools import reduce
from . import constants
from lbrynet.dht import constants
def is_valid_ipv4(address):

View file

@ -1,5 +1,5 @@
from collections import UserDict
from . import constants
from lbrynet.dht import constants
class DictDataStore(UserDict):

View file

@ -1,4 +1,4 @@
from . import constants
from lbrynet.dht import constants
class Distance:

View file

@ -1,4 +1,4 @@
from .error import DecodeError
from lbrynet.dht.error import DecodeError
def bencode(data):

View file

@ -1,8 +1,8 @@
import logging
from twisted.internet import defer
from .distance import Distance
from .error import TimeoutError
from . import constants
from lbrynet.dht.distance import Distance
from lbrynet.dht.error import TimeoutError
from lbrynet.dht import constants
log = logging.getLogger(__name__)

View file

@ -1,8 +1,8 @@
import logging
from . import constants
from .distance import Distance
from .error import BucketFull
from lbrynet.dht import constants
from lbrynet.dht.distance import Distance
from lbrynet.dht.error import BucketFull
log = logging.getLogger(__name__)

View file

@ -7,7 +7,7 @@
# The docstrings in this module contain epytext markup; API documentation
# may be created by processing this file with epydoc: http://epydoc.sf.net
from . import msgtypes
from lbrynet.dht import msgtypes
class MessageTranslator:

View file

@ -8,7 +8,7 @@
# may be created by processing this file with epydoc: http://epydoc.sf.net
from lbrynet.utils import generate_id
from . import constants
from lbrynet.dht import constants
class Message:

View file

@ -6,14 +6,11 @@ from functools import reduce
from twisted.internet import defer, error, task
from lbrynet.utils import generate_id, DeferredDict
from .call_later_manager import CallLaterManager
from .error import TimeoutError
from . import constants
from . import routingtable
from . import datastore
from . import protocol
from .contact import ContactManager
from .iterativefind import iterativeFind
from lbrynet.dht.call_later_manager import CallLaterManager
from lbrynet.dht.error import TimeoutError
from lbrynet.dht import constants, routingtable, datastore, protocol
from lbrynet.dht.contact import ContactManager
from lbrynet.dht.iterativefind import iterativeFind
log = logging.getLogger(__name__)

View file

@ -3,12 +3,8 @@ import errno
from binascii import hexlify
from twisted.internet import protocol, defer
from .error import BUILTIN_EXCEPTIONS, UnknownRemoteException, TimeoutError, TransportNotConnected
from . import constants
from . import encoding
from . import msgtypes
from . import msgformat
from lbrynet.dht import constants, encoding, msgformat, msgtypes
from lbrynet.dht.error import BUILTIN_EXCEPTIONS, UnknownRemoteException, TimeoutError, TransportNotConnected
log = logging.getLogger(__name__)

View file

@ -6,14 +6,13 @@
# may be created by processing this file with epydoc: http://epydoc.sf.net
import random
from binascii import unhexlify
from twisted.internet import defer
from . import constants
from . import kbucket
from .error import TimeoutError
from .distance import Distance
import logging
from binascii import unhexlify
from twisted.internet import defer
from lbrynet.dht import constants, kbucket
from lbrynet.dht.error import TimeoutError
from lbrynet.dht.distance import Distance
log = logging.getLogger(__name__)

View file

@ -1,7 +1,7 @@
import logging
from twisted.internet import defer
from twisted._threads import AlreadyQuit
from .ComponentManager import ComponentManager
from lbrynet.extras.daemon.ComponentManager import ComponentManager
log = logging.getLogger(__name__)

View file

@ -1,8 +1,8 @@
import logging
from twisted.internet import defer
from lbrynet.p2p.Error import ComponentStartConditionNotMet
from .PeerManager import PeerManager
from .PeerFinder import DHTPeerFinder
from lbrynet.extras.daemon.PeerManager import PeerManager
from lbrynet.extras.daemon.PeerFinder import DHTPeerFinder
log = logging.getLogger(__name__)

View file

@ -8,30 +8,33 @@ import binascii
from hashlib import sha256
from types import SimpleNamespace
from twisted.internet import defer, threads, reactor, error, task
import lbrynet.schema
from aioupnp import __version__ as aioupnp_version
from aioupnp.upnp import UPnP
from aioupnp.fault import UPnPError
import lbrynet.schema
from lbrynet import conf
from lbrynet.blob.EncryptedFileManager import EncryptedFileManager
from lbrynet.blob.client.EncryptedFileDownloader import EncryptedFileSaverFactory
from lbrynet.blob.client.EncryptedFileOptions import add_lbry_file_to_sd_identifier
from lbrynet.dht.node import Node
from lbrynet.extras.daemon.Component import Component
from lbrynet.extras.daemon.ExchangeRateManager import ExchangeRateManager
from lbrynet.extras.daemon.storage import SQLiteStorage
from lbrynet.extras.daemon.HashAnnouncer import DHTHashAnnouncer
from lbrynet.extras.reflector.server.server import ReflectorServerFactory
from lbrynet.extras.wallet import LbryWalletManager
from lbrynet.extras.wallet import Network
from lbrynet.utils import DeferredDict, generate_id
from lbrynet.p2p.PaymentRateManager import OnlyFreePaymentsManager
from lbrynet.p2p.RateLimiter import RateLimiter
from lbrynet.p2p.BlobManager import DiskBlobManager
from lbrynet.p2p.StreamDescriptor import StreamDescriptorIdentifier, EncryptedFileStreamType
from lbrynet.extras.wallet import LbryWalletManager
from lbrynet.extras.wallet import Network
from lbrynet.p2p.server.BlobRequestHandler import BlobRequestHandlerFactory
from lbrynet.p2p.server.ServerProtocol import ServerProtocolFactory
from .Component import Component
from .ExchangeRateManager import ExchangeRateManager
from .storage import SQLiteStorage
from .HashAnnouncer import DHTHashAnnouncer
from lbrynet.dht.node import Node
from lbrynet.blob.EncryptedFileManager import EncryptedFileManager
from lbrynet.blob.client.EncryptedFileDownloader import EncryptedFileSaverFactory
from lbrynet.blob.client.EncryptedFileOptions import add_lbry_file_to_sd_identifier
from lbrynet.extras.reflector import ServerFactory as reflector_server_factory
log = logging.getLogger(__name__)
@ -649,7 +652,7 @@ class ReflectorComponent(Component):
log.info("Starting reflector server")
blob_manager = self.component_manager.get_component(BLOB_COMPONENT)
file_manager = self.component_manager.get_component(FILE_MANAGER_COMPONENT)
reflector_factory = reflector_server_factory(self.component_manager.peer_manager, blob_manager, file_manager)
reflector_factory = ReflectorServerFactory(self.component_manager.peer_manager, blob_manager, file_manager)
try:
self.reflector_server = yield reactor.listenTCP(self.reflector_server_port, reflector_factory)
log.info('Started reflector on port %s', self.reflector_server_port)

View file

@ -17,7 +17,26 @@ from twisted.python.failure import Failure
from torba.client.baseaccount import SingleKey, HierarchicalDeterministic
from lbrynet import conf, utils, __version__
from lbrynet.dht.error import TimeoutError
from lbrynet.extras import system_info
from lbrynet.extras.reflector import reupload
from lbrynet.extras.daemon.Components import d2f, f2d
from lbrynet.extras.daemon.Components import WALLET_COMPONENT, DATABASE_COMPONENT, DHT_COMPONENT, BLOB_COMPONENT
from lbrynet.extras.daemon.Components import FILE_MANAGER_COMPONENT, RATE_LIMITER_COMPONENT
from lbrynet.extras.daemon.Components import EXCHANGE_RATE_MANAGER_COMPONENT, PAYMENT_RATE_COMPONENT, UPNP_COMPONENT
from lbrynet.extras.daemon.ComponentManager import RequiredCondition
from lbrynet.extras.daemon.Downloader import GetStream
from lbrynet.extras.daemon.Publisher import Publisher
from lbrynet.extras.daemon.auth.server import AuthJSONRPCServer
from lbrynet.extras.wallet import LbryWalletManager
from lbrynet.extras.wallet.account import Account as LBCAccount
from lbrynet.extras.wallet.dewies import dewies_to_lbc, lbc_to_dewies
from lbrynet.p2p.StreamDescriptor import download_sd_blob
from lbrynet.p2p.Error import InsufficientFundsError, UnknownNameError, DownloadDataTimeout, DownloadSDTimeout
from lbrynet.p2p.Error import NullFundsError, NegativeFundsError, ResolveError
from lbrynet.p2p.Peer import Peer
from lbrynet.p2p.SinglePeerDownloader import SinglePeerDownloader
from lbrynet.p2p.client.StandaloneBlobDownloader import StandaloneBlobDownloader
from lbrynet.schema.claim import ClaimDict
from lbrynet.schema.uri import parse_lbry_uri
from lbrynet.schema.error import URIParseError, DecodeError
@ -25,28 +44,6 @@ from lbrynet.schema.validator import validate_claim_id
from lbrynet.schema.address import decode_address
from lbrynet.schema.decode import smart_decode
from lbrynet.extras.reflector import reupload
from .Components import d2f, f2d
from .Components import WALLET_COMPONENT, DATABASE_COMPONENT, DHT_COMPONENT, BLOB_COMPONENT
from .Components import FILE_MANAGER_COMPONENT, RATE_LIMITER_COMPONENT
from .Components import EXCHANGE_RATE_MANAGER_COMPONENT, PAYMENT_RATE_COMPONENT, UPNP_COMPONENT
from .ComponentManager import RequiredCondition
from .Downloader import GetStream
from .Publisher import Publisher
from .auth.server import AuthJSONRPCServer
from lbrynet.p2p.StreamDescriptor import download_sd_blob
from lbrynet.p2p.Error import InsufficientFundsError, UnknownNameError
from lbrynet.p2p.Error import DownloadDataTimeout, DownloadSDTimeout
from lbrynet.p2p.Error import NullFundsError, NegativeFundsError
from lbrynet.p2p.Error import ResolveError
from lbrynet.dht.error import TimeoutError
from lbrynet.p2p.Peer import Peer
from lbrynet.p2p.SinglePeerDownloader import SinglePeerDownloader
from lbrynet.p2p.client.StandaloneBlobDownloader import StandaloneBlobDownloader
from lbrynet.extras.wallet import LbryWalletManager
from lbrynet.extras.wallet.account import Account as LBCAccount
from lbrynet.extras.wallet.dewies import dewies_to_lbc, lbc_to_dewies
log = logging.getLogger(__name__)
requires = AuthJSONRPCServer.requires

View file

@ -6,11 +6,10 @@ import logging.handlers
from twisted.internet import defer, reactor, threads
from aiohttp import client_exceptions
from lbrynet import utils, conf, log_support
from lbrynet.extras.daemon import analytics
from lbrynet import utils, conf
from lbrynet import log_support
from .auth.client import LBRYAPIClient
from .Daemon import Daemon
from lbrynet.extras.daemon.auth.client import LBRYAPIClient
from lbrynet.extras.daemon.Daemon import Daemon
log = logging.getLogger(__name__)

View file

@ -14,7 +14,7 @@ import logging.handlers
from twisted.internet import reactor
from lbrynet import utils, conf, log_support
from lbrynet.extras import system_info
from .Daemon import Daemon
from lbrynet.extras.daemon.Daemon import Daemon
log = logging.getLogger(__name__)

View file

@ -3,7 +3,6 @@ import os
from twisted.internet import defer
from twisted.internet.task import LoopingCall
from .Components import f2d
from lbrynet import conf
from lbrynet.schema.fee import Fee
@ -14,6 +13,7 @@ from lbrynet.p2p.StreamDescriptor import download_sd_blob
from lbrynet.blob.EncryptedFileDownloader import ManagedEncryptedFileDownloaderFactory
from torba.client.constants import COIN
from lbrynet.extras.wallet.dewies import dewies_to_lbc
from lbrynet.extras.daemon.Components import f2d
INITIALIZING_CODE = 'initializing'
DOWNLOAD_METADATA_CODE = 'downloading_metadata'

View file

@ -1 +1 @@
from . import Components # register Component classes
from lbrynet.extras.daemon import Components # register Component classes

View file

@ -3,7 +3,7 @@ from zope.interface import implementer
from twisted.cred import portal, checkers, credentials, error as cred_error
from twisted.internet import defer
from twisted.web import resource
from .keyring import Keyring
from lbrynet.extras.daemon.auth.keyring import Keyring
log = logging.getLogger(__name__)

View file

@ -4,7 +4,7 @@ import logging
from urllib.parse import urlparse
from lbrynet import conf
from .keyring import Keyring, APIKey
from lbrynet.extras.daemon.auth.keyring import Keyring, APIKey
log = logging.getLogger(__name__)
USER_AGENT = "AuthServiceProxy/0.1"

View file

@ -4,8 +4,8 @@ from twisted.web import server, guard, resource
from twisted.cred import portal
from lbrynet import conf
from .auth import PasswordChecker, HttpPasswordRealm
from ..auth.keyring import Keyring
from lbrynet.extras.daemon.auth.auth import PasswordChecker, HttpPasswordRealm
from lbrynet.extras.daemon.auth.keyring import Keyring
log = logging.getLogger(__name__)

View file

@ -3,6 +3,7 @@ import datetime
import hmac
import hashlib
import base58
import logging
from OpenSSL.crypto import FILETYPE_PEM
from ssl import create_default_context, SSLContext
from cryptography.hazmat.backends import default_backend
@ -12,7 +13,7 @@ from cryptography.x509.name import NameOID, NameAttribute
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import serialization
from twisted.internet import ssl
import logging
from lbrynet import conf
log = logging.getLogger(__name__)

View file

@ -4,7 +4,6 @@ from six.moves.urllib import parse as urlparse
import json
import inspect
import signal
from functools import wraps
from twisted.web import server
from twisted.internet import defer
@ -13,16 +12,18 @@ from twisted.python.failure import Failure
from twisted.internet.error import ConnectionDone, ConnectionLost
from txjsonrpc import jsonrpclib
from traceback import format_exc
from lbrynet import conf, utils
from lbrynet.extras.daemon import analytics
from lbrynet.p2p.Error import InvalidAuthenticationToken
from lbrynet.p2p.Error import ComponentsNotStarted, ComponentStartConditionNotMet
from lbrynet.extras.looping_call_manager import LoopingCallManager
from lbrynet.extras.daemon.ComponentManager import ComponentManager
from .keyring import APIKey, Keyring
from .undecorated import undecorated
from .factory import AuthJSONRPCResource
from lbrynet.extras.daemon.auth.keyring import APIKey, Keyring
from lbrynet.extras.daemon.auth.undecorated import undecorated
from lbrynet.extras.daemon.auth.factory import AuthJSONRPCResource
from lbrynet.extras.daemon.json_response_encoder import JSONResponseEncoder
log = logging.getLogger(__name__)
EMPTY_PARAMS = [{}]

View file

@ -2,8 +2,8 @@ import sqlite3
import os
import json
import logging
from lbrynet.schema.decode import smart_decode
from lbrynet import conf
from lbrynet.schema.decode import smart_decode
log = logging.getLogger(__name__)

View file

@ -6,12 +6,13 @@ from binascii import hexlify, unhexlify
from decimal import Decimal
from twisted.internet import defer, task, threads
from twisted.enterprise import adbapi
from torba.client.constants import COIN
from lbrynet import conf
from lbrynet.schema.claim import ClaimDict
from lbrynet.schema.decode import smart_decode
from lbrynet.blob.CryptBlob import CryptBlobInfo
from lbrynet.dht.constants import dataExpireTimeout
from torba.client.constants import COIN
log = logging.getLogger(__name__)

View file

@ -63,6 +63,3 @@ If the transfer was not successful (False), the blob is re-added to the needed_b
Blob requests continue for each of the blobs the client has queued to send, when completed
the client disconnects.
"""
from .server.server import ReflectorServerFactory as ServerFactory
from .client.client import EncryptedFileReflectorClientFactory as ClientFactory
from .client.blob import BlobReflectorClientFactory as BlobClientFactory

View file

@ -2,7 +2,8 @@ import random
from twisted.internet import reactor, defer
from lbrynet import conf
from . import ClientFactory, BlobClientFactory
from lbrynet.extras.reflector.client.client import EncryptedFileReflectorClientFactory
from lbrynet.extras.reflector.client.blob import BlobReflectorClientFactory
def _is_ip(host):
@ -26,7 +27,7 @@ def resolve(host):
@defer.inlineCallbacks
def _reflect_stream(blob_manager, stream_hash, sd_hash, reflector_server):
reflector_address, reflector_port = reflector_server[0], reflector_server[1]
factory = ClientFactory(blob_manager, stream_hash, sd_hash)
factory = EncryptedFileReflectorClientFactory(blob_manager, stream_hash, sd_hash)
ip = yield resolve(reflector_address)
yield reactor.connectTCP(ip, reflector_port, factory)
result = yield factory.finished_deferred
@ -40,7 +41,7 @@ def _reflect_file(lbry_file, reflector_server):
@defer.inlineCallbacks
def _reflect_blobs(blob_manager, blob_hashes, reflector_server):
reflector_address, reflector_port = reflector_server[0], reflector_server[1]
factory = BlobClientFactory(blob_manager, blob_hashes)
factory = BlobReflectorClientFactory(blob_manager, blob_hashes)
ip = yield resolve(reflector_address)
yield reactor.connectTCP(ip, reflector_port, factory)
result = yield factory.finished_deferred

View file

@ -1,9 +1,9 @@
import platform
import os
import logging.handlers
from lbrynet.schema import __version__ as schema_version
from lbrynet import build_type, __version__ as lbrynet_version
import logging.handlers
log = logging.getLogger(__name__)

View file

@ -6,6 +6,6 @@ __node_url__ = (
)
__spvserver__ = 'lbrynet.extras.wallet.server.coin.LBCRegTest'
from .ledger import MainNetLedger, RegTestLedger
from .manager import LbryWalletManager
from .network import Network
from lbrynet.extras.wallet.ledger import MainNetLedger, RegTestLedger
from lbrynet.extras.wallet.manager import LbryWalletManager
from lbrynet.extras.wallet.network import Network

View file

@ -2,17 +2,16 @@ import asyncio
import logging
from binascii import unhexlify
from lbrynet.extras.wallet.dewies import dewies_to_lbc
from torba.client.baseledger import BaseLedger
from lbrynet.schema.error import URIParseError
from lbrynet.schema.uri import parse_lbry_uri
from torba.client.baseledger import BaseLedger
from .resolve import Resolver
from .account import Account
from .network import Network
from .database import WalletDatabase
from .transaction import Transaction
from .header import Headers, UnvalidatedHeaders
from lbrynet.extras.wallet.dewies import dewies_to_lbc
from lbrynet.extras.wallet.resolve import Resolver
from lbrynet.extras.wallet.account import Account
from lbrynet.extras.wallet.network import Network
from lbrynet.extras.wallet.database import WalletDatabase
from lbrynet.extras.wallet.transaction import Transaction
from lbrynet.extras.wallet.header import Headers, UnvalidatedHeaders
log = logging.getLogger(__name__)

View file

@ -14,11 +14,11 @@ from torba.client.basemanager import BaseWalletManager
from lbrynet.schema.claim import ClaimDict
from .ledger import MainNetLedger
from .account import BaseAccount, generate_certificate
from .transaction import Transaction
from .database import WalletDatabase
from .dewies import dewies_to_lbc
from lbrynet.extras.wallet.ledger import MainNetLedger
from lbrynet.extras.wallet.account import BaseAccount, generate_certificate
from lbrynet.extras.wallet.transaction import Transaction
from lbrynet.extras.wallet.database import WalletDatabase
from lbrynet.extras.wallet.dewies import dewies_to_lbc
log = logging.getLogger(__name__)

View file

@ -9,8 +9,7 @@ from lbrynet.schema.claim import ClaimDict
from lbrynet.schema.decode import smart_decode
from lbrynet.schema.error import DecodeError
from lbrynet.schema.uri import parse_lbry_uri
from .claim_proofs import verify_proof, InvalidProofError
from lbrynet.extras.wallet.claim_proofs import verify_proof, InvalidProofError
log = logging.getLogger(__name__)

View file

@ -9,7 +9,7 @@ from lbrynet.schema.proto.claim_pb2 import Claim
from lbrynet.schema.uri import parse_lbry_uri
from lbrynet.schema.decode import smart_decode
from .model import NameClaim, ClaimInfo, ClaimUpdate, ClaimSupport
from lbrynet.extras.wallet.server.model import NameClaim, ClaimInfo, ClaimUpdate, ClaimSupport
class LBRYBlockProcessor(BlockProcessor):

View file

@ -6,7 +6,7 @@ from torba.server.hash import hash_to_hex_str, HASHX_LEN
from hashlib import sha256
from torba.server.coins import Coin, CoinError
from .opcodes import decode_claim_script, opcodes as lbry_opcodes
from lbrynet.extras.wallet.server.opcodes import decode_claim_script, opcodes as lbry_opcodes
class LBC(Coin):

View file

@ -6,7 +6,7 @@ from torba.server.hash import hash_to_hex_str
from torba.server.db import DB
from .model import ClaimInfo
from lbrynet.extras.wallet.server.model import ClaimInfo
class LBRYDB(DB):

View file

@ -1,6 +1,6 @@
import struct
from torba.server.enum import Enumeration
from .model import NameClaim, ClaimSupport, ClaimUpdate
from lbrynet.extras.wallet.server.model import NameClaim, ClaimSupport, ClaimUpdate
# TODO: Take this to lbryschema (it's also on lbryum and lbryum-server)

View file

@ -8,8 +8,8 @@ from torba.server import util
from lbrynet.schema.uri import parse_lbry_uri
from lbrynet.schema.error import URIParseError
from .block_processor import LBRYBlockProcessor
from .db import LBRYDB
from lbrynet.extras.wallet.server.block_processor import LBRYBlockProcessor
from lbrynet.extras.wallet.server.db import LBRYDB
class LBRYElectrumX(ElectrumX):

View file

@ -1,6 +1,6 @@
from torba.server.tx import Deserializer
from .opcodes import decode_claim_script
from .model import TxClaimOutput, LBRYTx
from lbrynet.extras.wallet.server.opcodes import decode_claim_script
from lbrynet.extras.wallet.server.model import TxClaimOutput, LBRYTx
class LBRYDeserializer(Deserializer):

View file

@ -2,13 +2,12 @@ import struct
from binascii import hexlify, unhexlify
from typing import List, Iterable, Optional
from lbrynet.schema.decode import smart_decode
from .account import Account
from torba.client.basetransaction import BaseTransaction, BaseInput, BaseOutput
from torba.client.hash import hash160
from lbrynet.schema.decode import smart_decode
from lbrynet.schema.claim import ClaimDict
from .script import InputScript, OutputScript
from lbrynet.extras.wallet.account import Account
from lbrynet.extras.wallet.script import InputScript, OutputScript
class Input(BaseInput):

View file

@ -1,10 +1,9 @@
import logging
import random
import time
from decimal import Decimal
from twisted.internet import defer
from twisted.internet.task import LoopingCall
from decimal import Decimal
log = logging.getLogger(__name__)

View file

@ -1,9 +1,10 @@
from random import choice
import logging
import treq
from random import choice
from twisted.internet import defer, task
from twisted.internet.error import ConnectingCancelledError
from twisted.web._newclient import ResponseNeverReceived
import treq
from lbrynet.utils import DeferredDict
from lbrynet.p2p.Error import DownloadCanceledError

View file

@ -1,6 +1,6 @@
from lbrynet.p2p.Strategy import get_default_strategy, OnlyFreeStrategy
from lbrynet import conf
from decimal import Decimal
from lbrynet import conf
from lbrynet.p2p.Strategy import get_default_strategy, OnlyFreeStrategy
class BasePaymentRateManager:

View file

@ -4,7 +4,7 @@ import tempfile
from twisted.internet import defer, threads, reactor
from lbrynet.blob import BlobFile
from lbrynet.blob.blob_file import BlobFile
from lbrynet.p2p.BlobManager import DiskBlobManager
from lbrynet.p2p.RateLimiter import DummyRateLimiter
from lbrynet.p2p.PaymentRateManager import OnlyFreePaymentsManager

View file

@ -1,10 +1,10 @@
from binascii import unhexlify
import string
from collections import defaultdict
import json
import logging
from collections import defaultdict
from binascii import unhexlify
from twisted.internet import threads, defer
from lbrynet.cryptoutils import get_lbry_hash_obj
from lbrynet.p2p.client.StandaloneBlobDownloader import StandaloneBlobDownloader
from lbrynet.p2p.Error import UnknownStreamTypeError, InvalidStreamDescriptorError

View file

@ -1,13 +1,12 @@
import json
import binascii
from google.protobuf import json_format # pylint: disable=no-name-in-module
import six
from lbrynet.schema.error import DecodeError, InvalidAddress
from lbrynet.schema.legacy.migrate import migrate as schema_migrator
from lbrynet.schema.claim import ClaimDict
from google.protobuf import json_format # pylint: disable=no-name-in-module
def migrate_json_claim_value(decoded_json):

View file

@ -4,7 +4,9 @@ from binascii import hexlify
from twisted.internet import defer, error
from twisted.trial import unittest
from lbrynet.p2p.StreamDescriptor import get_sd_info
from lbrynet.extras import reflector
from lbrynet.extras.reflector.server.server import ReflectorServerFactory
from lbrynet.extras.reflector.client.client import EncryptedFileReflectorClientFactory
from lbrynet.extras.reflector.client.blob import BlobReflectorClientFactory
from lbrynet.extras.daemon.PeerManager import PeerManager
from lbrynet.p2p import BlobManager
from lbrynet.p2p import StreamDescriptor
@ -96,7 +98,7 @@ class TestReflector(unittest.TestCase):
return d
def start_server():
server_factory = reflector.ServerFactory(peer_manager, self.server_blob_manager,
server_factory = ReflectorServerFactory(peer_manager, self.server_blob_manager,
self.server_lbry_file_manager)
from twisted.internet import reactor
port = 8943
@ -180,7 +182,7 @@ class TestReflector(unittest.TestCase):
return d
def send_to_server():
factory = reflector.ClientFactory(self.client_blob_manager, self.stream_hash, self.sd_hash)
factory = EncryptedFileReflectorClientFactory(self.client_blob_manager, self.stream_hash, self.sd_hash)
from twisted.internet import reactor
reactor.connectTCP('localhost', self.port, factory)
@ -209,7 +211,7 @@ class TestReflector(unittest.TestCase):
return d
def send_to_server(blob_hashes_to_send):
factory = reflector.BlobClientFactory(
factory = BlobReflectorClientFactory(
self.client_blob_manager,
blob_hashes_to_send
)
@ -248,7 +250,7 @@ class TestReflector(unittest.TestCase):
return d
def send_to_server(blob_hashes_to_send):
factory = reflector.BlobClientFactory(
factory = BlobReflectorClientFactory(
self.client_blob_manager,
blob_hashes_to_send
)
@ -302,7 +304,7 @@ class TestReflector(unittest.TestCase):
return d
def send_to_server_as_blobs(blob_hashes_to_send):
factory = reflector.BlobClientFactory(
factory = BlobReflectorClientFactory(
self.client_blob_manager,
blob_hashes_to_send
)
@ -313,7 +315,7 @@ class TestReflector(unittest.TestCase):
return factory.finished_deferred
def send_to_server_as_stream(result):
factory = reflector.ClientFactory(self.client_blob_manager, self.stream_hash, self.sd_hash)
factory = EncryptedFileReflectorClientFactory(self.client_blob_manager, self.stream_hash, self.sd_hash)
from twisted.internet import reactor
reactor.connectTCP('localhost', self.port, factory)

View file

@ -3,7 +3,7 @@ from mock import MagicMock
from twisted.trial import unittest
from twisted.internet import defer
from lbrynet.blob import BlobFile
from lbrynet.blob.blob_file import BlobFile
from lbrynet.p2p.HTTPBlobDownloader import HTTPBlobDownloader
from tests.test_utils import mk_db_and_blob_dir, rm_db_and_blob_dir

View file

@ -1,4 +1,4 @@
from lbrynet.blob import BlobFile
from lbrynet.blob.blob_file import BlobFile
from lbrynet.p2p.Error import DownloadCanceledError, InvalidDataError
from tests.test_utils import mk_db_and_blob_dir, rm_db_and_blob_dir, random_lbry_hash