@@ -1440,11 +1440,6 @@ def subplot(*args, **kwargs) -> Axes:
1440
1440
return ax
1441
1441
1442
1442
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.
1448
1443
@overload # type: ignore[misc]
1449
1444
def subplots (
1450
1445
nrows : Literal [1 ] = ...,
@@ -1462,54 +1457,37 @@ def subplots(
1462
1457
...
1463
1458
1464
1459
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
-
1482
1460
@overload # type: ignore[misc]
1483
1461
def subplots (
1484
1462
nrows : int = ...,
1485
- ncols : Literal [ 1 ] = ...,
1463
+ ncols : int = ...,
1486
1464
* ,
1487
1465
sharex : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1488
1466
sharey : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1489
- squeeze : Literal [True ] = ...,
1467
+ squeeze : Literal [False ] = ...,
1490
1468
width_ratios : Sequence [float ] | None = ...,
1491
1469
height_ratios : Sequence [float ] | None = ...,
1492
1470
subplot_kw : dict [str , Any ] | None = ...,
1493
1471
gridspec_kw : dict [str , Any ] | None = ...,
1494
1472
** fig_kw
1495
- ) -> tuple [Figure , Sequence [ Axes ]]:
1473
+ ) -> tuple [Figure , np . ndarray ]: # TODO numpy/numpy#24738
1496
1474
...
1497
1475
1498
1476
1499
- @overload # type: ignore[misc]
1477
+ @overload
1500
1478
def subplots (
1501
1479
nrows : int = ...,
1502
1480
ncols : int = ...,
1503
1481
* ,
1504
1482
sharex : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1505
1483
sharey : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1506
- squeeze : Literal [ False ] = ...,
1484
+ squeeze : bool = ...,
1507
1485
width_ratios : Sequence [float ] | None = ...,
1508
1486
height_ratios : Sequence [float ] | None = ...,
1509
1487
subplot_kw : dict [str , Any ] | None = ...,
1510
1488
gridspec_kw : dict [str , Any ] | None = ...,
1511
1489
** fig_kw
1512
- ) -> tuple [Figure , Sequence [ Sequence [ Axes ]] ]:
1490
+ ) -> tuple [Figure , Axes | np . ndarray ]:
1513
1491
...
1514
1492
1515
1493
0 commit comments