From bd46bc0c6cddfd2ca4393520ec456b5d8a30c806 Mon Sep 17 00:00:00 2001 From: yihong0618 Date: Sat, 27 Jan 2024 22:28:38 +0800 Subject: [PATCH] fix: lint Signed-off-by: yihong0618 --- book_maker/loader/epub_loader.py | 36 ++++++++++++++++++-------------- book_maker/loader/srt_loader.py | 1 + setup.py | 2 +- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/book_maker/loader/epub_loader.py b/book_maker/loader/epub_loader.py index 1aaeaf7..b7f0750 100644 --- a/book_maker/loader/epub_loader.py +++ b/book_maker/loader/epub_loader.py @@ -465,29 +465,33 @@ class EPUBBookLoader(BaseBookLoader): all_items = list(self.origin_book.get_items()) trans_taglist = self.translate_tags.split(",") all_p_length = sum( - 0 - if ( - (i.get_type() != ITEM_DOCUMENT) - or (i.file_name in self.exclude_filelist.split(",")) - or ( - self.only_filelist - and i.file_name not in self.only_filelist.split(",") + ( + 0 + if ( + (i.get_type() != ITEM_DOCUMENT) + or (i.file_name in self.exclude_filelist.split(",")) + or ( + 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 ) all_p_length += self.allow_navigable_strings * sum( - 0 - if ( - (i.get_type() != ITEM_DOCUMENT) - or (i.file_name in self.exclude_filelist.split(",")) - or ( - self.only_filelist - and i.file_name not in self.only_filelist.split(",") + ( + 0 + if ( + (i.get_type() != ITEM_DOCUMENT) + or (i.file_name in self.exclude_filelist.split(",")) + or ( + 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 ) pbar = tqdm(total=self.test_num) if self.is_test else tqdm(total=all_p_length) diff --git a/book_maker/loader/srt_loader.py b/book_maker/loader/srt_loader.py index 29f9c92..4328d98 100644 --- a/book_maker/loader/srt_loader.py +++ b/book_maker/loader/srt_loader.py @@ -1,6 +1,7 @@ """ inspired by: https://github.com/jesselau76/srt-gpt-translator, MIT License """ + import re import sys from pathlib import Path diff --git a/setup.py b/setup.py index 96ed5d5..114235b 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ packages = [ setup( 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.", - version="0.7.1", + version="0.7.2", license="MIT", author="yihong0618", author_email="zouzou0208@gmail.com",