microsoft / microsoft/FeatureManagement-Python
Typing bug in FeatureManager.is_enabled overloads: single argument call not supported by type hints
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 26
- Forks
- 11
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
- 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.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Localiza las declaraciones de sobrecargas de FeatureManager.is_enabled y compáralas con la firma en tiempo de ejecución y el ejemplo de un solo argumento de esta issue. Añade la variante de tipado de un argumento que falta y verifica que el análisis estático acepta la llamada e infiere bool.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- developer-experience
- Tipo de issue
- Error
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 55/100