PGH003: fix

This commit is contained in:
Jörg Thalheim
2025-08-20 21:14:33 +02:00
parent cbf9678534
commit 8f8426de52
29 changed files with 212 additions and 102 deletions

View File

@@ -818,7 +818,7 @@ class Win32Implementation(BaseImplementation):
]
def __init__(self, application: Gtk.Application) -> None:
from ctypes import windll # type: ignore
from ctypes import windll # type: ignore[attr-defined]
super().__init__(application)
@@ -834,11 +834,11 @@ class Win32Implementation(BaseImplementation):
self.update_icon()
def _register_class(self) -> None:
from ctypes import byref, windll # type: ignore
from ctypes import byref, windll # type: ignore[attr-defined]
self._window_class = self.WNDCLASSW( # type: ignore
self._window_class = self.WNDCLASSW( # type: ignore[attr-defined]
style=(self.CS_VREDRAW | self.CS_HREDRAW),
lpfn_wnd_proc=self.WNDCLASSW.LPFN_WND_PROC(self.on_process_window_message), # type: ignore
lpfn_wnd_proc=self.WNDCLASSW.LPFN_WND_PROC(self.on_process_window_message), # type: ignore[attr-defined]
h_cursor=windll.user32.LoadCursorW(0, self.IDC_ARROW),
hbr_background=self.COLOR_WINDOW,
lpsz_class_name=self.WINDOW_CLASS_NAME,
@@ -859,7 +859,7 @@ class Win32Implementation(BaseImplementation):
self._window_class = None
def _create_window(self) -> None:
from ctypes import windll # type: ignore
from ctypes import windll # type: ignore[attr-defined]
style = self.WS_OVERLAPPED | self.WS_SYSMENU
self._h_wnd = windll.user32.CreateWindowExW(
@@ -1180,7 +1180,7 @@ class TrayIcon:
self.implementation = Win32Implementation(self.application)
else:
try:
self.implementation = StatusNotifierImplementation(self.application) # type: ignore
self.implementation = StatusNotifierImplementation(self.application) # type: ignore[misc]
except ImplUnavailableError:
self.available = False

View File

@@ -74,7 +74,7 @@ class ErrorToast:
views = ViewStack.use().view
# we cannot check this type, python is not smart enough
logs_view: Logs = views.get_child_by_name("logs") # type: ignore
logs_view: Logs = views.get_child_by_name("logs") # type: ignore[assignment]
logs_view.set_message(details)
self.toast.connect(

View File

@@ -125,7 +125,7 @@ class ClanStore:
def log_details(self, vm: VMObject, gfile: Gio.File) -> None:
views = ViewStack.use().view
logs_view: Logs = views.get_child_by_name("logs") # type: ignore
logs_view: Logs = views.get_child_by_name("logs") # type: ignore[assignment]
def file_read_callback(
source_object: Gio.File,

View File

@@ -283,7 +283,7 @@ class ClanList(Gtk.Box):
views = ViewStack.use().view
# Reset the logs view
logs: Logs = views.get_child_by_name("logs") # type: ignore
logs: Logs = views.get_child_by_name("logs") # type: ignore[assignment]
if logs is None:
msg = "Logs view not found"

View File

@@ -50,14 +50,14 @@ class Logs(Gtk.Box):
buffer = self.text_view.get_buffer()
buffer.set_text(message)
mark = buffer.create_mark(None, buffer.get_end_iter(), False) # type: ignore
mark = buffer.create_mark(None, buffer.get_end_iter(), False) # type: ignore[misc]
self.text_view.scroll_to_mark(mark, 0.05, True, 0.0, 1.0)
def append_message(self, message: str) -> None:
"""Append to the end of a potentially existent log message"""
buffer = self.text_view.get_buffer()
end_iter = buffer.get_end_iter()
buffer.insert(end_iter, message) # type: ignore
buffer.insert(end_iter, message) # type: ignore[misc]
mark = buffer.create_mark(None, buffer.get_end_iter(), False) # type: ignore
mark = buffer.create_mark(None, buffer.get_end_iter(), False) # type: ignore[misc]
self.text_view.scroll_to_mark(mark, 0.05, True, 0.0, 1.0)