diff --git a/book_maker/loader/helper.py b/book_maker/loader/helper.py index b628f4f8..ba5485e9 100644 --- a/book_maker/loader/helper.py +++ b/book_maker/loader/helper.py @@ -1,7 +1,7 @@ import re -from copy import copy import backoff import logging +from copy import copy logging.basicConfig(level=logging.WARNING) logger = logging.getLogger(__name__) @@ -37,9 +37,10 @@ def insert_trans(self, p, text, translation_style="", single_translate=False): Exception, on_backoff=lambda details: logger.warning(f"retry backoff: {details}"), on_giveup=lambda details: logger.warning(f"retry abort: {details}"), + jitter=None, ) - def translate_with_backoff(self, **kwargs): - return self.translate_model.translate(**kwargs) + def translate_with_backoff(self, text, context_flag=False): + return self.translate_model.translate(text, context_flag) def deal_new(self, p, wait_p_list, single_translate=False): self.deal_old(wait_p_list, single_translate, self.context_flag)