Skip to content

Commit 9a085be

Browse files
committed
Add dialect typing
1 parent 8801162 commit 9a085be

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

sqlalchemy-stubs/sql/type_api.pyi

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ from .sqltypes import TableValueType
2222
from .visitors import Traversible
2323
from .visitors import TraversibleType
2424
from .. import util
25+
from ..engine import Dialect
2526
from ..util import compat
2627

2728
BOOLEANTYPE: Boolean
@@ -71,14 +72,18 @@ class TypeEngine(Traversible, Generic[_T]):
7172
should_evaluate_none: bool = ...
7273
def evaluates_none(self: _TE) -> _TE: ...
7374
def copy(self: _TE, **kw: Any) -> _TE: ...
74-
def compare_against_backend(self, dialect: Any, conn_type: Any) -> Any: ...
75+
def compare_against_backend(
76+
self, dialect: Dialect, conn_type: Any
77+
) -> Any: ...
7578
def copy_value(self, value: _T) -> _T: ...
7679
def literal_processor(
77-
self, dialect: Any
80+
self, dialect: Dialect
7881
) -> Optional[_LiteralProcessor[_T]]: ...
79-
def bind_processor(self, dialect: Any) -> Optional[_BindProcessor[_T]]: ...
82+
def bind_processor(
83+
self, dialect: Dialect
84+
) -> Optional[_BindProcessor[_T]]: ...
8085
def result_processor(
81-
self, dialect: Any, coltype: Any
86+
self, dialect: Dialect, coltype: Any
8287
) -> Optional[_ResultProcessor[_T]]: ...
8388
def column_expression(self, colexpr: Any) -> Any: ...
8489
def bind_expression(self, bindvalue: Any) -> Any: ...
@@ -90,12 +95,12 @@ class TypeEngine(Traversible, Generic[_T]):
9095
self, type_: Type[TypeEngine[_U]], dialect_name: str
9196
) -> Variant[_U]: ...
9297
def as_generic(self, allow_nulltype: bool = ...) -> TypeEngine[Any]: ...
93-
def dialect_impl(self, dialect: Any) -> Type[Any]: ...
98+
def dialect_impl(self, dialect: Dialect) -> Type[Any]: ...
9499
def adapt(self, __cls: Type[_U], **kw: Any) -> _U: ...
95100
def coerce_compared_value(
96101
self, op: Any, value: Any
97102
) -> TypeEngine[Any]: ...
98-
def compile(self, dialect: Optional[Any] = ...) -> Any: ...
103+
def compile(self, dialect: Optional[Dialect] = ...) -> Any: ...
99104

100105
class VisitableCheckKWArg(util.EnsureKWArgType, TraversibleType): ...
101106

@@ -130,20 +135,22 @@ class TypeDecorator(SchemaEventTarget, TypeEngine[_T]):
130135
) -> ClauseElement: ...
131136
@property
132137
def comparator_factory(self) -> Type[Comparator[TypeEngine[_T]]]: ... # type: ignore[override]
133-
def type_engine(self, dialect: Any) -> TypeEngine[Any]: ...
134-
def load_dialect_impl(self, dialect: Any) -> TypeEngine[Any]: ...
138+
def type_engine(self, dialect: Dialect) -> TypeEngine[Any]: ...
139+
def load_dialect_impl(self, dialect: Dialect) -> TypeEngine[Any]: ...
135140
def __getattr__(self, key: Any) -> Any: ...
136141
def process_literal_param(
137-
self, value: Optional[_T], dialect: Any
142+
self, value: Optional[_T], dialect: Dialect
138143
) -> str: ...
139-
def process_bind_param(self, value: Optional[_T], dialect: Any) -> Any: ...
144+
def process_bind_param(
145+
self, value: Optional[_T], dialect: Dialect
146+
) -> Any: ...
140147
def process_result_value(
141-
self, value: Any, dialect: Any
148+
self, value: Any, dialect: Dialect
142149
) -> Optional[_T]: ...
143-
def literal_processor(self, dialect: Any) -> _LiteralProcessor[_T]: ...
144-
def bind_processor(self, dialect: Any) -> _BindProcessor[_T]: ...
150+
def literal_processor(self, dialect: Dialect) -> _LiteralProcessor[_T]: ...
151+
def bind_processor(self, dialect: Dialect) -> _BindProcessor[_T]: ...
145152
def result_processor(
146-
self, dialect: Any, coltype: Any
153+
self, dialect: Dialect, coltype: Any
147154
) -> _ResultProcessor[_T]: ...
148155
def bind_expression(self, bindparam: Any) -> Any: ...
149156
def column_expression(self, column: Any) -> Any: ...
@@ -163,7 +170,7 @@ class Variant(TypeDecorator[_T]):
163170
def coerce_compared_value(
164171
self: _VT, operator: Any, value: Any
165172
) -> Union[_VT, TypeEngine[Any]]: ...
166-
def load_dialect_impl(self, dialect: Any) -> TypeEngine[Any]: ...
173+
def load_dialect_impl(self, dialect: Dialect) -> TypeEngine[Any]: ...
167174
def with_variant(
168175
self, type_: Type[TypeEngine[_U]], dialect_name: str
169176
) -> Variant[_U]: ...

0 commit comments

Comments
 (0)