fix: lint

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
This commit is contained in:
yihong0618 2024-01-27 22:28:38 +08:00
parent cb3779f279
commit bd46bc0c6c
3 changed files with 22 additions and 17 deletions

View File

@ -465,29 +465,33 @@ class EPUBBookLoader(BaseBookLoader):
all_items = list(self.origin_book.get_items()) all_items = list(self.origin_book.get_items())
trans_taglist = self.translate_tags.split(",") trans_taglist = self.translate_tags.split(",")
all_p_length = sum( all_p_length = sum(
0 (
if ( 0
(i.get_type() != ITEM_DOCUMENT) if (
or (i.file_name in self.exclude_filelist.split(",")) (i.get_type() != ITEM_DOCUMENT)
or ( or (i.file_name in self.exclude_filelist.split(","))
self.only_filelist or (
and i.file_name not in self.only_filelist.split(",") self.only_filelist
and i.file_name not in self.only_filelist.split(",")
)
) )
else len(bs(i.content, "html.parser").findAll(trans_taglist))
) )
else len(bs(i.content, "html.parser").findAll(trans_taglist))
for i in all_items for i in all_items
) )
all_p_length += self.allow_navigable_strings * sum( all_p_length += self.allow_navigable_strings * sum(
0 (
if ( 0
(i.get_type() != ITEM_DOCUMENT) if (
or (i.file_name in self.exclude_filelist.split(",")) (i.get_type() != ITEM_DOCUMENT)
or ( or (i.file_name in self.exclude_filelist.split(","))
self.only_filelist or (
and i.file_name not in self.only_filelist.split(",") self.only_filelist
and i.file_name not in self.only_filelist.split(",")
)
) )
else len(bs(i.content, "html.parser").findAll(text=True))
) )
else len(bs(i.content, "html.parser").findAll(text=True))
for i in all_items for i in all_items
) )
pbar = tqdm(total=self.test_num) if self.is_test else tqdm(total=all_p_length) pbar = tqdm(total=self.test_num) if self.is_test else tqdm(total=all_p_length)

View File

@ -1,6 +1,7 @@
""" """
inspired by: https://github.com/jesselau76/srt-gpt-translator, MIT License inspired by: https://github.com/jesselau76/srt-gpt-translator, MIT License
""" """
import re import re
import sys import sys
from pathlib import Path from pathlib import Path

View File

@ -18,7 +18,7 @@ packages = [
setup( setup(
name="bbook_maker", name="bbook_maker",
description="The bilingual_book_maker is an AI translation tool that uses ChatGPT to assist users in creating multi-language versions of epub/txt files and books.", description="The bilingual_book_maker is an AI translation tool that uses ChatGPT to assist users in creating multi-language versions of epub/txt files and books.",
version="0.7.1", version="0.7.2",
license="MIT", license="MIT",
author="yihong0618", author="yihong0618",
author_email="zouzou0208@gmail.com", author_email="zouzou0208@gmail.com",