stub for sklearn.datasets.load_iris is missing a return type option

Abierto
#345 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
python

Línea de trabajo

Search the sklearn.datasets stubs for the load_iris entry point and compare its return annotation with the linked documentation. Update the annotation to represent the return_X_y alternatives, then run the repository’s stub or type-check validation if available; it is done when both documented return forms are represented.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

The Returns section of the docstring for sklearn.datasets.load_iris() has two options:

  1. An sklearn.utils.Bunch, if return_X_y is False
  2. A tuple[ndarray, ndarray] if return_X_y is True

The type stub for the function is

def load_iris(*, return_X_y: bool = False, as_frame: bool = False) -> tuple[Bunch, tuple]: ...

but I believe it should be:

def load_iris(*, return_X_y: bool = False, as_frame: bool = False) -> Bunch | tuple[ndarray, ndarray]: ...

or at least:

def load_iris(*, return_X_y: bool = False, as_frame: bool = False) -> Bunch | tuple: ...

which might be all we can get with parsing.

This might not be the only case of this in the codebase, but unfortunately I just have enough time to write this ticket. Normally I like to come with a bit more information, sorry about that.

Lenguaje dominante
Python
Estrellas
304
Forks
104
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/python-type-stubs

Todos los issues de microsoft/python-type-stubs

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.