8000 Capitalize some docstrings. · matplotlib/matplotlib@4f32ec9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4f32ec9

Browse files
committed
Capitalize some docstrings.
1 parent af8a720 commit 4f32ec9

File tree

7 files changed

+46
-55
lines changed

7 files changed

+46
-55
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Deprecations
2+
````````````
3+
4+
The *currx* argument to `~.TextToPath.glyph_to_path` is deprecated (manually
5+
transform the path instead).

lib/matplotlib/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169

170170

171171
def compare_versions(a, b):
172-
"return True if a is greater than or equal to b"
172+
"Return whether version *a* is greater than or equal to version *b*."
173173
if isinstance(a, bytes):
174174
cbook.warn_deprecated(
175175
"3.0", message="compare_versions arguments should be strs.")
@@ -1450,7 +1450,7 @@ def _init_tests():
14501450

14511451
def test(verbosity=None, coverage=False, switch_backend_warn=True,
14521452
recursionlimit=0, **kwargs):
1453-
"""run the matplotlib test suite"""
1453+
"""Run the matplotlib test suite."""
14541454
_init_tests()
14551455
if not os.path.isdir(os.path.join(os.path.dirname(__file__), 'tests')):
14561456
raise ImportError("Matplotlib test data is not installed")

lib/matplotlib/backend_tools.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,16 +271,15 @@ def _tool_trigger_cbk(self, event):
271271
self._set_cursor_cbk(event.canvasevent)
272272

273273
def _add_tool(self, tool):
274-
"""set the cursor when the tool is triggered"""
274+
"""Set the cursor when the tool is triggered."""
275275
if getattr(tool, 'cursor', None) is not None:
276276
self.toolmanager.toolmanager_connect('tool_trigger_%s' % tool.name,
277277
self._tool_trigger_cbk)
278278

279279
def _add_tool_cbk(self, event):
280-
"""Process every newly added tool"""
280+
"""Process every newly added tool."""
281281
if event.tool is self:
282282
return
283-
284283
self._add_tool(event.tool)
285284

286285
def _set_cursor_cbk(self, event):
@@ -853,7 +852,7 @@ def _cancel_action(self):
853852
return
854853

855854
def _press(self, event):
856-
"""the _press mouse button in zoom to rect mode callback"""
855+
"""Callback for mouse button presses in zoom to rect mode."""
857856

858857
# If we're already in the middle of a zoom, pressing another
859858
# button works to "cancel"
@@ -895,7 +894,7 @@ def _switch_off_zoom_mode(self, event):
895894
self._mouse_move(event)
896895

897896
def _mouse_move(self, event):
898-
"""the drag callback in zoom mode"""
897+
"""Callback for mouse moves in zoom to rect mode."""
899898

900899
if self._xypress:
901900
x, y = event.x, event.y
@@ -910,7 +909,7 @@ def _mouse_move(self, event):
910909
'rubberband', self, data=(x1, y1, x2, y2))
911910

912911
def _release(self, event):
913-
"""the release mouse button callback in zoom to rect mode"""
912+
"""Callback for mouse button releases in zoom to rect mode."""
914913

915914
for zoom_id in self._ids_zoom:
916915
self.figure.canvas.mpl_disconnect(zoom_id)

lib/matplotlib/colorbar.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ def set_ticks(self, ticks, update_ticks=True):
569569
self.stale = True
570570

571571
def get_ticks(self, minor=False):
572-
"""Return the x ticks as a list of locations"""
572+
"""Return the x ticks as a list of locations."""
573573
if self._manual_tick_data_values is None:
574574
ax = self.ax
575575
if self.orientation == 'vertical':
@@ -584,9 +584,10 @@ def get_ticks(self, minor=False):
584584

585585
def set_ticklabels(self, ticklabels, update_ticks=True):
586586
"""
587-
set tick labels. Tick labels are updated immediately unless
588-
update_ticks is *False*. To manually update the ticks, call
589-
*update_ticks* method explicitly.
587+
Set tick labels.
588+
589+
Tick labels are updated immediately unless *update_ticks* is *False*,
590+
in which case one should call `~.update_ticks` explicitly.
590591
"""
591592
if isinstance(self.locator, ticker.FixedLocator):
592593
self.formatter = ticker.FixedFormatter(ticklabels)
@@ -864,7 +865,7 @@ def _find_range(self):
864865
self.vmax = b[-1]
865866

866867
def _central_N(self):
867-
'''number of boundaries **before** extension of ends'''
868+
"""Return the number of boundaries **excluding** end extensions."""
868869
nb = len(self._boundaries)
869870
if self.extend == 'both':
870871
nb -= 2
@@ -1128,11 +1129,13 @@ def add_lines(self, CS, erase=True):
11281129
erase=erase)
11291130

11301131
def update_normal(self, mappable):
1131-
'''
1132-
update solid, lines, etc. Unlike update_bruteforce, it does
1133-
not clear the axes. This is meant to be called when the image
1134-
or contour plot to which this colorbar belongs is changed.
1135-
'''
1132+
"""
1133+
Update solid patches, lines, etc.
1134+
1135+
Unlike `~.update_bruteforce`, this does not clear the axes. This is
1136+
meant to be called when the image or contour plot to which this
1137+
colorbar belongs changes.
1138+
"""
11361139
self.draw_all()
11371140
if isinstance(self.mappable, contour.ContourSet):
11381141
CS = self.mappable

