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

Skip to content

Commit 94067c6

Browse files
authored
Merge pull request #19421 from anntzer/lowercasetypegenerics
Switch to documenting generic collections in lowercase.
2 parents cdb6b51 + a98ab25 commit 94067c6

File tree

12 files changed

+37
-43
lines changed

12 files changed

+37
-43
lines changed

lib/matplotlib/animation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def __init__(self, fps=5, codec=None, bitrate=None, extra_args=None,
285285
Extra command-line arguments passed to the underlying movie
286286
encoder. The default, None, means to use
287287
:rc:`animation.[name-of-encoder]_args` for the builtin writers.
288-
metadata : Dict[str, str], default: {}
288+
metadata : dict[str, str], default: {}
289289
A dictionary of keys and values for metadata to include in the
290290
output file. Some keys that may be of use include:
291291
title, artist, genre, subject, copyright, srcform, comment.
@@ -1024,7 +1024,7 @@ class to use, such as 'ffmpeg'.
10241024
encoder. The default, None, means to use
10251025
:rc:`animation.[name-of-encoder]_args` for the builtin writers.
10261026
1027-
metadata : Dict[str, str], default: {}
1027+
metadata : dict[str, str], default: {}
10281028
Dictionary of keys and values for metadata to include in
10291029
the output file. Some keys that may be of use include:
10301030
title, artist, genre, subject, copyright, srcform, comment.

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6895,7 +6895,7 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
68956895
return tops[0], bins, patches[0]
68966896
else:
68976897
patch_type = ("BarContainer" if histtype.startswith("bar")
6898-
else "List[Polygon]")
6898+
else "list[Polygon]")
68996899
return tops, bins, cbook.silent_list(patch_type, patches)
69006900

69016901
@_preprocess_data()

lib/matplotlib/backend_bases.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ def __init__(self, interval=None, callbacks=None):
11171117
interval : int, default: 1000ms
11181118
The time between timer events in milliseconds. Will be stored as
11191119
``timer.interval``.
1120-
callbacks : List[Tuple[callable, Tuple, Dict]]
1120+
callbacks : list[tuple[callable, tuple, dict]]
11211121
List of (func, args, kwargs) tuples that will be called upon
11221122
timer events. This list is accessible as ``timer.callbacks`` and
11231123
can be manipulated directly, or the functions `add_callback` and
@@ -2405,7 +2405,7 @@ def new_timer(self, interval=None, callbacks=None):
24052405
interval : int
24062406
Timer interval in milliseconds.
24072407
2408-
callbacks : List[Tuple[callable, Tuple, Dict]]
2408+
callbacks : list[tuple[callable, tuple, dict]]
24092409
Sequence of (func, args, kwargs) where ``func(*args, **kwargs)``
24102410
will be executed by the timer every *interval*.
24112411

