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

Skip to content

Commit 5f40aba

Browse files
authored
Merge pull request #15074 from timhoffm/remove-accepts
Write all ACCEPTS markers in docstrings as comments.
2 parents a2de756 + 366805d commit 5f40aba

File tree

5 files changed

+79
-49
lines changed

5 files changed

+79
-49
lines changed

lib/matplotlib/artist.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -660,11 +660,9 @@ def set_sketch_params(self, scale=None, length=None, randomness=None):
660660
The amplitude of the wiggle perpendicular to the source
661661
line, in pixels. If scale is `None`, or not provided, no
662662
sketch filter will be provided.
663-
664663
length : float, optional
665664
The length of the wiggle along the line, in pixels
666665
(default 128.0)
667-
668666
randomness : float, optional
669667
The scale factor by which the length is shrunken or
670668
expanded (default 16.0)
@@ -732,20 +730,28 @@ def set_clip_box(self, clipbox):
732730

733731
def set_clip_path(self, path, transform=None):
734732
"""
735-
Set the artist's clip path, which may be:
736-
737-
- a :class:`~matplotlib.patches.Patch` (or subclass) instance; or
738-
- a :class:`~matplotlib.path.Path` instance, in which case a
739-
:class:`~matplotlib.transforms.Transform` instance, which will be
740-
applied to the path before using it for clipping, must be provided;
741-
or
742-
- ``None``, to remove a previously set clipping path.
733+
Set the artist's clip path.
743734
744-
For efficiency, if the path happens to be an axis-aligned rectangle,
745-
this method will set the clipping box to the corresponding rectangle
746-
and set the clipping path to ``None``.
747-
748-
ACCEPTS: [(`~matplotlib.path.Path`, `.Transform`) | `.Patch` | None]
735+
Parameters
736+
----------
737+
path : `.Patch` or `.Path` or `.TransformedPath` or None
738+
The clip path. If given a `.Path`, *transform* must be provided as
739+
well. If *None*, a previously set clip path is removed.
740+
transform : `~matplotlib.transforms.Transform`, optional
741+
Only used if *path* is a `.Path`, in which case the given `.Path`
742+
is converted to a `.TransformedPath` using *transform*.
743+
744+
Notes
745+
-----
746+
For efficiency, if *path* is a `.Rectangle` this method will set the
747+
clipping box to the corresponding rectangle and set the clipping path
748+
to ``None``.
749+
750+
For technical reasons (support of ``setp``), a tuple
751+
(*path*, *transform*) is also accepted as a single positional
752+
parameter.
753+
754+
.. ACCEPTS: Patch or (Path, Transform) or None
749755
"""
750756
from matplotlib.patches import Patch, Rectangle
751757

lib/matplotlib/axes/_base.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3103,19 +3103,19 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False,
31033103
"""
31043104
Set the x-axis view limits.
31053105
3106-
.. ACCEPTS: (left: float, right: float)
3107-
31083106
Parameters
31093107
----------
3110-
left : scalar, optional
3108+
left : float, optional
31113109
The left xlim in data coordinates. Passing *None* leaves the
31123110
limit unchanged.
31133111
31143112
The left and right xlims may also be passed as the tuple
31153113
(*left*, *right*) as the first positional argument (or as
31163114
the *left* keyword argument).
31173115
3118-
right : scalar, optional
3116+
.. ACCEPTS: (bottom: float, top: float)
3117+
3118+
right : float, optional
31193119
The right xlim in data coordinates. Passing *None* leaves the
31203120
limit unchanged.
31213121
@@ -3487,19 +3487,19 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False,
34873487
"""
34883488
Set the y-axis view limits.
34893489
3490-
.. ACCEPTS: (bottom: float, top: float)
3491-
34923490
Parameters
34933491
----------
3494-
bottom : scalar, optional
3492+
bottom : float, optional
34953493
The bottom ylim in data coordinates. Passing *None* leaves the
34963494
limit unchanged.
34973495
34983496
The bottom and top ylims may also be passed as the tuple
34993497
(*bottom*, *top*) as the first positional argument (or as
35003498
the *bottom* keyword argument).
35013499
3502-
top : scalar, optional
3500+
.. ACCEPTS: (bottom: float, top: float)
3501+
3502+
top : float, optional
35033503
The top ylim in data coordinates. Passing *None* leaves the
35043504
limit unchanged.
35053505

lib/matplotlib/cm.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,17 @@ def get_clim(self):
269269

