MyPy complains if file replaced by shadow-file doesn't exist
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Start by reproducing the three commands in the issue with mypy 0.570 or a current checkout, then trace the --shadow-file argument handling and file-existence checks. Done means a missing source file mapped to an existing shadow file behaves like the shadow file, while an unrelated mapping does not produce a misleading missing-file error.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
This is a follow-up to https://github.com/python/mypy/issues/2119. I think this a bug report, but maybe it's a feature request, or even possibly a documentation request.
I'm surprised by the following behavior of --shadow-file SOURCE_FILE SHADOW_FILE:
$ cd /tmp/
$ mkdir python
$ cd python/
$ echo "x = 1 + 'A'" > shadow.py
$ mypy --shadow-file error.py shadow.py error.py #1
mypy: can't read file 'error.py': No such file or directory
$ mypy --shadow-file error.py shadow.py shadow.py #2
mypy: can't read file 'shadow.py': No such file or directory
$ mypy shadow.py #3
shadow.py:1: error: Unsupported operand types for + ("int" and "str")
I see two problems here:
-
I expected
# (1)to behave just as if there had been a fileerror.pywith the contents ofshadow.py, returning the same as# (3). This use case happens concretely when a user of Emacs creates a new file (but hasn't saved it to disk yet). In that case we create a temporary file with the contents of the unsaved file, and pass that asshadow.py, witherror.pybeing the name of the yet-unsaved file. -
In
# (2)I did not expected the--shadow-fileoption to make a difference, since I remappederror.pytoshadow.pyand then asked aboutshadow.py(which shouldn't be affected by the unrelated mapping). Additionally, the error seems wrong (the fileshadow.pyexists).
I'm using mypy 0.570 and Python 3.5.2 (I have not tried with mypy from git master)
Am I misunderstanding the way --shadow-file is used?
Thanks!
- 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
-
link-check link-check:sphinx-theme
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
OpenHands/extensions#626 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
CSCfi/sd-search-api#39 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100