From 0d3e880950f7fc52df53dd2b6c2b316aa463af21 Mon Sep 17 00:00:00 2001 From: Andrei Andreev Date: Wed, 5 Jun 2024 17:09:05 +0200 Subject: [PATCH] Remove TODO FIXME and XXX comments --- .../core/components/database/category_filter/family_filter.py | 2 +- src/tribler/core/components/database/database_component.py | 4 +--- .../components/database/db/orm_bindings/torrent_metadata.py | 1 - src/tribler/core/components/database/db/serialization.py | 4 +--- .../core/components/database/restapi/database_endpoint.py | 1 - .../libtorrent/download_manager/download_manager.py | 2 -- src/tribler/gui/utilities.py | 2 -- src/tribler/gui/widgets/settingspage.py | 4 ---- src/tribler/gui/widgets/tablecontentdelegate.py | 2 -- 9 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/tribler/core/components/database/category_filter/family_filter.py b/src/tribler/core/components/database/category_filter/family_filter.py index 7b7594e350f..5422e95423a 100644 --- a/src/tribler/core/components/database/category_filter/family_filter.py +++ b/src/tribler/core/components/database/category_filter/family_filter.py @@ -110,5 +110,5 @@ def isAudio(self, s): return s[s.rfind('.') + 1:] in self.audio_extensions -# XXX filter should be stateless +# filter should be stateless default_xxx_filter = XXXFilter() diff --git a/src/tribler/core/components/database/database_component.py b/src/tribler/core/components/database/database_component.py index 953b4211572..1f3b9393127 100644 --- a/src/tribler/core/components/database/database_component.py +++ b/src/tribler/core/components/database/database_component.py @@ -10,7 +10,7 @@ class DatabaseComponent(Component): tribler_should_stop_on_component_error = True db: TriblerDatabase = None - mds: MetadataStore = None # TODO: legacy, should be merged into ``db`` + mds: MetadataStore = None async def run(self): await super().run() @@ -22,8 +22,6 @@ async def run(self): self.db = TriblerDatabase(str(db_path)) - # TODO: merge the code below into the TriblerDatabase - channels_dir = config.chant.get_path_as_absolute('channels_dir', config.state_dir) chant_testnet = config.general.testnet or config.chant.testnet diff --git a/src/tribler/core/components/database/db/orm_bindings/torrent_metadata.py b/src/tribler/core/components/database/db/orm_bindings/torrent_metadata.py index a36ee02214e..84468adba37 100644 --- a/src/tribler/core/components/database/db/orm_bindings/torrent_metadata.py +++ b/src/tribler/core/components/database/db/orm_bindings/torrent_metadata.py @@ -46,7 +46,6 @@ def tdef_to_metadata_dict(tdef, category_filter: Category = None) -> Dict: """ Helper function to create a TorrentMetadata-compatible dict from TorrentDef """ - # We only want to determine the type of the data. XXX filtering is done by the receiving side category_filter = category_filter or default_category_filter try: tags = category_filter.calculateCategory(tdef.metainfo, tdef.get_name_as_unicode()) diff --git a/src/tribler/core/components/database/db/serialization.py b/src/tribler/core/components/database/db/serialization.py index 733a218bd29..fd5f3fcd44a 100644 --- a/src/tribler/core/components/database/db/serialization.py +++ b/src/tribler/core/components/database/db/serialization.py @@ -6,12 +6,10 @@ from ipv8.keyvault.crypto import default_eccrypto from ipv8.messaging.lazy_payload import VariablePayload, vp_compile -from ipv8.messaging.serialization import VarLenUtf8, default_serializer +from ipv8.messaging.serialization import default_serializer from tribler.core.utilities.unicode import hexlify -default_serializer.add_packer('varlenIutf8', VarLenUtf8('>I')) # TODO: move to IPv8 - EPOCH = datetime(1970, 1, 1) SIGNATURE_SIZE = 64 diff --git a/src/tribler/core/components/database/restapi/database_endpoint.py b/src/tribler/core/components/database/restapi/database_endpoint.py index 7a15c5b530b..d273da5940a 100644 --- a/src/tribler/core/components/database/restapi/database_endpoint.py +++ b/src/tribler/core/components/database/restapi/database_endpoint.py @@ -322,6 +322,5 @@ async def completions(self, request): return RESTResponse({"error": "query parameter missing"}, status=HTTP_BAD_REQUEST) keywords = args['q'].strip().lower() - # TODO: add XXX filtering for completion terms results = self.mds.get_auto_complete_terms(keywords, max_terms=5) return RESTResponse({"completions": results}) diff --git a/src/tribler/core/components/libtorrent/download_manager/download_manager.py b/src/tribler/core/components/libtorrent/download_manager/download_manager.py index eb975589e8d..2d7c04e8cb3 100644 --- a/src/tribler/core/components/libtorrent/download_manager/download_manager.py +++ b/src/tribler/core/components/libtorrent/download_manager/download_manager.py @@ -92,7 +92,6 @@ def __init__(self, self.socks_listen_ports = socks_listen_ports - # TODO: Remove the dependency on notifier and refactor it to instead use callbacks injection self.notifier = notifier self.peer_mid = peer_mid self.config = config or LibtorrentSettings() @@ -864,7 +863,6 @@ async def sesscb_states_callback(self, states_list): """ This method is periodically (every second) called with a list of the download states of the active downloads. """ - # TODO: refactor this method. It is too long and tightly coupled with higher-level modules. self.state_cb_count += 1 for ds in states_list: diff --git a/src/tribler/gui/utilities.py b/src/tribler/gui/utilities.py index 7f5c1f3193d..afb55dac574 100644 --- a/src/tribler/gui/utilities.py +++ b/src/tribler/gui/utilities.py @@ -401,8 +401,6 @@ def html_label(text, background="#e4e4e4", color="#222222", bold=True): def votes_count(votes=0.0): votes = float(votes) - # FIXME: this is a temp fix to cap the normalized value to 1. - # The votes should already be normalized before formatting it. votes = max(0.0, min(votes, 1.0)) # We add sqrt to flatten the votes curve a bit votes = math.sqrt(votes) diff --git a/src/tribler/gui/widgets/settingspage.py b/src/tribler/gui/widgets/settingspage.py index 8b67c1b9b65..4bba018af31 100644 --- a/src/tribler/gui/widgets/settingspage.py +++ b/src/tribler/gui/widgets/settingspage.py @@ -482,10 +482,6 @@ def save_settings(self, checked): # network statistics settings_data['ipv8']['statistics'] = self.window().checkbox_enable_network_statistics.isChecked() - # TODO: do it in RESTful style, on the REST return JSON instead - # In case the default save dir has changed, add it to the top of the list of last download locations. - # Otherwise, the user could absentmindedly click through the download dialog and start downloading into - # the last used download dir, and not into the newly designated default download dir. if self.settings['download_defaults']['saveas'] != settings_data['download_defaults']['saveas']: self.window().update_recent_download_locations(settings_data['download_defaults']['saveas']) self.settings = settings_data diff --git a/src/tribler/gui/widgets/tablecontentdelegate.py b/src/tribler/gui/widgets/tablecontentdelegate.py index 34fe55fd273..8d19b2cca63 100644 --- a/src/tribler/gui/widgets/tablecontentdelegate.py +++ b/src/tribler/gui/widgets/tablecontentdelegate.py @@ -140,7 +140,6 @@ def __init__(self, parent=None): self.hovering_over_tag_edit_button: bool = False self.hovering_over_download_popular_torrent_button: int = -1 - # TODO: restore this behavior, so there is really some tolerance zone! # We have to control if mouse is in the buttons box to add some tolerance for vertical mouse # misplacement around the buttons. The button box effectively overlaps upper and lower rows. # row 0 @@ -566,7 +565,6 @@ class TriblerContentDelegate( SnippetCreatedColumnMixin, ): def __init__(self, table_view, parent=None): - # TODO: refactor this not to rely on inheritance order, but instead use interface method pattern TriblerButtonsDelegate.__init__(self, parent) self.download_button = DownloadIconButton()