This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# util/compat.py
|
||||
# Copyright (C) 2005-2023 the SQLAlchemy authors and contributors
|
||||
# Copyright (C) 2005-2025 the SQLAlchemy authors and contributors
|
||||
# <see AUTHORS file>
|
||||
#
|
||||
# This module is part of SQLAlchemy and is released under
|
||||
@@ -19,8 +19,6 @@ import platform
|
||||
import sys
|
||||
import typing
|
||||
from typing import Any
|
||||
from typing import AsyncGenerator
|
||||
from typing import Awaitable
|
||||
from typing import Callable
|
||||
from typing import Dict
|
||||
from typing import Iterable
|
||||
@@ -34,6 +32,9 @@ from typing import Type
|
||||
from typing import TypeVar
|
||||
|
||||
|
||||
py314b1 = sys.version_info >= (3, 14, 0, "beta", 1)
|
||||
py314 = sys.version_info >= (3, 14)
|
||||
py313 = sys.version_info >= (3, 13)
|
||||
py312 = sys.version_info >= (3, 12)
|
||||
py311 = sys.version_info >= (3, 11)
|
||||
py310 = sys.version_info >= (3, 10)
|
||||
@@ -60,7 +61,7 @@ class FullArgSpec(typing.NamedTuple):
|
||||
varkw: Optional[str]
|
||||
defaults: Optional[Tuple[Any, ...]]
|
||||
kwonlyargs: List[str]
|
||||
kwonlydefaults: Dict[str, Any]
|
||||
kwonlydefaults: Optional[Dict[str, Any]]
|
||||
annotations: Dict[str, Any]
|
||||
|
||||
|
||||
@@ -102,24 +103,6 @@ def inspect_getfullargspec(func: Callable[..., Any]) -> FullArgSpec:
|
||||
)
|
||||
|
||||
|
||||
if py312:
|
||||
# we are 95% certain this form of athrow works in former Python
|
||||
# versions, however we are unable to get confirmation;
|
||||
# see https://github.com/python/cpython/issues/105269 where have
|
||||
# been unable to get a straight answer so far
|
||||
def athrow( # noqa
|
||||
gen: AsyncGenerator[_T_co, Any], typ: Any, value: Any, traceback: Any
|
||||
) -> Awaitable[_T_co]:
|
||||
return gen.athrow(value)
|
||||
|
||||
else:
|
||||
|
||||
def athrow( # noqa
|
||||
gen: AsyncGenerator[_T_co, Any], typ: Any, value: Any, traceback: Any
|
||||
) -> Awaitable[_T_co]:
|
||||
return gen.athrow(typ, value, traceback)
|
||||
|
||||
|
||||
if py39:
|
||||
# python stubs don't have a public type for this. not worth
|
||||
# making a protocol
|
||||
@@ -173,7 +156,7 @@ else:
|
||||
|
||||
def importlib_metadata_get(group):
|
||||
ep = importlib_metadata.entry_points()
|
||||
if not typing.TYPE_CHECKING and hasattr(ep, "select"):
|
||||
if typing.TYPE_CHECKING or hasattr(ep, "select"):
|
||||
return ep.select(group=group)
|
||||
else:
|
||||
return ep.get(group, ())
|
||||
|
||||
Reference in New Issue
Block a user