mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-10-06 09:14:39 +01:00
[FIX] Refactor code to fix typing (#23)
This also fixes some bug with the CF bypasser and the file checker
This commit is contained in:
@@ -27,7 +27,7 @@ class BookInfo:
|
||||
format: Optional[str] = None
|
||||
size: Optional[str] = None
|
||||
info: Optional[Dict[str, List[str]]] = None
|
||||
download_urls: Optional[List[str]] = field(default_factory=list)
|
||||
download_urls: List[str] = field(default_factory=list)
|
||||
|
||||
class BookQueue:
|
||||
"""Thread-safe book queue manager."""
|
||||
@@ -62,11 +62,11 @@ class BookQueue:
|
||||
with self._lock:
|
||||
self._update_status(book_id, status)
|
||||
|
||||
def get_status(self) -> Dict[str, Dict[str, BookInfo]]:
|
||||
def get_status(self) -> Dict[QueueStatus, Dict[str, BookInfo]]:
|
||||
"""Get current queue status."""
|
||||
self.refresh()
|
||||
with self._lock:
|
||||
result = {status: {} for status in QueueStatus}
|
||||
result: Dict[QueueStatus, Dict[str, BookInfo]] = {status: {} for status in QueueStatus}
|
||||
for book_id, status in self._status.items():
|
||||
if book_id in self._book_data:
|
||||
result[status][book_id] = self._book_data[book_id]
|
||||
|
||||
Reference in New Issue
Block a user