@@ -1440,11 +1440,6 @@ 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 (
14501445 nrows : Literal [1 ] = ...,
@@ -1462,54 +1457,37 @@ def subplots(
14621457 ...
14631458
14641459
1465- @overload # type: ignore[misc]
1466- def subplots (
1467- nrows : Literal [1 ] = ...,
1468- ncols : int = ...,
1469- * ,
1470- sharex : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1471- sharey : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1472- squeeze : Literal [True ] = ...,
1473- width_ratios : Sequence [float ] | None = ...,
1474- height_ratios : Sequence [float ] | None = ...,
1475- subplot_kw : dict [str , Any ] | None = ...,
1476- gridspec_kw : dict [str , Any ] | None = ...,
1477- ** fig_kw
1478- ) -> tuple [Figure , Sequence [Axes ]]:
1479- ...
1480-
1481-
14821460@overload # type: ignore[misc]
14831461def subplots (
14841462 nrows : int = ...,
1485- ncols : Literal [ 1 ] = ...,
1463+ ncols : int = ...,
14861464 * ,
14871465 sharex : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
14881466 sharey : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1489- squeeze : Literal [True ] = ...,
1467+ squeeze : Literal [False ] = ...,
14901468 width_ratios : Sequence [float ] | None = ...,
14911469 height_ratios : Sequence [float ] | None = ...,
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 , np . ndarray ]: # TODO numpy/numpy#24738
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