-from typing import (TYPE_CHECKING, AbstractSet, Iterable, Iterator, Mapping,
- MutableSet, TypeVar, Union)
+from typing import (TYPE_CHECKING, AbstractSet, Any, Iterable, Iterator,
+ Mapping, MutableSet, NoReturn, TypeVar, Union)
if TYPE_CHECKING:
- from typing_extensions import Literal, final
+ from typing_extensions import Literal, Self, final
else:
def final(v):
return v
Literal = _Literal()
+ Self = Any
+
_T_co = TypeVar("_T_co", covariant=True)
_T = TypeVar("_T")
-__all__ = ["final", "Literal", "OFSet", "OSet", "FMap"]
+__all__ = ["final", "Literal", "Self", "assert_never", "OFSet", "OSet", "FMap"]
+
+
+# pyright currently doesn't like typing_extensions' definition
+# -- added to typing in python 3.11
+def assert_never(arg):
+ # type: (NoReturn) -> NoReturn
+ raise AssertionError("got to code that's supposed to be unreachable")
class OFSet(AbstractSet[_T_co]):
from typing import (AbstractSet, Iterable, Iterator, Mapping,
- MutableSet, TypeVar, overload)
-from typing_extensions import final, Literal
+ MutableSet, NoReturn, TypeVar, overload)
+from typing_extensions import final, Literal, Self
_T_co = TypeVar("_T_co", covariant=True)
_T = TypeVar("_T")
-__all__ = ["final", "Literal", "OFSet", "OSet", "FMap"]
+__all__ = ["final", "Literal", "Self", "assert_never", "OFSet", "OSet", "FMap"]
+
+
+# pyright currently doesn't like typing_extensions' definition
+# -- added to typing in python 3.11
+def assert_never(arg):
+ # type: (NoReturn) -> NoReturn
+ raise AssertionError("got to code that's supposed to be unreachable")
class OFSet(AbstractSet[_T_co]):
--- /dev/null
+from typing import Any, Callable, Generic, TypeVar, overload
+
+_T = TypeVar("_T")
+
+
+class cached_property(Generic[_T]):
+ def __init__(self, func: Callable[[Any], _T]) -> None: ...
+
+ @overload
+ def __get__(self, instance: None,
+ owner: type[Any] | None = ...) -> cached_property[_T]: ...
+
+ @overload
+ def __get__(self, instance: object,
+ owner: type[Any] | None = ...) -> _T: ...