migrate all projects to python 3.13 linting

This commit is contained in:
Jörg Thalheim
2025-07-04 17:18:13 +02:00
parent 0d1e1d9796
commit cb89457731
10 changed files with 13 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
import logging
from collections.abc import Callable
from typing import Any, Generic, TypeVar
from typing import Any, TypeVar
import gi
@@ -22,7 +22,7 @@ V = TypeVar(
# clan_vm_manager/components/gkvstore.py:21: error: Definition of "newv" in base class "Object" is incompatible with definition in base class "GInterface" [misc]
# clan_vm_manager/components/gkvstore.py:21: error: Definition of "install_properties" in base class "Object" is incompatible with definition in base class "GInterface" [misc]
# clan_vm_manager/components/gkvstore.py:21: error: Definition of "getv" in base class "Object" is incompatible with definition in base class "GInterface" [misc]
class GKVStore(GObject.GObject, Gio.ListModel, Generic[K, V]): # type: ignore[misc]
class GKVStore[K, V: GObject.Object](GObject.GObject, Gio.ListModel): # type: ignore[misc]
"""
A simple key-value store that implements the Gio.ListModel interface, with generic types for keys and values.
Only use self[key] and del self[key] for accessing the items for better performance.

View File

@@ -143,7 +143,7 @@ class VMObject(GObject.Object):
# We use a context manager to create the machine object
# and make sure it is destroyed when the context is exited
@contextmanager
def _create_machine(self) -> Generator[Machine, None, None]:
def _create_machine(self) -> Generator[Machine]:
uri = ClanURI.from_str(
url=str(self.data.flake.flake_url), machine_name=self.data.flake.flake_attr
)

View File

@@ -12,7 +12,7 @@ from gi.repository import Adw, Gio, GObject, Gtk
ListItem = TypeVar("ListItem", bound=GObject.Object)
def create_details_list(
def create_details_list[ListItem: GObject.Object](
model: Gio.ListStore, render_row: Callable[[Gtk.ListBox, ListItem], Gtk.Widget]
) -> Gtk.ListBox:
boxed_list = Gtk.ListBox()

View File

@@ -32,7 +32,7 @@ ListItem = TypeVar("ListItem", bound=GObject.Object)
CustomStore = TypeVar("CustomStore", bound=Gio.ListModel)
def create_boxed_list(
def create_boxed_list[CustomStore: Gio.ListModel, ListItem: GObject.Object](
model: CustomStore,
render_row: Callable[[Gtk.ListBox, ListItem], Gtk.Widget],
) -> Gtk.ListBox: