python / python/mypy

`mypy` should use `List` when complaining about issues with the `List` type, instead of `list`

Aperta
#18,530 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

feature topic-error-reporting
Lingua principale
Python
Stelle
20.6k
Fork
3.3k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

Bug Report

mypy should use List when surfacing errors with the List type, not list.

It's confusing to engineers if mypy uses list when complaining about a type error because then engineers are searching the source code for occurrences of list, when the problem is actually with the usage of List.

To Reproduce

        self.orders: typing.List[typing.List[int, int]] = []

Expected Behavior

mypy should complain with

error: "List" expects 1 type argument, but 2 given  [type-arg]

Actual Behavior

mypy actually complains with

error: "list" expects 1 type argument, but 2 given  [type-arg]

Your Environment

  • Mypy version used: mypy==1.10.0
  • Mypy command-line flags: n/a
  • Mypy configuration options from mypy.ini (and other config files): n/a
  • Python version used: Python 3.10.12

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo l’esempio segnalato con mypy 1.10.0 e confronta la diagnostica attuale con la formulazione prevista di List. Individua il codice o i test responsabili del messaggio di errore relativo agli argomenti di tipo, quindi aggiungi una copertura che mostri che typing.List viene riportato come List e conferma che la diagnostica corrisponde all’issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
devtools
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.