Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 666e6cc

Browse files
authored
Merge pull request #18707 from timhoffm/whether
Use "Return whether ..." docstring for functions returning bool
2 parents fc35fc8 + 9bcaf7c commit 666e6cc

File tree

9 files changed

+18
-17
lines changed

9 files changed

+18
-17
lines changed

examples/misc/custom_projection.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,14 +338,16 @@ def get_data_ratio(self):
338338
# so we override all of the following methods to disable it.
339339
def can_zoom(self):
340340
"""
341-
Return *True* if this axes supports the zoom box button functionality.
341+
Return whether this axes supports the zoom box button functionality.
342+
342343
This axes object does not support interactive zoom box.
343344
"""
344345
return False
345346

346347
def can_pan(self):
347348
"""
348-
Return *True* if this axes supports the pan/zoom button functionality.
349+
Return whether this axes supports the pan/zoom button functionality.
350+
349351
This axes object does not support interactive pan/zoom.
350352
"""
351353
return False

lib/matplotlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ def rc_params(fail_on_error=False):
711711

712712

713713
def is_url(filename):
714-
"""Return True if string is an http, ftp, or file URL path."""
714+
"""Return whether *filename* is an http, https, ftp, or file URL path."""
715715
return URL_REGEX.match(filename) is not None
716716

717717

lib/matplotlib/artist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def remove(self):
188188
# TODO: add legend support
189189

190190
def have_units(self):
191-
"""Return *True* if units are set on any axis."""
191+
"""Return whether units are set on any axis."""
192192
ax = self.axes
193193
return ax and any(axis.have_units() for axis in ax._get_axis_list())
194194

lib/matplotlib/axes/_base.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,7 +1931,7 @@ def _gci(self):
19311931

19321932
def has_data(self):
19331933
"""
1934-
Return *True* if any artists have been added to axes.
1934+
Return whether any artists have been added to the axes.
19351935
19361936
This should not be used to determine whether the *dataLim*
19371937
need to be updated, and may not actually be useful for
@@ -2287,8 +2287,7 @@ def _process_unit_info(self, datasets=None, kwargs=None, *, convert=True):
22872287

22882288
def in_axes(self, mouseevent):
22892289
"""
2290-
Return *True* if the given *mouseevent* (in display coords)
2291-
is in the Axes
2290+
Return whether the given event (in display coords) is in the Axes.
22922291
"""
22932292
return self.patch.contains(mouseevent)[0]
22942293

@@ -3935,13 +3934,13 @@ def minorticks_off(self):
39353934

39363935
def can_zoom(self):
39373936
"""
3938-
Return *True* if this axes supports the zoom box button functionality.
3937+
Return whether this axes supports the zoom box button functionality.
39393938
"""
39403939
return True
39413940

39423941
def can_pan(self):
39433942
"""
3944-
Return *True* if this axes supports any pan/zoom button functionality.
3943+
Return whether this axes supports any pan/zoom button functionality.
39453944
"""
39463945
return True
39473946

lib/matplotlib/contour.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def print_label(self, linecontour, labelwidth):
208208
or (np.ptp(linecontour, axis=0) > 1.2 * labelwidth).any())
209209

210210
def too_close(self, x, y, lw):
211-
"""Return *True* if a label is already near this location."""
211+
"""Return whether a label is already near this location."""
212212
thresh = (1.2 * lw) ** 2
213213
return any((x - loc[0]) ** 2 + (y - loc[1]) ** 2 < thresh
214214
for loc in self.labelXYs)

lib/matplotlib/projections/geo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,15 @@ def get_data_ratio(self):
202202

203203
def can_zoom(self):
204204
"""
205-
Return *True* if this axes supports the zoom box button functionality.
205+
Return whether this axes supports the zoom box button functionality.
206206
207207
This axes object does not support interactive zoom box.
208208
"""
209209
return False
210210

211211
def can_pan(self):
212212
"""
213-
Return *True* if this axes supports the pan/zoom button functionality.
213+
Return whether this axes supports the pan/zoom button functionality.
214214
215215
This axes object does not support interactive pan/zoom.
216216
"""

lib/matplotlib/projections/polar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,15 +1420,15 @@ def get_data_ratio(self):
14201420

14211421
def can_zoom(self):
14221422
"""
1423-
Return *True* if this axes supports the zoom box button functionality.
1423+
Return whether this axes supports the zoom box button functionality.
14241424
14251425
Polar axes do not support zoom boxes.
14261426
"""
14271427
return False
14281428

14291429
def can_pan(self):
14301430
"""
1431-
Return *True* if this axes supports the pan/zoom button functionality.
1431+
Return whether this axes supports the pan/zoom button functionality.
14321432
14331433
For polar axes, this is slightly misleading. Both panning and
14341434
zooming are performed by the same button. Panning is performed

lib/matplotlib/streamplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def shape(self):
355355
return self.ny, self.nx
356356

357357
def within_grid(self, xi, yi):
358-
"""Return True if point is a valid index of grid."""
358+
"""Return whether (*xi*, *yi*) is a valid index of the grid."""
359359
# Note that xi/yi can be floats; so, for example, we can't simply check
360360
# `xi < self.nx` since *xi* can be `self.nx - 1 < xi < self.nx`
361361
return 0 <= xi <= self.nx - 1 and 0 <= yi <= self.ny - 1

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,15 +1061,15 @@ def disable_mouse_rotation(self):
10611061

10621062
def can_zoom(self):
10631063
"""
1064-
Return *True* if this axes supports the zoom box button functionality.
1064+
Return whether this axes supports the zoom box button functionality.
10651065
10661066
3D axes objects do not use the zoom box button.
10671067
"""
10681068
return False
10691069

10701070
def can_pan(self):
10711071
"""
1072-
Return *True* if this axes supports the pan/zoom button functionality.
1072+
Return whether this axes supports the pan/zoom button functionality.
10731073
10741074
3D axes objects do not use the pan/zoom button.
10751075
"""

0 commit comments

Comments
 (0)