From e0c44660e82dc56cb8b66d9b3ca29a9cdd00da8a Mon Sep 17 00:00:00 2001 From: Mick Vleeshouwer Date: Sun, 19 Apr 2026 18:01:32 +0000 Subject: [PATCH 1/2] Enable ruff PYI rule and fix type annotation violations - Use Self return type for __aenter__ (PYI034) - Simplify int | float to float in ValuePrototype (PYI041) --- pyoverkiz/client.py | 4 ++-- pyoverkiz/models.py | 4 ++-- pyproject.toml | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pyoverkiz/client.py b/pyoverkiz/client.py index 74d51583..bb905884 100644 --- a/pyoverkiz/client.py +++ b/pyoverkiz/client.py @@ -7,7 +7,7 @@ import urllib.parse from pathlib import Path from types import TracebackType -from typing import Any, cast +from typing import Any, Self, cast import backoff from aiohttp import ( @@ -216,7 +216,7 @@ def __init__( ssl_context=self._ssl, ) - async def __aenter__(self) -> OverkizClient: + async def __aenter__(self) -> Self: """Enter async context manager and return the client instance.""" return self diff --git a/pyoverkiz/models.py b/pyoverkiz/models.py index 8a33f319..715abb86 100644 --- a/pyoverkiz/models.py +++ b/pyoverkiz/models.py @@ -1273,8 +1273,8 @@ class ValuePrototype: def __init__( self, type: str, - min_value: int | float | None = None, - max_value: int | float | None = None, + min_value: float | None = None, + max_value: float | None = None, enum_values: list[str] | None = None, description: str | None = None, **_: Any, diff --git a/pyproject.toml b/pyproject.toml index 15ae4d59..63468641 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -116,6 +116,8 @@ select = [ "PIE", # eradicate "ERA", + # flake8-pyi + "PYI", ] ignore = [ "E501", # Line too long From 55842c274fa31c5955e5143d25bdb861e64fcdf9 Mon Sep 17 00:00:00 2001 From: Mick Vleeshouwer Date: Sun, 19 Apr 2026 18:02:52 +0000 Subject: [PATCH 2/2] Also simplify class attribute annotations for consistency Address review feedback: align ValuePrototype class attribute annotations with __init__ parameter types (int | float -> float). --- pyoverkiz/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyoverkiz/models.py b/pyoverkiz/models.py index 715abb86..b25fca50 100644 --- a/pyoverkiz/models.py +++ b/pyoverkiz/models.py @@ -1265,8 +1265,8 @@ class ValuePrototype: """Value prototype defining parameter/state value constraints.""" type: str - min_value: int | float | None = None - max_value: int | float | None = None + min_value: float | None = None + max_value: float | None = None enum_values: list[str] | None = None description: str | None = None