Skip to content

Commit 52fdb48

Browse files
phoflnoatamir
authored andcommitted
TYPE: Move any all to _typing (pandas-dev#48300)
1 parent 8e1a43c commit 52fdb48

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

pandas/_typing.py

+3
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,6 @@ def closed(self) -> bool:
328328

329329
# plotting
330330
PlottingOrientation = Literal["horizontal", "vertical"]
331+
332+
# dropna
333+
AnyAll = Literal["any", "all"]

pandas/core/frame.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
)
5151
from pandas._typing import (
5252
AggFuncType,
53+
AnyAll,
5354
AnyArrayLike,
5455
ArrayLike,
5556
Axes,
@@ -6423,7 +6424,7 @@ def dropna(
64236424
self,
64246425
*,
64256426
axis: Axis = ...,
6426-
how: Literal["any", "all"] | NoDefault = ...,
6427+
how: AnyAll | NoDefault = ...,
64276428
thresh: int | NoDefault = ...,
64286429
subset: IndexLabel = ...,
64296430
inplace: Literal[False] = ...,
@@ -6435,7 +6436,7 @@ def dropna(
64356436
self,
64366437
*,
64376438
axis: Axis = ...,
6438-
how: Literal["any", "all"] | NoDefault = ...,
6439+
how: AnyAll | NoDefault = ...,
64396440
thresh: int | NoDefault = ...,
64406441
subset: IndexLabel = ...,
64416442
inplace: Literal[True],
@@ -6446,7 +6447,7 @@ def dropna(
64466447
def dropna(
64476448
self,
64486449
axis: Axis = 0,
6449-
how: Literal["any", "all"] | NoDefault = no_default,
6450+
how: AnyAll | NoDefault = no_default,
64506451
thresh: int | NoDefault = no_default,
64516452
subset: IndexLabel = None,
64526453
inplace: bool = False,

pandas/core/indexes/base.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
tz_compare,
4646
)
4747
from pandas._typing import (
48+
AnyAll,
4849
ArrayLike,
4950
Axes,
5051
Dtype,
@@ -2971,7 +2972,7 @@ def fillna(self, value=None, downcast=None):
29712972
)
29722973
return self._view()
29732974

2974-
def dropna(self: _IndexT, how: Literal["any", "all"] = "any") -> _IndexT:
2975+
def dropna(self: _IndexT, how: AnyAll = "any") -> _IndexT:
29752976
"""
29762977
Return Index without NA/NaN values.
29772978

pandas/core/indexes/multi.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
)
3030
from pandas._libs.hashtable import duplicated
3131
from pandas._typing import (
32+
AnyAll,
3233
AnyArrayLike,
3334
DtypeObj,
3435
F,
@@ -1634,7 +1635,7 @@ def fillna(self, value=None, downcast=None):
16341635
raise NotImplementedError("isna is not defined for MultiIndex")
16351636

16361637
@doc(Index.dropna)
1637-
def dropna(self, how: Literal["any", "all"] = "any") -> MultiIndex:
1638+
def dropna(self, how: AnyAll = "any") -> MultiIndex:
16381639
nans = [level_codes == -1 for level_codes in self.codes]
16391640
if how == "any":
16401641
indexer = np.any(nans, axis=0)

pandas/core/series.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from pandas._libs.lib import no_default
3636
from pandas._typing import (
3737
AggFuncType,
38+
AnyAll,
3839
AnyArrayLike,
3940
ArrayLike,
4041
Axis,
@@ -5735,7 +5736,7 @@ def dropna(
57355736
*,
57365737
axis: Axis = ...,
57375738
inplace: Literal[False] = ...,
5738-
how: Literal["any", "all"] | None = ...,
5739+
how: AnyAll | None = ...,
57395740
) -> Series:
57405741
...
57415742

@@ -5745,7 +5746,7 @@ def dropna(
57455746
*,
57465747
axis: Axis = ...,
57475748
inplace: Literal[True],
5748-
how: Literal["any", "all"] | None = ...,
5749+
how: AnyAll | None = ...,
57495750
) -> None:
57505751
...
57515752

@@ -5754,7 +5755,7 @@ def dropna(
57545755
self,
57555756
axis: Axis = 0,
57565757
inplace: bool = False,
5757-
how: Literal["any", "all"] | None = None,
5758+
how: AnyAll | None = None,
57585759
) -> Series | None:
57595760
"""
57605761
Return a new Series with missing values removed.

0 commit comments

Comments
 (0)