Confusing message for indirect import from a stub
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 38/100
Direzione di ricerca
Download testcase.zip and run mypy --config-file=mypy.ini -p testcase to reproduce the reported errors. Start with teststubs/a/stubA.pyi, testcase/init.py, b.init.pyi, and b.stubB, then trace why the indirect import is not recognized. Done means the supplied case no longer reports either missing TestClass error.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Indirect imports in stubs don't seem to work. I tested the following case against mypy 0.520, where everything worked (no error detected), mypy 0.530 (where the error occurred) and the current git version, which also had the same error as mypy 0.530.
I attached a zip file with the test case:
testcase.zip
The mypy call line is just mypy --config-file=mypy.ini -p testcase.
The error I get is the following:
teststubs/a/stubA.pyi:1: error: Module 'b' has no attribute 'TestClass'
testcase/__init__.py:1: error: Module 'a.stubA' has no attribute 'TestClass'
The main problem is the first line. Module 'b' imports 'TestClass' from b.stubB in b.__init__.pyi, but mypy for some reason does not know that.
- Lingua principale
- Python
- Stelle
- 20.6k
- Fork
- 3.3k
- Merge medio
- 1g 18h
- PR unite (30g)
- 54
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di python/mypy
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
bug topic-configuration topic-error-reporting
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
🐛 Bug 🔔 Pending processing
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
jumpserver/jumpserver#17584 ·