fix a bunch of lsp errors

This commit is contained in:
2026-02-28 03:31:06 +01:00
parent 60019e0d2e
commit 664e660198
3 changed files with 16 additions and 17 deletions
+11 -12
View File
@@ -1,5 +1,5 @@
from PySide6 import QtWidgets, QtCore, QtGui
from PySide6.QtCore import Qt, QTimer, QModelIndex, QAbstractTableModel, Signal, QEvent, QSize
from PySide6 import QtWidgets
from PySide6.QtCore import QPersistentModelIndex, Qt, QTimer, QModelIndex, QAbstractTableModel, Signal, QEvent, QSize
from PySide6.QtWidgets import (
QLineEdit,
QTableView,
@@ -41,7 +41,6 @@ from core.interface.dialogs.settings import settings_dialog
from core.interface.assets.base64_icons import settings_black_base64
from core.interface.assets.base64_icons import settings_white_base64
from core.interface.assets.base64_icons import logo_base64
from core.network.libtorrent_misc import cleanup_session
from core.utils.general.shutdown import closehelper
@@ -183,19 +182,19 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
super().__init__()
self.headers = ["Action", "Name", "Status", "Progress", "Speed", "Size", "Total Size"]
def rowCount(self, parent=QModelIndex()):
def rowCount(self, parent: QModelIndex | QPersistentModelIndex = QModelIndex()) -> int:
return len(state.active_downloads)
def columnCount(self, parent=QModelIndex()):
def columnCount(self, parent: QModelIndex | QPersistentModelIndex = QModelIndex()):
return len(self.headers)
def headerData(self, section, orientation, role=Qt.DisplayRole):
if role == Qt.DisplayRole and orientation == Qt.Horizontal:
def headerData(self, section, orientation, role: int = Qt.ItemDataRole.DisplayRole):
if role == Qt.ItemDataRole.DisplayRole and orientation == Qt.Orientation.Horizontal:
return self.headers[section]
return None
def data(self, index, role=Qt.DisplayRole):
if role == Qt.DisplayRole:
def data(self, index: QModelIndex | QPersistentModelIndex, role: int = Qt.ItemDataRole.DisplayRole):
if role == Qt.ItemDataRole.DisplayRole:
col = index.column()
if index.row() >= len(state.active_downloads) or index.row() < 0:
@@ -211,9 +210,9 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
elif col == 1:
return status.name if status.has_metadata else "Fetching metadata..."
elif col == 2:
if status.state == lt.torrent_status.downloading:
if status.state == lt.torrent_status.downloading:
return "Downloading"
elif status.state == lt.torrent_status.seeding:
elif status.state == lt.torrent_status.seeding:
return "Seeding"
elif status.paused:
return "Paused"
@@ -257,7 +256,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
else:
return "" if status.paused else "Stalled"
if role == Qt.UserRole and index.column() == 0:
if role == Qt.ItemDataRole.UserRole and index.column() == 0:
magnet_link = list(state.active_downloads.keys())[index.row()]
magnetdl = state.active_downloads[magnet_link]
return magnetdl.status().paused
+1 -1
View File
@@ -57,4 +57,4 @@ def update_log(shutdown_event):
updated.add(magnet_uri)
except Exception:
pass
time.sleep(5)
time.sleep(5)
+4 -4
View File
@@ -9,8 +9,8 @@ class AppState(QObject):
def __init__(self):
super().__init__()
self.posts: List[Dict[str, Any]] = []
self.post_titles: List[str] = []
self.post_urls: List[str] = []
self.post_titles: Optional[List] = None
self.post_urls: Optional[List] = None
self.post_author: List[str] = []
self.post_seeders: List[str] = []
self.post_leechers: List[str] = []
@@ -29,11 +29,11 @@ class AppState(QObject):
self.max_downloads: int = 10
self.settings_path: str = ""
self.dl_session: Any = None
self.active_downloads: List[str] = {}
self.active_downloads: Dict = {}
self.window_transparency: bool = False
self.interfaces: List = []
self.active_interfaces: List = []
self.bound_interface: str = None
self.bound_interface: Any = None
@property
def image_path(self) -> str: