From 2ae42bd56a5c50ebbc30a0aa63f64fe5a707da0d Mon Sep 17 00:00:00 2001 From: xxyzz Date: Wed, 31 Jan 2024 22:50:35 +0800 Subject: [PATCH] Fix download file from MTP device error Should pass `gui.device_manager` to `download_file_from_mtp()`. --- custom_lemmas.py | 2 +- data/deps.json | 2 +- docs/conf.py | 3 ++- send_file.py | 8 ++++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/custom_lemmas.py b/custom_lemmas.py index 2741db1..d04a3dd 100644 --- a/custom_lemmas.py +++ b/custom_lemmas.py @@ -237,7 +237,7 @@ def check_empty_kindle_gloss(self) -> None: if isinstance(package_name, str): copy_klld_from_android(package_name, custom_folder) else: - copy_klld_from_kindle(gui.device_manager.device, custom_folder) + copy_klld_from_kindle(gui.device_manager, custom_folder) klld_path = get_kindle_klld_path(plugin_path) if klld_path is None: diff --git a/data/deps.json b/data/deps.json index 6fdd41b..70739f5 100644 --- a/data/deps.json +++ b/data/deps.json @@ -5,6 +5,6 @@ "spacy_cpu_model": "3.7.0", "spacy_trf_model": "3.7.2", "thinc-apple-ops": "0.1.4", - "torch": "2.1.2", + "torch": "2.2.0", "typing-extensions": "4.9.0" } diff --git a/docs/conf.py b/docs/conf.py index f2fff44..82b752d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -5,9 +5,10 @@ # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information +from datetime import datetime, timezone project = "WordDumb" -copyright = "2024, xxyzz" +copyright = f"{datetime.now(timezone.utc).year}, xxyzz" author = "xxyzz" # -- General configuration --------------------------------------------------- diff --git a/send_file.py b/send_file.py index 2d028d0..33d085d 100644 --- a/send_file.py +++ b/send_file.py @@ -239,13 +239,13 @@ def copy_klld_from_android(package_name: str, dest_path: Path) -> None: dest_path.joinpath("wordwise").rmdir() -def copy_klld_from_kindle(device_driver: Any, dest_path: Path) -> None: - if is_mtp_device(device_driver): +def copy_klld_from_kindle(device_manager: Any, dest_path: Path) -> None: + if is_mtp_device(device_manager.device): download_file_from_mtp( - device_driver, Path("system/kll/kll.en.en.klld"), dest_path + device_manager, Path("system/kll/kll.en.en.klld"), dest_path ) else: - for klld_path in Path(f"{device_driver._main_prefix}/system/kll").glob( + for klld_path in Path(f"{device_manager.device._main_prefix}/system/kll").glob( "*.en.klld" ): shutil.copy(klld_path, dest_path)