special case ellipsis types
This commit is contained in:
parent
a9db61b371
commit
2c04153013
@ -14,7 +14,7 @@ import re
|
|||||||
import string
|
import string
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
from types import CodeType, EllipsisType, FunctionType
|
from types import CodeType, FunctionType
|
||||||
from typing import (
|
from typing import (
|
||||||
TYPE_CHECKING,
|
TYPE_CHECKING,
|
||||||
Any,
|
Any,
|
||||||
@ -96,9 +96,17 @@ class ReflexCallable(Protocol[P, R]):
|
|||||||
__call__: Callable[P, R]
|
__call__: Callable[P, R]
|
||||||
|
|
||||||
|
|
||||||
|
if sys.version_info >= (3, 10):
|
||||||
|
from types import EllipsisType
|
||||||
|
|
||||||
|
ReflexCallableParams = Union[EllipsisType, Tuple[GenericType, ...]]
|
||||||
|
else:
|
||||||
|
ReflexCallableParams = Union[Any, Tuple[GenericType, ...]]
|
||||||
|
|
||||||
|
|
||||||
def unwrap_reflex_callalbe(
|
def unwrap_reflex_callalbe(
|
||||||
callable_type: GenericType,
|
callable_type: GenericType,
|
||||||
) -> Tuple[Union[EllipsisType, Tuple[GenericType, ...]], GenericType]:
|
) -> Tuple[ReflexCallableParams, GenericType]:
|
||||||
"""Unwrap the ReflexCallable type.
|
"""Unwrap the ReflexCallable type.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
Loading…
Reference in New Issue
Block a user