Skip to content

Commit

Permalink
use sets, not tuples, of users in ScrapePremiumUsersExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusShepherd committed Sep 14, 2023
1 parent 7bd19ef commit 9e4770a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions board_game_scraper/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,15 @@ def from_crawler(cls, crawler):
if not crawler.settings.getbool("SCRAPE_PREMIUM_USERS_ENABLED"):
raise NotConfigured

premium_users_list = tuple(
premium_users_list = frozenset(
arg_to_iter(crawler.settings.getlist("SCRAPE_PREMIUM_USERS_LIST"))
)
premium_users_from_dir = tuple(
premium_users_from_dir = frozenset(
load_premium_users(
dirs=crawler.settings.get("SCRAPE_PREMIUM_USERS_CONFIG_DIR"),
)
)
premium_users = premium_users_list + premium_users_from_dir
premium_users = premium_users_list | premium_users_from_dir

if not premium_users:
raise NotConfigured
Expand All @@ -197,7 +197,8 @@ def __init__(
interval: float,
prevent_rescrape_for: Union[float, timedelta, None] = None,
):
self.premium_users = tuple(user.lower() for user in premium_users)
self.premium_users = frozenset(user.lower() for user in premium_users)
LOGGER.info("Scraping %d premium users", len(self.premium_users))

prevent_rescrape_for = (
prevent_rescrape_for
Expand Down

0 comments on commit 9e4770a

Please sign in to comment.