@@ -1440,48 +1440,26 @@ 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
- 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 = ...,
1468
1446
ncols : int = ...,
1469
1447
* ,
1470
1448
sharex : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1471
1449
sharey : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
1472
- squeeze : Literal [True ] = ...,
1450
+ squeeze : Literal [False ] = ...,
1473
1451
width_ratios : Sequence [float ] | None = ...,
1474
1452
height_ratios : Sequence [float ] | None = ...,
1475
1453
subplot_kw : dict [str , Any ] | None = ...,
1476
1454
gridspec_kw : dict [str , Any ] | None = ...,
1477
1455
** fig_kw
1478
- ) -> tuple [Figure , Sequence [ Axes ]]:
1456
+ ) -> tuple [Figure , np . ndarray ]: # TODO numpy/numpy#24738
1479
1457
...
1480
1458
1481
1459
1482
1460
@overload # type: ignore[misc]
1483
1461
def subplots (
1484
- nrows : int = ...,
1462
+ nrows : Literal [ 1 ] = ...,
1485
1463
ncols : Literal [1 ] = ...,
1486
1464
* ,
1487
1465
sharex : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
@@ -1492,24 +1470,24 @@ def subplots(
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 , Axes ]:
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