Add option to select scope for doctests
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- testing-qa, tooling
Línea de trabajo
Start with the test.py reproducer in the issue and run pyflakes against it, then inspect how doctest code is analyzed. Add a selectable scope for doctests so imports in doctest scope do not produce false redefinition warnings, while genuine unused-import warnings remain; verify the reported output and the SymPy example.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Original report by asmeurer (@asmeurer?) on Launchpad:
test.py:
import sys
import sys
def func():
"""
A docstring
>>> import sys
>>> sys.path
"""
return 1
The pyflakes output is
test.py:1: 'sys' imported but unused
test.py:6: redefinition of unused 'sys' from line 1
The line 6 "redefinition of unused 'sys' from line 1" is incorrect, because the doctest scope is separate from the module scope.
I can't figure out how to reproduce it with a small file, but in this file: https://github.com/sympy/sympy/blob/master/sympy/physics/mechanics/functions.py, the output is
sympy/physics/mechanics/functions.py:160: redefinition of unused 'diff' from line 27
sympy/physics/mechanics/functions.py:200: redefinition of unused 'dynamicsymbols' from line 19
sympy/physics/mechanics/functions.py:261: redefinition of unused 'dynamicsymbols' from line 19
sympy/physics/mechanics/functions.py:458: redefinition of unused 'Point' from line 26
sympy/physics/mechanics/functions.py:508: redefinition of unused 'Point' from line 26
That is, it complains about the imports in the doctests, but not the imports themselves (because they actually are used in the file).
- Lenguaje dominante
- Python
- Estrellas
- 1.5k
- Forks
- 205
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 5
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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 PyCQA/pyflakes
-
F542 is not a crimeAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
-
setuptools deprecation warningsAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 52/100
-
Use of await in a function that is not async should be shown as a syntax error by flake8Quizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Todos los issues de PyCQA/pyflakes
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
micropython/micropython#19906 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
FinanceFlash/unvibecode#597 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
TomAnthony/YourOwnWeigh#21 ·
Los mantenedores suelen responder en 1 día
-
[BUG]: Compliance rules never see Unity Catalog views as viewsPosiblemente ocupada @wagnercsantos la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
databrickslabs/ontos#1348 ·
Los mantenedores suelen responder en 3 días
-
Deprecated datetime.utcnow() is called on every log line (DeprecationWarning on Python 3.12+)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días