8000 Merge pull request #14496 from timhoffm/fix-pydocstyle-D208 · matplotlib/matplotlib@3530d43 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3530d43

Browse files
authored
Merge pull request #14496 from timhoffm/fix-pydocstyle-D208
Fix pydocstyle D208 (Docstring is over-indented)
2 parents 03fc2ef + e76c94e commit 3530d43

File tree

12 files changed

+85
-59
lines changed

12 files changed

+85
-59
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ignore =
1212
N801, N802, N803, N806, N812,
1313
# pydocstyle
1414
D100, D101, D102, D103, D104, D105, D106, D107,
15-
D200, D202, D203, D204, D205, D207, D208, D209, D212, D213,
15+
D200, D202, D203, D204, D205, D207, D209, D212, D213,
1616
D300, D301
1717
D400, D401, D402, D403, D413,
1818

lib/matplotlib/__init__.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,23 +1264,24 @@ def get_backend():
12641264

12651265
def interactive(b):
12661266
"""
1267-
Set interactive mode to boolean b.
1268-
1269-
If b is True, then draw after every plotting command, e.g., after xlabel
1267+
Set whether to redraw after every plotting command (e.g. `.pyplot.xlabel`).
12701268
"""
12711269
rcParams['interactive'] = b
12721270

12731271

12741272
def is_interactive():
1275-
'Return true if plot mode is interactive'
1273+
"""Return whether to redraw after every plotting command."""
12761274
return rcParams['interactive']
12771275

12781276

12791277
@cbook.deprecated("3.1", alternative="rcParams['tk.window_focus']")
12801278
def tk_window_focus():
1281-
"""Return true if focus maintenance under TkAgg on win32 is on.
1282-
This currently works only for python.exe and IPython.exe.
1283-
Both IDLE and Pythonwin.exe fail badly when tk_window_focus is on."""
1279+
"""
1280+
Return true if focus maintenance under TkAgg on win32 is on.
1281+
1282+
This currently works only for python.exe and IPython.exe.
1283+
Both IDLE and Pythonwin.exe fail badly when tk_window_focus is on.
1284+
"""
12841285
if rcParams['backend'] != 'TkAgg':
12851286
return False
12861287
return rcParams['tk.window_focus']

lib/matplotlib/colors.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,16 +613,16 @@ def set_bad(self, color='k', alpha=None):
613613
self._set_extremes()
614614

615615
def set_under(self, color='k', alpha=None):
616-
"""Set color to be used for low out-of-range values.
617-
Requires norm.clip = False
616+
"""
617+
Set the color for low out-of-range values when ``norm.clip = False``.
618618
"""
619619
self._rgba_under = to_rgba(color, alpha)
620620
if self._isinit:
621621
self._set_extremes()
622622

623623
def set_over(self, color='k', alpha=None):
624-
"""Set color to be used for high out-of-range values.
625-
Requires norm.clip = False
624+
"""
625+
Set the color for high out-of-range values when ``norm.clip = False``.
626626
"""
627627
self._rgba_over = to_rgba(color, alpha)
628628
if self._isinit:

lib/matplotlib/dates.py

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,22 @@ class strpdate2num:
321321
you know the date format string of the date you are parsing.
322322
"""
323323
def __init__(self, fmt):
324-
"""fmt: any valid strptime format is supported"""
324+
"""
325+
Parameters
326+
----------
327+
fmt : any valid strptime format
328+
"""
325329
self.fmt = fmt
326330

327331
def __call__(self, s):
328-
"""s : string to be converted
329-
return value: a date2num float
332+
"""
333+
Parameters
334+
----------
335+
s : str
336+
337+
Returns
338+
-------
339+
date2num float
330340
"""
331341
return date2num(datetime.datetime(*time.strptime(s, self.fmt)[:6]))
332342

