Skip to content

Commit 1fedc53

Browse files
committed
Make most arguments to Patch classes keyword only
1 parent d090165 commit 1fedc53

File tree

1 file changed

+20
-33
lines changed

1 file changed

+20
-33
lines changed

lib/matplotlib/patches.py

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ class Patch(artist.Artist):
4545
# subclass-by-subclass basis.
4646
_edge_default = False
4747

48-
@_api.make_keyword_only("3.6", name="edgecolor")
49-
def __init__(self,
48+
def __init__(self, *,
5049
edgecolor=None,
5150
facecolor=None,
5251
color=None,
@@ -687,9 +686,8 @@ def __str__(self):
687686
return fmt % pars
688687

689688
@_docstring.dedent_interpd
690-
@_api.make_keyword_only("3.6", name="angle")
691-
def __init__(self, xy, width, height, angle=0.0, *,
692-
rotation_point='xy', **kwargs):
689+
def __init__(self, xy, width, height, *,
690+
angle=0.0, rotation_point='xy', **kwargs):
693691
"""
694692
Parameters
695693
----------
@@ -890,9 +888,8 @@ def __str__(self):
890888
self.orientation)
891889

892890
@_docstring.dedent_interpd
893-
@_api.make_keyword_only("3.6", name="radius")
894-
def __init__(self, xy, numVertices, radius=5, orientation=0,
895-
**kwargs):
891+
def __init__(self, xy, numVertices, *,
892+
radius=5, orientation=0, **kwargs):
896893
"""
897894
Parameters
898895
----------
@@ -1078,8 +1075,7 @@ def __str__(self):
10781075
return "Polygon0()"
10791076

10801077
@_docstring.dedent_interpd
1081-
@_api.make_keyword_only("3.6", name="closed")
1082-
def __init__(self, xy, closed=True, **kwargs):
1078+
def __init__(self, xy, *, closed=True, **kwargs):
10831079
"""
10841080
Parameters
10851081
----------
@@ -1177,8 +1173,7 @@ def __str__(self):
11771173
return fmt % pars
11781174

11791175
@_docstring.dedent_interpd
1180-
@_api.make_keyword_only("3.6", name="width")
1181-
def __init__(self, center, r, theta1, theta2, width=None, **kwargs):
1176+
def __init__(self, center, r, theta1, theta2, *, width=None, **kwargs):
11821177
"""
11831178
A wedge centered at *x*, *y* center with radius *r* that
11841179
sweeps *theta1* to *theta2* (in degrees). If *width* is given,
@@ -1266,8 +1261,7 @@ def __str__(self):
12661261
[0.8, 0.3], [0.8, 0.1]])
12671262

12681263
@_docstring.dedent_interpd
1269-
@_api.make_keyword_only("3.6", name="width")
1270-
def __init__(self, x, y, dx, dy, width=1.0, **kwargs):
1264+
def __init__(self, x, y, dx, dy, *, width=1.0, **kwargs):
12711265
"""
12721266
Draws an arrow from (*x*, *y*) to (*x* + *dx*, *y* + *dy*).
12731267
The width of the arrow is scaled by *width*.
@@ -1322,9 +1316,9 @@ def __str__(self):
13221316
return "FancyArrow()"
13231317

13241318
@_docstring.dedent_interpd
1325-
@_api.make_keyword_only("3.6", name="width")
1326-
def __init__(self, x, y, dx, dy, width=0.001, length_includes_head=False,
1327-
head_width=None, head_length=None, shape='full', overhang=0,
1319+
def __init__(self, x, y, dx, dy, *,
1320+
width=0.001, length_includes_head=False, head_width=None,
1321+
head_length=None, shape='full', overhang=0,
13281322
head_starts_at_zero=False, **kwargs):
13291323
"""
13301324
Parameters
@@ -1493,8 +1487,7 @@ def __str__(self):
14931487
return s % (self.xy[0], self.xy[1], self.radius, self.numvertices)
14941488

14951489
@_docstring.dedent_interpd
1496-
@_api.make_keyword_only("3.6", name="resolution")
1497-
def __init__(self, xy, radius=5,
1490+
def __init__(self, xy, radius=5, *,
14981491
resolution=20, # the number of vertices
14991492
** kwargs):
15001493
"""
@@ -1521,8 +1514,7 @@ def __str__(self):
15211514
return fmt % pars
15221515

15231516
@_docstring.dedent_interpd
1524-
@_api.make_keyword_only("3.6", name="angle")
1525-
def __init__(self, xy, width, height, angle=0, **kwargs):
1517+
def __init__(self, xy, width, height, *, angle=0, **kwargs):
15261518
"""
15271519
Parameters
15281520
----------
@@ -1908,9 +1900,8 @@ def __str__(self):
19081900
return fmt % pars
19091901

19101902
@_docstring.dedent_interpd
1911-
@_api.make_keyword_only("3.6", name="angle")
1912-
def __init__(self, xy, width, height, angle=0.0,
1913-
theta1=0.0, theta2=360.0, **kwargs):
1903+
def __init__(self, xy, width, height, *,
1904+
angle=0.0, theta1=0.0, theta2=360.0, **kwargs):
19141905
"""
19151906
Parameters
19161907
----------
@@ -4043,13 +4034,10 @@ def __str__(self):
40434034
return f"{type(self).__name__}({self._path_original})"
40444035

40454036
@_docstring.dedent_interpd
4046-
@_api.make_keyword_only("3.6", name="path")
4047-
def __init__(self, posA=None, posB=None, path=None,
4048-
arrowstyle="simple", connectionstyle="arc3",
4049-
patchA=None, patchB=None,
4050-
shrinkA=2, shrinkB=2,
4051-
mutation_scale=1, mutation_aspect=1,
4052-
**kwargs):
4037+
def __init__(self, posA=None, posB=None, *,
4038+
path=None, arrowstyle="simple", connectionstyle="arc3",
4039+
patchA=None, patchB=None, shrinkA=2, shrinkB=2,
4040+
mutation_scale=1, mutation_aspect=1, **kwargs):
40534041
"""
40544042
There are two ways for defining an arrow:
40554043
@@ -4372,8 +4360,7 @@ def __str__(self):
43724360
(self.xy1[0], self.xy1[1], self.xy2[0], self.xy2[1])
43734361

43744362
@_docstring.dedent_interpd
4375-
@_api.make_keyword_only("3.6", name="axesA")
4376-
def __init__(self, xyA, xyB, coordsA, coordsB=None,
4363+
def __init__(self, xyA, xyB, coordsA, coordsB=None, *,
43774364
axesA=None, axesB=None,
43784365
arrowstyle="-",
43794366
connectionstyle="arc3",

0 commit comments

Comments
 (0)