Wording in `mypy.plugin.Plugin.get_method[_signature]_hook` docstring
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 20.6k
- Fork
- 3.3k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Documentation
The docstring of these plugin hook methods currently say:
...
https://github.com/python/mypy/blob/057508b4cb405fbc22e26b44f764b142352fcce5/mypy/plugin.py#L664
I understand this to mean that the argument to fullname will be "__main__.Base.method", because __main__.Base defines method.
However, this doesn't seem to be the case. Setting up the same example in the docstring:
mypy.ini[mypy] plugins = plugin.py files = test.pyplugin.pyfrom mypy.plugin import Plugin def plugin(version): return TestPlugin class TestPlugin(Plugin): def get_method_signature_hook(self, fullname): if fullname.startswith("test."): print(f"Hook will be called with `{fullname}`")test.pyfrom typing import Any class Base: def method(self, arg: Any) -> Any: ... class Derived(Base): ... var: Derived var.method(42)
$ mypy
Hook will be called with `test.Derived.method`
I installed as far back as mypy 0.9x and it was the same behaviour as described above, displaying test.Derived.method (not test.Base.method).
Is there something wrong with the docstring (perhaps from outdated behaviour that no longer applies), or have I misunderstood something?
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.
Direzione di ricerca
Inizia con i docstring degli hook collegati in mypy/plugin.py intorno alle righe 647-648 e 664, quindi riproduci l’esempio fornito di mypy.ini, plugin.py e test.py. Confronta il fullname documentato con il valore osservato test.Derived.method; il lavoro è completato quando il docstring spiega accuratamente l’argomento dell’hook o chiarisce l’equivoco segnalato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100