lib/matplotlib/backends/backend_pdf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def _create_pdf_info_dict(backend, metadata):
151151
backend : str
152152
The name of the backend to use in the Producer value.
153153
154-
metadata : Dict[str, Union[str, datetime, Name]]
154+
metadata : dict[str, Union[str, datetime, Name]]
155155
A dictionary of metadata supplied by the user with information
156156
following the PDF specification, also defined in
157157
`~.backend_pdf.PdfPages` below.
@@ -161,7 +161,7 @@ def _create_pdf_info_dict(backend, metadata):
161161
162162
Returns
163163
-------
164-
Dict[str, Union[str, datetime, Name]]
164+
dict[str, Union[str, datetime, Name]]
165165
A validated dictionary of metadata.
166166
"""
167167

lib/matplotlib/backends/backend_svg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ def print_svg(self, filename, *args, **kwargs):
12931293
filename : str or path-like or file-like
12941294
Output target; if a string, a file will be opened for writing.
12951295
1296-
metadata : Dict[str, Any], optional
1296+
metadata : dict[str, Any], optional
12971297
Metadata in the SVG file defined as key-value pairs of strings,
12981298
datetimes, or lists of strings, e.g., ``{'Creator': 'My software',
12991299
'Contributor': ['Me', 'My Friend'], 'Title': 'Awesome'}``.

lib/matplotlib/bezier.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ def find_bezier_t_intersecting_with_closedpath(
129129
A function returning x, y coordinates of the Bezier at parameter *t*.
130130
It must have the signature::
131131
132-
bezier_point_at_t(t: float) -> Tuple[float, float]
132+
bezier_point_at_t(t: float) -> tuple[float, float]
133133
134134
inside_closedpath : callable
135135
A function returning True if a given point (x, y) is inside the
136136
closed path. It must have the signature::
137137
138-
inside_closedpath(point: Tuple[float, float]) -> bool
138+
inside_closedpath(point: tuple[float, float]) -> bool
139139
140140
t0, t1 : float
141141
Start parameters for the search.
@@ -204,20 +204,22 @@ def __call__(self, t):
204204
205205
Parameters
206206
----------
207-
t : float (k,), array_like
207+
t : float (k,) array_like
208208
Points at which to evaluate the curve.
209209
210210
Returns
211211
-------
212-
float (k, d), array_like
212+
float (k, d) array_like
213213
Value of the curve for each point in *t*.
214214
"""
215215
t = np.asarray(t)
216216
return (np.power.outer(1 - t, self._orders[::-1])
217217
* np.power.outer(t, self._orders)) @ self._px
218218

219219
def point_at_t(self, t):
220-
"""Evaluate curve at a single point *t*. Returns a Tuple[float*d]."""
220+
"""
221+
Evaluate the curve at a single point, returning a tuple of *d* floats.
222+
"""
221223
return tuple(self(t))
222224

223225
@property
@@ -407,7 +409,7 @@ def inside_circle(cx, cy, r):
407409
408410
The returned function has the signature::
409411
410-
f(xy: Tuple[float, float]) -> bool
412+
f(xy: tuple[float, float]) -> bool
411413
"""
412414
r2 = r ** 2
413415

lib/matplotlib/contour.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -915,18 +915,15 @@ def legend_elements(self, variable_name='x', str_format=str):
915915
----------
916916
variable_name : str
917917
The string used inside the inequality used on the labels.
918-
919918
str_format : function: float -> str
920919
Function used to format the numbers in the labels.
921920
922921
Returns
923922
-------
924-
artists : List[`.Artist`]
923+
artists : list[`.Artist`]
925924
A list of the artists.
926-
927-
labels : List[str]
925+
labels : list[str]
928926
A list of the labels.
929-
930927
"""
931928
artists = []
932929
labels = []
@@ -1706,7 +1703,7 @@ def _initialize_x_y(self, z):
17061703
iterable is shorter than the number of contour levels
17071704
it will be repeated as necessary.
17081705
1709-
hatches : List[str], optional
1706+
hatches : list[str], optional
17101707
*Only applies to* `.contourf`.
17111708
17121709
A list of cross hatch patterns to use on the filled areas.

lib/matplotlib/figure.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1711,9 +1711,9 @@ def _identify_keys_and_nested(layout):
17111711
17121712
Returns
17131713
-------
1714-
unique_ids : Set[object]
1714+
unique_ids : set
17151715
The unique non-sub layout entries in this layout
1716-
nested : Dict[Tuple[int, int]], 2D object array
1716+
nested : dict[tuple[int, int]], 2D object array
17171717
"""
17181718
unique_ids = set()
17191719
nested = {}
@@ -1735,19 +1735,16 @@ def _do_layout(gs, layout, unique_ids, nested):
17351735
Parameters
17361736
----------
17371737
gs : GridSpec
1738-
17391738
layout : 2D object array
17401739
The input converted to a 2D numpy array for this level.
1741-
1742-
unique_ids : Set[object]
1740+
unique_ids : set
17431741
The identified scalar labels at this level of nesting.
1744-
1745-
nested : Dict[Tuple[int, int]], 2D object array
1746-
The identified nested layouts if any.
1742+
nested : dict[tuple[int, int]], 2D object array
1743+
The identified nested layouts, if any.
17471744
17481745
Returns
17491746
-------
1750-
Dict[label, Axes]
1747+
dict[label, Axes]
17511748
A flat dict of all of the Axes created.
17521749
"""
17531750
rows, cols = layout.shape

