Typing bug in FeatureManager.is_enabled overloads: single argument call not supported by type hints
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- python
调研方向
找到 FeatureManager.is_enabled 的重载声明,并将其与此 issue 中的运行时签名和单参数示例进行比较。添加缺失的单参数类型标注变体,然后验证静态分析接受该调用并推断出 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 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/FeatureManagement-Python 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 35/100
-
microsoft/FeatureManagement-Python#67 · 1 个 reaction · 已指派 2 人 ·
查看 microsoft/FeatureManagement-Python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
难度 2/5 1-3 小时 新手友好度 88/100
OpenHands/extensions#626 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
CSCfi/sd-search-api#39 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 68/100
StevenBlack/hosts#3255 ·