@@ -341,19 +351,24 @@ class bytespdate2num(strpdate2num):
341351
"""
342352
def __init__(self, fmt, encoding='utf-8'):
343353
"""
344-
Args:
345-
fmt: any valid strptime format is supported
346-
encoding: encoding to use on byte input (default: 'utf-8')
354+
Parameters
355+
----------
356+
fmt : any valid strptime format
357+
encoding : str
358+
Encoding to use on byte input.
347359
"""
348360
super().__init__(fmt)
349361
self.encoding = encoding
350362

351363
def __call__(self, b):
352364
"""
353-
Args:
354-
b: byte input to be converted
355-
Returns:
356-
A date2num float
365+
Parameters
366+
----------
367+
b : bytes
368+
369+
Returns
370+
-------
371+
date2num float
357372
"""
358373
s = b.decode(self.encoding)
359374
return super().__call__(s)

lib/matplotlib/patches.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -709,10 +709,13 @@ def get_path(self):
709709
return Path.unit_rectangle()
710710

711711
def _update_patch_transform(self):
712-
"""NOTE: This cannot be called until after this has been added
713-
to an Axes, otherwise unit conversion will fail. This
714-
makes it very important to call the accessor method and
715-
not directly access the transformation member variable.
712+
"""
713+
Notes
714+
-----
715+
This cannot be called until after this has been added to an Axes,
716+
otherwise unit conversion will fail. This makes it very important to
717+
call the accessor method and not directly access the transformation
718+
member variable.
716719
"""
717720
x0, y0, x1, y1 = self._convert_units()
718721
bbox = transforms.Bbox.from_extents(x0, y0, x1, y1)
@@ -1364,10 +1367,13 @@ def __init__(self, xy, width, height, angle=0, **kwargs):
13641367
self._patch_transform = transforms.IdentityTransform()
13651368