lib/matplotlib/lines.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,8 @@ def set_markevery(self, every):
546546
547547
Parameters
548548
----------
549-
every : None or int or (int, int) or slice or List[int] or float or \
550-
(float, float) or List[bool]
549+
every : None or int or (int, int) or slice or list[int] or float or \
550+
(float, float) or list[bool]
551551
Which markers to plot.
552552
553553
- every=None, every point will be plotted.
@@ -609,7 +609,7 @@ def set_picker(self, p):
609609
610610
Parameters
611611
----------
612-
p : float or callable[[Artist, Event], Tuple[bool, dict]]
612+
p : float or callable[[Artist, Event], tuple[bool, dict]]
613613
If a float, it is used as the pick radius in points.
614614
"""
615615
if callable(p):

lib/matplotlib/tight_layout.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ def auto_adjust_subplotpars(
3030
3131
Parameters
3232
----------
33-
nrows_ncols : Tuple[int, int]
33+
nrows_ncols : tuple[int, int]
3434
Number of rows and number of columns of the grid.
35-
num1num2_list : List[int]
35+
num1num2_list : list[int]
3636
List of numbers specifying the area occupied by the subplot
3737
subplot_list : list of subplots
3838
List of subplots that will be used to calculate optimal subplot_params.
@@ -42,7 +42,7 @@ def auto_adjust_subplotpars(
4242
h_pad, w_pad : float
4343
Padding (height/width) between edges of adjacent subplots, as a
4444
fraction of the font size. Defaults to *pad*.
45-
rect : Tuple[float, float, float, float]
45+
rect : tuple[float, float, float, float]
4646
[left, bottom, right, top] in normalized (0, 1) figure coordinates.
4747
"""
4848
rows, cols = nrows_ncols
@@ -237,7 +237,7 @@ def get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer,
237237
h_pad, w_pad : float
238238
Padding (height/width) between edges of adjacent subplots. Defaults to
239239
*pad*.
240-
rect : Tuple[float, float, float, float], optional
240+
rect : tuple[float, float, float, float], optional
241241
(left, bottom, right, top) rectangle in normalized figure coordinates
242242
that the whole subplots area (including labels) will fit into.
243243
Defaults to using the entire figure.
@@ -247,7 +247,6 @@ def get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer,
247247
subplotspec or None
248248
subplotspec kwargs to be passed to `.Figure.subplots_adjust` or
249249
None if tight_layout could not be accomplished.
250-
251250
"""
252251

253252
subplot_list = []

lib/matplotlib/type1font.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ class Type1Font:
4646
parts : tuple
4747
A 3-tuple of the cleartext part, the encrypted part, and the finale of
4848
zeros.
49-
50-
prop : Dict[str, Any]
49+
prop : dict[str, Any]
5150
A dictionary of font properties.
52-
5351
"""
5452
__slots__ = ('parts', 'prop')
5553

tutorials/provisional/mosaic.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,16 @@ def identify_axes(ax_dict, fontsize=48):
4646
4747
Parameters
4848
----------
49-
ax_dict : Dict[str, Axes]
49+
ax_dict : dict[str, Axes]
5050
Mapping between the title / label and the Axes.
51-
5251
fontsize : int, optional
53-
How big the label should be
52+
How big the label should be.
5453
"""
5554
kw = dict(ha="center", va="center", fontsize=fontsize, color="darkgrey")
5655
for k, ax in ax_dict.items():
5756
ax.text(0.5, 0.5, k, transform=ax.transAxes, **kw)
57+
58+
5859
###############################################################################
5960
# If we want a 2x2 grid we can use `.Figure.subplots` which returns a 2D array
6061
# of `.axes.Axes` which we can index into to do our plotting.

0 commit comments

Comments
 (0)