10000 numpydocification. · matplotlib/matplotlib@5fa0072 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5fa0072

Browse files
committed
numpydocification.
1 parent f58c933 commit 5fa0072

File tree

13 files changed

+186
-198
lines changed

13 files changed

+186
-198
lines changed

lib/matplotlib/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ def _create_tmp_config_or_cache_dir():
522522

523523
def _get_xdg_config_dir():
524524
"""
525-
Returns the XDG configuration directory, according to the `XDG
525+
Return the XDG configuration directory, according to the `XDG
526526
base directory spec
527527
<http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_.
528528
"""
@@ -534,7 +534,7 @@ def _get_xdg_config_dir():
534534

535535
def _get_xdg_cache_dir():
536536
"""
537-
Returns the XDG cache directory, according to the `XDG
537+
Return the XDG cache directory, according to the `XDG
538538
base directory spec
539539
<http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_.
540540
"""

lib/matplotlib/animation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ def grab_frame(self, **savefig_kwargs):
384384
dpi=self.dpi, **savefig_kwargs)
385385

386386
def _frame_sink(self):
387-
'''Returns the place to which frames should be written.'''
387+
'''Return the place to which frames should be written.'''
388388
return self._proc.stdin
389389

390390
def _args(self):
@@ -413,7 +413,7 @@ def cleanup(self):
413413
@classmethod
414414
def bin_path(cls):
415415
'''
416-
Returns the binary path to the commandline tool used by a specific
416+
Return the binary path to the commandline tool used by a specific
417417
subclass. This is a class method so that the tool can be looked for
418418
before making a particular MovieWriter subclass available.
419419
'''

lib/matplotlib/artist.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,10 +1562,8 @@ def setp(obj, *args, **kwargs):
15621562

15631563
def kwdoc(artist):
15641564
r"""
1565-
Inspect an `~matplotlib.artist.Artist` class and return
1566-
information about its settable properties and their current values.
1567-
1568-
It use the class `.ArtistInspector`.
1565+
Inspect an `~matplotlib.artist.Artist` class (using `.ArtistInspector`) and
1566+
return information about its settable properties and their current values.
15691567
15701568
Parameters
15711569
----------
@@ -1574,11 +1572,9 @@ def kwdoc(artist):
15741572
Returns
15751573
-------
15761574
string
1577-
Returns a string with a list or rst table with the settable properties
1578-
of the *artist*. The formatting depends on the value of
1579-
:rc:`docstring.hardcopy`. False result in a list that is intended for
1580-
easy reading as a docstring and True result in a rst table intended
1581-
for rendering the documentation with sphinx.
1575+
The settable properties of *artist*, as plain text if
1576+
:rc:`docstring.hardcopy` is False and as a rst table (intended for
1577+
use in Sphinx) if it is True.
15821578
"""
15831579
hardcopy = matplotlib.rcParams['docstring.hardcopy']
15841580
if hardcopy:

lib/matplotlib/axes/_base.py

Lines changed: 94 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -682,23 +682,23 @@ def get_xaxis_transform(self, which='grid'):
682682

