1
- import sys
2
1
from typing import Any
3
- from typing import Callable
4
2
from typing import Generic
5
3
from typing import Mapping
6
4
from typing import Optional
@@ -17,6 +15,7 @@ from .visitors import Traversible as Traversible
17
15
from .visitors import TraversibleType as TraversibleType
18
16
from .. import exc as exc
19
17
from .. import util as util
18
+ from ..util import compat
20
19
21
20
BOOLEANTYPE : Any
22
21
INTEGERTYPE : Any
@@ -36,13 +35,6 @@ _NFE = TypeVar("_NFE", bound=NativeForEmulated)
36
35
_TD = TypeVar ("_TD" , bound = TypeDecorator [Any ])
37
36
_VT = TypeVar ("_VT" , bound = Variant [Any ])
38
37
39
- if sys .version_info [0 ] < 3 :
40
- from _typeshed import SupportsLessThan
41
-
42
- _SortKeyFunction = Callable [[Any ], SupportsLessThan ]
43
- else :
44
- _SortKeyFunction = Callable [[Any ], Any ]
45
-
46
38
class _LiteralProcessor (Protocol [_T_contra ]):
47
39
def __call__ (self , __value : Optional [_T_contra ]) -> str : ...
48
40
@@ -64,7 +56,7 @@ class TypeEngine(Traversible, Generic[_T]):
64
56
def __reduce__ (self ): ...
65
57
hashable : bool = ...
66
58
comparator_factory : Type [Any ] = ...
67
- sort_key_function : Optional [_SortKeyFunction ] = ...
59
+ sort_key_function : Optional [compat . _SortKeyFunction ] = ...
68
60
should_evaluate_none : bool = ...
69
61
def evaluates_none (self : _TE ) -> _TE : ...
70
62
def copy (self : _TE , ** kw : Any ) -> _TE : ...
@@ -145,7 +137,7 @@ class TypeDecorator(SchemaEventTarget, TypeEngine[_T]):
145
137
def get_dbapi_type (self , dbapi : Any ) -> Any : ...
146
138
def compare_values (self , x : Any , y : Any ) -> bool : ...
147
139
@property
148
- def sort_key_function (self ) -> Optional [_SortKeyFunction ]: ... # type: ignore[override]
140
+ def sort_key_function (self ) -> Optional [compat . _SortKeyFunction ]: ... # type: ignore[override]
149
141
150
142
class Variant (TypeDecorator [_T ]):
151
143
impl : TypeEngine [Any ] = ...
0 commit comments