Skip to content

Commit

Permalink
Use Protocol[_T] as _ClassPropertyAttribute base
Browse files Browse the repository at this point in the history
  • Loading branch information
bswck committed Feb 7, 2024
1 parent 135f192 commit b1e7325
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions jaraco/classes/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
from typing import TYPE_CHECKING, Generic, TypeVar, cast, overload

_T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True)
_T_contra = TypeVar("_T_contra", contravariant=True)

if TYPE_CHECKING:
from collections.abc import Callable
from typing import Any
from typing import Any, Protocol

from typing_extensions import Self, TypeAlias

Expand All @@ -20,7 +18,7 @@
_SetterCallable: TypeAlias = Callable[[type[Any], _T], None]
_SetterClassMethod: TypeAlias = classmethod[Any, [_T], None]

class _ClassPropertyAttribute(Generic[_T]):
class _ClassPropertyAttribute(Protocol[_T]):
def __get__(self, obj: object, objtype: type[Any] | None = None) -> _T: ...
def __set__(self, obj: object, value: _T) -> None: ...

Expand Down

0 comments on commit b1e7325

Please sign in to comment.