270270
def set_clim(self, vmin=None, vmax=None):
271271
"""
272-
set the norm limits for image scaling; if *vmin* is a length2
273-
sequence, interpret it as ``(vmin, vmax)`` which is used to
274-
support setp
272+
Set the norm limits for image scaling.
275273
276-
ACCEPTS: a length 2 sequence of floats; may be overridden in methods
277-
that have ``vmin`` and ``vmax`` kwargs.
274+
Parameters
275+
----------
276+
vmin, vmax : float
277+
The limits.
278+
279+
The limits may also be passed as a tuple (*vmin*, *vmax*) as a
280+
single positional argument.
281+
282+
.. ACCEPTS: (vmin: float, vmax: float)
278283
"""
279284
if vmax is None:
280285
try:

lib/matplotlib/patches.py

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -791,22 +791,27 @@ def set_xy(self, xy):
791791
self.stale = True
792792

793793
def set_width(self, w):
794-
"Set the width of the rectangle."
794+
"""Set the width of the rectangle."""
795795
self._width = w
796796
self._update_x1()
797797
self.stale = True
798798

799799
def set_height(self, h):
800-
"Set the height of the rectangle."
800+
"""Set the height of the rectangle."""
801801
self._height = h
802802
self._update_y1()
803803
self.stale = True
804804

805805
def set_bounds(self, *args):
806806
"""
807-
Set the bounds of the rectangle.
807+
Set the bounds of the rectangle as *left*, *bottom*, *width*, *height*.
808+
809+
The values may be passed as separate parameters or as a tuple::
810+
811+
set_bounds(left, bottom, width, height)
812+
set_bounds((left, bottom, width, height))
808813
809-
ACCEPTS: (left, bottom, width, height)
814+
.. ACCEPTS: (left, bottom, width, height)
810815
"""
811816
if len(args) == 1:
812817
l, b, w, h = args[0]
@@ -2403,34 +2408,48 @@ def __init__(self, xy, width, height,
24032408
self.stale = True
24042409

24052410
@docstring.dedent_interpd
2406-
def set_boxstyle(self, boxstyle=None, **kw):
2411+
def set_boxstyle(self, boxstyle=None, **kwargs):
24072412
"""
24082413
Set the box style.
24092414
2410-
*boxstyle* can be a string with boxstyle name with optional
2411-
comma-separated attributes. Alternatively, the attrs can
2412-
be provided as keywords::
2415+
Most box styles can be further configured using attributes.
2416+
Attributes from the previous box style are not reused.
24132417
2414-
set_boxstyle("round,pad=0.2")
2415-
set_boxstyle("round", pad=0.2)
2418+
Without argument (or with ``boxstyle=None``), the available box styles
2419+
are returned as a human-readable string.
24162420
2417-
Old attrs simply are forgotten.
2421+
Parameters
2422+
----------
2423+
boxstyle : str
2424+
The name of the box style. Optionally, followed by a comma and a
2425+
comma-separated list of attributes. The attributes may
2426+
alternatively be passed separately as keyword arguments.
24182427
2419-
Without argument (or with *boxstyle* = None), it returns
2420-
available box styles.
2428+
The following box styles are available:
24212429
2422-
The following boxstyles are available:
2423-
%(AvailableBoxstyles)s
2430+
%(AvailableBoxstyles)s
2431+
2432+
.. ACCEPTS: %(ListBoxstyles)s
2433+
2434+
**kwargs
2435+
Additional attributes for the box style. See the table above for
2436+
supported parameters.
2437+
2438+
Examples
2439+
--------
2440+
::
2441+
2442+
set_boxstyle("round,pad=0.2")
2443+
set_boxstyle("round", pad=0.2)
24242444
2425-
ACCEPTS: %(ListBoxstyles)s
24262445
"""
24272446
if boxstyle is None:
24282447
return BoxStyle.pprint_styles()
24292448

24302449
if isinstance(boxstyle, BoxStyle._Base) or callable(boxstyle):
24312450
self._bbox_transmuter = boxstyle
24322451
else:
2433-
self._bbox_transmuter = BoxStyle(boxstyle, **kw)
2452+
self._bbox_transmuter = BoxStyle(boxstyle, **kwargs)
24342453
self.stale = True
24352454

24362455
def set_mutation_scale(self, scale):

lib/matplotlib/spines.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -538,17 +538,17 @@ def set_bounds(self, low=None, high=None):
538538
"""
539539
Set the spine bounds.
540540
541-
.. ACCEPTS: (low: float, high: float)
542-
543541
Parameters
544542
----------
545-
low : scalar, optional
543+
low : float or None, optional
546544
The lower spine bound. Passing *None* leaves the limit unchanged.
547545
548546
The bounds may also be passed as the tuple (*low*, *high*) as the
549547
first positional argument.
550548
551-
high : scalar, optional
549+
.. ACCEPTS: (low: float, high: float)
550+
551+
high : float or None, optional
552552
The higher spine bound. Passing *None* leaves the limit unchanged.
553553
"""
554554
if self.spine_type == 'circle':

0 commit comments

Comments
 (0)