Skip to content

Commit 536174d

Browse files
committed
Fix typing errors
1 parent 4481cad commit 536174d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

nisystemlink/clients/core/_internal/_classproperty_support.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
import abc
66
import typing
7-
from typing import Any, Callable, Dict, Tuple
7+
from typing import Any, Callable, Dict, Tuple, TypeVar
8+
9+
_T = TypeVar("_T")
810

911

1012
class ClasspropertySupport(abc.ABCMeta):
@@ -31,8 +33,8 @@ class ClasspropertySupport_(meta): # type: ignore
3133
)
3234

3335
@classmethod
34-
def classproperty(cls, f: Callable[[Any], Any]) -> property:
36+
def classproperty(cls, f: Callable[[Any], _T]) -> _T:
3537
"""Make a classproperty."""
36-
# Cast to a property for the type checker, as we'll convert it to a property
37-
# later, in the __new__ method
38-
return typing.cast(property, cls._ClassProperty(f))
38+
# Cast to preserve the original function's return type for the type checker.
39+
# It'll get wrapped in a property in the __new__ method.
40+
return typing.cast(_T, cls._ClassProperty(f))

nisystemlink/clients/core/_uplink/_base_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from ._json_model import JsonModel
1313

1414

15-
@response_handler
15+
@response_handler # type: ignore[untyped-decorator]
1616
def _handle_http_status(response: Response) -> Optional[Response]:
1717
"""Checks an HTTP response's status code and raises an exception if necessary."""
1818
if 200 <= response.status_code < 300:

0 commit comments

Comments
 (0)