683683
def get_xaxis_text1_transform(self, pad_points):
684684
"""
685-
Get the transformation used for drawing x-axis labels, which
686-
will add the given amount of padding (in points) between the
687-
axes and the label. The x-direction is in data coordinates
688-
and the y-direction is in axis coordinates. Returns a
689-
3-tuple of the form::
690-
691-
(transform, valign, halign)
692-
693-
where *valign* and *halign* are requested alignments for the
694-
text.
695-
696-
.. note::
685+
Returns
686+
-------
687+
transform : Transform
688+
The transform used for drawing x-axis labels, which will add
689+
*pad_points* of padding (in points) between the axes and the label.
690+
The x-direction is in data coordinates and the y-direction is in
691+
axis corrdinates
692+
valign : {'center', 'top', 'bottom', 'baseline', 'center_baseline'}
693+
The text vertical alignment.
694+
halign : {'center', 'left', 'right'}
695+
The text horizontal alignment.
697696
698-
This transformation is primarily used by the
699-
`~matplotlib.axis.Axis` class, and is meant to be
700-
overridden by new kinds of projections that may need to
701-
place axis elements in different locations.
697+
Notes
698+
-----
699+
This transformation is primarily used by the `~matplotlib.axis.Axis`
700+
class, and is meant to be overridden by new kinds of projections that
701+
may need to place axis elements in different locations.
702702
"""
703703
labels_align = rcParams["xtick.alignment"]
704704
return (self.get_xaxis_transform(which='tick1') +
@@ -708,23 +708,23 @@ def get_xaxis_text1_transform(self, pad_points):
708708

709709
def get_xaxis_text2_transform(self, pad_points):
710710
"""
711-
Get the transformation used for drawing the secondary x-axis
712-
labels, which will add the given amount of padding (in points)
713-
between the axes and the label. The x-direction is in data
714-
coordinates and the y-direction is in axis coordinates.
715-
Returns a 3-tuple of the form::
716-
717-
(transform, valign, halign)
718-
719-
where *valign* and *halign* are requested alignments for the
720-
text.
721-
722-
.. note::
711+
Returns
712+
-------
713+
transform : Transform
714+
The transform used for drawing secondary x-axis labels, which will
715+
add *pad_points* of padding (in points) between the axes and the
716+
label. The x-direction is in data coordinates and the y-direction
717+
is in axis corrdinates
718+
valign : {'center', 'top', 'bottom', 'baseline', 'center_baseline'}
719+
The text vertical alignment.
720+
halign : {'center', 'left', 'right'}
721+
The text horizontal alignment.
723722
724-
This transformation is primarily used by the
725-
`~matplotlib.axis.Axis` class, and is meant to be
726-
overridden by new kinds of projections that may need to
727-
place axis elements in different locations.
723+
Notes
724+
-----
725+
This transformation is primarily used by the `~matplotlib.axis.Axis`
726+
class, and is meant to be overridden by new kinds of projections that
727+
may need to place axis elements in different locations.
728728
"""
729729
labels_align = rcParams["xtick.alignment"]
730730
return (self.get_xaxis_transform(which='tick2') +
@@ -758,23 +758,23 @@ def get_yaxis_transform(self, which='grid'):
758758

759759
def get_yaxis_text1_transform(self, pad_points):
760760
"""
761-
Get the transformation used for drawing y-axis labels, which
762-
will add the given amount of padding (in points) between the
763-
axes and the label. The x-direction is in axis coordinates
764-
and the y-direction is in data coordinates. Returns a 3-tuple
765-
of the form::
766-
767-
(transform, valign, halign)
768-
769-
where *valign* and *halign* are requested alignments for the
770-
text.
771-
772-
.. note::
761+
Returns
762+
-------
763+
transform : Transform
764+
The transform used for drawing y-axis labels, which will add
765+
*pad_points* of padding (in points) between the axes and the label.
766+
The x-direction is in axis coordinates and the y-direction is in
767+
data corrdinates
768+
valign : {'center', 'top', 'bottom', 'baseline', 'center_baseline'}
769+
The text vertical alignment.
770+
halign : {'center', 'left', 'right'}
771+
The text horizontal alignment.
773772
774-
This transformation is primarily used by the
775-
`~matplotlib.axis.Axis` class, and is meant to be
776-
overridden by new kinds of projections that may need to
777-
place axis elements in different locations.
773+
Notes
774+
-----
775+
This transformation is primarily used by the `~matplotlib.axis.Axis`
776+
class, and is meant to be overridden by new kinds of projections that
777+
may need to place axis elements in different locations.
778778
"""
779779
labels_align = rcParams["ytick.alignment"]
780780
return (self.get_yaxis_transform(which='tick1') +
@@ -784,23 +784,23 @@ def get_yaxis_text1_transform(self, pad_points):
784784

785785
def get_yaxis_text2_transform(self, pad_points):
786786
"""
787-
Get the transformation used for drawing the secondary y-axis
788-
labels, which will add the given amount of padding (in points)
789-
between the axes and the label. The x-direction is in axis
790-
coordinates and the y-direction is in data coordinates.
791-
Returns a 3-tuple of the form::
792-
793-
(transform, valign, halign)
794-
795-
where *valign* and *halign* are requested alignments for the
796-
text.
797-
798-
.. note::
787+
Returns
788+
-------
789+
transform : Transform
790+
The transform used for drawing secondart y-axis labels, which will
791+
add *pad_points* of padding (in points) between the axes and the
792+
label. The x-direction is in axis coordinates and the y-direction
793+
is in data corrdinates
794+
valign : {'center', 'top', 'bottom', 'baseline', 'center_baseline'}
795+
The text vertical alignment.
796+
halign : {'center', 'left', 'right'}
797+
The text horizontal alignment.
799798
800-
This transformation is primarily used by the
801-
`~matplotlib.axis.Axis` class, and is meant to be
802-
overridden by new kinds of projections that may need to
803-
place axis elements in different locations.
799+
Notes
800+
-----
801+
This transformation is primarily used by the `~matplotlib.axis.Axis`
802+
class, and is meant to be overridden by new kinds of projections that
803+
may need to place axis elements in different locations.
804804
"""
805805
labels_align = rcParams["ytick.alignment"]
806806
return (self.get_yaxis_transform(which='tick2') +
@@ -923,33 +923,35 @@ def _set_artist_props(self, a):
923923

924924
def _gen_axes_patch(self):
925925
"""
926-
Returns the patch used to draw the background of the axes. It
927-
is also used as the clipping path for any data elements on the
928-
axes.
929-
930-
In the standard axes, this is a rectangle, but in other
931-
projections it may not be.
932-
933-
.. note::
926+
Returns
927+
-------
928+
Patch
929+
The patch used to draw the background of the axes. It is also used
930+
as the clipping path for any data elements on the axes.
934931
935-
Intended to be overridden by new projection types.
932+
In the standard axes, this is a rectangle, but in other projections
933+
it may not be.
936934
935+
Notes
936+
-----
937+
Intended to be overridden by new projection types.
937938
"""
938939
return mpatches.Rectangle((0.0, 0.0), 1.0, 1.0)
939940

940941
def _gen_axes_spines(self, locations=None, offset=0.0, units='inches'):
941942
"""
942-
Returns a dict whose keys are spine names and values are
943-
Line2D or Patch instances. Each element is used to draw a
944-
spine of the axes.
945-
946-
In the standard axes, this is a single line segment, but in
947-
other projections it may not be.
943+
Returns
944+
-------
945+
dict
946+
Mapping of spine names to `Line2D` or `Patch` instances that are
947+
used to draw axes spines.
948948
949-
.. note::
950-
951-
Intended to be overridden by new projection types.
949+
In the standard axes, spines are single line segments, but in other
950+
projections they may not be.
952951
952+
Notes
953+
-----
954+
Intended to be overridden by new projection types.
953955
"""
954956
return OrderedDict((side, mspines.Spine.linear_spine(self, side))
955957
for side in ['left', 'right', 'bottom', 'top'])
@@ -1410,10 +1412,11 @@ def set_anchor(self, anchor, share=False):
14101412

14111413
def get_data_ratio(self):
14121414
"""
1413-
Returns the aspect ratio of the raw data.
1415+
Return the aspect ratio of the raw data.
14141416
1415-
This method is intended to be overridden by new projection
1416-
types.
1417+
Notes
1418+
-----
1419+
This method is intended to be overridden by new projection types.
14171420
"""
14181421
xmin, xmax = self.get_xbound()
14191422
ymin, ymax = self.get_ybound()
@@ -1425,8 +1428,11 @@ def get_data_ratio(self):
14251428

14261429
def get_data_ratio_log(self):
14271430
"""
1428-
Returns the aspect ratio of the raw data in log scale.
1429-
Will be used when both axis scales are in log.
1431+
Return the aspect ratio of the raw data in log scale.
1432+
1433+
Notes
1434+
-----
1435+
Will be used when both axis are in log scale.
14301436
"""
14311437
xmin, xmax = self.get_xbound()
14321438
ymin, ymax = self.get_ybound()
@@ -4244,7 +4250,7 @@ def contains(self, mouseevent):
42444250

42454251
def contains_point(self, point):
42464252
"""
4247-
Returns whether *point* (pair of pixel coordinates) is inside the axes
4253+
Return whether *point* (pair of pixel coordinates) is inside the axes
42484254
patch.
42494255
"""
42504256
return self.patch.contains_point(point, radius=1.0)

lib/matplotlib/cbook/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def is_writable_file_like(obj):
368368

369369
def file_requires_unicode(x):
370370
"""
371-
Returns whether the given writable file-like object requires Unicode to be
371+
Return whether the given writable file-like object requires Unicode to be
372372
written to it.
373373
"""
374374
try:
@@ -494,7 +494,7 @@ def get_sample_data(fname, asfileobj=True):
494494

495495
def flatten(seq, scalarp=is_scalar_or_string):
496496
"""
497-
Returns a generator of flattened nested containers
497+
Return a generator of flattened nested containers
498498
499499
For example:
500500
@@ -943,7 +943,7 @@ def join(self, a, *args):
943943
self.clean()
944944

945945
def joined(self, a, b):
946-
"""Returns True if *a* and *b* are members of the same set."""
946+
"""Return whether *a* and *b* are members of the same set."""
947947
self.clean()
948948
return (self._mapping.get(weakref.ref(a), object())
949949
is self._mapping.get(weakref.ref(b)))
@@ -966,7 +966,7 @@ def __iter__(self):
966966
yield [x() for x in group]
967967

968968
def get_siblings(self, a):
969-
"""Returns all of the items joined with *a*, including itself."""
969+
"""Return all of the items joined with *a*, including itself."""
970970
self.clean()
971971
siblings = self._mapping.get(weakref.ref(a), [weakref.ref(a)])
972972
return [x() for x in siblings]

lib/matplotlib/colorbar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,11 +460,11 @@ def __init__(self, ax, cmap=None,
460460
self.draw_all()
461461

462462
def _extend_lower(self):
463-
"""Returns whether the lower limit is open ended."""
463+
"""Return whether the lower limit is open ended."""
464464
return self.extend in ('both', 'min')
465465

466466
def _extend_upper(self):
467-
"""Returns whether the uper limit is open ended."""
467+
"""Return whether the uper limit is open ended."""
468468
return self.extend in ('both', 'max')
469469

470470
def _patch_ax(self):

lib/matplotlib/font_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,9 +1308,9 @@ def _findfont_cached(self, prop, fontext, directory, fallback_to_default,
13081308
@lru_cache()
13091309
def is_opentype_cff_font(filename):
13101310
"""
1311-
Returns True if the given font is a Postscript Compact Font Format
1312-
Font embedded in an OpenType wrapper. Used by the PostScript and
1313-
PDF backends that can not subset these fonts.
1311+
Return whether the given font is a Postscript Compact Font Format Font
1312+
embedded in an OpenType wrapper. Used by the PostScript and PDF backends
1313+
that can not subset these fonts.
13141314
"""
13151315
if os.path.splitext(filename)[1].lower() == '.otf':
13161316
with open(filename, 'rb') as fd:

lib/matplotlib/lines.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,11 @@ def _scale_dashes(offset, dashes, lw):
7272

7373
def segment_hits(cx, cy, x, y, radius):
7474
"""
75-
Determine if any line segments are within radius of a
76-
point. Returns the list of line segments that are within that
77-
radius.
75+
Return the indices of the segments in the polyline with coordinates (*cx*,
76+
*cy*) that are within a distance *radius* of the point (*x*, *y*).
7877
"""
7978
# Process single points specially
80-
if len(x) < 2:
79+
if len(x) <= 1:
8180
res, = np.nonzero((cx - x) ** 2 + (cy - y) ** 2 <= radius ** 2)
8281
return res
8382

0 commit comments

Comments
 (0)
0