From 6571f555e1661daab43832318b8b628396d5b30e Mon Sep 17 00:00:00 2001 From: Derek Passen Date: Fri, 24 Nov 2023 19:55:15 -0600 Subject: [PATCH] PEP695 --- optional/optional.py | 9 +++------ optional/something.py | 6 ++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/optional/optional.py b/optional/optional.py index 2333686..c3932ce 100644 --- a/optional/optional.py +++ b/optional/optional.py @@ -1,15 +1,12 @@ -from typing import TypeAlias, TypeVar, overload +from typing import overload from optional.nothing import Nothing from optional.something import Something -T = TypeVar("T") +type Option[T] = Something[T] | Nothing -Option: TypeAlias = Something[T] | Nothing - - -class Optional: +class Optional[T]: """Entrypoint of optional.py Provides static methods to help intelligently create diff --git a/optional/something.py b/optional/something.py index f99040b..b687b4a 100644 --- a/optional/something.py +++ b/optional/something.py @@ -1,10 +1,8 @@ from types import NotImplementedType -from typing import Any, Generic, TypeVar +from typing import Any -T = TypeVar("T") - -class Something(Generic[T]): +class Something[T]: """Represents the presence of a value. Rarely instantiated on its own, see :func:`Optional.of`"""