Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit4b03f0c

Browse files
Add explicit overloads for pyplot.{show,subplot} (#30202)
* Create show overloads on pyplot.py(cherry picked from commit1ff2bd2)* Create subplot overloads on pyplot.py(cherry picked from commitf4693e3)* Removed subplot(Axes) on overloads and docstring* Update show overloads* Correct mypy error* Add typing to overloaded copy of show* Revert superfluous changes---------Co-authored-by: Corenthin ZOZOR <corenthin.zozor@gmail.com>
1 parentc78c2f4 commit4b03f0c

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

‎lib/matplotlib/pyplot.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,14 @@ def draw_if_interactive(*args, **kwargs):
569569
return_get_backend_mod().draw_if_interactive(*args,**kwargs)
570570

571571

572+
@overload
573+
defshow(*,block:bool,**kwargs)->None: ...
574+
575+
576+
@overload
577+
defshow(*args:Any,**kwargs:Any)->None: ...
578+
579+
572580
# This function's signature is rewritten upon backend-load by switch_backend.
573581
defshow(*args,**kwargs)->None:
574582
"""
@@ -1393,6 +1401,18 @@ def cla() -> None:
13931401

13941402
## More ways of creating Axes ##
13951403

1404+
@overload
1405+
defsubplot(nrows:int,ncols:int,index:int,/,**kwargs): ...
1406+
1407+
1408+
@overload
1409+
defsubplot(pos:int|SubplotSpec,/,**kwargs): ...
1410+
1411+
1412+
@overload
1413+
defsubplot(**kwargs): ...
1414+
1415+
13961416
@_docstring.interpd
13971417
defsubplot(*args,**kwargs)->Axes:
13981418
"""
@@ -1406,7 +1426,6 @@ def subplot(*args, **kwargs) -> Axes:
14061426
subplot(nrows, ncols, index, **kwargs)
14071427
subplot(pos, **kwargs)
14081428
subplot(**kwargs)
1409-
subplot(ax)
14101429
14111430
Parameters
14121431
----------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp