Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non interpolated placeholder value in docstring. #19292

Closed
Carreau opened this issue Jan 14, 2021 · 0 comments · Fixed by #19293
Closed

Non interpolated placeholder value in docstring. #19292

Carreau opened this issue Jan 14, 2021 · 0 comments · Fixed by #19293
Milestone

Comments

@Carreau
Copy link
Contributor

Carreau commented Jan 14, 2021

Problem

matplotlib.pyplot.axvspan, and respectively matplotlib.pyplot.Axes.axvspan still have the raw %(Polygon) on 3.3.3 and %(Polygon_kwdoc)s on master not interpolated in the docstring. As can be see
here online or via matplotlib.pyplot.Axes.axvspan? in IPython.

%(Rectangle_kwdocs)s is also present in matplotlib.axes.Axes.indicate_inset as well.

A couple of other %(...) are detectable in other docstring but are either purposeful, or private AFAICT.

In addition a number of extra formatting seem to be done but are no-op, quick grep through source code:

...
 rg _kwdoc | cut -f2 -d: | tr -d ' '  | sort | uniq
%(Axes3D_kwdoc)s
%(Axes_kwdoc)s
%(BrokenBarHCollection_kwdoc)s
%(Line2D_kwdoc)s
%(Patch_kwdoc)s
%(PolyCollection_kwdoc)s
%(Polygon_kwdoc)s
%(QuadMesh_kwdoc)s
%(Rectangle_kwdoc)s
%(Table_kwdoc)s
%(Text_kwdoc)s
_artist_kwdoc=artist.kwdoc(Collection)
_patch_kwdoc=artist.kwdoc(Patch)
docstring.interpd.update(Artist_kwdoc=kwdoc(Artist))
docstring.interpd.update(Axes3D_kwdoc=artist.kwdoc(Axes3D))
docstring.interpd.update(Axes_kwdoc=martist.kwdoc(Axes))
docstring.interpd.update(Figure_kwdoc=martist.kwdoc(Figure))
docstring.interpd.update(Line2D_kwdoc=artist.kwdoc(Line2D))
docstring.interpd.update(LineCollection_kwdoc=artist.kwdoc(LineCollection))
docstring.interpd.update(Subplot_kwdoc=martist.kwdoc(Axes))
docstring.interpd.update(Table_kwdoc=artist.kwdoc(Table))
docstring.interpd.update(Text_kwdoc=artist.kwdoc(Text))
docstring.interpd.update({f'{k}_kwdoc'

Of which the following have no matching targets:

Artist_kwdoc=kwdoc(Artist))
Figure_kwdoc=martist.kwdoc(Figure))
LineCollection_kwdoc=artist.kwdoc(LineCollection))
Subplot_kwdoc=martist.kwdoc(Axes))

Note also the docstring.interpd.update({f'{k}_kwdoc' present in two files that loops over many values:

$ rg \}_kwdoc -B4
lib/matplotlib/collections.py
2085-for k in ('QuadMesh', 'TriMesh', 'PolyCollection', 'BrokenBarHCollection',
2086-          'RegularPolyCollection', 'PathCollection',
2087-          'StarPolygonCollection', 'PatchCollection',
2088-          'CircleCollection', 'Collection',):
2089:    docstring.interpd.update({f'{k}_kwdoc': _artist_kwdoc})

lib/matplotlib/patches.py
627-_patch_kwdoc = artist.kwdoc(Patch)
628-for k in ['Rectangle', 'Circle', 'RegularPolygon', 'Polygon', 'Wedge', 'Arrow',
629-          'FancyArrow', 'CirclePolygon', 'Ellipse', 'Arc', 'FancyBboxPatch',
630-          'Patch']:
631:    docstring.interpd.update({f'{k}_kwdoc': _patch_kwdoc})

Circle, Ellipses, Arc,... etc have no corresponding target, my guess is that this may contribute to import slowdown on matplotlib if each docstring formatting have to carry all this extra information.

Suggested Improvement

Fix matplotlib.axes.Axes.indicate_inset and axvspan to get properly formatted; not sure why they aren't. Maybe add a check in docstring.interpd and docstring.dedent_interpd to make sure there is no remaining %(...) after formatting ? and try to remove the unnecessary collection of format target.

Matplotlib version

  • Operating system: Mac OS, online docs
  • Matplotlib version: 3.3.3 and master branch
  • Matplotlib documentation version: 3.3.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants