You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
incomplete type declaration at sqlite3.Connection.create_aggregate() #12141
The create_aggregate documentation does not specify a result type of the aggregation and even allows for multiple aggregating values per row (n_arg parameter).
However, the type declaration at dbapi2.pyi does not reflect that (comments added by me):
defcreate_aggregate(self, name: str, n_arg: int, aggregate_class: Callable[[], _AggregateProtocol]) ->None: ...
class_AggregateProtocol(Protocol):
defstep(self, value: int, /) ->object: ... # <-- just one aggregating value of type intdeffinalize(self) ->int: ... # <-- result has to be int
I think that this is not correct. At least, I have working code that aggregates multiple strings into a combined one.
Also, it is in stark contrast to other, way more generic, type declarations at the same place (comments added by me):
class_AnyParamWindowAggregateClass(Protocol):
defstep(self, *args: Any) ->object: ... # <-- multiple aggregating values of any type alloweddefinverse(self, *args: Any) ->object: ...
defvalue(self) ->_SqliteData: ...
deffinalize(self) ->_SqliteData: ... # <-- result can be many more types_SqliteData: TypeAlias=str|ReadableBuffer|int|float|None
Hello!
This repository is intended as a CPython bug tracker, your problem is actually related to stubs which is not part of CPython; It's a part of typeshed.
I can't transfer this issue to the typeshed repo, @AlexWaygood maybe you can? 🙂
Activity
Eclips4 commentedon Jun 16, 2024
Hello!
This repository is intended as a CPython bug tracker, your problem is actually related to stubs which is not part of CPython; It's a part of typeshed.
I can't transfer this issue to the typeshed repo, @AlexWaygood maybe you can? 🙂
sobolevn commentedon Jun 16, 2024
This is indeed a typeshed problem. CPython documents that
finalize()returns:Looks like this protocol should be generic.
kunom commentedon Jun 16, 2024
Just to summarize my request:
stepcan take multiple arguments of several typesfinalizecan return several types