enum auto must not be derived from IntFlag

オープン 初心者向け
#8,286 コメント 4 件 リアクション 9 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
65/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python
領域
devtools

調査の方向性

まず、Issue で言及されている元の enum.py の実装と、enum.pyi にある auto の定義を比較します。両方のファイルに示されているコンストラクターと継承を確認し、その後、stub の定義が実装と一致し、紛らわしい型ヒント enum.auto(IntFlag) が生成されなくなるように更新します。

索引モデルが issue の本文から書いたものです。

説明

When using auto enumeration within an class Example(enum.Enum): X = auto(), the invokation of auto() is actually constructing an instance of enum.auto, which just has a default constructor without any extra arguments.

However, when deriving class auto(IntFlag) in enum.pyi the stub actually has a constructor argument of type int, the value for the IntFlag.

This contradicts the definition in the original enum.py implementation.
As a matter of fact this leads to confusing type hints, e.g. enum class auto(IntFlag).

主要言語
Python
スター
5.1k
フォーク
2.1k
平均マージ
1日 12時間
マージ済み PR(30日)
71

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

python/typeshed のほかの issue

python/typeshed の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。