10000 Fix pydocstyle D208 · matplotlib/matplotlib@b6394c2 · GitHub
[go: up one dir, main page]

Skip to content

Commit b6394c2

Browse files
committed
Fix pydocstyle D208
1 parent efafb6c commit b6394c2

File tree

12 files changed

+68
-42
lines changed

12 files changed

+68
-42
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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,21 +1251,24 @@ def interactive(b):
12511251
"""
12521252
Set interactive mode to boolean b.
12531253
1254-
If b is True, then draw after every plotting command, e.g., after xlabel
1254+
If b is True, then draw after every plotting command, e.g., after xlabel.
12551255
"""
12561256
rcParams['interactive'] = b
12571257

12581258

12591259
def is_interactive():
1260-
'Return true if plot mode is interactive'
1260+
"""Return whether plot mode is interactive."""
12611261
return rcParams['interactive']
12621262

12631263

12641264
@cbook.deprecated("3.1", alternative="rcParams['tk.window_focus']")
12651265
def tk_window_focus():
1266-
"""Return true if focus maintenance under TkAgg on win32 is on.
1267-
This currently works only for python.exe and IPython.exe.
1268-
Both IDLE and Pythonwin.exe fail badly when tk_window_focus is on."""
1266+
"""
1267+
Return true if focus maintenance under TkAgg on win32 is on.
1268+
1269+
This currently works only for python.exe and IPython.exe.
1270+
Both IDLE and Pythonwin.exe fail badly when tk_window_focus is on.
1271+
"""
12691272
if rcParams['backend'] != 'TkAgg':
12701273
return False
12711274
return rcParams['tk.window_focus']

lib/matplotlib/colors.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,16 +613,20 @@ 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 color to be used for low out-of-range values.
618+
619+
The under color is only used when ``norm.clip = False``.
618620
"""
619621
self._rgba_under = to_rgba(color, alpha)
620622
if self._isinit:
621623
self._set_extremes()
622624

623625
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
626+
"""
627+
Set color to be used for high out-of-range values.
628+
629+
The over color is only used when ``norm.clip = False``.
626630
"""
627631
self._rgba_over = to_rgba(color, alpha)
628632
if self._isinit:

lib/matplotlib/dates.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,14 @@ def __init__(self, fmt):
325325
self.fmt = fmt
326326

327327
def __call__(self, s):
328-
"""s : string to be converted
329-
return value: a date2num float
328+
"""
329+
Parameters
330+
----------
331+
s : str
332+
333+
Returns
334+
-------
335+
num : date2num float
330336
"""
331337
return date2num(datetime.datetime(*time.strptime(s, self.fmt)[:6]))
332338

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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
@@ -124,10 +124,13 @@ def set_patch_line(self):
124124

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

lib/matplotlib/testing/jpl_units/EpochConverter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
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

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: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,26 @@
66

77

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

1618
def __call__(self, x, pos=None):
17-
'Return the format for tick val x at position pos'
19+
"""Return the format for tick val *x* at position *pos*."""
1820
if len(self.locs) == 0:
1921
return ''
2022
else:
2123
return '{:.12}'.format(x)
2224

2325
def format_data_short(self, value):
24-
"Return the value formatted in 'short' format."
26+
"""Return *value* formatted in 'short' format."""
2527
return '{:.12}'.format(value)
2628

2729
def format_data(self, value):
28-
"Return the value formatted into a string."
30+
"""Return *value* formatted into a string."""
2931
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
@@ -135,8 +135,10 @@ class SimpleArrow(_Base):
135135

136136
def __init__(self, size=1):
137137
"""
138-
*size*
139-
size of the arrow as a fraction of the ticklabel size.
138+
Parameters
139+
----------
140+
size : float
141+
Size of the arrow as a fraction of the ticklabel size.
140142
"""
141143

142144
self.size = size

0 commit comments

Comments
 (0)
0