diff --git a/calibre-plugin/action.py b/calibre-plugin/action.py index c4adf7f..d6f1941 100644 --- a/calibre-plugin/action.py +++ b/calibre-plugin/action.py @@ -265,7 +265,7 @@ def __get_loans_thread(self): thread.worker = worker thread.started.connect(worker.run) - def loaded(value): + def loaded(value: Dict): self.model.refresh_loans(value) self.refresh_btn.setEnabled(True) self.status_bar.clearMessage() @@ -275,7 +275,7 @@ def loaded(value): return thread - def set_hide_books_already_in_library(self, checked): + def set_hide_books_already_in_library(self, checked: bool): PREFS[PreferenceKeys.HIDE_BOOKS_ALREADY_IN_LIB] = checked self.model.set_filter_hide_books_already_in_library(checked) self.loans_view.sortByColumn(-1, Qt.AscendingOrder) @@ -291,7 +291,7 @@ def download_selected_loans(self): self, _("Download"), _("Please select at least 1 loan."), show=True ) - def download_loan(self, loan): + def download_loan(self, loan: Dict): format_id = LibbyClient.get_loan_format( loan, prefer_open_format=PREFS[PreferenceKeys.PREFER_OPEN_FORMATS] ) diff --git a/calibre-plugin/ebook_download.py b/calibre-plugin/ebook_download.py index 151514a..b0025fa 100644 --- a/calibre-plugin/ebook_download.py +++ b/calibre-plugin/ebook_download.py @@ -65,7 +65,7 @@ def _custom_download( log=None, abort=None, notifications=None, - ): + ) -> str: temp_path = os.path.join(PersistentTemporaryDirectory(), filename) notifications.put((0.5, "Downloading")) res_content = libby_client.fulfill_loan_file( diff --git a/calibre-plugin/magazine_download.py b/calibre-plugin/magazine_download.py index 59c5c9e..555c598 100644 --- a/calibre-plugin/magazine_download.py +++ b/calibre-plugin/magazine_download.py @@ -391,7 +391,7 @@ def _custom_download( log=None, abort=None, notifications=None, - ): + ) -> str: logger = log download_progress_fraction = 0.97 meta_progress_fraction = 1.0 - download_progress_fraction diff --git a/calibre-plugin/model.py b/calibre-plugin/model.py index 86480ff..2077fe0 100644 --- a/calibre-plugin/model.py +++ b/calibre-plugin/model.py @@ -1,4 +1,4 @@ -from typing import Dict +from typing import Dict, Optional from calibre.ebooks.metadata.book.base import Metadata @@ -46,7 +46,7 @@ def __init__(self, parent, synced_state=None, db=None): ] self.refresh_loans(synced_state) - def refresh_loans(self, synced_state=None): + def refresh_loans(self, synced_state: Optional[Dict] = None): if not synced_state: synced_state = {} self._cards = synced_state.get("cards", []) diff --git a/calibre-plugin/worker.py b/calibre-plugin/worker.py index 80941d1..1295f71 100644 --- a/calibre-plugin/worker.py +++ b/calibre-plugin/worker.py @@ -15,7 +15,7 @@ def __int__(self): super().__init__() def run(self): - libby_token = PREFS[PreferenceKeys.LIBBY_TOKEN] + libby_token: str = PREFS[PreferenceKeys.LIBBY_TOKEN] if not libby_token: self.finished.emit([])