MCPcopy
hub / github.com/PDFMathTranslate/PDFMathTranslate / worker

Method worker

pdf2zh/converter.py:347–358  ·  view source on GitHub ↗
(s: str)

Source from the content-addressed store, hash-verified

345
346 @retry(wait=wait_fixed(1))
347 def worker(s: str): # 多线程翻译
348 if not s.strip() or re.match(r"^\{v\d+\}$", s): # 空白和公式不翻译
349 return s
350 try:
351 new = self.translator.translate(s)
352 return new
353 except BaseException as e:
354 if log.isEnabledFor(logging.DEBUG):
355 log.exception(e)
356 else:
357 log.exception(e, exc_info=False)
358 raise e
359 with concurrent.futures.ThreadPoolExecutor(
360 max_workers=self.thread
361 ) as executor:

Callers

nothing calls this directly

Calls 1

translateMethod · 0.45

Tested by

no test coverage detected