From f4c6dc90c9649dbf379017ecd847b46cafcada59 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Sun, 4 Nov 2018 14:06:29 -0500 Subject: [PATCH] updated references lbrynet.core -> lbrynet.p2p --- lbrynet/analytics.py | 2 +- lbrynet/blob/blob_file.py | 4 ++-- lbrynet/blob/creator.py | 2 +- lbrynet/blob/writer.py | 4 ++-- lbrynet/cli.py | 2 +- lbrynet/conf.py | 4 ++-- lbrynet/cryptstream/CryptBlob.py | 2 +- .../client/CryptStreamDownloader.py | 8 ++++---- lbrynet/dht/hashannouncer.py | 2 +- lbrynet/dht/msgtypes.py | 2 +- lbrynet/dht/node.py | 8 ++++---- lbrynet/extras/daemon/ComponentManager.py | 2 +- lbrynet/extras/daemon/Components.py | 18 ++++++++--------- lbrynet/extras/daemon/Daemon.py | 20 +++++++++---------- lbrynet/extras/daemon/DaemonConsole.py | 4 ++-- lbrynet/extras/daemon/DaemonControl.py | 4 ++-- lbrynet/extras/daemon/Downloader.py | 8 ++++---- lbrynet/extras/daemon/ExchangeRateManager.py | 2 +- lbrynet/extras/daemon/auth/server.py | 8 ++++---- lbrynet/extras/daemon/migrator/migrate8to9.py | 4 ++-- lbrynet/extras/reflector/server/server.py | 8 ++++---- lbrynet/extras/wallet/resolve.py | 2 +- lbrynet/file_manager/EncryptedFileCreator.py | 4 ++-- .../file_manager/EncryptedFileDownloader.py | 8 ++++---- lbrynet/file_manager/EncryptedFileManager.py | 4 ++-- .../client/EncryptedFileDownloader.py | 6 +++--- .../lbry_file/client/EncryptedFileOptions.py | 6 +++--- lbrynet/p2p/HTTPBlobDownloader.py | 4 ++-- lbrynet/p2p/PaymentRateManager.py | 2 +- lbrynet/p2p/Peer.py | 2 +- lbrynet/p2p/PeerManager.py | 2 +- lbrynet/p2p/SinglePeerDownloader.py | 12 +++++------ lbrynet/p2p/Strategy.py | 4 ++-- lbrynet/p2p/StreamDescriptor.py | 8 ++++---- lbrynet/p2p/client/BlobRequester.py | 10 +++++----- lbrynet/p2p/client/ClientProtocol.py | 8 ++++---- lbrynet/p2p/client/ConnectionManager.py | 6 +++--- .../p2p/client/StandaloneBlobDownloader.py | 12 +++++------ lbrynet/p2p/log_support.py | 2 +- lbrynet/p2p/server/BlobRequestHandler.py | 2 +- lbrynet/p2p/server/ServerProtocol.py | 2 +- lbrynet/p2p/utils.py | 2 +- tests/functional/dht/test_store.py | 2 +- tests/functional/test_misc.py | 18 ++++++++--------- tests/functional/test_reflector.py | 10 +++++----- tests/functional/test_streamify.py | 12 +++++------ tests/integration/wallet/test_commands.py | 2 +- tests/mocks.py | 6 +++--- .../core/client/test_ConnectionManager.py | 18 ++++++++--------- .../core/server/test_BlobRequestHandler.py | 6 +++--- tests/unit/core/test_BlobManager.py | 6 +++--- tests/unit/core/test_HTTPBlobDownloader.py | 2 +- tests/unit/core/test_HashBlob.py | 2 +- tests/unit/core/test_Strategy.py | 6 +++--- tests/unit/core/test_Wallet.py | 4 ++-- tests/unit/core/test_utils.py | 2 +- tests/unit/dht/test_contact.py | 2 +- tests/unit/dht/test_hash_announcer.py | 2 +- tests/unit/dht/test_kbucket.py | 2 +- tests/unit/dht/test_node.py | 2 +- tests/unit/dht/test_routingtable.py | 2 +- .../test_EncryptedFileCreator.py | 14 ++++++------- tests/unit/lbrynet_daemon/test_Daemon.py | 2 +- tests/unit/lbrynet_daemon/test_Downloader.py | 10 +++++----- .../test_ExchangeRateManager.py | 2 +- tests/unit/test_cli.py | 2 +- tests/unit/test_conf.py | 2 +- tests/util.py | 4 ++-- 68 files changed, 184 insertions(+), 184 deletions(-) diff --git a/lbrynet/analytics.py b/lbrynet/analytics.py index 10de2bbaa..9c02fd717 100644 --- a/lbrynet/analytics.py +++ b/lbrynet/analytics.py @@ -5,7 +5,7 @@ import treq from twisted.internet import defer, task from lbrynet import conf -from lbrynet.core import looping_call_manager, utils, system_info +from lbrynet.p2p import looping_call_manager, utils, system_info # Things We Track SERVER_STARTUP = 'Server Startup' diff --git a/lbrynet/blob/blob_file.py b/lbrynet/blob/blob_file.py index 4091913b9..0046b6c5a 100644 --- a/lbrynet/blob/blob_file.py +++ b/lbrynet/blob/blob_file.py @@ -3,8 +3,8 @@ import os from twisted.internet import defer, threads from twisted.web.client import FileBodyProducer from twisted.python.failure import Failure -from lbrynet.core.Error import DownloadCanceledError, InvalidDataError, InvalidBlobHashError -from lbrynet.core.utils import is_valid_blobhash +from lbrynet.p2p.Error import DownloadCanceledError, InvalidDataError, InvalidBlobHashError +from lbrynet.p2p.utils import is_valid_blobhash from lbrynet.blob.writer import HashBlobWriter from lbrynet.blob.reader import HashBlobReader diff --git a/lbrynet/blob/creator.py b/lbrynet/blob/creator.py index d4edbfaeb..04b42961b 100644 --- a/lbrynet/blob/creator.py +++ b/lbrynet/blob/creator.py @@ -3,7 +3,7 @@ import logging from io import BytesIO from twisted.internet import defer from twisted.web.client import FileBodyProducer -from lbrynet.core.cryptoutils import get_lbry_hash_obj +from lbrynet.p2p.cryptoutils import get_lbry_hash_obj log = logging.getLogger(__name__) diff --git a/lbrynet/blob/writer.py b/lbrynet/blob/writer.py index 464e4701c..5332d3533 100644 --- a/lbrynet/blob/writer.py +++ b/lbrynet/blob/writer.py @@ -1,8 +1,8 @@ import logging from io import BytesIO from twisted.python.failure import Failure -from lbrynet.core.Error import DownloadCanceledError, InvalidDataError -from lbrynet.core.cryptoutils import get_lbry_hash_obj +from lbrynet.p2p.Error import DownloadCanceledError, InvalidDataError +from lbrynet.p2p.cryptoutils import get_lbry_hash_obj log = logging.getLogger(__name__) diff --git a/lbrynet/cli.py b/lbrynet/cli.py index 9f4cc8248..50a198bc4 100644 --- a/lbrynet/cli.py +++ b/lbrynet/cli.py @@ -24,7 +24,7 @@ from lbrynet.extras.daemon.Daemon import Daemon from lbrynet.extras.daemon.DaemonControl import start as daemon_main from lbrynet.extras.daemon.DaemonConsole import main as daemon_console from lbrynet.extras.daemon.auth.client import LBRYAPIClient -from lbrynet.core.system_info import get_platform +from lbrynet.p2p.system_info import get_platform async def execute_command(method, params, conf_path=None): diff --git a/lbrynet/conf.py b/lbrynet/conf.py index b47051b48..45b59c26a 100644 --- a/lbrynet/conf.py +++ b/lbrynet/conf.py @@ -7,8 +7,8 @@ import sys import yaml import envparse from appdirs import user_data_dir, user_config_dir -from lbrynet.core import utils -from lbrynet.core.Error import InvalidCurrencyError, NoSuchDirectoryError +from lbrynet.p2p import utils +from lbrynet.p2p.Error import InvalidCurrencyError, NoSuchDirectoryError from lbrynet.androidhelpers.paths import ( android_internal_storage_dir, android_app_internal_storage_dir diff --git a/lbrynet/cryptstream/CryptBlob.py b/lbrynet/cryptstream/CryptBlob.py index 4a942b28f..2a3b103d2 100644 --- a/lbrynet/cryptstream/CryptBlob.py +++ b/lbrynet/cryptstream/CryptBlob.py @@ -7,7 +7,7 @@ from cryptography.hazmat.primitives.ciphers import Cipher, modes from cryptography.hazmat.primitives.ciphers.algorithms import AES from cryptography.hazmat.primitives.padding import PKCS7 from cryptography.hazmat.backends import default_backend -from lbrynet.core.BlobInfo import BlobInfo +from lbrynet.p2p.BlobInfo import BlobInfo from lbrynet.blob.blob_file import MAX_BLOB_SIZE log = logging.getLogger(__name__) diff --git a/lbrynet/cryptstream/client/CryptStreamDownloader.py b/lbrynet/cryptstream/client/CryptStreamDownloader.py index 382365ce4..317d514b7 100644 --- a/lbrynet/cryptstream/client/CryptStreamDownloader.py +++ b/lbrynet/cryptstream/client/CryptStreamDownloader.py @@ -1,9 +1,9 @@ from binascii import unhexlify import logging -from lbrynet.core.client.BlobRequester import BlobRequester -from lbrynet.core.client.ConnectionManager import ConnectionManager -from lbrynet.core.client.DownloadManager import DownloadManager -from lbrynet.core.client.StreamProgressManager import FullStreamProgressManager +from lbrynet.p2p.client.BlobRequester import BlobRequester +from lbrynet.p2p.client.ConnectionManager import ConnectionManager +from lbrynet.p2p.client.DownloadManager import DownloadManager +from lbrynet.p2p.client.StreamProgressManager import FullStreamProgressManager from lbrynet.cryptstream.client.CryptBlobHandler import CryptBlobHandler from twisted.internet import defer from twisted.python.failure import Failure diff --git a/lbrynet/dht/hashannouncer.py b/lbrynet/dht/hashannouncer.py index d78e56ad2..7369d7cdc 100644 --- a/lbrynet/dht/hashannouncer.py +++ b/lbrynet/dht/hashannouncer.py @@ -2,7 +2,7 @@ import binascii import logging from twisted.internet import defer, task -from lbrynet.core import utils +from lbrynet.p2p import utils from lbrynet import conf log = logging.getLogger(__name__) diff --git a/lbrynet/dht/msgtypes.py b/lbrynet/dht/msgtypes.py index 5e19346fc..8bf8f3227 100644 --- a/lbrynet/dht/msgtypes.py +++ b/lbrynet/dht/msgtypes.py @@ -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 lbrynet.core.utils import generate_id +from lbrynet.p2p.utils import generate_id from . import constants diff --git a/lbrynet/dht/node.py b/lbrynet/dht/node.py index 7d6c79ea8..287cae8fb 100644 --- a/lbrynet/dht/node.py +++ b/lbrynet/dht/node.py @@ -5,9 +5,9 @@ from functools import reduce from twisted.internet import defer, error, task -from lbrynet.core.utils import generate_id, DeferredDict -from lbrynet.core.call_later_manager import CallLaterManager -from lbrynet.core.PeerManager import PeerManager +from lbrynet.p2p.utils import generate_id, DeferredDict +from lbrynet.p2p.call_later_manager import CallLaterManager +from lbrynet.p2p.PeerManager import PeerManager from .error import TimeoutError from . import constants from . import routingtable @@ -580,7 +580,7 @@ class Node(MockKademliaHelper): """ return generate_id() - # from lbrynet.core.utils import profile_deferred + # from lbrynet.p2p.utils import profile_deferred # @profile_deferred() @defer.inlineCallbacks def _iterativeFind(self, key, startupShortlist=None, rpc='findNode', exclude=None): diff --git a/lbrynet/extras/daemon/ComponentManager.py b/lbrynet/extras/daemon/ComponentManager.py index c263feaed..087a446ee 100644 --- a/lbrynet/extras/daemon/ComponentManager.py +++ b/lbrynet/extras/daemon/ComponentManager.py @@ -1,7 +1,7 @@ import logging from twisted.internet import defer -from lbrynet.core.Error import ComponentStartConditionNotMet +from lbrynet.p2p.Error import ComponentStartConditionNotMet log = logging.getLogger(__name__) diff --git a/lbrynet/extras/daemon/Components.py b/lbrynet/extras/daemon/Components.py index 2e36a7cab..5e0e34c47 100644 --- a/lbrynet/extras/daemon/Components.py +++ b/lbrynet/extras/daemon/Components.py @@ -12,15 +12,15 @@ from aioupnp import __version__ as aioupnp_version from aioupnp.upnp import UPnP from aioupnp.fault import UPnPError from lbrynet import conf -from lbrynet.core.utils import DeferredDict -from lbrynet.core.PaymentRateManager import OnlyFreePaymentsManager -from lbrynet.core.RateLimiter import RateLimiter -from lbrynet.core.BlobManager import DiskBlobManager -from lbrynet.core.StreamDescriptor import StreamDescriptorIdentifier, EncryptedFileStreamType +from lbrynet.p2p.utils import DeferredDict +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.core.server.BlobRequestHandler import BlobRequestHandlerFactory -from lbrynet.core.server.ServerProtocol import ServerProtocolFactory +from lbrynet.p2p.server.BlobRequestHandler import BlobRequestHandlerFactory +from lbrynet.p2p.server.ServerProtocol import ServerProtocolFactory from .Component import Component from .ExchangeRateManager import ExchangeRateManager from lbrynet.extras.daemon.storage import SQLiteStorage @@ -30,7 +30,7 @@ from lbrynet.lbry_file.client.EncryptedFileDownloader import EncryptedFileSaverF from lbrynet.lbry_file.client.EncryptedFileOptions import add_lbry_file_to_sd_identifier from lbrynet.extras.reflector import ServerFactory as reflector_server_factory -from lbrynet.core.utils import generate_id +from lbrynet.p2p.utils import generate_id log = logging.getLogger(__name__) @@ -95,7 +95,7 @@ class ConfigSettings: @staticmethod def get_external_ip(): - from lbrynet.core.system_info import get_platform + from lbrynet.p2p.system_info import get_platform platform = get_platform(get_ip=True) return platform['ip'] diff --git a/lbrynet/extras/daemon/Daemon.py b/lbrynet/extras/daemon/Daemon.py index 2a6c68c04..9d10cea43 100644 --- a/lbrynet/extras/daemon/Daemon.py +++ b/lbrynet/extras/daemon/Daemon.py @@ -25,7 +25,7 @@ from lbrynet.schema.address import decode_address from lbrynet.schema.decode import smart_decode # TODO: importing this when internet is disabled raises a socket.gaierror -from lbrynet.core.system_info import get_lbrynet_version +from lbrynet.p2p.system_info import get_lbrynet_version from lbrynet import conf from lbrynet.extras.reflector import reupload from .Components import d2f, f2d @@ -36,16 +36,16 @@ from .ComponentManager import RequiredCondition from .Downloader import GetStream from .Publisher import Publisher from .auth.server import AuthJSONRPCServer -from lbrynet.core import utils, system_info -from lbrynet.core.StreamDescriptor import download_sd_blob -from lbrynet.core.Error import InsufficientFundsError, UnknownNameError -from lbrynet.core.Error import DownloadDataTimeout, DownloadSDTimeout -from lbrynet.core.Error import NullFundsError, NegativeFundsError -from lbrynet.core.Error import ResolveError +from lbrynet.p2p import utils, system_info +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.core.Peer import Peer -from lbrynet.core.SinglePeerDownloader import SinglePeerDownloader -from lbrynet.core.client.StandaloneBlobDownloader import StandaloneBlobDownloader +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 diff --git a/lbrynet/extras/daemon/DaemonConsole.py b/lbrynet/extras/daemon/DaemonConsole.py index 02f2a7b51..3ef636b16 100644 --- a/lbrynet/extras/daemon/DaemonConsole.py +++ b/lbrynet/extras/daemon/DaemonConsole.py @@ -8,8 +8,8 @@ from aiohttp import client_exceptions from lbrynet import analytics from lbrynet import conf -from lbrynet.core import utils -from lbrynet.core import log_support +from lbrynet.p2p import utils +from lbrynet.p2p import log_support from .auth.client import LBRYAPIClient from .Daemon import Daemon diff --git a/lbrynet/extras/daemon/DaemonControl.py b/lbrynet/extras/daemon/DaemonControl.py index 302810937..1e1cadf69 100644 --- a/lbrynet/extras/daemon/DaemonControl.py +++ b/lbrynet/extras/daemon/DaemonControl.py @@ -7,7 +7,7 @@ if 'win' in sys.platform: import certifi os.environ['SSL_CERT_FILE'] = certifi.where() -from lbrynet.core import log_support +from lbrynet.p2p import log_support import argparse import logging.handlers @@ -15,7 +15,7 @@ import logging.handlers from twisted.internet import reactor from lbrynet import conf -from lbrynet.core import utils, system_info +from lbrynet.p2p import utils, system_info from .Daemon import Daemon log = logging.getLogger(__name__) diff --git a/lbrynet/extras/daemon/Downloader.py b/lbrynet/extras/daemon/Downloader.py index 7c80976ca..b18eb1a8f 100644 --- a/lbrynet/extras/daemon/Downloader.py +++ b/lbrynet/extras/daemon/Downloader.py @@ -6,10 +6,10 @@ from twisted.internet.task import LoopingCall from .Components import f2d from lbrynet.schema.fee import Fee -from lbrynet.core.Error import InsufficientFundsError, KeyFeeAboveMaxAllowed, InvalidStreamDescriptorError -from lbrynet.core.Error import DownloadDataTimeout, DownloadCanceledError, DownloadSDTimeout -from lbrynet.core.utils import safe_start_looping_call, safe_stop_looping_call -from lbrynet.core.StreamDescriptor import download_sd_blob +from lbrynet.p2p.Error import InsufficientFundsError, KeyFeeAboveMaxAllowed, InvalidStreamDescriptorError +from lbrynet.p2p.Error import DownloadDataTimeout, DownloadCanceledError, DownloadSDTimeout +from lbrynet.p2p.utils import safe_start_looping_call, safe_stop_looping_call +from lbrynet.p2p.StreamDescriptor import download_sd_blob from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloaderFactory from lbrynet import conf from torba.client.constants import COIN diff --git a/lbrynet/extras/daemon/ExchangeRateManager.py b/lbrynet/extras/daemon/ExchangeRateManager.py index 9f50d09bc..feeadd5f8 100644 --- a/lbrynet/extras/daemon/ExchangeRateManager.py +++ b/lbrynet/extras/daemon/ExchangeRateManager.py @@ -6,7 +6,7 @@ import treq from twisted.internet import defer from twisted.internet.task import LoopingCall -from lbrynet.core.Error import InvalidExchangeRateResponse, CurrencyConversionError +from lbrynet.p2p.Error import InvalidExchangeRateResponse, CurrencyConversionError log = logging.getLogger(__name__) diff --git a/lbrynet/extras/daemon/auth/server.py b/lbrynet/extras/daemon/auth/server.py index a3b4c0898..ea2b277d3 100644 --- a/lbrynet/extras/daemon/auth/server.py +++ b/lbrynet/extras/daemon/auth/server.py @@ -15,10 +15,10 @@ from txjsonrpc import jsonrpclib from traceback import format_exc from lbrynet import conf, analytics -from lbrynet.core.Error import InvalidAuthenticationToken -from lbrynet.core import utils -from lbrynet.core.Error import ComponentsNotStarted, ComponentStartConditionNotMet -from lbrynet.core.looping_call_manager import LoopingCallManager +from lbrynet.p2p.Error import InvalidAuthenticationToken +from lbrynet.p2p import utils +from lbrynet.p2p.Error import ComponentsNotStarted, ComponentStartConditionNotMet +from lbrynet.p2p.looping_call_manager import LoopingCallManager from lbrynet.extras.daemon.ComponentManager import ComponentManager from .keyring import APIKey, Keyring from .undecorated import undecorated diff --git a/lbrynet/extras/daemon/migrator/migrate8to9.py b/lbrynet/extras/daemon/migrator/migrate8to9.py index a518e9899..285934a0e 100644 --- a/lbrynet/extras/daemon/migrator/migrate8to9.py +++ b/lbrynet/extras/daemon/migrator/migrate8to9.py @@ -2,8 +2,8 @@ import sqlite3 import logging import os -from lbrynet.core.Error import InvalidStreamDescriptorError -from lbrynet.core.StreamDescriptor import EncryptedFileStreamType, format_sd_info, format_blobs, validate_descriptor +from lbrynet.p2p.Error import InvalidStreamDescriptorError +from lbrynet.p2p.StreamDescriptor import EncryptedFileStreamType, format_sd_info, format_blobs, validate_descriptor from lbrynet.cryptstream.CryptBlob import CryptBlobInfo log = logging.getLogger(__name__) diff --git a/lbrynet/extras/reflector/server/server.py b/lbrynet/extras/reflector/server/server.py index d0bae71e2..14bf2f889 100644 --- a/lbrynet/extras/reflector/server/server.py +++ b/lbrynet/extras/reflector/server/server.py @@ -3,10 +3,10 @@ import json from twisted.python import failure from twisted.internet import error, defer from twisted.internet.protocol import Protocol, ServerFactory -from lbrynet.core.utils import is_valid_blobhash -from lbrynet.core.Error import DownloadCanceledError, InvalidBlobHashError -from lbrynet.core.StreamDescriptor import BlobStreamDescriptorReader -from lbrynet.core.StreamDescriptor import save_sd_info +from lbrynet.p2p.utils import is_valid_blobhash +from lbrynet.p2p.Error import DownloadCanceledError, InvalidBlobHashError +from lbrynet.p2p.StreamDescriptor import BlobStreamDescriptorReader +from lbrynet.p2p.StreamDescriptor import save_sd_info from lbrynet.extras.reflector.common import REFLECTOR_V1, REFLECTOR_V2 from lbrynet.extras.reflector.common import ReflectorRequestError, ReflectorClientVersionError diff --git a/lbrynet/extras/wallet/resolve.py b/lbrynet/extras/wallet/resolve.py index e0bb1043f..db9e0e73f 100644 --- a/lbrynet/extras/wallet/resolve.py +++ b/lbrynet/extras/wallet/resolve.py @@ -3,7 +3,7 @@ import logging from ecdsa import BadSignatureError from binascii import unhexlify, hexlify -from lbrynet.core.Error import UnknownNameError, UnknownClaimID, UnknownURI, UnknownOutpoint +from lbrynet.p2p.Error import UnknownNameError, UnknownClaimID, UnknownURI, UnknownOutpoint from lbrynet.schema.address import is_address from lbrynet.schema.claim import ClaimDict from lbrynet.schema.decode import smart_decode diff --git a/lbrynet/file_manager/EncryptedFileCreator.py b/lbrynet/file_manager/EncryptedFileCreator.py index 4e4ec4c37..57347363d 100644 --- a/lbrynet/file_manager/EncryptedFileCreator.py +++ b/lbrynet/file_manager/EncryptedFileCreator.py @@ -9,8 +9,8 @@ from binascii import hexlify from twisted.internet import defer from twisted.protocols.basic import FileSender -from lbrynet.core.StreamDescriptor import BlobStreamDescriptorWriter, EncryptedFileStreamType -from lbrynet.core.StreamDescriptor import format_sd_info, get_stream_hash, validate_descriptor +from lbrynet.p2p.StreamDescriptor import BlobStreamDescriptorWriter, EncryptedFileStreamType +from lbrynet.p2p.StreamDescriptor import format_sd_info, get_stream_hash, validate_descriptor from lbrynet.cryptstream.CryptStreamCreator import CryptStreamCreator log = logging.getLogger(__name__) diff --git a/lbrynet/file_manager/EncryptedFileDownloader.py b/lbrynet/file_manager/EncryptedFileDownloader.py index 3aa38c38b..ea6201c81 100644 --- a/lbrynet/file_manager/EncryptedFileDownloader.py +++ b/lbrynet/file_manager/EncryptedFileDownloader.py @@ -6,13 +6,13 @@ from binascii import hexlify, unhexlify from twisted.internet import defer from lbrynet import conf -from lbrynet.core.client.StreamProgressManager import FullStreamProgressManager -from lbrynet.core.HTTPBlobDownloader import HTTPBlobDownloader -from lbrynet.core.utils import short_hash +from lbrynet.p2p.client.StreamProgressManager import FullStreamProgressManager +from lbrynet.p2p.HTTPBlobDownloader import HTTPBlobDownloader +from lbrynet.p2p.utils import short_hash from lbrynet.lbry_file.client.EncryptedFileDownloader import EncryptedFileSaver from lbrynet.lbry_file.client.EncryptedFileDownloader import EncryptedFileDownloader from lbrynet.file_manager.EncryptedFileStatusReport import EncryptedFileStatusReport -from lbrynet.core.StreamDescriptor import save_sd_info +from lbrynet.p2p.StreamDescriptor import save_sd_info log = logging.getLogger(__name__) diff --git a/lbrynet/file_manager/EncryptedFileManager.py b/lbrynet/file_manager/EncryptedFileManager.py index 4a710bce3..fbf4d4403 100644 --- a/lbrynet/file_manager/EncryptedFileManager.py +++ b/lbrynet/file_manager/EncryptedFileManager.py @@ -10,10 +10,10 @@ from twisted.python.failure import Failure from lbrynet.extras.reflector.reupload import reflect_file from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloader from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloaderFactory -from lbrynet.core.StreamDescriptor import EncryptedFileStreamType, get_sd_info +from lbrynet.p2p.StreamDescriptor import EncryptedFileStreamType, get_sd_info from lbrynet.cryptstream.client.CryptStreamDownloader import AlreadyStoppedError from lbrynet.cryptstream.client.CryptStreamDownloader import CurrentlyStoppingError -from lbrynet.core.utils import safe_start_looping_call, safe_stop_looping_call +from lbrynet.p2p.utils import safe_start_looping_call, safe_stop_looping_call from lbrynet import conf diff --git a/lbrynet/lbry_file/client/EncryptedFileDownloader.py b/lbrynet/lbry_file/client/EncryptedFileDownloader.py index 7869768ed..38254a749 100644 --- a/lbrynet/lbry_file/client/EncryptedFileDownloader.py +++ b/lbrynet/lbry_file/client/EncryptedFileDownloader.py @@ -3,10 +3,10 @@ import logging import traceback from binascii import hexlify, unhexlify -from lbrynet.core.StreamDescriptor import save_sd_info +from lbrynet.p2p.StreamDescriptor import save_sd_info from lbrynet.cryptstream.client.CryptStreamDownloader import CryptStreamDownloader -from lbrynet.core.client.StreamProgressManager import FullStreamProgressManager -from lbrynet.core.Error import FileOpenError +from lbrynet.p2p.client.StreamProgressManager import FullStreamProgressManager +from lbrynet.p2p.Error import FileOpenError from lbrynet.lbry_file.client.EncryptedFileMetadataHandler import EncryptedFileMetadataHandler from twisted.internet import defer, threads diff --git a/lbrynet/lbry_file/client/EncryptedFileOptions.py b/lbrynet/lbry_file/client/EncryptedFileOptions.py index fbc0d93b6..ca4421d35 100644 --- a/lbrynet/lbry_file/client/EncryptedFileOptions.py +++ b/lbrynet/lbry_file/client/EncryptedFileOptions.py @@ -1,6 +1,6 @@ -from lbrynet.core.StreamDescriptor import EncryptedFileStreamType -from lbrynet.core.StreamDescriptor import EncryptedFileStreamDescriptorValidator -from lbrynet.core.DownloadOption import DownloadOption, DownloadOptionChoice +from lbrynet.p2p.StreamDescriptor import EncryptedFileStreamType +from lbrynet.p2p.StreamDescriptor import EncryptedFileStreamDescriptorValidator +from lbrynet.p2p.DownloadOption import DownloadOption, DownloadOptionChoice def add_lbry_file_to_sd_identifier(sd_identifier): diff --git a/lbrynet/p2p/HTTPBlobDownloader.py b/lbrynet/p2p/HTTPBlobDownloader.py index 9358f3a14..8619737fa 100644 --- a/lbrynet/p2p/HTTPBlobDownloader.py +++ b/lbrynet/p2p/HTTPBlobDownloader.py @@ -4,8 +4,8 @@ from twisted.internet import defer, task from twisted.internet.error import ConnectingCancelledError from twisted.web._newclient import ResponseNeverReceived import treq -from lbrynet.core.utils import DeferredDict -from lbrynet.core.Error import DownloadCanceledError +from lbrynet.p2p.utils import DeferredDict +from lbrynet.p2p.Error import DownloadCanceledError log = logging.getLogger(__name__) diff --git a/lbrynet/p2p/PaymentRateManager.py b/lbrynet/p2p/PaymentRateManager.py index f395e5bfb..372204365 100644 --- a/lbrynet/p2p/PaymentRateManager.py +++ b/lbrynet/p2p/PaymentRateManager.py @@ -1,4 +1,4 @@ -from lbrynet.core.Strategy import get_default_strategy, OnlyFreeStrategy +from lbrynet.p2p.Strategy import get_default_strategy, OnlyFreeStrategy from lbrynet import conf from decimal import Decimal diff --git a/lbrynet/p2p/Peer.py b/lbrynet/p2p/Peer.py index 9d5bc3a60..f06ce806d 100644 --- a/lbrynet/p2p/Peer.py +++ b/lbrynet/p2p/Peer.py @@ -1,6 +1,6 @@ import datetime from collections import defaultdict -from lbrynet.core import utils +from lbrynet.p2p import utils # Do not create this object except through PeerManager class Peer: diff --git a/lbrynet/p2p/PeerManager.py b/lbrynet/p2p/PeerManager.py index 66e6214df..4cb1425ba 100644 --- a/lbrynet/p2p/PeerManager.py +++ b/lbrynet/p2p/PeerManager.py @@ -1,4 +1,4 @@ -from lbrynet.core.Peer import Peer +from lbrynet.p2p.Peer import Peer class PeerManager: diff --git a/lbrynet/p2p/SinglePeerDownloader.py b/lbrynet/p2p/SinglePeerDownloader.py index 73ef095de..ab1eee31f 100644 --- a/lbrynet/p2p/SinglePeerDownloader.py +++ b/lbrynet/p2p/SinglePeerDownloader.py @@ -5,12 +5,12 @@ import tempfile from twisted.internet import defer, threads, reactor from lbrynet.blob import BlobFile -from lbrynet.core.BlobManager import DiskBlobManager -from lbrynet.core.RateLimiter import DummyRateLimiter -from lbrynet.core.PaymentRateManager import OnlyFreePaymentsManager -from lbrynet.core.client.BlobRequester import BlobRequester -from lbrynet.core.client.StandaloneBlobDownloader import StandaloneBlobDownloader -from lbrynet.core.client.ConnectionManager import ConnectionManager +from lbrynet.p2p.BlobManager import DiskBlobManager +from lbrynet.p2p.RateLimiter import DummyRateLimiter +from lbrynet.p2p.PaymentRateManager import OnlyFreePaymentsManager +from lbrynet.p2p.client.BlobRequester import BlobRequester +from lbrynet.p2p.client.StandaloneBlobDownloader import StandaloneBlobDownloader +from lbrynet.p2p.client.ConnectionManager import ConnectionManager from lbrynet.extras.daemon.storage import SQLiteStorage from lbrynet.dht.peerfinder import DummyPeerFinder diff --git a/lbrynet/p2p/Strategy.py b/lbrynet/p2p/Strategy.py index d8eb62749..9a020de93 100644 --- a/lbrynet/p2p/Strategy.py +++ b/lbrynet/p2p/Strategy.py @@ -2,8 +2,8 @@ from zope.interface import implementer from decimal import Decimal from lbrynet import conf from lbrynet.interfaces import INegotiationStrategy -from lbrynet.core.Offer import Offer -from lbrynet.core.PriceModel import MeanAvailabilityWeightedPrice, ZeroPrice +from lbrynet.p2p.Offer import Offer +from lbrynet.p2p.PriceModel import MeanAvailabilityWeightedPrice, ZeroPrice def get_default_strategy(blob_tracker, **kwargs): diff --git a/lbrynet/p2p/StreamDescriptor.py b/lbrynet/p2p/StreamDescriptor.py index a72a39c31..9e8849dcb 100644 --- a/lbrynet/p2p/StreamDescriptor.py +++ b/lbrynet/p2p/StreamDescriptor.py @@ -5,10 +5,10 @@ import json import logging from twisted.internet import threads, defer -from lbrynet.core.cryptoutils import get_lbry_hash_obj -from lbrynet.core.client.StandaloneBlobDownloader import StandaloneBlobDownloader -from lbrynet.core.Error import UnknownStreamTypeError, InvalidStreamDescriptorError -from lbrynet.core.HTTPBlobDownloader import HTTPBlobDownloader +from lbrynet.p2p.cryptoutils import get_lbry_hash_obj +from lbrynet.p2p.client.StandaloneBlobDownloader import StandaloneBlobDownloader +from lbrynet.p2p.Error import UnknownStreamTypeError, InvalidStreamDescriptorError +from lbrynet.p2p.HTTPBlobDownloader import HTTPBlobDownloader log = logging.getLogger(__name__) diff --git a/lbrynet/p2p/client/BlobRequester.py b/lbrynet/p2p/client/BlobRequester.py index a18849367..d2506043a 100644 --- a/lbrynet/p2p/client/BlobRequester.py +++ b/lbrynet/p2p/client/BlobRequester.py @@ -6,11 +6,11 @@ from twisted.internet import defer from twisted.python.failure import Failure from twisted.internet.error import ConnectionAborted -from lbrynet.core.Error import ConnectionClosedBeforeResponseError -from lbrynet.core.Error import InvalidResponseError, RequestCanceledError, NoResponseError -from lbrynet.core.Error import PriceDisagreementError, DownloadCanceledError, InsufficientFundsError -from lbrynet.core.client.ClientRequest import ClientRequest, ClientBlobRequest -from lbrynet.core.Offer import Offer +from lbrynet.p2p.Error import ConnectionClosedBeforeResponseError +from lbrynet.p2p.Error import InvalidResponseError, RequestCanceledError, NoResponseError +from lbrynet.p2p.Error import PriceDisagreementError, DownloadCanceledError, InsufficientFundsError +from lbrynet.p2p.client.ClientRequest import ClientRequest, ClientBlobRequest +from lbrynet.p2p.Offer import Offer log = logging.getLogger(__name__) diff --git a/lbrynet/p2p/client/ClientProtocol.py b/lbrynet/p2p/client/ClientProtocol.py index dc47a881d..44f6074e4 100644 --- a/lbrynet/p2p/client/ClientProtocol.py +++ b/lbrynet/p2p/client/ClientProtocol.py @@ -6,10 +6,10 @@ from twisted.internet.protocol import Protocol, ClientFactory from twisted.protocols.policies import TimeoutMixin from twisted.python import failure from lbrynet import conf -from lbrynet.core import utils -from lbrynet.core.Error import ConnectionClosedBeforeResponseError, NoResponseError -from lbrynet.core.Error import DownloadCanceledError, MisbehavingPeerError -from lbrynet.core.Error import RequestCanceledError +from lbrynet.p2p import utils +from lbrynet.p2p.Error import ConnectionClosedBeforeResponseError, NoResponseError +from lbrynet.p2p.Error import DownloadCanceledError, MisbehavingPeerError +from lbrynet.p2p.Error import RequestCanceledError log = logging.getLogger(__name__) diff --git a/lbrynet/p2p/client/ConnectionManager.py b/lbrynet/p2p/client/ConnectionManager.py index f202922a5..3e72835e1 100644 --- a/lbrynet/p2p/client/ConnectionManager.py +++ b/lbrynet/p2p/client/ConnectionManager.py @@ -2,9 +2,9 @@ import random import logging from twisted.internet import defer, reactor from lbrynet import conf -from lbrynet.core.client.ClientProtocol import ClientProtocolFactory -from lbrynet.core.Error import InsufficientFundsError -from lbrynet.core import utils +from lbrynet.p2p.client.ClientProtocol import ClientProtocolFactory +from lbrynet.p2p.Error import InsufficientFundsError +from lbrynet.p2p import utils log = logging.getLogger(__name__) diff --git a/lbrynet/p2p/client/StandaloneBlobDownloader.py b/lbrynet/p2p/client/StandaloneBlobDownloader.py index a0b52ef48..08aa0b386 100644 --- a/lbrynet/p2p/client/StandaloneBlobDownloader.py +++ b/lbrynet/p2p/client/StandaloneBlobDownloader.py @@ -1,10 +1,10 @@ import logging -from lbrynet.core.BlobInfo import BlobInfo -from lbrynet.core.client.BlobRequester import BlobRequester -from lbrynet.core.client.ConnectionManager import ConnectionManager -from lbrynet.core.client.DownloadManager import DownloadManager -from lbrynet.core.Error import InvalidBlobHashError, DownloadSDTimeout -from lbrynet.core.utils import is_valid_blobhash, safe_start_looping_call, safe_stop_looping_call +from lbrynet.p2p.BlobInfo import BlobInfo +from lbrynet.p2p.client.BlobRequester import BlobRequester +from lbrynet.p2p.client.ConnectionManager import ConnectionManager +from lbrynet.p2p.client.DownloadManager import DownloadManager +from lbrynet.p2p.Error import InvalidBlobHashError, DownloadSDTimeout +from lbrynet.p2p.utils import is_valid_blobhash, safe_start_looping_call, safe_stop_looping_call from twisted.python.failure import Failure from twisted.internet import defer from twisted.internet.task import LoopingCall diff --git a/lbrynet/p2p/log_support.py b/lbrynet/p2p/log_support.py index c0c497a6f..1eabe7328 100644 --- a/lbrynet/p2p/log_support.py +++ b/lbrynet/p2p/log_support.py @@ -9,7 +9,7 @@ from twisted.internet import defer import twisted.python.log from lbrynet import __version__ as lbrynet_version, build_type, conf -from lbrynet.core import utils +from lbrynet.p2p import utils class HTTPSHandler(logging.Handler): diff --git a/lbrynet/p2p/server/BlobRequestHandler.py b/lbrynet/p2p/server/BlobRequestHandler.py index 405402c9a..128024400 100644 --- a/lbrynet/p2p/server/BlobRequestHandler.py +++ b/lbrynet/p2p/server/BlobRequestHandler.py @@ -5,7 +5,7 @@ from twisted.protocols.basic import FileSender from twisted.python.failure import Failure from lbrynet import analytics -from lbrynet.core.Offer import Offer +from lbrynet.p2p.Offer import Offer log = logging.getLogger(__name__) diff --git a/lbrynet/p2p/server/ServerProtocol.py b/lbrynet/p2p/server/ServerProtocol.py index c652c1db1..66c6b4b97 100644 --- a/lbrynet/p2p/server/ServerProtocol.py +++ b/lbrynet/p2p/server/ServerProtocol.py @@ -2,7 +2,7 @@ import logging from twisted.internet import error from twisted.internet.protocol import Protocol, ServerFactory from twisted.python import failure -from lbrynet.core.server.ServerRequestHandler import ServerRequestHandler +from lbrynet.p2p.server.ServerRequestHandler import ServerRequestHandler log = logging.getLogger(__name__) diff --git a/lbrynet/p2p/utils.py b/lbrynet/p2p/utils.py index 4e9f8e9ab..e7a459edf 100644 --- a/lbrynet/p2p/utils.py +++ b/lbrynet/p2p/utils.py @@ -12,7 +12,7 @@ import pkg_resources from twisted.python.failure import Failure from twisted.internet import defer from lbrynet.schema.claim import ClaimDict -from lbrynet.core.cryptoutils import get_lbry_hash_obj +from lbrynet.p2p.cryptoutils import get_lbry_hash_obj log = logging.getLogger(__name__) diff --git a/tests/functional/dht/test_store.py b/tests/functional/dht/test_store.py index e50e12fec..f3e81b332 100644 --- a/tests/functional/dht/test_store.py +++ b/tests/functional/dht/test_store.py @@ -3,7 +3,7 @@ from binascii import hexlify from twisted.internet import defer from lbrynet.dht import constants -from lbrynet.core.utils import generate_id +from lbrynet.p2p.utils import generate_id from .dht_test_environment import TestKademliaBase import logging diff --git a/tests/functional/test_misc.py b/tests/functional/test_misc.py index 71d360df5..d82abf17e 100644 --- a/tests/functional/test_misc.py +++ b/tests/functional/test_misc.py @@ -3,15 +3,15 @@ from hashlib import md5 from twisted.internet import defer, reactor from twisted.trial import unittest from lbrynet import conf -from lbrynet.core.server.BlobAvailabilityHandler import BlobAvailabilityHandlerFactory -from lbrynet.core.StreamDescriptor import StreamDescriptorIdentifier -from lbrynet.core.StreamDescriptor import download_sd_blob -from lbrynet.core.PaymentRateManager import OnlyFreePaymentsManager -from lbrynet.core.BlobManager import DiskBlobManager -from lbrynet.core.PeerManager import PeerManager -from lbrynet.core.RateLimiter import RateLimiter -from lbrynet.core.server.BlobRequestHandler import BlobRequestHandlerFactory -from lbrynet.core.server.ServerProtocol import ServerProtocolFactory +from lbrynet.p2p.server.BlobAvailabilityHandler import BlobAvailabilityHandlerFactory +from lbrynet.p2p.StreamDescriptor import StreamDescriptorIdentifier +from lbrynet.p2p.StreamDescriptor import download_sd_blob +from lbrynet.p2p.PaymentRateManager import OnlyFreePaymentsManager +from lbrynet.p2p.BlobManager import DiskBlobManager +from lbrynet.p2p.PeerManager import PeerManager +from lbrynet.p2p.RateLimiter import RateLimiter +from lbrynet.p2p.server.BlobRequestHandler import BlobRequestHandlerFactory +from lbrynet.p2p.server.ServerProtocol import ServerProtocolFactory from lbrynet.extras.daemon.storage import SQLiteStorage from lbrynet.file_manager.EncryptedFileCreator import create_lbry_file from lbrynet.file_manager.EncryptedFileManager import EncryptedFileManager diff --git a/tests/functional/test_reflector.py b/tests/functional/test_reflector.py index eb633b60f..e2cbd1021 100644 --- a/tests/functional/test_reflector.py +++ b/tests/functional/test_reflector.py @@ -3,15 +3,15 @@ from binascii import hexlify from twisted.internet import defer, error from twisted.trial import unittest -from lbrynet.core.StreamDescriptor import get_sd_info +from lbrynet.p2p.StreamDescriptor import get_sd_info from lbrynet.extras import reflector -from lbrynet.core import BlobManager, PeerManager -from lbrynet.core import StreamDescriptor +from lbrynet.p2p import BlobManager, PeerManager +from lbrynet.p2p import StreamDescriptor from lbrynet.file_manager import EncryptedFileCreator from lbrynet.file_manager.EncryptedFileManager import EncryptedFileManager -from lbrynet.core.RateLimiter import DummyRateLimiter +from lbrynet.p2p.RateLimiter import DummyRateLimiter from lbrynet.extras.daemon.storage import SQLiteStorage -from lbrynet.core.PaymentRateManager import OnlyFreePaymentsManager +from lbrynet.p2p.PaymentRateManager import OnlyFreePaymentsManager from tests import mocks from tests.util import mk_db_and_blob_dir, rm_db_and_blob_dir diff --git a/tests/functional/test_streamify.py b/tests/functional/test_streamify.py index f9cf9efc5..24dbd4bcb 100644 --- a/tests/functional/test_streamify.py +++ b/tests/functional/test_streamify.py @@ -4,13 +4,13 @@ import tempfile from hashlib import md5 from twisted.trial.unittest import TestCase from twisted.internet import defer, threads -from lbrynet.core.StreamDescriptor import StreamDescriptorIdentifier -from lbrynet.core.BlobManager import DiskBlobManager -from lbrynet.core.StreamDescriptor import get_sd_info -from lbrynet.core.PeerManager import PeerManager -from lbrynet.core.RateLimiter import DummyRateLimiter +from lbrynet.p2p.StreamDescriptor import StreamDescriptorIdentifier +from lbrynet.p2p.BlobManager import DiskBlobManager +from lbrynet.p2p.StreamDescriptor import get_sd_info +from lbrynet.p2p.PeerManager import PeerManager +from lbrynet.p2p.RateLimiter import DummyRateLimiter from lbrynet.extras.daemon.storage import SQLiteStorage -from lbrynet.core.PaymentRateManager import OnlyFreePaymentsManager +from lbrynet.p2p.PaymentRateManager import OnlyFreePaymentsManager from lbrynet.file_manager.EncryptedFileCreator import create_lbry_file from lbrynet.file_manager.EncryptedFileManager import EncryptedFileManager from tests import mocks diff --git a/tests/integration/wallet/test_commands.py b/tests/integration/wallet/test_commands.py index 32f1ce388..ae8bb800e 100644 --- a/tests/integration/wallet/test_commands.py +++ b/tests/integration/wallet/test_commands.py @@ -116,7 +116,7 @@ class CommandTestCase(IntegrationTestCase): async def setUp(self): await super().setUp() - logging.getLogger('lbrynet.core').setLevel(self.VERBOSITY) + logging.getLogger('lbrynet.p2p').setLevel(self.VERBOSITY) logging.getLogger('lbrynet.daemon').setLevel(self.VERBOSITY) lbry_conf.settings = None diff --git a/tests/mocks.py b/tests/mocks.py index 83de006c3..cd78440ce 100644 --- a/tests/mocks.py +++ b/tests/mocks.py @@ -8,9 +8,9 @@ from cryptography.hazmat.primitives import serialization from twisted.internet import defer from twisted.python.failure import Failure -from lbrynet.core.client.ClientRequest import ClientRequest -from lbrynet.core.Error import RequestCanceledError -from lbrynet.core import BlobAvailability +from lbrynet.p2p.client.ClientRequest import ClientRequest +from lbrynet.p2p.Error import RequestCanceledError +from lbrynet.p2p import BlobAvailability from lbrynet.file_manager.EncryptedFileManager import EncryptedFileManager from lbrynet.dht.node import Node as RealNode from lbrynet.extras.daemon import ExchangeRateManager as ERM diff --git a/tests/unit/core/client/test_ConnectionManager.py b/tests/unit/core/client/test_ConnectionManager.py index 31eaf2e04..24d2771fb 100644 --- a/tests/unit/core/client/test_ConnectionManager.py +++ b/tests/unit/core/client/test_ConnectionManager.py @@ -1,17 +1,17 @@ -from lbrynet.core.client.ClientRequest import ClientRequest -from lbrynet.core.server.ServerProtocol import ServerProtocol -from lbrynet.core.client.ClientProtocol import ClientProtocol -from lbrynet.core.RateLimiter import RateLimiter -from lbrynet.core.Peer import Peer -from lbrynet.core.PeerManager import PeerManager -from lbrynet.core.Error import NoResponseError +from lbrynet.p2p.client.ClientRequest import ClientRequest +from lbrynet.p2p.server.ServerProtocol import ServerProtocol +from lbrynet.p2p.client.ClientProtocol import ClientProtocol +from lbrynet.p2p.RateLimiter import RateLimiter +from lbrynet.p2p.Peer import Peer +from lbrynet.p2p.PeerManager import PeerManager +from lbrynet.p2p.Error import NoResponseError from twisted.trial.unittest import TestCase from twisted.internet import defer, reactor, task from twisted.internet.task import deferLater from twisted.internet.protocol import ServerFactory from lbrynet import conf -from lbrynet.core import utils +from lbrynet.p2p import utils PEER_PORT = 5551 LOCAL_HOST = '127.0.0.1' @@ -131,7 +131,7 @@ class TestIntegrationConnectionManager(TestCase): def _init_connection_manager(self, seek_head_blob_first=False): # this import is required here so utils.call_later is replaced by self.clock.callLater - from lbrynet.core.client.ConnectionManager import ConnectionManager + from lbrynet.p2p.client.ConnectionManager import ConnectionManager self.connection_manager = ConnectionManager(self.downloader, self.rate_limiter, [self.primary_request_creator], []) self.connection_manager.seek_head_blob_first = seek_head_blob_first diff --git a/tests/unit/core/server/test_BlobRequestHandler.py b/tests/unit/core/server/test_BlobRequestHandler.py index 203c32874..07fe9e1af 100644 --- a/tests/unit/core/server/test_BlobRequestHandler.py +++ b/tests/unit/core/server/test_BlobRequestHandler.py @@ -5,9 +5,9 @@ from twisted.internet import defer from twisted.test import proto_helpers from twisted.trial import unittest -from lbrynet.core import Peer -from lbrynet.core.server import BlobRequestHandler -from lbrynet.core.PaymentRateManager import NegotiatedPaymentRateManager, BasePaymentRateManager +from lbrynet.p2p import Peer +from lbrynet.p2p.server import BlobRequestHandler +from lbrynet.p2p.PaymentRateManager import NegotiatedPaymentRateManager, BasePaymentRateManager from tests.mocks import BlobAvailabilityTracker as DummyBlobAvailabilityTracker, mock_conf_settings diff --git a/tests/unit/core/test_BlobManager.py b/tests/unit/core/test_BlobManager.py index 37512a852..69b6a73d9 100644 --- a/tests/unit/core/test_BlobManager.py +++ b/tests/unit/core/test_BlobManager.py @@ -7,11 +7,11 @@ from twisted.trial import unittest from twisted.internet import defer from tests.util import random_lbry_hash -from lbrynet.core.BlobManager import DiskBlobManager +from lbrynet.p2p.BlobManager import DiskBlobManager from lbrynet.extras.daemon.storage import SQLiteStorage -from lbrynet.core.Peer import Peer +from lbrynet.p2p.Peer import Peer from lbrynet import conf -from lbrynet.core.cryptoutils import get_lbry_hash_obj +from lbrynet.p2p.cryptoutils import get_lbry_hash_obj class BlobManagerTest(unittest.TestCase): diff --git a/tests/unit/core/test_HTTPBlobDownloader.py b/tests/unit/core/test_HTTPBlobDownloader.py index 0db0f8753..40fb98452 100644 --- a/tests/unit/core/test_HTTPBlobDownloader.py +++ b/tests/unit/core/test_HTTPBlobDownloader.py @@ -4,7 +4,7 @@ from twisted.trial import unittest from twisted.internet import defer from lbrynet.blob import BlobFile -from lbrynet.core.HTTPBlobDownloader import HTTPBlobDownloader +from lbrynet.p2p.HTTPBlobDownloader import HTTPBlobDownloader from tests.util import mk_db_and_blob_dir, rm_db_and_blob_dir diff --git a/tests/unit/core/test_HashBlob.py b/tests/unit/core/test_HashBlob.py index 1ec7c88a4..5e7ab86ff 100644 --- a/tests/unit/core/test_HashBlob.py +++ b/tests/unit/core/test_HashBlob.py @@ -1,5 +1,5 @@ from lbrynet.blob import BlobFile -from lbrynet.core.Error import DownloadCanceledError, InvalidDataError +from lbrynet.p2p.Error import DownloadCanceledError, InvalidDataError from tests.util import mk_db_and_blob_dir, rm_db_and_blob_dir, random_lbry_hash from twisted.trial import unittest diff --git a/tests/unit/core/test_Strategy.py b/tests/unit/core/test_Strategy.py index a49d771e2..f7d2c0f9f 100644 --- a/tests/unit/core/test_Strategy.py +++ b/tests/unit/core/test_Strategy.py @@ -2,9 +2,9 @@ import itertools from twisted.trial import unittest import random import mock -from lbrynet.core.PaymentRateManager import NegotiatedPaymentRateManager, BasePaymentRateManager -from lbrynet.core.Strategy import BasicAvailabilityWeightedStrategy -from lbrynet.core.Offer import Offer +from lbrynet.p2p.PaymentRateManager import NegotiatedPaymentRateManager, BasePaymentRateManager +from lbrynet.p2p.Strategy import BasicAvailabilityWeightedStrategy +from lbrynet.p2p.Offer import Offer from tests.mocks\ import BlobAvailabilityTracker as DummyBlobAvailabilityTracker, mock_conf_settings diff --git a/tests/unit/core/test_Wallet.py b/tests/unit/core/test_Wallet.py index 8170c8ae9..3083be6f4 100644 --- a/tests/unit/core/test_Wallet.py +++ b/tests/unit/core/test_Wallet.py @@ -4,8 +4,8 @@ import tempfile from decimal import Decimal from twisted.trial import unittest from twisted.internet import defer -from lbrynet.core.Error import InsufficientFundsError -#from lbrynet.core.Wallet import LBRYumWallet, ReservedPoints +from lbrynet.p2p.Error import InsufficientFundsError +#from lbrynet.p2p.Wallet import LBRYumWallet, ReservedPoints #from lbryum.commands import Commands #from lbryum.simple_config import SimpleConfig from lbrynet.schema.claim import ClaimDict diff --git a/tests/unit/core/test_utils.py b/tests/unit/core/test_utils.py index 208b45ad3..c4f1289e2 100644 --- a/tests/unit/core/test_utils.py +++ b/tests/unit/core/test_utils.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from lbrynet.core import utils +from lbrynet.p2p import utils from twisted.trial import unittest diff --git a/tests/unit/dht/test_contact.py b/tests/unit/dht/test_contact.py index de219d05d..3543854d9 100644 --- a/tests/unit/dht/test_contact.py +++ b/tests/unit/dht/test_contact.py @@ -1,7 +1,7 @@ from binascii import hexlify from twisted.internet import task from twisted.trial import unittest -from lbrynet.core.utils import generate_id +from lbrynet.p2p.utils import generate_id from lbrynet.dht.contact import ContactManager from lbrynet.dht import constants diff --git a/tests/unit/dht/test_hash_announcer.py b/tests/unit/dht/test_hash_announcer.py index 3ca3c1889..c2fd3e9ed 100644 --- a/tests/unit/dht/test_hash_announcer.py +++ b/tests/unit/dht/test_hash_announcer.py @@ -1,7 +1,7 @@ from twisted.trial import unittest from twisted.internet import defer, task from lbrynet import conf -from lbrynet.core import utils +from lbrynet.p2p import utils from lbrynet.dht.hashannouncer import DHTHashAnnouncer from tests.util import random_lbry_hash from tests.mocks import mock_conf_settings diff --git a/tests/unit/dht/test_kbucket.py b/tests/unit/dht/test_kbucket.py index 67e30d4dc..b746afa7b 100644 --- a/tests/unit/dht/test_kbucket.py +++ b/tests/unit/dht/test_kbucket.py @@ -6,7 +6,7 @@ from twisted.trial import unittest import struct -from lbrynet.core.utils import generate_id +from lbrynet.p2p.utils import generate_id from lbrynet.dht import kbucket from lbrynet.dht.contact import ContactManager from lbrynet.dht import constants diff --git a/tests/unit/dht/test_node.py b/tests/unit/dht/test_node.py index 48bdb50a0..a82cdb803 100644 --- a/tests/unit/dht/test_node.py +++ b/tests/unit/dht/test_node.py @@ -5,7 +5,7 @@ from twisted.trial import unittest from twisted.internet import defer from lbrynet.dht.node import Node from lbrynet.dht import constants -from lbrynet.core.utils import generate_id +from lbrynet.p2p.utils import generate_id class NodeIDTest(unittest.TestCase): diff --git a/tests/unit/dht/test_routingtable.py b/tests/unit/dht/test_routingtable.py index 89dba21ac..37131b53f 100644 --- a/tests/unit/dht/test_routingtable.py +++ b/tests/unit/dht/test_routingtable.py @@ -6,7 +6,7 @@ from lbrynet.dht import constants from lbrynet.dht.routingtable import TreeRoutingTable from lbrynet.dht.contact import ContactManager from lbrynet.dht.distance import Distance -from lbrynet.core.utils import generate_id +from lbrynet.p2p.utils import generate_id class FakeRPCProtocol: diff --git a/tests/unit/lbryfilemanager/test_EncryptedFileCreator.py b/tests/unit/lbryfilemanager/test_EncryptedFileCreator.py index d38cf4871..3eed979c1 100644 --- a/tests/unit/lbryfilemanager/test_EncryptedFileCreator.py +++ b/tests/unit/lbryfilemanager/test_EncryptedFileCreator.py @@ -3,16 +3,16 @@ from twisted.trial import unittest from twisted.internet import defer from cryptography.hazmat.primitives.ciphers.algorithms import AES -from lbrynet.core.StreamDescriptor import get_sd_info, BlobStreamDescriptorReader -from lbrynet.core.StreamDescriptor import StreamDescriptorIdentifier -from lbrynet.core.BlobManager import DiskBlobManager -from lbrynet.core.PeerManager import PeerManager -from lbrynet.core.RateLimiter import DummyRateLimiter -from lbrynet.core.PaymentRateManager import OnlyFreePaymentsManager +from lbrynet.p2p.StreamDescriptor import get_sd_info, BlobStreamDescriptorReader +from lbrynet.p2p.StreamDescriptor import StreamDescriptorIdentifier +from lbrynet.p2p.BlobManager import DiskBlobManager +from lbrynet.p2p.PeerManager import PeerManager +from lbrynet.p2p.RateLimiter import DummyRateLimiter +from lbrynet.p2p.PaymentRateManager import OnlyFreePaymentsManager from lbrynet.extras.daemon.storage import SQLiteStorage from lbrynet.file_manager import EncryptedFileCreator from lbrynet.file_manager.EncryptedFileManager import EncryptedFileManager -from lbrynet.core.StreamDescriptor import JSONBytesEncoder +from lbrynet.p2p.StreamDescriptor import JSONBytesEncoder from tests import mocks from tests.util import mk_db_and_blob_dir, rm_db_and_blob_dir diff --git a/tests/unit/lbrynet_daemon/test_Daemon.py b/tests/unit/lbrynet_daemon/test_Daemon.py index fa822ca0e..5afc80ea4 100644 --- a/tests/unit/lbrynet_daemon/test_Daemon.py +++ b/tests/unit/lbrynet_daemon/test_Daemon.py @@ -22,7 +22,7 @@ from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDow from lbrynet.extras.wallet import LbryWalletManager from torba.client.wallet import Wallet -from lbrynet.core.PaymentRateManager import OnlyFreePaymentsManager +from lbrynet.p2p.PaymentRateManager import OnlyFreePaymentsManager from tests import util from tests.mocks import mock_conf_settings, FakeNetwork, FakeFileManager from tests.mocks import ExchangeRateManager as DummyExchangeRateManager diff --git a/tests/unit/lbrynet_daemon/test_Downloader.py b/tests/unit/lbrynet_daemon/test_Downloader.py index 2da3f88db..1833c9af5 100644 --- a/tests/unit/lbrynet_daemon/test_Downloader.py +++ b/tests/unit/lbrynet_daemon/test_Downloader.py @@ -4,11 +4,11 @@ from twisted.trial import unittest from twisted.internet import defer, task -from lbrynet.core import PaymentRateManager -from lbrynet.core.Error import DownloadDataTimeout, DownloadSDTimeout -from lbrynet.core.StreamDescriptor import StreamDescriptorIdentifier -from lbrynet.core.BlobManager import DiskBlobManager -from lbrynet.core.RateLimiter import DummyRateLimiter +from lbrynet.p2p import PaymentRateManager +from lbrynet.p2p.Error import DownloadDataTimeout, DownloadSDTimeout +from lbrynet.p2p.StreamDescriptor import StreamDescriptorIdentifier +from lbrynet.p2p.BlobManager import DiskBlobManager +from lbrynet.p2p.RateLimiter import DummyRateLimiter from lbrynet.extras.daemon import Downloader from lbrynet.extras.daemon import ExchangeRateManager from lbrynet.extras.daemon.storage import SQLiteStorage diff --git a/tests/unit/lbrynet_daemon/test_ExchangeRateManager.py b/tests/unit/lbrynet_daemon/test_ExchangeRateManager.py index 5f63a819b..b3f2f1b3e 100644 --- a/tests/unit/lbrynet_daemon/test_ExchangeRateManager.py +++ b/tests/unit/lbrynet_daemon/test_ExchangeRateManager.py @@ -1,6 +1,6 @@ from lbrynet.schema.fee import Fee from lbrynet.extras.daemon import ExchangeRateManager -from lbrynet.core.Error import InvalidExchangeRateResponse +from lbrynet.p2p.Error import InvalidExchangeRateResponse from twisted.trial import unittest from twisted.internet import defer from tests import util diff --git a/tests/unit/test_cli.py b/tests/unit/test_cli.py index 2105b4ec5..5df67db9e 100644 --- a/tests/unit/test_cli.py +++ b/tests/unit/test_cli.py @@ -3,7 +3,7 @@ from io import StringIO from twisted.trial import unittest from lbrynet.cli import normalize_value, main -from lbrynet.core.system_info import get_platform +from lbrynet.p2p.system_info import get_platform class CLITest(unittest.TestCase): diff --git a/tests/unit/test_conf.py b/tests/unit/test_conf.py index ec5162ecc..5ab939b6d 100644 --- a/tests/unit/test_conf.py +++ b/tests/unit/test_conf.py @@ -5,7 +5,7 @@ import tempfile from unittest import skipIf from twisted.trial import unittest from lbrynet import conf -from lbrynet.core.Error import InvalidCurrencyError +from lbrynet.p2p.Error import InvalidCurrencyError class SettingsTest(unittest.TestCase): diff --git a/tests/util.py b/tests/util.py index e661dd525..8b65b7033 100644 --- a/tests/util.py +++ b/tests/util.py @@ -32,11 +32,11 @@ def resetTime(test_case, timestamp=DEFAULT_TIMESTAMP): patcher.start().return_value = iso_time test_case.addCleanup(patcher.stop) - patcher = mock.patch('lbrynet.core.utils.now') + patcher = mock.patch('lbrynet.p2p.utils.now') patcher.start().return_value = timestamp test_case.addCleanup(patcher.stop) - patcher = mock.patch('lbrynet.core.utils.utcnow') + patcher = mock.patch('lbrynet.p2p.utils.utcnow') patcher.start().return_value = timestamp test_case.addCleanup(patcher.stop)