Running with --disallow-any-expr errors on exprs from "unfollowed code" even with immediate cast / assignment.
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Reproduce the report using the command mypy --disallow-any-expr and the example in scratch_6.py, then compare the observed diagnostics with the linked command-line documentation. Trace how expressions from unfollowed imports are handled in the cast and annotated-assignment cases; done means both forms no longer produce the reported errors when their result is explicitly typed.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Run mypy 0.580 on the following code with the flag:
mypy --disallow-any-expr
from typing import cast
import numpy as np # type: ignore
class C: ...
a = cast(C, np.array([1,2,3]))
b: C = np.array([1,2,3])
This yields the errors:
scratch_6.py:7: error: Expression has type "Any"
scratch_6.py:8: error: Expression has type "Any"
One each for the cast and assignment forms.
According to the docs on --disallow-any-expr (http://mypy.readthedocs.io/en/latest/command_line.html). I believe both the cast and the assignment to a typed variable should resolve the errors.
Note that I'm using numpy as my "unfollowed import" here, but the problem seems to occur with other "unfollowed" libraries I've tried as well. Substitute as convenient.
- 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