1
+ from _typeshed import SupportsLessThan
1
2
from typing import Any
3
+ from typing import Callable
2
4
from typing import Generic
5
+ from typing import Mapping
3
6
from typing import Optional
7
+ from typing import Text
8
+ from typing import Tuple
4
9
from typing import Type
5
10
from typing import TypeVar
11
+ from typing import Union
12
+ from typing_extensions import Protocol
6
13
7
14
from . import operators as operators
8
15
from .base import SchemaEventTarget as SchemaEventTarget
@@ -20,6 +27,14 @@ INDEXABLE: Any
20
27
TABLEVALUE : Any
21
28
22
29
_T = TypeVar ("_T" )
30
+ _U = TypeVar ("_U" )
31
+
32
+ _TE = TypeVar ('_TE' , bound = TypeEngine [Any ])
33
+ _NFE = TypeVar ('_NFE' , bound = NativeForEmulated )
34
+ _TD = TypeVar ('_TD' , bound = TypeDecorator [Any ])
35
+ _VT = TypeVar ('_VT' , bound = Variant [Any ])
36
+
37
+ _SortKeyFunction = Callable [[Any ], SupportsLessThan ]
23
38
24
39
class TypeEngine (Traversible , Generic [_T ]):
25
40
class Comparator (operators .ColumnOperators ):
@@ -32,87 +47,85 @@ class TypeEngine(Traversible, Generic[_T]):
32
47
def reverse_operate (self , op : Any , other : Any , ** kwargs : Any ): ...
33
48
def __reduce__ (self ): ...
34
49
hashable : bool = ...
35
- comparator_factory : Any = ...
36
- sort_key_function : Any = ...
50
+ comparator_factory : Type [ Any ] = ...
51
+ sort_key_function : Optional [ _SortKeyFunction ] = ...
37
52
should_evaluate_none : bool = ...
38
- def evaluates_none (self ) : ...
39
- def copy (self , ** kw : Any ): ...
53
+ def evaluates_none (self : _TE ) -> _TE : ...
54
+ def copy (self : _TE , ** kw : Any ) -> _TE : ...
40
55
def compare_against_backend (
41
56
self , dialect : Any , conn_type : Any
42
- ) -> None : ...
43
- def copy_value (self , value : Any ) : ...
44
- def literal_processor (self , dialect : Any ) -> None : ...
45
- def bind_processor (self , dialect : Any ) -> None : ...
46
- def result_processor (self , dialect : Any , coltype : Any ) -> None : ...
47
- def column_expression (self , colexpr : Any ) -> None : ...
48
- def bind_expression (self , bindvalue : Any ) -> None : ...
49
- def compare_values (self , x : Any , y : Any ): ...
50
- def get_dbapi_type (self , dbapi : Any ) -> None : ...
57
+ ) -> Any : ...
58
+ def copy_value (self , value : _T ) -> _T : ...
59
+ def literal_processor (self , dialect : Any ) -> Optional [ Callable [..., Any ]] : ...
60
+ def bind_processor (self , dialect : Any ) -> Optional [ Callable [..., Any ]] : ...
61
+ def result_processor (self , dialect : Any , coltype : Any ) -> Optional [ Callable [..., Any ]] : ...
62
+ def column_expression (self , colexpr : Any ) -> Any : ...
63
+ def bind_expression (self , bindvalue : Any ) -> Any : ...
64
+ def compare_values (self , x : Any , y : Any ) -> bool : ...
65
+ def get_dbapi_type (self , dbapi : Any ) -> Any : ...
51
66
@property
52
67
def python_type (self ) -> Type [_T ]: ...
53
- def with_variant (self , type_ : Any , dialect_name : Any ) : ...
54
- def as_generic (self , allow_nulltype : bool = ...): ...
55
- def dialect_impl (self , dialect : Any ): ...
56
- def adapt (self , cls : Any , ** kw : Any ): ...
57
- def coerce_compared_value (self , op : Any , value : Any ): ...
58
- def compile (self , dialect : Optional [Any ] = ...): ...
68
+ def with_variant (self , type_ : Type [ TypeEngine [ _U ]] , dialect_name : str ) -> Variant [ _U ] : ...
69
+ def as_generic (self , allow_nulltype : bool = ...) -> TypeEngine [ Any ] : ...
70
+ def dialect_impl (self , dialect : Any ) -> Type [ Any ] : ...
71
+ def adapt (self , __cls : Type [ _U ] , ** kw : Any ) -> _U : ...
72
+ def coerce_compared_value (self , op : Any , value : Any ) -> TypeEngine [ Any ] : ...
73
+ def compile (self , dialect : Optional [Any ] = ...) -> Any : ...
59
74
60
75
class VisitableCheckKWArg (util .EnsureKWArgType , TraversibleType ): ...
61
76
62
77
class UserDefinedType :
63
78
__visit_name__ : str = ...
64
79
ensure_kwarg : str = ...
65
- def coerce_compared_value (self , op : Any , value : Any ): ...
80
+ def coerce_compared_value (self , op : Any , value : Any ) -> Any : ...
66
81
67
82
class Emulated :
68
- def adapt_to_emulated (self , impltype : Any , ** kw : Any ): ...
69
- def adapt (self , impltype : Any , ** kw : Any ): ...
83
+ def adapt_to_emulated (self , impltype : Any , ** kw : Any ) -> Any : ...
84
+ def adapt (self , __impltype : Any , ** kw : Any ) -> Any : ...
70
85
71
86
class NativeForEmulated :
72
87
@classmethod
73
- def adapt_native_to_emulated (cls , impl : Any , ** kw : Any ): ...
88
+ def adapt_native_to_emulated (cls , impl : Any , ** kw : Any ) -> Any : ...
74
89
@classmethod
75
- def adapt_emulated_to_native (cls , impl : Any , ** kw : Any ): ...
90
+ def adapt_emulated_to_native (cls : Type [ _NFE ] , impl : Any , ** kw : Any ) -> _NFE : ...
76
91
77
- _TD = TypeVar ("_TD" )
78
-
79
- class TypeDecorator (SchemaEventTarget , TypeEngine [Any ], Generic [_TD ]):
92
+ class TypeDecorator (SchemaEventTarget , TypeEngine [_T ]):
80
93
__visit_name__ : str = ...
81
94
impl : Any = ...
82
95
def __init__ (self , * args : Any , ** kwargs : Any ) -> None : ...
83
- coerce_to_is_types : Any = ...
96
+ coerce_to_is_types : Tuple [ Type [ Any ], ...] = ...
84
97
class Comparator (TypeEngine .Comparator ):
85
98
def operate (self , op : Any , * other : Any , ** kwargs : Any ): ...
86
99
def reverse_operate (self , op : Any , other : Any , ** kwargs : Any ): ...
87
100
@property
88
- def comparator_factory (self ): ...
89
- def type_engine (self , dialect : Any ): ...
90
- def load_dialect_impl (self , dialect : Any ): ...
91
- def __getattr__ (self , key : Any ): ...
92
- def process_literal_param (self , value : Any , dialect : Any ) -> None : ...
93
- def process_bind_param (self , value : Any , dialect : Any ) -> None : ...
94
- def process_result_value (self , value : Any , dialect : Any ) -> None : ...
95
- def literal_processor (self , dialect : Any ): ...
96
- def bind_processor (self , dialect : Any ): ...
97
- def result_processor (self , dialect : Any , coltype : Any ): ...
98
- def bind_expression (self , bindparam : Any ): ...
99
- def column_expression (self , column : Any ): ...
100
- def coerce_compared_value (self , op : Any , value : Any ): ...
101
- def copy (self , ** kw : Any ): ...
102
- def get_dbapi_type (self , dbapi : Any ): ...
103
- def compare_values (self , x : Any , y : Any ): ...
101
+ def comparator_factory (self ) -> Type [ Any ] : ... # type: ignore[override]
102
+ def type_engine (self , dialect : Any ) -> TypeEngine [ Any ] : ...
103
+ def load_dialect_impl (self , dialect : Any ) -> TypeEngine [ Any ] : ...
104
+ def __getattr__ (self , key : Any ) -> Any : ...
105
+ def process_literal_param (self , value : Any , dialect : Any ) -> Optional [ str ] : ...
106
+ def process_bind_param (self , value : Any , dialect : Any ) -> Optional [ Text ] : ...
107
+ def process_result_value (self , value : Any , dialect : Any ) -> Optional [ _T ] : ...
108
+ def literal_processor (self , dialect : Any ) -> Callable [[ Optional [ _T ]], Optional [ str ]] : ...
109
+ def bind_processor (self , dialect : Any ) -> Callable [[ Optional [ _T ]], Optional [ str ]] : ...
110
+ def result_processor (self , dialect : Any , coltype : Any ) -> Callable [[ Optional [ Any ]], Optional [ _T ]] : ...
111
+ def bind_expression (self , bindparam : Any ) -> Any : ...
112
+ def column_expression (self , column : Any ) -> Any : ...
113
+ def coerce_compared_value (self , op : Any , value : Any ) -> Any : ...
114
+ def copy (self : _TD , ** kw : Any ) -> _TD : ...
115
+ def get_dbapi_type (self , dbapi : Any ) -> Any : ...
116
+ def compare_values (self , x : Any , y : Any ) -> bool : ...
104
117
@property
105
- def sort_key_function (self ): ...
118
+ def sort_key_function (self ) -> Optional [ _SortKeyFunction ] : ... # type: ignore[override]
106
119
107
- class Variant (TypeDecorator [Any ]):
108
- impl : Any = ...
109
- mapping : Any = ...
110
- def __init__ (self , base : Any , mapping : Any ) -> None : ...
111
- def coerce_compared_value (self , operator : Any , value : Any ): ...
112
- def load_dialect_impl (self , dialect : Any ): ...
113
- def with_variant (self , type_ : Any , dialect_name : Any ) : ...
120
+ class Variant (TypeDecorator [_T ]):
121
+ impl : Type [ TypeEngine [ Any ]] = ...
122
+ mapping : Mapping [ str , TypeEngine [ Any ]] = ...
123
+ def __init__ (self , base : Any , mapping : Mapping [ str , TypeEngine [ Any ]] ) -> None : ...
124
+ def coerce_compared_value (self : _VT , operator : Any , value : Any ) -> Union [ _VT , TypeEngine [ Any ]] : ...
125
+ def load_dialect_impl (self , dialect : Any ) -> TypeEngine [ Any ] : ...
126
+ def with_variant (self , type_ : Type [ TypeEngine [ _U ]] , dialect_name : str ) -> Variant [ _U ] : ...
114
127
@property
115
- def comparator_factory (self ): ...
128
+ def comparator_factory (self ) -> Type [ Any ] : ... # type: ignore[override]
116
129
117
130
def to_instance (typeobj : Any , * arg : Any , ** kw : Any ): ...
118
131
def adapt_type (typeobj : Any , colspecs : Any ): ...
0 commit comments