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 3f1fdc0aae
commit d5aa917ee7
10 changed files with 13 additions and 13 deletions

View File

@@ -15,7 +15,7 @@ find = {}
[tool.setuptools.package-data] [tool.setuptools.package-data]
test_driver = ["py.typed"] test_driver = ["py.typed"]
[tool.mypy] [tool.mypy]
python_version = "3.12" python_version = "3.13"
warn_redundant_casts = true warn_redundant_casts = true
disallow_untyped_calls = true disallow_untyped_calls = true
disallow_untyped_defs = true disallow_untyped_defs = true

View File

@@ -30,7 +30,7 @@ norecursedirs = "tests/helpers"
markers = ["impure"] markers = ["impure"]
[tool.mypy] [tool.mypy]
python_version = "3.12" python_version = "3.13"
warn_redundant_casts = true warn_redundant_casts = true
disallow_untyped_calls = true disallow_untyped_calls = true
disallow_untyped_defs = true disallow_untyped_defs = true

View File

@@ -7,7 +7,7 @@ import pytest
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def wayland_compositor() -> Generator[Popen, None, None]: def wayland_compositor() -> Generator[Popen]:
# Start the Wayland compositor (e.g., Weston) # Start the Wayland compositor (e.g., Weston)
# compositor = Popen(["weston", "--backend=headless-backend.so"]) # compositor = Popen(["weston", "--backend=headless-backend.so"])
compositor = Popen(["weston"]) compositor = Popen(["weston"])
@@ -20,7 +20,7 @@ GtkProc = NewType("GtkProc", Popen)
@pytest.fixture @pytest.fixture
def app() -> Generator[GtkProc, None, None]: def app() -> Generator[GtkProc]:
cmd = [sys.executable, "-m", "clan_app"] cmd = [sys.executable, "-m", "clan_app"]
print(f"Running: {cmd}") print(f"Running: {cmd}")
rapp = Popen( rapp = Popen(

View File

@@ -1,6 +1,6 @@
import logging import logging
from collections.abc import Callable from collections.abc import Callable
from typing import Any, Generic, TypeVar from typing import Any, TypeVar
import gi 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 "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 "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] # 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. 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. 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 # We use a context manager to create the machine object
# and make sure it is destroyed when the context is exited # and make sure it is destroyed when the context is exited
@contextmanager @contextmanager
def _create_machine(self) -> Generator[Machine, None, None]: def _create_machine(self) -> Generator[Machine]:
uri = ClanURI.from_str( uri = ClanURI.from_str(
url=str(self.data.flake.flake_url), machine_name=self.data.flake.flake_attr 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) 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] model: Gio.ListStore, render_row: Callable[[Gtk.ListBox, ListItem], Gtk.Widget]
) -> Gtk.ListBox: ) -> Gtk.ListBox:
boxed_list = Gtk.ListBox() boxed_list = Gtk.ListBox()

View File

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

View File

@@ -30,7 +30,7 @@ norecursedirs = "tests/helpers"
markers = ["impure"] markers = ["impure"]
[tool.mypy] [tool.mypy]
python_version = "3.12" python_version = "3.13"
warn_redundant_casts = true warn_redundant_casts = true
disallow_untyped_calls = true disallow_untyped_calls = true
disallow_untyped_defs = true disallow_untyped_defs = true

View File

@@ -7,7 +7,7 @@ import pytest
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def wayland_compositor() -> Generator[Popen, None, None]: def wayland_compositor() -> Generator[Popen]:
# Start the Wayland compositor (e.g., Weston) # Start the Wayland compositor (e.g., Weston)
# compositor = Popen(["weston", "--backend=headless-backend.so"]) # compositor = Popen(["weston", "--backend=headless-backend.so"])
compositor = Popen(["weston"]) compositor = Popen(["weston"])
@@ -20,7 +20,7 @@ GtkProc = NewType("GtkProc", Popen)
@pytest.fixture @pytest.fixture
def app() -> Generator[GtkProc, None, None]: def app() -> Generator[GtkProc]:
rapp = Popen([sys.executable, "-m", "clan_vm_manager"], text=True) rapp = Popen([sys.executable, "-m", "clan_vm_manager"], text=True)
yield GtkProc(rapp) yield GtkProc(rapp)
# Cleanup: Terminate your application # Cleanup: Terminate your application

View File

@@ -26,7 +26,7 @@ addopts = "--durations 5 --color=yes --new-first" # Add --pdb for debugging
norecursedirs = "tests/helpers" norecursedirs = "tests/helpers"
[tool.mypy] [tool.mypy]
python_version = "3.12" python_version = "3.13"
warn_redundant_casts = true warn_redundant_casts = true
disallow_untyped_calls = true disallow_untyped_calls = true
disallow_untyped_defs = true disallow_untyped_defs = true