lib/matplotlib/colors.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,8 +1356,7 @@ def rgb_to_hsv(arr):
13561356

13571357
def hsv_to_rgb(hsv):
13581358
"""
1359-
convert hsv values in a numpy array to rgb values
1360-
all values assumed to be in range [0, 1]
1359+
Convert hsv values to rgb.
13611360
13621361
Parameters
13631362
----------

lib/matplotlib/markers.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,6 @@ class MarkerStyle(object):
222222

223223
def __init__(self, marker=None, fillstyle=None):
224224
"""
225-
MarkerStyle
226-
227225
Attributes
228226
----------
229227
markers : list of known marks

lib/matplotlib/textpath.py

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@ def tex_font_map(self):
4242

4343
def _get_font(self, prop):
4444
"""
45-
find a ttf font.
45+
Find the `FT2Font` matching font properties *prop*, with its size set.
4646
"""
4747
fname = font_manager.findfont(prop)
4848
font = get_font(fname)
4949
font.set_size(self.FONT_SCALE, self.DPI)
50-
5150
return font
5251

5352
def _get_hinting_flag(self):
@@ -68,11 +67,12 @@ def _get_char_id_ps(self, font, ccode):
6867
return char_id
6968

7069
def glyph_to_path(self, font, currx=0.):
71-
"""
72-
convert the ft2font glyph to vertices and codes.
73-
"""
70+
"""Convert the *font*'s current glyph to a (vertices, codes) pair."""
7471
verts, codes = font.get_path()
7572
if currx != 0.0:
73+
cbook._warn_deprecated(
74+
"3.1", name="currx", obj_type="argument",
75+
alternative="Manually translate the path vertices.")
7676
verts[:, 0] += currx
7777
return verts, codes
7878

@@ -237,8 +237,7 @@ def get_glyphs_with_font(self, font, s, glyph_map=None,
237237
def get_glyphs_mathtext(self, prop, s, glyph_map=None,
238238
return_new_glyphs_only=False):
239239
"""
240-
convert the string *s* to vertices and codes by parsing it with
241-
mathtext.
240+
Parse mathtext string *s* and convert it to a (vertices, codes) pair.
242241
"""
243242

244243
prop = prop.copy()
@@ -287,9 +286,7 @@ def get_glyphs_mathtext(self, prop, s, glyph_map=None,
287286
glyph_map_new, myrects)
288287

289288
def get_texmanager(self):
290-
"""
291-
return the :class:`matplotlib.texmanager.TexManager` instance
292-
"""
289+
"""Return a cached `~.texmanager.TexManager` instance."""
293290
if self._texmanager is None:
294291
from matplotlib.texmanager import TexManager
295292
self._texmanager = TexManager()
@@ -298,11 +295,11 @@ def get_texmanager(self):
298295
def get_glyphs_tex(self, prop, s, glyph_map=None,
299296
return_new_glyphs_only=False):
300297
"""
301-
convert the string *s* to vertices and codes using matplotlib's usetex
302-
mode.
298+
Process string *s* with usetex and convert it to a (vertices, codes)
299+
pair.
303300
"""
304301

305-
# codes are modstly borrowed from pdf backend.
302+
# Implementation mostly borrowed from pdf backend.
306303

307304
dvifile = self.get_texmanager().make_dvi(s, self.FONT_SCALE)
308305
with dviread.Dvi(dvifile, self.DPI) as dvi:
@@ -476,16 +473,12 @@ def __init__(self, xy, s, size=None, prop=None,
476473
self._interpolation_steps = _interpolation_steps
477474

478475
def set_size(self, size):
479-
"""
480-
set the size of the text
481-
"""
476+
"""Set the text size."""
482477
self._size = size
483478
self._invalid = True
484479

485480
def get_size(self):
486-
"""
487-
get the size of the text
488-
"""
481+
"""Get the text size."""
489482
return self._size
490483

491484
@property
@@ -505,12 +498,10 @@ def codes(self):
505498

506499
def _revalidate_path(self):
507500
"""
508-
update the path if necessary.
509-
510-
The path for the text is initially create with the font size
511-
of FONT_SCALE, and this path is rescaled to other size when
512-
necessary.
501+
Update the path if necessary.
513502
503+
The path for the text is initially create with the font size of
504+
`~.FONT_SCALE`, and this path is rescaled to other size when necessary.
514505
"""
515506
if self._invalid or self._cached_vertices is None:
516507
tr = Affine2D().scale(
@@ -540,16 +531,12 @@ def is_math_text(self, s):
540531

541532
def text_get_vertices_codes(self, prop, s, usetex):
542533
"""
543-
convert the string *s* to vertices and codes using the
544-
provided font property *prop*. Mostly copied from
545-
backend_svg.py.
534+
Convert string *s* to a (vertices, codes) pair using font property
535+
*prop*.
546536
"""
547-
537+
# Mostly copied from backend_svg.py.
548538
if usetex:
549-
verts, codes = text_to_path.get_text_path(prop, s, usetex=True)
539+
return text_to_path.get_text_path(prop, s, usetex=True)
550540
else:
551541
clean_line, ismath = self.is_math_text(s)
552-
verts, codes = text_to_path.get_text_path(prop, clean_line,
553-
ismath=ismath)
554-
555-
return verts, codes
542+
return text_to_path.get_text_path(prop, clean_line, ismath=ismath)

0 commit comments

Comments
 (0)
0