Skip to content

Commit

Permalink
Add more typing hints
Browse files Browse the repository at this point in the history
  • Loading branch information
ping committed Jul 5, 2023
1 parent 44a4058 commit cbe70a8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions calibre-plugin/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand All @@ -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]
)
Expand Down
2 changes: 1 addition & 1 deletion calibre-plugin/ebook_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion calibre-plugin/magazine_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions calibre-plugin/model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict
from typing import Dict, Optional

from calibre.ebooks.metadata.book.base import Metadata

Expand Down Expand Up @@ -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", [])
Expand Down
2 changes: 1 addition & 1 deletion calibre-plugin/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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([])

Expand Down

0 comments on commit cbe70a8

Please sign in to comment.