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

Skip to content

Commit 02de05b

Browse files
committed
Use str instead of string as type in docstrings
1 parent 1636987 commit 02de05b

31 files changed

+110
-102
lines changed

lib/matplotlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,7 @@ def func(ax, *args, **kwargs): ...
14791479
replace_names : list of str or None, optional, default: None
14801480
The list of parameter names for which lookup into *data* should be
14811481
attempted. If None, replacement is attempted for all arguments.
1482-
label_namer : string, optional, default: None
1482+
label_namer : str, optional, default: None
14831483
If set e.g. to "namer" (which must be a kwarg in the function's
14841484
signature -- not as ``**kwargs``), if the *namer* argument passed in is
14851485
a (string) key of *data* and no *label* kwarg is passed, then use the

lib/matplotlib/animation.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def setup(self, fig, outfile, dpi=None):
195195
----------
196196
fig : `~matplotlib.figure.Figure`
197197
The figure object that contains the information for frames
198-
outfile : string
198+
outfile : str
199199
The filename of the resulting movie file
200200
dpi : int, optional
201201
The DPI (or resolution) for the file. This controls the size
@@ -231,7 +231,8 @@ def saving(self, fig, outfile, dpi, *args, **kwargs):
231231

232232

233233
class MovieWriter(AbstractMovieWriter):
234-
'''Base class for writing movies.
234+
"""
235+
Base class for writing movies.
235236
236237
This is a base class for MovieWriter subclasses that write a movie frame
237238
data to a pipe. You cannot instantiate this class directly.
@@ -240,39 +241,38 @@ class MovieWriter(AbstractMovieWriter):
240241
Attributes
241242
----------
242243
frame_format : str
243-
The format used in writing frame data, defaults to 'rgba'
244+
The format used in writing frame data, defaults to 'rgba'.
244245
fig : `~matplotlib.figure.Figure`
245246
The figure to capture data from.
246247
This must be provided by the sub-classes.
247248
248-
'''
249+
"""
249250

250251
def __init__(self, fps=5, codec=None, bitrate=None, extra_args=None,
251252
metadata=None):
252-
'''MovieWriter
253-
253+
"""
254254
Parameters
255255
----------
256256
fps : int
257257
Framerate for movie.
258-
codec : string or None, optional
259-
The codec to use. If ``None`` (the default) the ``animation.codec``
260-
rcParam is used.
258+
codec : str or None, optional
259+
The codec to use. If ``None`` (the default) :rc:`animation.codec`
260+
is used.
261261
bitrate : int or None, optional
262262
The bitrate for the saved movie file, which is one way to control
263263
the output file size and quality. The default value is ``None``,
264-
which uses the ``animation.bitrate`` rcParam. A value of -1
265-
implies that the bitrate should be determined automatically by the
266-
underlying utility.
267-
extra_args : list of strings or None, optional
264+
which uses :rc:`animation.bitrate`. A value of -1 implies that
265+
the bitrate should be determined automatically by the underlying
266+
utility.
267+
extra_args : list of str or None, optional
268268
A list of extra string arguments to be passed to the underlying
269269
movie utility. The default is ``None``, which passes the additional
270-
arguments in the ``animation.extra_args`` rcParam.
270+
arguments in :rc:`animation.extra_args`.
271271
metadata : Dict[str, str] or None
272272
A dictionary of keys and values for metadata to include in the
273273
output file. Some keys that may be of use include:
274274
title, artist, genre, subject, copyright, srcform, comment.
275-
'''
275+
"""
276276
if self.__class__ is MovieWriter:
277277
# TODO MovieWriter is still an abstract class and needs to be
278278
# extended with a mixin. This should be clearer in naming

lib/matplotlib/axes/_axes.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def legend(self, *args, **kwargs):
363363
The length of handles and labels should be the same in this
364364
case. If they are not, they are truncated to the smaller length.
365365
366-
labels : sequence of strings, optional
366+
labels : list of str, optional
367367
A list of labels to show next to the artists.
368368
Use this together with *handles*, if you need full control on what
369369
is shown in the legend and the automatic mechanism described above
@@ -1060,7 +1060,7 @@ def hlines(self, y, xmin, xmax, colors='k', linestyles='solid',
10601060
10611061
linestyles : {'solid', 'dashed', 'dashdot', 'dotted'}, optional
10621062
1063-
label : string, optional, default: ''
1063+
label : str, optional, default: ''
10641064
10651065
Returns
10661066
-------
@@ -1138,7 +1138,7 @@ def vlines(self, x, ymin, ymax, colors='k', linestyles='solid',
11381138
11391139
linestyles : {'solid', 'dashed', 'dashdot', 'dotted'}, optional
11401140
1141-
label : string, optional, default: ''
1141+
label : str, optional, default: ''
11421142
11431143
Returns
11441144
-------
@@ -1671,7 +1671,7 @@ def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False,
16711671
The plot format string. For details, see the corresponding
16721672
parameter in `.plot`.
16731673
1674-
tz : [ *None* | timezone string | :class:`tzinfo` instance]
1674+
tz : None or timezone string or :class:`tzinfo`
16751675
The time zone to use in labeling dates. If *None*, defaults to
16761676
rcParam ``timezone``.
16771677
@@ -2217,7 +2217,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
22172217
linewidth : scalar or array-like, optional
22182218
Width of the bar edge(s). If 0, don't draw edges.
22192219
2220-
tick_label : string or array-like, optional
2220+
tick_label : str or array-like, optional
22212221
The tick labels of the bars.
22222222
Default: None (Use default numeric labels.)
22232223
@@ -2513,7 +2513,7 @@ def barh(self, y, width, height=0.8, left=None, *, align="center",
25132513
linewidth : scalar or array-like, optional
25142514
Width of the bar edge(s). If 0, don't draw edges.
25152515
2516-
tick_label : string or array-like, optional
2516+
tick_label : str or array-like, optional
25172517
The tick labels of the bars.
25182518
Default: None (Use default numeric labels.)
25192519
@@ -2864,7 +2864,7 @@ def pie(self, x, explode=None, labels=None, colors=None,
28642864
will cycle. If *None*, will use the colors in the currently
28652865
active cycle.
28662866
2867-
autopct : None (default), string, or function, optional
2867+
autopct : None (default), str, or function, optional
28682868
If not *None*, is a string or function used to label the wedges
28692869
with their numeric value. The label will be placed inside the
28702870
wedge. If it is a format string, the label will be ``fmt%pct``.
@@ -3099,7 +3099,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
30993099
See :doc:`/gallery/statistics/errorbar_features`
31003100
for an example on the usage of ``xerr`` and ``yerr``.
31013101
3102-
fmt : plot format string, optional, default: ''
3102+
fmt : str, optional, default: ''
31033103
The format for the data points / data lines. See `.plot` for
31043104
details.
31053105

lib/matplotlib/axes/_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2980,7 +2980,7 @@ def tick_params(self, axis='both', **kwargs):
29802980
Transparency of gridlines: 0 (transparent) to 1 (opaque).
29812981
grid_linewidth : float
29822982
Width of gridlines in points.
2983-
grid_linestyle : string
2983+
grid_linestyle : str
29842984
Any valid `~matplotlib.lines.Line2D` line style spec.
29852985
29862986
Examples
@@ -3811,7 +3811,7 @@ def xaxis_date(self, tz=None):
38113811
38123812
Parameters
38133813
----------
3814-
tz : string or `tzinfo` instance, optional
3814+
tz : str or `tzinfo` instance, optional
38153815
Timezone. Defaults to :rc:`timezone`.
38163816
"""
38173817
# should be enough to inform the unit conversion interface
@@ -3824,7 +3824,7 @@ def yaxis_date(self, tz=None):
38243824
38253825
Parameters
38263826
----------
3827-
tz : string or `tzinfo` instance, optional
3827+
tz : str or `tzinfo` instance, optional
38283828
Timezone. Defaults to :rc:`timezone`.
38293829
"""
38303830
self.yaxis.axis_date(tz)

lib/matplotlib/axes/_secondary_axes.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ def set_location(self, location):
121121
122122
Parameters
123123
----------
124-
location : string or scalar
124+
location : {'top', 'bottom', 'left', 'right'} or float
125125
The position to put the secondary axis. Strings can be 'top' or
126126
'bottom' for orientation='x' and 'right' or 'left' for
127-
orientation='y', scalar can be a float indicating the relative
128-
position on the parent axes to put the new axes, 0.0 being the
129-
bottom (or left) and 1.0 being the top (or right).
127+
orientation='y'. A float indicates the relative position on the
128+
parent axes to put the new axes, 0.0 being the bottom (or left)
129+
and 1.0 being the top (or right).
130130
"""
131131

132132
# This puts the rectangle into figure-relative coordinates.
@@ -374,12 +374,12 @@ def set_color(self, color):
374374
375375
Parameters
376376
----------
377-
location : string or scalar
377+
location : {'top', 'bottom', 'left', 'right'} or float
378378
The position to put the secondary axis. Strings can be 'top' or
379-
'bottom', for x-oriented axises or 'left' or 'right' for y-oriented axises
380-
or a scalar can be a float indicating the relative position
381-
on the axes to put the new axes (0 being the bottom (left), and 1.0 being
382-
the top (right).)
379+
'bottom' for orientation='x' and 'right' or 'left' for
380+
orientation='y'. A float indicates the relative position on the
381+
parent axes to put the new axes, 0.0 being the bottom (or left)
382+
and 1.0 being the top (or right).
383383
384384
functions : 2-tuple of func, or Transform with an inverse
385385

lib/matplotlib/backend_bases.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3166,8 +3166,8 @@ def trigger_tool(self, name):
31663166
31673167
Parameters
31683168
----------
3169-
name : string
3170-
Name (id) of the tool triggered from within the container
3169+
name : str
3170+
Name (id) of the tool triggered from within the container.
31713171
"""
31723172
self.toolmanager.trigger_tool(name, sender=self)
31733173

@@ -3182,7 +3182,7 @@ def add_toolitem(self, name, group, position, image, description, toggle):
31823182
31833183
Parameters
31843184
----------
3185-
name : string
3185+
name : str
31863186
Name of the tool to add, this gets used as the tool's ID and as the
31873187
default label of the buttons
31883188
group : String
@@ -3224,7 +3224,7 @@ def remove_toolitem(self, name):
32243224
32253225
Parameters
32263226
----------
3227-
name : string
3227+
name : str
32283228
Name of the tool to remove.
32293229
"""
32303230
raise NotImplementedError

lib/matplotlib/backend_managers.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ def get_tool_keymap(self, name):
163163
164164
Parameters
165165
----------
166-
name : string
167-
Name of the Tool
166+
name : str
167+
Name of the Tool.
168168
169169
Returns
170170
-------
@@ -184,8 +184,8 @@ def update_keymap(self, name, *keys):
184184
185185
Parameters
186186
----------
187-
name : string
188-
Name of the Tool
187+
name : str
188+
Name of the Tool.
189189
keys : keys to associate with the Tool
190190
"""
191191

@@ -207,8 +207,8 @@ def remove_tool(self, name):
207207
208208
Parameters
209209
----------
210-
name : string
211-
Name of the Tool
210+
name : str
211+
Name of the Tool.
212212
"""
213213

214214
tool = self.get_tool(name)
@@ -355,8 +355,8 @@ def trigger_tool(self, name, sender=None, canvasevent=None, data=None):
355355
356356
Parameters
357357
----------
358-
name : string
359-
Name of the tool
358+
name : str
359+
Name of the tool.
360360
sender : object
361361
Object that wishes to trigger the tool
362362
canvasevent : Event

lib/matplotlib/backend_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class ToolBase:
4949
ToolManager that controls this Tool
5050
figure : `FigureCanvas`
5151
Figure instance that is affected by this Tool
52-
name : string
52+
name : str
5353
Used as **Id** of the tool, has to be unique among tools of the same
5454
ToolManager
5555
"""

lib/matplotlib/backends/backend_pdf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ def __init__(self, filename, metadata=None):
437437
Parameters
438438
----------
439439
440-
filename : file-like object or string
440+
filename : str or path-like or file-like
441441
Output target; if a string, a file will be opened for writing.
442442
metadata : dict from strings to strings and dates
443443
Information dictionary object (see PDF reference section 10.2.1
@@ -2472,7 +2472,7 @@ def __init__(self, filename, keep_empty=True, metadata=None):
24722472
24732473
Parameters
24742474
----------
2475-
filename : str
2475+
filename : str or path-like or file-like
24762476
Plots using :meth:`PdfPages.savefig` will be written to a file at
24772477
this location. The file is opened at once and any older file with
24782478
the same name is overwritten.

lib/matplotlib/backends/backend_pgf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ def __init__(self, filename, *, keep_empty=True, metadata=None):
991991
992992
Parameters
993993
----------
994-
filename : str
994+
filename : str or path-like
995995
Plots using :meth:`PdfPages.savefig` will be written to a file at
996996
this location. Any older file with the same name is overwritten.
997997
keep_empty : bool, optional

lib/matplotlib/backends/qt_editor/_formlayout.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,8 @@ def fedit(data, title="", comment="", icon=None, parent=None, apply=None):
491491
(if Cancel button is pressed, return None)
492492
493493
data: datalist, datagroup
494-
title: string
495-
comment: string
494+
title: str
495+
comment: str
496496
icon: QIcon instance
497497
parent: parent QWidget
498498
apply: apply callback (function)

lib/matplotlib/category.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def convert(value, unit, axis):
3232
3333
Parameters
3434
----------
35-
value : string or iterable
35+
value : str or iterable
3636
Value or list of values to be converted.
3737
unit : `.UnitData`
3838
An object mapping strings to integers.
@@ -93,7 +93,7 @@ def default_units(data, axis):
9393
9494
Parameters
9595
----------
96-
data : string or iterable of strings
96+
data : str or iterable of str
9797
axis : `~matplotlib.axis.Axis`
9898
axis on which the data is plotted
9999

lib/matplotlib/cbook/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ def to_filehandle(fname, flag='r', return_opened=False, encoding=None):
360360
361361
Parameters
362362
----------
363-
fname : str or PathLike or file-like object
363+
fname : str or path-like or file-like object
364364
If `str` or `os.PathLike`, the file is opened using the flags specified
365365
by *flag* and *encoding*. If a file-like object, it is passed through.
366366
flag : str, default 'r'

lib/matplotlib/collections.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ def legend_elements(self, prop="colors", num="auto",
906906
to a `~.ticker.Locator` being used to find useful locations.
907907
If a list or array, use exactly those elements for the legend.
908908
Finally, a `~.ticker.Locator` can be provided.
909-
fmt : string, `~matplotlib.ticker.Formatter`, or None (default)
909+
fmt : str, `~matplotlib.ticker.Formatter`, or None (default)
910910
The format or formatter to use for the labels. If a string must be
911911
a valid input for a `~.StrMethodFormatter`. If None (the default),
912912
use a `~.ScalarFormatter`.
@@ -1241,8 +1241,8 @@ def __init__(self, segments, # Can be None.
12411241
antialiaseds : sequence, optional
12421242
A sequence of ones or zeros.
12431243
1244-
linestyles : string, tuple, optional
1245-
Either one of [ 'solid' | 'dashed' | 'dashdot' | 'dotted' ], or
1244+
linestyles : str or tuple, optional
1245+
Either one of {'solid', 'dashed', 'dashdot', 'dotted'}, or
12461246
a dash tuple. The dash tuple is::
12471247
12481248
(offset, onoffseq)
@@ -1253,7 +1253,7 @@ def __init__(self, segments, # Can be None.
12531253
norm : Normalize, optional
12541254
`~.colors.Normalize` instance.
12551255
1256-
cmap : string or Colormap, optional
1256+
cmap : str or Colormap, optional
12571257
Colormap name or `~.colors.Colormap` instance.
12581258
12591259
pickradius : float, optional

0 commit comments

Comments
 (0)