streamstats: should get_watershed always return a Watershed?
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 45/100
Línea de trabajo
Lee primero dataretrieval.streamstats.get_watershed y Watershed.init, y después inspecciona el borrador revertido fix/streamstats-watershed-class en el commit b3a5d29. Revisa las implicaciones del cambio incompatible para los formatos documentados y determina si el proyecto debe adoptar la propuesta, aplazarla a una versión major o usar deprecation; la tarea estará terminada cuando se hayan registrado esa decisión y su plan de compatibilidad.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Background
dataretrieval.streamstats.get_watershed currently has a format parameter that selects between three return types:
format="geojson"(default): the rawrequests.Responseformat="object": the parsed JSONdictformat="watershed": aWatershedinstance built from the parsed JSON- anything else:
ValueError
The multi-return contract is documented in #245 (after that PR's fix). But the function's name and StreamStats' own conceptual model both suggest it should return a watershed.
Proposal
Drop the format parameter and have get_watershed always return a Watershed.
Pros:
- Single return type → cleaner type annotation (
-> Watershed), noUnion[Response, dict, Watershed]. - Function name matches its contract.
- Removes the silent-fallthrough bug class entirely (no
formatstring to typo). - Callers wanting the raw
Responsecan userequests.get(...); callers wanting JSON can callWatershed.from_streamstats_json(r.json())or readWatershed.parameters/Watershed.workspace_iddirectly.
Cons:
- Breaking change for callers using
format="geojson"(the current default) orformat="object". - The default behavior changes silently if a caller passed no
format— they previously got aResponseand would now get aWatershed.
Implementation sketch
Extract the HTTP+parse into a private helper (_fetch_streamstats_json) so get_watershed and Watershed.__init__ can share fetch logic without circular calls. A working draft of this lived briefly on the fix/streamstats-watershed-class branch (commit b3a5d29, since reverted to keep #245 non-breaking).
Decision needed
Is this worth the breaking change? If so, when — current minor cycle, next major, or behind a deprecation warning?
- Lenguaje dominante
- Python
- Estrellas
- 269
- Forks
- 67
- Merge medio
- 3 d 17 h
- PR fusionados (30 d)
- 18
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
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.
Más de DOI-USGS/dataretrieval-python
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
DOI-USGS/dataretrieval-python#406 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Check getter parameter docs against the service's queryablesPosiblemente ocupada @acalebratliff la tomó hace 3 días. Abiertodocumentation ready-for-agent
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
DOI-USGS/dataretrieval-python#379 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de DOI-USGS/dataretrieval-python
Issues similares
-
documentation good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
drevendev/HungryCrab#273 ·
Los mantenedores suelen responder en 1 día
-
good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
drevendev/BeautifulRepo#19 ·
Los mantenedores suelen responder en 2 días
-
Moonshot: Kimi K3 always sends `reasoning_effort="max"`, though the API now accepts `low` and `high`Abiertoaccepted
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
UKGovernmentBEIS/inspect_ai#5939 ·
Los mantenedores suelen responder en 1 día
-
bug linux
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Fill paper for Screen2WordsAbiertoarea:data data-quality
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
reacher-z/Awesome-CUA#1468 ·
Los mantenedores suelen responder en 1 día