- self.filter_list = filter_list
- if filter_list is None:
- self.filter_list = []
- self.filter_list.append(self.dont_choose_page_twice_in_a_row_filter)
-
- def dont_choose_page_twice_in_a_row_filter(self, choice: str) -> bool:
- if choice == self.last_choice:
- return False
- self.last_choice = choice
- return True
-
- def choose_next_page(self) -> str:
- if self.pages == None or self.count % 100 == 0:
+ self.filter_list: List[Callable[[str], bool]] = []
+ if filter_list is not None:
+ self.filter_list.extend(filter_list)
+
+ @logging_utils.LoggingContext(logger, prefix="chooser:")
+ def choose_next_page(self) -> Any:
+ if self.pages is None or self.count % 100 == 0:
+ logger.info("refreshing the candidate pages list.")