Typing bug in FeatureManager.is_enabled overloads: single argument call not supported by type hints
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
FeatureManager.is_enabled のオーバーロード宣言を見つけ、この issue にある実行時シグネチャおよび単一引数の例と比較します。不足している1引数の型付けバリアントを追加し、静的解析が呼び出しを受け入れて bool を推論することを確認します。
索引モデルが issue の本文から書いたものです。
説明
- 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.
- 主要言語
- Python
- スター
- 26
- フォーク
- 11
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/FeatureManagement-Python のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
microsoft/FeatureManagement-Python#67 · リアクション 1 件 · 担当者 2 名 ·
microsoft/FeatureManagement-Python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
🐛 Bug 🔔 Pending processing
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
jumpserver/jumpserver#17584 ·