13661369
def _recompute_transform(self):
1367-
"""NOTE: This cannot be called until after this has been added
1368-
to an Axes, otherwise unit conversion will fail. This
1369-
makes it very important to call the accessor method and
1370-
not directly access the transformation member variable.
1370+
"""
1371+
Notes
1372+
-----
1373+
This cannot be called until after this has been added to an Axes,
1374+
otherwise unit conversion will fail. This makes it very important to
1375+
call the accessor method and not directly access the transformation
1376+
member variable.
13711377
"""
13721378
center = (self.convert_xunits(self._center[0]),
13731379
self.convert_yunits(self._center[1]))
@@ -1941,10 +1947,10 @@ class Square(_Base):
19411947

19421948
def __init__(self, pad=0.3):
19431949
"""
1944-
*pad*
1945-
amount of padding
1950+
Parameters
1951+
----------
1952+
pad : float
19461953
"""
1947-
19481954
self.pad = pad
19491955
super().__init__()
19501956

lib/matplotlib/pyplot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def show(*args, **kw):
272272

273273

274274
def isinteractive():
275-
"""Return the status of interactive mode."""
275+
"""Return whether to redraw after every plotting command."""
276276
return matplotlib.is_interactive()
277277

278278

@@ -1007,7 +1007,7 @@ def subplot(*args, **kwargs):
10071007
10081008
# add ax2 to the figure again
10091009
plt.subplot(ax2)
1010-
"""
1010+
"""
10111011

10121012
# if subplot called without arguments, create subplot(1,1,1)
10131013
if len(args) == 0:

lib/matplotlib/spines.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,13 @@ def set_patch_line(self):
122122

123123
# Behavior copied from mpatches.Ellipse:
124124
def _recompute_transform(self):
125-
"""NOTE: This cannot be called until after this has been added
126-
to an Axes, otherwise unit conversion will fail. This
127-
makes it very important to call the accessor method and
128-
not directly access the transformation member variable.
125+
"""
126+
Notes
127+
-----
128+
This cannot be called until after this has been added to an Axes,
129+
otherwise unit conversion will fail. This makes it very important to
130+
call the accessor method and not directly access the transformation
131+
member variable.
129132
"""
130133
assert self._patch_type in ('arc', 'circle')
131134
center = (self.convert_xunits(self._center[0]),

lib/matplotlib/testing/jpl_units/EpochConverter.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010

1111

1212
class EpochConverter(units.ConversionInterface):
13-
""": A matplotlib converter class. Provides matplotlib conversion
14-
functionality for Monte Epoch and Duration classes.
13+
"""
14+
Provides Matplotlib conversion functionality for Monte Epoch and Duration
15+
classes.
1516
"""
1617

1718
# julian date reference for "Jan 1, 0001" minus 1 day because
18-
# matplotlib really wants "Jan 0, 0001"
19+
# Matplotlib really wants "Jan 0, 0001"
1920
jdRef = 1721425.5 - 1
2021

2122
@staticmethod
@@ -26,7 +27,7 @@ def axisinfo(unit, axis):
2627
- unit The units to use for a axis with Epoch data.
2728
2829
= RETURN VALUE
29-
- Returns a matplotlib AxisInfo data structure that contains
30+
- Returns a AxisInfo data structure that contains
3031
minor/major formatters, major/minor locators, and default
3132
label information.
3233
"""
@@ -38,11 +39,11 @@ def axisinfo(unit, axis):
3839

3940
@staticmethod
4041
def float2epoch(value, unit):
41-
""": Convert a matplotlib floating-point date into an Epoch of the
42+
""": Convert a Matplotlib floating-point date into an Epoch of the
4243
specified units.
4344
4445
= INPUT VARIABLES
45-
- value The matplotlib floating-point date.
46+
- value The Matplotlib floating-point date.
4647
- unit The unit system to use for the Epoch.
4748
4849
= RETURN VALUE

lib/matplotlib/testing/jpl_units/UnitDblConverter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def rad_fn(x, pos=None):
2828

2929

3030
class UnitDblConverter(units.ConversionInterface):
31-
""": A matplotlib converter class. Provides matplotlib conversion
32-
functionality for the Monte UnitDbl class.
31+
"""
32+
Provides Matplotlib conversion functionality for the Monte UnitDbl class.
3333
"""
3434
# default for plotting
3535
defaults = {

lib/matplotlib/testing/jpl_units/UnitDblFormatter.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,23 @@
66
10000
77

88
class UnitDblFormatter(ticker.ScalarFormatter):
9-
"""The formatter for UnitDbl data types. This allows for formatting
10-
with the unit string.
119
"""
12-
def __init__(self, *args, **kwargs):
13-
'The arguments are identical to matplotlib.ticker.ScalarFormatter.'
14-
ticker.ScalarFormatter.__init__(self, *args, **kwargs)
10+
The formatter for UnitDbl data types.
11+
12+
This allows for formatting with the unit string.
13+
"""
1514

1615
def __call__(self, x, pos=None):
17-
'Return the format for tick val x at position pos'
16+
# docstring inherited
1817
if len(self.locs) == 0:
1918
return ''
2019
else:
2120
return '{:.12}'.format(x)
2221

2322
def format_data_short(self, value):
24-
"Return the value formatted in 'short' format."
23+
# docstring inherited
2524
return '{:.12}'.format(value)
2625

2726
def format_data(self, value):
28-
"Return the value formatted into a string."
27+
# docstring inherited
2928
return '{:.12}'.format(value)

lib/matplotlib/ticker.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,8 +1512,7 @@ def __call__(self):
15121512
raise NotImplementedError('Derived must override')
15131513

15141514
def raise_if_exceeds(self, locs):
1515-
"""raise a RuntimeError if Locator attempts to create more than
1516-
MAXTICKS locs"""
1515+
"""Raise a RuntimeError if ``len(locs) > self.MAXTICKS``."""
15171516
if len(locs) >= self.MAXTICKS:
15181517
raise RuntimeError("Locator attempting to generate {} ticks from "
15191518
"{} to {}: exceeds Locator.MAXTICKS".format(

lib/mpl_toolkits/axisartist/axisline_style.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ class SimpleArrow(_Base):
130130

131131
def __init__(self, size=1):
132132
"""
133-
*size*
134-
size of the arrow as a fraction of the ticklabel size.
133+
Parameters
134+
----------
135+
size : float
136+
Size of the arrow as a fraction of the ticklabel size.
135137
"""
136138

137139
self.size = size

0 commit comments

Comments
 (0)
0