From 0b3b4e1b63b096d06c96e3cdeb7bedebe93cf3ce Mon Sep 17 00:00:00 2001 From: drew2a Date: Mon, 31 Jan 2022 09:37:38 +0700 Subject: [PATCH] Flake&Lint --- .../components/tag/db/tests/test_tag_db.py | 11 ++++------- .../components/tag/rules/tag_rules_processor.py | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/tribler-core/tribler_core/components/tag/db/tests/test_tag_db.py b/src/tribler-core/tribler_core/components/tag/db/tests/test_tag_db.py index 05f14a0d7bb..dba25aba105 100644 --- a/src/tribler-core/tribler_core/components/tag/db/tests/test_tag_db.py +++ b/src/tribler-core/tribler_core/components/tag/db/tests/test_tag_db.py @@ -4,17 +4,14 @@ from types import SimpleNamespace from unittest.mock import Mock, patch +from ipv8.test.base import TestBase + from pony import orm from pony.orm import commit, db_session -from ipv8.test.base import TestBase # pylint: disable=protected-access from tribler_core.components.tag.community.tag_payload import TagOperation, TagOperationEnum -from tribler_core.components.tag.db.tag_db import ( - PUBLIC_KEY_FOR_AUTO_GENERATED_TAGS, - SHOW_THRESHOLD, - TagDatabase, -) +from tribler_core.components.tag.db.tag_db import PUBLIC_KEY_FOR_AUTO_GENERATED_TAGS, SHOW_THRESHOLD, TagDatabase from tribler_core.utilities.pony_utils import get_or_create @@ -89,7 +86,7 @@ def test_constructor_create_tables_true(self, mocked_generate_mapping: Mock): mocked_generate_mapping.assert_called_with(create_tables=True) @patch.object(orm.Database, 'generate_mapping') - def test_constructor_create_tables_true(self, mocked_generate_mapping: Mock): + def test_constructor_create_tables_false(self, mocked_generate_mapping: Mock): TagDatabase(':memory:', create_tables=False) mocked_generate_mapping.assert_called_with(create_tables=False) diff --git a/src/tribler-core/tribler_core/components/tag/rules/tag_rules_processor.py b/src/tribler-core/tribler_core/components/tag/rules/tag_rules_processor.py index c4c68e3e954..79e5c62f0ae 100644 --- a/src/tribler-core/tribler_core/components/tag/rules/tag_rules_processor.py +++ b/src/tribler-core/tribler_core/components/tag/rules/tag_rules_processor.py @@ -40,7 +40,7 @@ def __init__(self, notifier: Notifier, db: TagDatabase, mds: MDS.MetadataStore, callback=self.process_torrent_title) @db_session def start(self): - self.logger.info(f'Start') + self.logger.info('Start') max_row_id = self.mds.get_max_rowid() is_finished = self.get_last_processed_torrent_id() >= max_row_id @@ -76,7 +76,7 @@ def query(_start, _end): is_finished = end >= max_row_id if is_finished: - self.logger.info(f'Finish batch processing, cancel process_batch task') + self.logger.info('Finish batch processing, cancel process_batch task') self.cancel_pending_task(name=self.process_batch.__name__) return processed