microsoft / microsoft/FeatureManagement-Python
Typing bug in FeatureManager.is_enabled overloads: single argument call not supported by type hints
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 26
- フォーク
- 11
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
- Package Version: 2.1.0
- Operating System: Ubuntu
- Python Version: 3.12
Describe the bug
The FeatureManager.is_enabled method has incorrect type hints in the published SDK.
The implementation accepts a single argument:
await feature_manager.is_enabled("my-flag")
This works at runtime because the method signature is:
async def is_enabled(self, feature_flag_id: str, *args, **kwargs) -> bool
However, the declared overloads do not include a signature that accepts only one argument. The only available overload is:
@overload
async def is_enabled(self, feature_flag_id: str, user_id: str, **kwargs) -> bool:
...
Type checkers such as Mypy report this usage as invalid and treat the return type as Any.
Expected Behavior
The type hints should describe all valid usages. Since the runtime implementation allows calling the method with only feature_flag_id, the overloads should include a matching variant.
Proposed Fix
Add a second overload:
@overload
async def is_enabled(self, feature_flag_id: str) -> bool:
...
This aligns the type hints with the implementation and returns the correct bool type to static analysis tools.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
FeatureManager.is_enabled のオーバーロード宣言を見つけ、この issue にある実行時シグネチャおよび単一引数の例と比較します。不足している1引数の型付けバリアントを追加し、静的解析が呼び出しを受け入れて bool を推論することを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- developer-experience
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 55/100