incomplete type declaration at `sqlite3.Connection.create_aggregate()`
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 5.1k
- フォーク
- 2.1k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 82
説明
Bug report
Bug description:
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):
def create_aggregate(self, name: str, n_arg: int, aggregate_class: Callable[[], _AggregateProtocol]) -> None: ...
class _AggregateProtocol(Protocol):
def step(self, value: int, /) -> object: ... # <-- just one aggregating value of type int
def finalize(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):
def step(self, *args: Any) -> object: ... # <-- multiple aggregating values of any type allowed
def inverse(self, *args: Any) -> object: ...
def value(self) -> _SqliteData: ...
def finalize(self) -> _SqliteData: ... # <-- result can be many more types
_SqliteData: TypeAlias = str | ReadableBuffer | int | float | None
CPython versions tested on:
3.12
Operating systems tested on:
Windows
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
sqlite3 dbapi2.pyi スタブから始め、create_aggregate と、文書化されている sqlite3.Connection.create_aggregate の動作を比較します。同じファイルにある _AnyParamWindowAggregateClass と _SqliteData を確認し、複数の入力値と整数以外の集約結果に対応する宣言を決定します。スタブが文書化されたユースケースを正しく受け入れれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100