python / python/mypy

stubgen: missing `__str__` method when the signature is different from default

Aperta
#14,696 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug topic-stubgen
Lingua principale
Python
Stelle
20.6k
Fork
3.3k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

Bug Report
When generating a stub with classes that define __str__ with extra parameters, __str__ is missing from the generated stub.

(A clear and concise description of what the bug is.)

To Reproduce

stubgen -p PyInstaller.utils.win32.versioninfo 

Expected Behavior

Classes in the generated PyInstaller.utils.win32.versioninfo stub should define def __str__(self, indent: str = "") -> str: ...

Actual Behavior
It's missing. Which results in a stubtest failure that has to be fixed manually.

Your Environment

  • Mypy version used: mypy 1.0.0 (compiled: yes)
  • Mypy command-line flags: N/A (stubgen, see above)
  • Mypy configuration options from mypy.ini (and other config files): N/A
  • Python version used: Python 3.9.13

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 il problema con stubgen -p PyInstaller.utils.win32.versioninfo, quindi segui l'entry point di stubgen che gestisce i metodi __str__. Il lavoro è completato quando lo stub generato include def __str__(self, indent: str = "") -> str: ... per le classi interessate ed evita il fallimento di stubtest segnalato.

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

Valutazione

Stack tecnologico
python
Ambito
cli, tooling
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.