From fd000f593411cabd41c8188d475486af83eff4dd Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Tue, 28 Jan 2020 22:52:21 +0100 Subject: [PATCH] slight improv in ImageCrawler deduplication checks --- nichtparasoup/core/__init__.py | 2 +- nichtparasoup/testing/config.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nichtparasoup/core/__init__.py b/nichtparasoup/core/__init__.py index 23911fb4..a25674b1 100644 --- a/nichtparasoup/core/__init__.py +++ b/nichtparasoup/core/__init__.py @@ -142,7 +142,7 @@ def _add_image_to_blacklist(self, image: Image) -> None: self.blacklist.add(image.uri) def has_imagecrawler(self, imagecrawler: BaseImageCrawler) -> bool: - return imagecrawler in [crawler.imagecrawler for crawler in self.crawlers] + return imagecrawler in (crawler.imagecrawler for crawler in self.crawlers) def add_imagecrawler(self, imagecrawler: BaseImageCrawler, weight: _CrawlerWeight) -> None: self.crawlers.append(Crawler( diff --git a/nichtparasoup/testing/config.py b/nichtparasoup/testing/config.py index 6681ea9e..65d04012 100644 --- a/nichtparasoup/testing/config.py +++ b/nichtparasoup/testing/config.py @@ -13,7 +13,7 @@ class ConfigFileTest(TestCase): def validate(self, file: str) -> None: config = parse_yaml_file(file) self.assertIsInstance(config, dict) - imagecrawlers = [] # type: List[BaseImageCrawler] + imagecrawlers = list() # type: List[BaseImageCrawler] for crawler_config in config['crawlers']: imagecrawler = get_imagecrawler(crawler_config) self.assertNotIn(imagecrawler, imagecrawlers, msg='Duplicate ImageCrawler')