Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 93cb0f3

Browse filesBrowse files
committed
Use str instead of string as type in docstrings
1 parent 0851204 commit 93cb0f3
Copy full SHA for 93cb0f3
Expand file treeCollapse file tree

31 files changed

+109
-101
lines changed

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+1-1Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/animation.py
+15-15Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def legend(self, *args, **kwargs):
364364
The length of handles and labels should be the same in this
365365
case. If they are not, they are truncated to the smaller length.
366366
367-
labels : sequence of strings, optional
367+
labels : list of str, optional
368368
A list of labels to show next to the artists.
369369
Use this together with *handles*, if you need full control on what
370370
is shown in the legend and the automatic mechanism described above
@@ -1061,7 +1061,7 @@ def hlines(self, y, xmin, xmax, colors='k', linestyles='solid',
10611061
10621062
linestyles : {'solid', 'dashed', 'dashdot', 'dotted'}, optional
10631063
1064-
label : string, optional, default: ''
1064+
label : str, optional, default: ''
10651065
10661066
Returns
10671067
-------
@@ -1139,7 +1139,7 @@ def vlines(self, x, ymin, ymax, colors='k', linestyles='solid',
11391139
11401140
linestyles : {'solid', 'dashed', 'dashdot', 'dotted'}, optional
11411141
1142-
label : string, optional, default: ''
1142+
label : str, optional, default: ''
11431143
11441144
Returns
11451145
-------
@@ -2218,7 +2218,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
22182218
linewidth : scalar or array-like, optional
22192219
Width of the bar edge(s). If 0, don't draw edges.
22202220
2221-
tick_label : string or array-like, optional
2221+
tick_label : str or array-like, optional
22222222
The tick labels of the bars.
22232223
Default: None (Use default numeric labels.)
22242224
@@ -2514,7 +2514,7 @@ def barh(self, y, width, height=0.8, left=None, *, align="center",
25142514
linewidth : scalar or array-like, optional
25152515
Width of the bar edge(s). If 0, don't draw edges.
25162516
2517-
tick_label : string or array-like, optional
2517+
tick_label : str or array-like, optional
25182518
The tick labels of the bars.
25192519
Default: None (Use default numeric labels.)
25202520
@@ -2862,7 +2862,7 @@ def pie(self, x, explode=None, labels=None, colors=None,
28622862
will cycle. If *None*, will use the colors in the currently
28632863
active cycle.
28642864
2865-
autopct : None (default), string, or function, optional
2865+
autopct : None (default), str, or function, optional
28662866
If not *None*, is a string or function used to label the wedges
28672867
with their numeric value. The label will be placed inside the
28682868
wedge. If it is a format string, the label will be ``fmt%pct``.
@@ -3097,7 +3097,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
30973097
See :doc:`/gallery/statistics/errorbar_features`
30983098
for an example on the usage of ``xerr`` and ``yerr``.
30993099
3100-
fmt : plot format string, optional, default: ''
3100+
fmt : str, optional, default: ''
31013101
The format for the data points / data lines. See `.plot` for
31023102
details.
31033103

‎lib/matplotlib/axes/_base.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_base.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2924,7 +2924,7 @@ def tick_params(self, axis='both', **kwargs):
29242924
Transparency of gridlines: 0 (transparent) to 1 (opaque).
29252925
grid_linewidth : float
29262926
Width of gridlines in points.
2927-
grid_linestyle : string
2927+
grid_linestyle : str
29282928
Any valid `~matplotlib.lines.Line2D` line style spec.
29292929
29302930
Examples
@@ -3755,7 +3755,7 @@ def xaxis_date(self, tz=None):
37553755
37563756
Parameters
37573757
----------
3758-
tz : string or `tzinfo` instance, optional
3758+
tz : str or `tzinfo` instance, optional
37593759
Timezone. Defaults to :rc:`timezone`.
37603760
"""
37613761
# should be enough to inform the unit conversion interface
@@ -3768,7 +3768,7 @@ def yaxis_date(self, tz=None):
37683768
37693769
Parameters
37703770
----------
3771-
tz : string or `tzinfo` instance, optional
3771+
tz : str or `tzinfo` instance, optional
37723772
Timezone. Defaults to :rc:`timezone`.
37733773
"""
37743774
self.yaxis.axis_date(tz)

‎lib/matplotlib/axes/_secondary_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_secondary_axes.py
+9-9Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3168,8 +3168,8 @@ def trigger_tool(self, name):
31683168
31693169
Parameters
31703170
----------
3171-
name : string
3172-
Name (id) of the tool triggered from within the container
3171+
name : str
3172+
Name (id) of the tool triggered from within the container.
31733173
"""
31743174
self.toolmanager.trigger_tool(name, sender=self)
31753175

@@ -3184,7 +3184,7 @@ def add_toolitem(self, name, group, position, image, description, toggle):
31843184
31853185
Parameters
31863186
----------
3187-
name : string
3187+
name : str
31883188
Name of the tool to add, this gets used as the tool's ID and as the
31893189
default label of the buttons
31903190
group : String
@@ -3226,7 +3226,7 @@ def remove_toolitem(self, name):
32263226
32273227
Parameters
32283228
----------
3229-
name : string
3229+
name : str
32303230
Name of the tool to remove.
32313231
"""
32323232
raise NotImplementedError

‎lib/matplotlib/backend_managers.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_managers.py
+8-8Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_tools.py
+1-1Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_pdf.py
+2-2Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_pgf.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ def __init__(self, filename, *, keep_empty=True, metadata=None):
989989
990990
Parameters
991991
----------
992-
filename : str
992+
filename : str or path-like
993993
Plots using :meth:`PdfPages.savefig` will be written to a file at
994994
this location. Any older file with the same name is overwritten.
995995
keep_empty : bool, optional

‎lib/matplotlib/backends/qt_editor/_formlayout.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/qt_editor/_formlayout.py
+2-2Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/category.py
+2-2Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/cbook/__init__.py
+1-1Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/collections.py
+4-4Lines 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`.
@@ -1240,8 +1240,8 @@ def __init__(self, segments, # Can be None.
12401240
antialiaseds : sequence, optional
12411241
A sequence of ones or zeros.
12421242
1243-
linestyles : string, tuple, optional
1244-
Either one of [ 'solid' | 'dashed' | 'dashdot' | 'dotted' ], or
1243+
linestyles : str or tuple, optional
1244+
Either one of {'solid', 'dashed', 'dashdot', 'dotted'}, or
12451245
a dash tuple. The dash tuple is::
12461246
12471247
(offset, onoffseq)
@@ -1252,7 +1252,7 @@ def __init__(self, segments, # Can be None.
12521252
norm : Normalize, optional
12531253
`~.colors.Normalize` instance.
12541254
1255-
cmap : string or Colormap, optional
1255+
cmap : str or Colormap, optional
12561256
Colormap name or `~.colors.Colormap` instance.
12571257
12581258
pickradius : float, optional

‎lib/matplotlib/contour.py

Copy file name to clipboardExpand all lines: lib/matplotlib/contour.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def clabel(self, levels=None, *,
6464
A list of level values, that should be labeled. The list must be
6565
a subset of ``cs.levels``. If not given, all levels are labeled.
6666
67-
fontsize : string or float, optional
67+
fontsize : str or float, optional
6868
Size in points or relative size e.g., 'smaller', 'x-large'.
6969
See `.Text.set_size` for accepted string values.
7070
@@ -92,7 +92,7 @@ def clabel(self, levels=None, *,
9292
This spacing will be exact for labels at locations where the
9393
contour is straight, less so for labels on curved contours.
9494
95-
fmt : string or dict, optional
95+
fmt : str or dict, optional
9696
A format string for the label. Default is '%1.3f'
9797
9898
Alternatively, this can be a dictionary matching contour levels

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.