-
- def choose_next_page(self):
- 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)
+ 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 self.last_choice is not None and choice == self.last_choice:
+ return False
+ self.last_choice = choice
+ return True
+
+ def choose_next_page(self) -> Any:
+ if self.pages is None or self.count % 100 == 0:
+ logger.info('chooser: refreshing the candidate pages list.')