From cf5596e001ca5f8d35039ff874d3801056763f92 Mon Sep 17 00:00:00 2001 From: drew2a Date: Thu, 6 Jan 2022 13:30:11 +0100 Subject: [PATCH] Lint&Flake --- .../tests/test_remote_search_by_tags.py | 4 ++-- .../restapi/remote_query_endpoint.py | 2 +- .../widgets/searchresultswidget.py | 24 ++++++++++--------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/tribler-core/tribler_core/components/metadata_store/remote_query_community/tests/test_remote_search_by_tags.py b/src/tribler-core/tribler_core/components/metadata_store/remote_query_community/tests/test_remote_search_by_tags.py index b574ce9a651..0a4fe470310 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/remote_query_community/tests/test_remote_search_by_tags.py +++ b/src/tribler-core/tribler_core/components/metadata_store/remote_query_community/tests/test_remote_search_by_tags.py @@ -39,12 +39,12 @@ async def tearDown(self): def create_node(self, *args, **kwargs): self.metadata_store = MetadataStore( - Path(self.temporary_directory()) / f"mds.db", + Path(self.temporary_directory()) / "mds.db", Path(self.temporary_directory()), default_eccrypto.generate_key("curve25519"), disable_sync=True, ) - self.tags_db = TagDatabase(str(Path(self.temporary_directory()) / f"tags.db")) + self.tags_db = TagDatabase(str(Path(self.temporary_directory()) / "tags.db")) kwargs['metadata_store'] = self.metadata_store kwargs['tags_db'] = self.tags_db diff --git a/src/tribler-core/tribler_core/components/metadata_store/restapi/remote_query_endpoint.py b/src/tribler-core/tribler_core/components/metadata_store/restapi/remote_query_endpoint.py index b6a98a601b3..56c3fac2e32 100644 --- a/src/tribler-core/tribler_core/components/metadata_store/restapi/remote_query_endpoint.py +++ b/src/tribler-core/tribler_core/components/metadata_store/restapi/remote_query_endpoint.py @@ -50,7 +50,7 @@ def sanitize_parameters(self, parameters): ) @querystring_schema(RemoteQueryParameters) async def create_remote_search_request(self, request): - self._logger.info(f'Create remote search request') + self._logger.info('Create remote search request') # Query remote results from the GigaChannel Community. # Results are returned over the Events endpoint. try: diff --git a/src/tribler-gui/tribler_gui/widgets/searchresultswidget.py b/src/tribler-gui/tribler_gui/widgets/searchresultswidget.py index 7129ce2b6f1..abc72d59865 100644 --- a/src/tribler-gui/tribler_gui/widgets/searchresultswidget.py +++ b/src/tribler-gui/tribler_gui/widgets/searchresultswidget.py @@ -6,7 +6,9 @@ from PyQt5 import uic from tribler_common.utilities import Query, to_fts_query + from tribler_core.components.metadata_store.db.serialization import CHANNEL_TORRENT, COLLECTION_NODE, REGULAR_TORRENT + from tribler_gui.sentry_mixin import AddBreadcrumbOnShowMixin from tribler_gui.tribler_request_manager import TriblerNetworkRequest from tribler_gui.utilities import connect, get_ui_file_path, tr @@ -23,11 +25,11 @@ def format_search_loading_label(search_request): } return ( - tr( - "Remote responses: %(num_complete_peers)i / %(total_peers)i" - "\nNew remote results received: %(num_remote_results)i" - ) - % data + tr( + "Remote responses: %(num_complete_peers)i / %(total_peers)i" + "\nNew remote results received: %(num_remote_results)i" + ) + % data ) @@ -99,9 +101,9 @@ def show_results(self, *_): def check_can_show(self, query): if ( - self.last_search_query == query - and self.last_search_time is not None - and time.time() - self.last_search_time < 1 + self.last_search_query == query + and self.last_search_time is not None + and time.time() - self.last_search_time < 1 ): self._logger.info("Same search query already sent within 500ms so dropping this one") return False @@ -136,9 +138,9 @@ def reset(self): def update_loading_page(self, remote_results): if ( - not self.search_request - or remote_results.get("uuid") != self.search_request.uuid - or self.currentWidget() == self.results_page + not self.search_request + or remote_results.get("uuid") != self.search_request.uuid + or self.currentWidget() == self.results_page ): return peer = remote_results["peer"]