reveal_locals() doesn't show module globals that are annotated
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Bug Report
reveal_locals() doesn't show module globals that are annotated with type information.
To Reproduce
from typing import List
global_var = [1, 2, 3]
global_var_annotated: List[int] = [1, 2, 3]
reveal_locals()
def foo():
local_var = [1, 2, 3]
local_var_annotated: List[int] = [1, 2, 3]
reveal_locals()
Expected Behavior
A note on the global_var_annotated variable:
note: global_var_annotated: builtins.list[builtins.int]
Actual Behavior
global_var_annotated is missing from the revealed types:
note: Revealed local types are:
note: global_var: builtins.list[builtins.int*]
note: Revealed local types are:
note: local_var: Any
note: local_var_annotated: builtins.list[builtins.int]
Your Environment
- mypy 0.931
- Python 3.7.7
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, die bereitgestellte Python-Reproduktion mit mypy auszuführen und die Verarbeitung von reveal_locals() für annotierte Globals auf Modulebene zu untersuchen. Vergleiche ihre Ausgabe mit dem erwarteten Hinweis für global_var_annotated; abgeschlossen, wenn annotierte Modul-Globals enthalten sind, ohne die bestehende Ausgabe für lokale und nicht annotierte Globals zu beeinträchtigen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100