Non-functions in the `See Also` section

Aperta
#618 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Inizia con numpydoc.docscrape e il round-trip di FunctionDoc mostrato nell’issue, usando l’esempio non taggato numpy.logaddexp. Traccia il modo in cui le voci See Also ricevono il tag :func: e verifica che un round-trip preservi i riferimenti a oggetti non funzione e venga renderizzato correttamente come oggetto py:data.

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

Descrizione

The See Also section should be explicitly allowed to contain references to any object.

The current situation is murky:

  • The documentation exclusively mentions functions, without explicitly ruling out other entities.
    https://numpydoc.readthedocs.io/en/latest/format.html#see-also
  • numpydoc parses untagged entries in the section to match anything
  • numpydoc.docscrape automatically adds the :func: tag to untagged entries, but otherwise accepts other entries.

This causes problems for example with https://github.com/numpy/numpy/issues/28734.
This works with intersphinx:


def f():
    """
    See Also
    --------
    numpy.logaddexp
    """

However, a round-trip through docscrape breaks it:


def f():
    """
    See Also
    --------
    numpy.logaddexp
    """

from numpydoc.docscrape import FunctionDoc
f.__doc__ = str(FunctionDoc(f))

Now f.__doc__ has been changed to

.. function:: f
    




See Also
--------

:func:`numpy.logaddexp`
    ..

Which encroaches on https://github.com/numpy/numpy/issues/28734 and breaks the rendering, because numpy.logaddexp is actually a py:data object.

Lingua principale
Python
Stelle
354
Fork
185
Merge medio
4m
PR unite (30g)
1

Preparare l'ambiente

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.

Altre issue di numpy/numpydoc

Tutte le issue di numpy/numpydoc

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.