@@ -1440,48 +1440,26 @@ def subplot(*args, **kwargs) -> Axes:
14401440 return ax
14411441
14421442
1443- # NOTE The actual type is `Axes` or `numpy.ndarray`,
1444- # but `numpy.ndarray` does notsupport objects.
1445- # NOTE Since there is no Exclude-type in Python's type hints, it is assumed that
1446- # the overload that matches first will be resolved.
1447- # mypy warns that it is an unsafe overload, so mark it as ignore.
14481443@overload # type: ignore[misc]
14491444def subplots (
1450- nrows : Literal [1 ] = ...,
1451- ncols : Literal [1 ] = ...,
1452- * ,
1453- sharex : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1454- sharey : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1455- squeeze : Literal [True ] = ...,
1456- width_ratios : Sequence [float ] | None = ...,
1457- height_ratios : Sequence [float ] | None = ...,
1458- subplot_kw : dict [str , Any ] | None = ...,
1459- gridspec_kw : dict [str , Any ] | None = ...,
1460- ** fig_kw
1461- ) -> tuple [Figure , Axes ]:
1462- ...
1463-
1464-
1465- @overload # type: ignore[misc]
1466- def subplots (
1467- nrows : Literal [1 ] = ...,
1445+ nrows : int = ...,
14681446 ncols : int = ...,
14691447 * ,
14701448 sharex : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
14711449 sharey : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1472- squeeze : Literal [True ] = ...,
1450+ squeeze : Literal [False ] = ...,
14731451 width_ratios : Sequence [float ] | None = ...,
14741452 height_ratios : Sequence [float ] | None = ...,
14751453 subplot_kw : dict [str , Any ] | None = ...,
14761454 gridspec_kw : dict [str , Any ] | None = ...,
14771455 ** fig_kw
1478- ) -> tuple [Figure , Sequence [ Axes ]]:
1456+ ) -> tuple [Figure , np . ndarray ]: # TODO numpy/numpy#24738
14791457 ...
14801458
14811459
14821460@overload # type: ignore[misc]
14831461def subplots (
1484- nrows : int = ...,
1462+ nrows : Literal [ 1 ] = ...,
14851463 ncols : Literal [1 ] = ...,
14861464 * ,
14871465 sharex : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
@@ -1492,24 +1470,24 @@ def subplots(
14921470 subplot_kw : dict [str , Any ] | None = ...,
14931471 gridspec_kw : dict [str , Any ] | None = ...,
14941472 ** fig_kw
1495- ) -> tuple [Figure , Sequence [ Axes ] ]:
1473+ ) -> tuple [Figure , Axes ]:
14961474 ...
14971475
14981476
1499- @overload # type: ignore[misc]
1477+ @overload
15001478def subplots (
15011479 nrows : int = ...,
15021480 ncols : int = ...,
15031481 * ,
15041482 sharex : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
15051483 sharey : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1506- squeeze : Literal [ False ] = ...,
1484+ squeeze : bool = ...,
15071485 width_ratios : Sequence [float ] | None = ...,
15081486 height_ratios : Sequence [float ] | None = ...,
15091487 subplot_kw : dict [str , Any ] | None = ...,
15101488 gridspec_kw : dict [str , Any ] | None = ...,
15111489 ** fig_kw
1512- ) -> tuple [Figure , Sequence [ Sequence [ Axes ]] ]:
1490+ ) -> tuple [Figure , Axes | np . ndarray ]:
15131491 ...
15141492
15151493
0 commit comments