Wrong type annotations for read only mapping types.
メンテナーはふだん 3 日以内に返信
評価
調査の方向性
src/confluent_kafka/admin/init.py の issue に示されている conf 引数の周辺から始め、次に Dict でアノテーションされた他の読み取り専用 mapping 引数を検索します。該当するアノテーションを collections.abc.Mapping に置き換え、dict[str, str] 構成が型チェッカーに受け入れられることを確認します。
索引モデルが issue の本文から書いたものです。
説明
There are type annotations that uses Dict to annotate read-only mapping arguments, e.g. the conf argument here: https://github.com/confluentinc/confluent-kafka-python/blob/7d0abd551c5061e655fbf403f9baa09af040e29b/src/confluent_kafka/admin/__init__.py#L118
The problem is that Dict is invariant in its value type, meaning that in the example above where conf is typed as conf: Dict[str, Union[str, int, float, bool] it is not valid to assign a dict of type Dict[str, str].
That means code like this
from confluent_kafka.admin import AdminClient
conf = {
"bootstrap.servers": "kafka:9092"),
} # inferred type dict[str, str]
admin_client = AdminClient(conf)
is rejected by type-checkers.
The solution here would be to annotate conf with collections.abc.Mapping instead of Dict, as Mapping is covariant in its value-type.
- 主要言語
- Python
- スター
- 528
- フォーク
- 977
- 平均マージ
- 2日 19時間
- マージ済み PR(30日)
- 19
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
confluentinc/confluent-kafka-python のほかの issue
-
KIP-848 migration guide says never use assign()/unassign() with group.protocol='consumer'; it's only rejected after subscribe対応中かも @hidingmyname が 22 日前に担当しました。 オープン
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
confluentinc/confluent-kafka-python#2405 ·
メンテナーはふだん 3 日以内に返信
-
init_transactions docstring says the transaction.timeout.ms clock starts there; it starts at begin_transaction対応中かも @hidingmyname が 22 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
confluentinc/confluent-kafka-python#2404 ·
メンテナーはふだん 3 日以内に返信
-
Wrong signature for `KafkaError`'s 1st parameter in `.pyi`対応中かも @wgu9 が 159 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
confluentinc/confluent-kafka-python#2243 ·
メンテナーはふだん 3 日以内に返信
-
Use joserfc instead of authlib.jose対応中かも @yvaishalirao が 135 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
confluentinc/confluent-kafka-python#2242 · コメント 2 件 ·
メンテナーはふだん 3 日以内に返信
-
Producer.poll(timeout) blocks for full timeout after delivery callback fires (regression in 2.13.0)再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンcomponent:producer
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
confluentinc/confluent-kafka-python#2215 · コメント 1 件 · リアクション 3 件 ·
メンテナーはふだん 3 日以内に返信
confluentinc/confluent-kafka-python の issue をすべて見る
似ている issue
-
needs-triage
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
flashinfer-ai/flashinfer#9803 ·
メンテナーはふだん 1 日以内に返信
-
bug frontend good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
oscarbol09/thesisforge#61 ·
-
api bug performance
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
oscarbol09/audiobard#159 ·
-
area:web p2 product:business triage:active type:bug
難易度 1/5 1時間未満 初心者へのやさしさ 89/100
cuadrao-ai/argus#2328 ·
メンテナーはふだん 1 日以内に返信
-
bug frontend good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
nikhilb2/simple_invoicing#907 ·