Skip to content

Commit e2442c5

Browse files
authored
Fix UserDefinedType inheritance (#56)
1 parent 1cbc5e3 commit e2442c5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sqlalchemy-stubs/sql/type_api.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ _U = TypeVar("_U")
4040

4141
_TE = TypeVar("_TE", bound=TypeEngine[Any])
4242
_NFE = TypeVar("_NFE", bound=NativeForEmulated)
43+
_UDT = TypeVar("_UDT", bound=UserDefinedType[Any])
4344
_TD = TypeVar("_TD", bound=TypeDecorator[Any])
4445
_VT = TypeVar("_VT", bound=Variant[Any])
4546

@@ -104,10 +105,10 @@ class TypeEngine(Traversible, Generic[_T]):
104105

105106
class VisitableCheckKWArg(util.EnsureKWArgType, TraversibleType): ...
106107

107-
class UserDefinedType:
108+
class UserDefinedType(TypeEngine[_T], metaclass=VisitableCheckKWArg):
108109
__visit_name__: str = ...
109110
ensure_kwarg: str = ...
110-
def coerce_compared_value(self, op: Any, value: Any) -> Any: ...
111+
def coerce_compared_value(self: _UDT, op: Any, value: Any) -> _UDT: ...
111112

112113
class Emulated:
113114
def adapt_to_emulated(self, impltype: Any, **kw: Any) -> Any: ...

0 commit comments

Comments
 (0)