diff --git a/src/tribler-core/run_bandwidth_crawler.py b/src/tribler-core/run_bandwidth_crawler.py index 3a1a00b1dfc..fc871715de4 100644 --- a/src/tribler-core/run_bandwidth_crawler.py +++ b/src/tribler-core/run_bandwidth_crawler.py @@ -10,9 +10,9 @@ from tribler_common.simpledefs import STATEDIR_DB_DIR from tribler_core.config.tribler_config import TriblerConfig -from tribler_core.modules.bandwidth_accounting.database import BandwidthDatabase +from tribler_core.components.bandwidth_accounting.db.database import BandwidthDatabase from tribler_core.modules.bandwidth_accounting.launcher import BandwidthCommunityLauncher -from tribler_core.modules.bandwidth_accounting.settings import BandwidthAccountingSettings +from tribler_core.components.bandwidth_accounting.settings import BandwidthAccountingSettings from tribler_core.start_core import Session diff --git a/src/tribler-core/tribler_core/components/bandwidth_accounting/__init__.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/tribler-core/tribler_core/components/bandwidth_accounting.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/bandwidth_accounting_component.py similarity index 93% rename from src/tribler-core/tribler_core/components/bandwidth_accounting.py rename to src/tribler-core/tribler_core/components/bandwidth_accounting/bandwidth_accounting_component.py index 8faaa3b204f..cc04dca4b8d 100644 --- a/src/tribler-core/tribler_core/components/bandwidth_accounting.py +++ b/src/tribler-core/tribler_core/components/bandwidth_accounting/bandwidth_accounting_component.py @@ -6,11 +6,11 @@ from tribler_core.components.reporter import ReporterComponent from tribler_core.components.restapi import RESTComponent from tribler_core.components.upgrade import UpgradeComponent -from tribler_core.modules.bandwidth_accounting.community import ( +from tribler_core.components.bandwidth_accounting.community.community import ( BandwidthAccountingCommunity, BandwidthAccountingTestnetCommunity, ) -from tribler_core.modules.bandwidth_accounting.database import BandwidthDatabase +from tribler_core.components.bandwidth_accounting.db.database import BandwidthDatabase from tribler_core.restapi.rest_manager import RESTManager diff --git a/src/tribler-core/tribler_core/components/bandwidth_accounting/community/__init__.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/community/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/tribler-core/tribler_core/modules/bandwidth_accounting/cache.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/community/cache.py similarity index 92% rename from src/tribler-core/tribler_core/modules/bandwidth_accounting/cache.py rename to src/tribler-core/tribler_core/components/bandwidth_accounting/community/cache.py index 8689fdffd90..b28b06c1a83 100644 --- a/src/tribler-core/tribler_core/modules/bandwidth_accounting/cache.py +++ b/src/tribler-core/tribler_core/components/bandwidth_accounting/community/cache.py @@ -4,7 +4,7 @@ from ipv8.requestcache import RandomNumberCache -from tribler_core.modules.bandwidth_accounting.transaction import BandwidthTransactionData +from tribler_core.components.bandwidth_accounting.db.transaction import BandwidthTransactionData class BandwidthTransactionSignCache(RandomNumberCache): diff --git a/src/tribler-core/tribler_core/modules/bandwidth_accounting/community.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/community/community.py similarity index 95% rename from src/tribler-core/tribler_core/modules/bandwidth_accounting/community.py rename to src/tribler-core/tribler_core/components/bandwidth_accounting/community/community.py index 9b3e37ca5bc..937b3e5c1d7 100644 --- a/src/tribler-core/tribler_core/modules/bandwidth_accounting/community.py +++ b/src/tribler-core/tribler_core/components/bandwidth_accounting/community/community.py @@ -8,15 +8,13 @@ from ipv8.peer import Peer from ipv8.requestcache import RequestCache from ipv8.types import Address - -from tribler_core.modules.bandwidth_accounting import EMPTY_SIGNATURE -from tribler_core.modules.bandwidth_accounting.cache import BandwidthTransactionSignCache -from tribler_core.modules.bandwidth_accounting.database import BandwidthDatabase -from tribler_core.modules.bandwidth_accounting.payload import ( +from tribler_core.components.bandwidth_accounting.community.cache import BandwidthTransactionSignCache +from tribler_core.components.bandwidth_accounting.community.payload import ( BandwidthTransactionPayload, BandwidthTransactionQueryPayload, ) -from tribler_core.modules.bandwidth_accounting.transaction import BandwidthTransactionData +from tribler_core.components.bandwidth_accounting.db.database import BandwidthDatabase +from tribler_core.components.bandwidth_accounting.db.transaction import BandwidthTransactionData, EMPTY_SIGNATURE from tribler_core.modules.tribler_community import TriblerCommunity from tribler_core.utilities.unicode import hexlify diff --git a/src/tribler-core/tribler_core/modules/bandwidth_accounting/payload.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/community/payload.py similarity index 100% rename from src/tribler-core/tribler_core/modules/bandwidth_accounting/payload.py rename to src/tribler-core/tribler_core/components/bandwidth_accounting/community/payload.py diff --git a/src/tribler-core/tribler_core/components/bandwidth_accounting/db/__init__.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/db/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/tribler-core/tribler_core/modules/bandwidth_accounting/database.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/db/database.py similarity index 97% rename from src/tribler-core/tribler_core/modules/bandwidth_accounting/database.py rename to src/tribler-core/tribler_core/components/bandwidth_accounting/db/database.py index e1513d25367..08a28ffbe89 100644 --- a/src/tribler-core/tribler_core/modules/bandwidth_accounting/database.py +++ b/src/tribler-core/tribler_core/components/bandwidth_accounting/db/database.py @@ -3,8 +3,8 @@ from pony.orm import Database, count, db_session, select, sum -from tribler_core.modules.bandwidth_accounting import history, misc, transaction as db_transaction -from tribler_core.modules.bandwidth_accounting.transaction import BandwidthTransactionData +from tribler_core.components.bandwidth_accounting.db import history, misc, transaction as db_transaction +from tribler_core.components.bandwidth_accounting.db.transaction import BandwidthTransactionData from tribler_core.utilities.utilities import MEMORY_DB diff --git a/src/tribler-core/tribler_core/modules/bandwidth_accounting/history.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/db/history.py similarity index 100% rename from src/tribler-core/tribler_core/modules/bandwidth_accounting/history.py rename to src/tribler-core/tribler_core/components/bandwidth_accounting/db/history.py diff --git a/src/tribler-core/tribler_core/modules/bandwidth_accounting/misc.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/db/misc.py similarity index 100% rename from src/tribler-core/tribler_core/modules/bandwidth_accounting/misc.py rename to src/tribler-core/tribler_core/components/bandwidth_accounting/db/misc.py diff --git a/src/tribler-core/tribler_core/modules/bandwidth_accounting/transaction.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/db/transaction.py similarity index 97% rename from src/tribler-core/tribler_core/modules/bandwidth_accounting/transaction.py rename to src/tribler-core/tribler_core/components/bandwidth_accounting/db/transaction.py index 38ce1d4f12c..da4255165e7 100644 --- a/src/tribler-core/tribler_core/modules/bandwidth_accounting/transaction.py +++ b/src/tribler-core/tribler_core/components/bandwidth_accounting/db/transaction.py @@ -17,9 +17,9 @@ from pony.orm import PrimaryKey, Required, db_session -from tribler_core.modules.bandwidth_accounting import EMPTY_SIGNATURE -from tribler_core.modules.bandwidth_accounting.payload import BandwidthTransactionPayload +from tribler_core.components.bandwidth_accounting.community.payload import BandwidthTransactionPayload +EMPTY_SIGNATURE = b'0' * 64 @dataclass class BandwidthTransactionData: diff --git a/src/tribler-core/tribler_core/components/bandwidth_accounting/restapi/__init__.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/restapi/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/tribler-core/tribler_core/modules/bandwidth_accounting/bandwidth_endpoint.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/restapi/bandwidth_endpoint.py similarity index 100% rename from src/tribler-core/tribler_core/modules/bandwidth_accounting/bandwidth_endpoint.py rename to src/tribler-core/tribler_core/components/bandwidth_accounting/restapi/bandwidth_endpoint.py diff --git a/src/tribler-core/tribler_core/modules/bandwidth_accounting/settings.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/settings.py similarity index 100% rename from src/tribler-core/tribler_core/modules/bandwidth_accounting/settings.py rename to src/tribler-core/tribler_core/components/bandwidth_accounting/settings.py diff --git a/src/tribler-core/tribler_core/components/bandwidth_accounting/tests/__init__.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/tests/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/tribler-core/tribler_core/components/bandwidth_accounting/tests/test_bandwidth_accounting_component.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/tests/test_bandwidth_accounting_component.py new file mode 100644 index 00000000000..3265357b990 --- /dev/null +++ b/src/tribler-core/tribler_core/components/bandwidth_accounting/tests/test_bandwidth_accounting_component.py @@ -0,0 +1,26 @@ +from unittest.mock import patch + +from tribler_core.components.bandwidth_accounting.bandwidth_accounting_component import BandwidthAccountingComponent +from tribler_core.components.base import Session +from tribler_core.components.ipv8 import Ipv8Component +from tribler_core.components.masterkey import MasterKeyComponent +from tribler_core.components.restapi import RESTComponent +from tribler_core.restapi.rest_manager import RESTManager + + +# pylint: disable=protected-access + + +async def test_bandwidth_accounting_component(tribler_config): + components = [RESTComponent(), MasterKeyComponent(), Ipv8Component(), BandwidthAccountingComponent()] + session = Session(tribler_config, components) + with session: + comp = BandwidthAccountingComponent.instance() + with patch.object(RESTManager, 'get_endpoint'): + await session.start() + + assert comp.community + assert comp._rest_manager + assert comp._ipv8 + + await session.shutdown() diff --git a/src/tribler-core/tribler_core/modules/tests/bandwidth_accounting/test_bandwidth_endpoint.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/tests/test_bandwidth_endpoint.py similarity index 86% rename from src/tribler-core/tribler_core/modules/tests/bandwidth_accounting/test_bandwidth_endpoint.py rename to src/tribler-core/tribler_core/components/bandwidth_accounting/tests/test_bandwidth_endpoint.py index a5fb4d90550..106acb021e8 100644 --- a/src/tribler-core/tribler_core/modules/tests/bandwidth_accounting/test_bandwidth_endpoint.py +++ b/src/tribler-core/tribler_core/components/bandwidth_accounting/tests/test_bandwidth_endpoint.py @@ -2,12 +2,11 @@ import pytest -from tribler_core.modules.bandwidth_accounting import EMPTY_SIGNATURE -from tribler_core.modules.bandwidth_accounting.bandwidth_endpoint import BandwidthEndpoint -from tribler_core.modules.bandwidth_accounting.community import BandwidthAccountingCommunity -from tribler_core.modules.bandwidth_accounting.database import BandwidthDatabase -from tribler_core.modules.bandwidth_accounting.settings import BandwidthAccountingSettings -from tribler_core.modules.bandwidth_accounting.transaction import BandwidthTransactionData +from tribler_core.components.bandwidth_accounting.restapi.bandwidth_endpoint import BandwidthEndpoint +from tribler_core.components.bandwidth_accounting.community.community import BandwidthAccountingCommunity +from tribler_core.components.bandwidth_accounting.db.database import BandwidthDatabase +from tribler_core.components.bandwidth_accounting.settings import BandwidthAccountingSettings +from tribler_core.components.bandwidth_accounting.db.transaction import BandwidthTransactionData, EMPTY_SIGNATURE from tribler_core.restapi.base_api_test import do_request from tribler_core.utilities.unicode import hexlify diff --git a/src/tribler-core/tribler_core/modules/tests/bandwidth_accounting/test_community.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/tests/test_community.py similarity index 92% rename from src/tribler-core/tribler_core/modules/tests/bandwidth_accounting/test_community.py rename to src/tribler-core/tribler_core/components/bandwidth_accounting/tests/test_community.py index 04afcb73749..5267c889072 100644 --- a/src/tribler-core/tribler_core/modules/tests/bandwidth_accounting/test_community.py +++ b/src/tribler-core/tribler_core/components/bandwidth_accounting/tests/test_community.py @@ -3,12 +3,11 @@ from ipv8.test.base import TestBase from ipv8.test.mocking.ipv8 import MockIPv8 -from tribler_core.modules.bandwidth_accounting import EMPTY_SIGNATURE -from tribler_core.modules.bandwidth_accounting.cache import BandwidthTransactionSignCache -from tribler_core.modules.bandwidth_accounting.community import BandwidthAccountingCommunity -from tribler_core.modules.bandwidth_accounting.database import BandwidthDatabase -from tribler_core.modules.bandwidth_accounting.settings import BandwidthAccountingSettings -from tribler_core.modules.bandwidth_accounting.transaction import BandwidthTransactionData +from tribler_core.components.bandwidth_accounting.community.cache import BandwidthTransactionSignCache +from tribler_core.components.bandwidth_accounting.community.community import BandwidthAccountingCommunity +from tribler_core.components.bandwidth_accounting.db.database import BandwidthDatabase +from tribler_core.components.bandwidth_accounting.settings import BandwidthAccountingSettings +from tribler_core.components.bandwidth_accounting.db.transaction import BandwidthTransactionData, EMPTY_SIGNATURE from tribler_core.utilities.utilities import MEMORY_DB diff --git a/src/tribler-core/tribler_core/modules/tests/bandwidth_accounting/test_database.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/tests/test_database.py similarity index 96% rename from src/tribler-core/tribler_core/modules/tests/bandwidth_accounting/test_database.py rename to src/tribler-core/tribler_core/components/bandwidth_accounting/tests/test_database.py index 721cf56935e..73eb5c02dd4 100644 --- a/src/tribler-core/tribler_core/modules/tests/bandwidth_accounting/test_database.py +++ b/src/tribler-core/tribler_core/components/bandwidth_accounting/tests/test_database.py @@ -6,9 +6,8 @@ import pytest -from tribler_core.modules.bandwidth_accounting import EMPTY_SIGNATURE -from tribler_core.modules.bandwidth_accounting.database import BandwidthDatabase -from tribler_core.modules.bandwidth_accounting.transaction import BandwidthTransactionData +from tribler_core.components.bandwidth_accounting.db.database import BandwidthDatabase +from tribler_core.components.bandwidth_accounting.db.transaction import BandwidthTransactionData, EMPTY_SIGNATURE from tribler_core.utilities.utilities import MEMORY_DB diff --git a/src/tribler-core/tribler_core/modules/tests/bandwidth_accounting/test_transaction.py b/src/tribler-core/tribler_core/components/bandwidth_accounting/tests/test_transaction.py similarity index 88% rename from src/tribler-core/tribler_core/modules/tests/bandwidth_accounting/test_transaction.py rename to src/tribler-core/tribler_core/components/bandwidth_accounting/tests/test_transaction.py index 39f77065854..c9f0698bfda 100644 --- a/src/tribler-core/tribler_core/modules/tests/bandwidth_accounting/test_transaction.py +++ b/src/tribler-core/tribler_core/components/bandwidth_accounting/tests/test_transaction.py @@ -1,7 +1,6 @@ from ipv8.keyvault.crypto import default_eccrypto -from tribler_core.modules.bandwidth_accounting import EMPTY_SIGNATURE -from tribler_core.modules.bandwidth_accounting.transaction import BandwidthTransactionData +from tribler_core.components.bandwidth_accounting.db.transaction import BandwidthTransactionData, EMPTY_SIGNATURE def test_sign_transaction(): diff --git a/src/tribler-core/tribler_core/components/payout.py b/src/tribler-core/tribler_core/components/payout.py index 93cfc18155e..cf428900174 100644 --- a/src/tribler-core/tribler_core/components/payout.py +++ b/src/tribler-core/tribler_core/components/payout.py @@ -1,6 +1,6 @@ from tribler_common.simpledefs import NTFY +from tribler_core.components.bandwidth_accounting.bandwidth_accounting_component import BandwidthAccountingComponent from tribler_core.components.base import Component -from tribler_core.components.bandwidth_accounting import BandwidthAccountingComponent from tribler_core.components.ipv8 import Ipv8Component from tribler_core.components.reporter import ReporterComponent from tribler_core.modules.payout.payout_manager import PayoutManager diff --git a/src/tribler-core/tribler_core/components/tests/test_tribler_components.py b/src/tribler-core/tribler_core/components/tests/test_tribler_components.py index b22adb8d051..70952d503af 100644 --- a/src/tribler-core/tribler_core/components/tests/test_tribler_components.py +++ b/src/tribler-core/tribler_core/components/tests/test_tribler_components.py @@ -2,8 +2,8 @@ import pytest +from tribler_core.components.bandwidth_accounting.bandwidth_accounting_component import BandwidthAccountingComponent from tribler_core.components.base import Session, SessionError -from tribler_core.components.bandwidth_accounting import BandwidthAccountingComponent from tribler_core.components.gigachannel import GigaChannelComponent from tribler_core.components.gigachannel_manager import GigachannelManagerComponent from tribler_core.components.ipv8 import Ipv8Component @@ -62,19 +62,6 @@ async def test_masterkey_component(tribler_config): await session.shutdown() -async def test_bandwidth_accounting_component(tribler_config): - components = [RESTComponent(), MasterKeyComponent(), Ipv8Component(), BandwidthAccountingComponent()] - session = Session(tribler_config, components) - with session: - comp = BandwidthAccountingComponent.instance() - with patch.object(RESTManager, 'get_endpoint'): - await session.start() - - assert comp.community - assert comp._rest_manager - assert comp._ipv8 - - await session.shutdown() async def test_giga_channel_component(tribler_config): diff --git a/src/tribler-core/tribler_core/components/tunnels.py b/src/tribler-core/tribler_core/components/tunnels.py index e6a900f7cc8..7fa9f585bd2 100644 --- a/src/tribler-core/tribler_core/components/tunnels.py +++ b/src/tribler-core/tribler_core/components/tunnels.py @@ -2,8 +2,8 @@ from ipv8.messaging.anonymization.community import TunnelSettings from ipv8.peerdiscovery.discovery import RandomWalk from ipv8_service import IPv8 +from tribler_core.components.bandwidth_accounting.bandwidth_accounting_component import BandwidthAccountingComponent from tribler_core.components.base import Component -from tribler_core.components.bandwidth_accounting import BandwidthAccountingComponent from tribler_core.components.ipv8 import Ipv8Component from tribler_core.components.libtorrent import LibtorrentComponent from tribler_core.components.reporter import ReporterComponent diff --git a/src/tribler-core/tribler_core/config/tribler_config_sections.py b/src/tribler-core/tribler_core/config/tribler_config_sections.py index a52c096266e..2a533a3980d 100644 --- a/src/tribler-core/tribler_core/config/tribler_config_sections.py +++ b/src/tribler-core/tribler_core/config/tribler_config_sections.py @@ -1,6 +1,6 @@ from pydantic import BaseSettings, Extra -from tribler_core.modules.bandwidth_accounting.settings import BandwidthAccountingSettings +from tribler_core.components.bandwidth_accounting.settings import BandwidthAccountingSettings from tribler_core.modules.libtorrent.settings import DownloadDefaultsSettings, LibtorrentSettings from tribler_core.modules.metadata_store.settings import ChantSettings from tribler_core.modules.popularity.settings import PopularityCommunitySettings diff --git a/src/tribler-core/tribler_core/modules/bandwidth_accounting/__init__.py b/src/tribler-core/tribler_core/modules/bandwidth_accounting/__init__.py deleted file mode 100644 index 4c09ac1c1f5..00000000000 --- a/src/tribler-core/tribler_core/modules/bandwidth_accounting/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -""" -This module contains the code for our bandwidth accounting mechanism. -Also see https://github.com/Tribler/tribler/issues/5623 -""" -EMPTY_SIGNATURE = b'0' * 64 diff --git a/src/tribler-core/tribler_core/modules/tests/bandwidth_accounting/__init__.py b/src/tribler-core/tribler_core/modules/tests/bandwidth_accounting/__init__.py deleted file mode 100644 index bd9e6408687..00000000000 --- a/src/tribler-core/tribler_core/modules/tests/bandwidth_accounting/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -""" -This module contains tests for the bandwidth accounting mechanism. -""" diff --git a/src/tribler-core/tribler_core/modules/tunnel/community/community.py b/src/tribler-core/tribler_core/modules/tunnel/community/community.py index 10e99e6dd5d..8f26169dc65 100644 --- a/src/tribler-core/tribler_core/modules/tunnel/community/community.py +++ b/src/tribler-core/tribler_core/modules/tunnel/community/community.py @@ -34,7 +34,7 @@ from tribler_common.simpledefs import DLSTATUS_DOWNLOADING, DLSTATUS_METADATA, DLSTATUS_SEEDING, DLSTATUS_STOPPED, NTFY -from tribler_core.modules.bandwidth_accounting.transaction import BandwidthTransactionData +from tribler_core.components.bandwidth_accounting.db.transaction import BandwidthTransactionData from tribler_core.modules.tunnel.community.caches import BalanceRequestCache, HTTPRequestCache from tribler_core.modules.tunnel.community.discovery import GoldenRatioStrategy from tribler_core.modules.tunnel.community.dispatcher import TunnelDispatcher diff --git a/src/tribler-core/tribler_core/modules/tunnel/tests/test_triblertunnel_community.py b/src/tribler-core/tribler_core/modules/tunnel/tests/test_triblertunnel_community.py index 983e619a144..e352cb8fddf 100644 --- a/src/tribler-core/tribler_core/modules/tunnel/tests/test_triblertunnel_community.py +++ b/src/tribler-core/tribler_core/modules/tunnel/tests/test_triblertunnel_community.py @@ -21,9 +21,9 @@ from tribler_common.network_utils import NetworkUtils -from tribler_core.modules.bandwidth_accounting.community import BandwidthAccountingCommunity -from tribler_core.modules.bandwidth_accounting.database import BandwidthDatabase -from tribler_core.modules.bandwidth_accounting.settings import BandwidthAccountingSettings +from tribler_core.components.bandwidth_accounting.community.community import BandwidthAccountingCommunity +from tribler_core.components.bandwidth_accounting.db.database import BandwidthDatabase +from tribler_core.components.bandwidth_accounting.settings import BandwidthAccountingSettings from tribler_core.modules.tunnel.community.community import PEER_FLAG_EXIT_HTTP, TriblerTunnelCommunity from tribler_core.modules.tunnel.community.payload import BandwidthTransactionPayload from tribler_core.modules.tunnel.community.settings import TunnelCommunitySettings diff --git a/src/tribler-core/tribler_core/restapi/root_endpoint.py b/src/tribler-core/tribler_core/restapi/root_endpoint.py index a8a9cf2af8c..f3d80e10d97 100644 --- a/src/tribler-core/tribler_core/restapi/root_endpoint.py +++ b/src/tribler-core/tribler_core/restapi/root_endpoint.py @@ -1,7 +1,7 @@ from ipv8.REST.root_endpoint import RootEndpoint as IPV8RootEndpoint from tribler_core.config.tribler_config import TriblerConfig -from tribler_core.modules.bandwidth_accounting.bandwidth_endpoint import BandwidthEndpoint +from tribler_core.components.bandwidth_accounting.restapi.bandwidth_endpoint import BandwidthEndpoint from tribler_core.modules.libtorrent.restapi.create_torrent_endpoint import CreateTorrentEndpoint from tribler_core.modules.libtorrent.restapi.downloads_endpoint import DownloadsEndpoint from tribler_core.modules.libtorrent.restapi.libtorrent_endpoint import LibTorrentEndpoint diff --git a/src/tribler-core/tribler_core/restapi/tests/test_statistics_endpoint.py b/src/tribler-core/tribler_core/restapi/tests/test_statistics_endpoint.py index f562e45c509..cfe0c018b67 100644 --- a/src/tribler-core/tribler_core/restapi/tests/test_statistics_endpoint.py +++ b/src/tribler-core/tribler_core/restapi/tests/test_statistics_endpoint.py @@ -6,8 +6,8 @@ import pytest -from tribler_core.modules.bandwidth_accounting.community import BandwidthAccountingCommunity -from tribler_core.modules.bandwidth_accounting.settings import BandwidthAccountingSettings +from tribler_core.components.bandwidth_accounting.community.community import BandwidthAccountingCommunity +from tribler_core.components.bandwidth_accounting.settings import BandwidthAccountingSettings from tribler_core.restapi.base_api_test import do_request from tribler_core.restapi.rest_manager import error_middleware from tribler_core.restapi.statistics_endpoint import StatisticsEndpoint diff --git a/src/tribler-core/tribler_core/restapi/tests/test_trustview_endpoint.py b/src/tribler-core/tribler_core/restapi/tests/test_trustview_endpoint.py index b8f7e45f10d..e1d07d5d0b5 100644 --- a/src/tribler-core/tribler_core/restapi/tests/test_trustview_endpoint.py +++ b/src/tribler-core/tribler_core/restapi/tests/test_trustview_endpoint.py @@ -9,9 +9,8 @@ import pytest from tribler_core.exceptions import TrustGraphException -from tribler_core.modules.bandwidth_accounting import EMPTY_SIGNATURE -from tribler_core.modules.bandwidth_accounting.database import BandwidthDatabase -from tribler_core.modules.bandwidth_accounting.transaction import BandwidthTransactionData +from tribler_core.components.bandwidth_accounting.db.database import BandwidthDatabase +from tribler_core.components.bandwidth_accounting.db.transaction import BandwidthTransactionData, EMPTY_SIGNATURE from tribler_core.modules.trust_calculation.trust_graph import TrustGraph from tribler_core.restapi.base_api_test import do_request from tribler_core.restapi.rest_manager import error_middleware diff --git a/src/tribler-core/tribler_core/start_core.py b/src/tribler-core/tribler_core/start_core.py index 8a599f0111c..57afaaddaba 100644 --- a/src/tribler-core/tribler_core/start_core.py +++ b/src/tribler-core/tribler_core/start_core.py @@ -13,7 +13,7 @@ import tribler_core from tribler_core.check_os import check_and_enable_code_tracing, set_process_priority -from tribler_core.components.bandwidth_accounting import BandwidthAccountingComponent +from tribler_core.components.bandwidth_accounting.bandwidth_accounting_component import BandwidthAccountingComponent from tribler_core.components.base import Component, Session from tribler_core.components.gigachannel import GigaChannelComponent from tribler_core.components.gigachannel_manager import GigachannelManagerComponent diff --git a/src/tribler-core/tribler_core/upgrade/tests/test_upgrader.py b/src/tribler-core/tribler_core/upgrade/tests/test_upgrader.py index a436e981a05..1d4e5292b61 100644 --- a/src/tribler-core/tribler_core/upgrade/tests/test_upgrader.py +++ b/src/tribler-core/tribler_core/upgrade/tests/test_upgrader.py @@ -11,7 +11,7 @@ from tribler_common.simpledefs import NTFY import tribler_core.utilities.permid as permid_module -from tribler_core.modules.bandwidth_accounting.database import BandwidthDatabase +from tribler_core.components.bandwidth_accounting.db.database import BandwidthDatabase from tribler_core.modules.metadata_store.orm_bindings.channel_metadata import CHANNEL_DIR_NAME_LENGTH from tribler_core.modules.metadata_store.store import CURRENT_DB_VERSION, MetadataStore from tribler_core.notifier import Notifier diff --git a/src/tribler-core/tribler_core/upgrade/upgrade.py b/src/tribler-core/tribler_core/upgrade/upgrade.py index fce55efad77..eec02a7cbe2 100644 --- a/src/tribler-core/tribler_core/upgrade/upgrade.py +++ b/src/tribler-core/tribler_core/upgrade/upgrade.py @@ -7,7 +7,7 @@ from tribler_common.simpledefs import NTFY, STATEDIR_DB_DIR, STATEDIR_CHANNELS_DIR -from tribler_core.modules.bandwidth_accounting.database import BandwidthDatabase +from tribler_core.components.bandwidth_accounting.db.database import BandwidthDatabase from tribler_core.modules.category_filter.l2_filter import is_forbidden from tribler_core.modules.metadata_store.orm_bindings.channel_metadata import CHANNEL_DIR_NAME_LENGTH from tribler_core.modules.metadata_store.serialization import CHANNEL_TORRENT