Skip to content

Commit

Permalink
export typealias to compat.py
Browse files Browse the repository at this point in the history
  • Loading branch information
qthequartermasterman committed May 3, 2024
1 parent e3cabf5 commit 7cd4096
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions hypothesis-python/src/hypothesis/internal/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import sys
import typing
from functools import partial
from typing import Any, ForwardRef, List, Optional, get_args
from typing import Any, ForwardRef, List, Optional, TypedDict as TypedDict, get_args

try:
BaseExceptionGroup = BaseExceptionGroup
Expand All @@ -33,6 +33,7 @@
ParamSpec as ParamSpec,
TypedDict as TypedDict,
override as override,
TypeAlias as TypeAlias,
)
else:
# In order to use NotRequired, we need the version of TypedDict included in Python 3.11+.
Expand All @@ -46,8 +47,6 @@
)
except ImportError:
# We can use the old TypedDict from Python 3.8+ at runtime.
from typing import TypedDict as TypedDict

class NotRequired:
"""A runtime placeholder for the NotRequired type, which is not available in Python <3.11."""

Expand All @@ -59,16 +58,19 @@ def __class_getitem__(cls, item):
Concatenate as Concatenate,
ParamSpec as ParamSpec,
override as override,
TypeAlias as TypeAlias
)
except ImportError:
try:
from typing_extensions import (
Concatenate as Concatenate,
ParamSpec as ParamSpec,
override as override,
TypeAlias as TypeAlias,
)
except ImportError:
Concatenate, ParamSpec = None, None
TypeAlias = None
override = lambda f: f


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
NoReturn,
Optional,
Set,
TypeAlias,
Union,
overload,
)
Expand All @@ -45,6 +44,7 @@
ceil,
int_from_bytes,
override,
TypeAlias
)
from hypothesis.internal.conjecture.data import (
AVAILABLE_PROVIDERS,
Expand Down

0 comments on commit 7cd4096

Please sign in to comment.