Skip to content

Commit 7442310

Browse files
author
MomIsBestFriend
committed
Removed any newly added annotation of Callable/str
This is because no matter what typing annotation combination of "method" is being used "Union[Callable, str]" or "Callable" or "str" mypy is raising errors
1 parent 3283564 commit 7442310

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

pandas/core/nanops.py

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import functools
22
import itertools
33
import operator
4-
from typing import Any, Callable, Optional, Tuple, Union
4+
from typing import Any, Optional, Tuple, Union
55

66
import numpy as np
77

@@ -56,7 +56,7 @@ def __init__(self, *dtypes):
5656
def check(self, obj) -> bool:
5757
return hasattr(obj, "dtype") and issubclass(obj.dtype.type, self.dtypes)
5858

59-
def __call__(self, f) -> Callable:
59+
def __call__(self, f):
6060
@functools.wraps(f)
6161
def _f(*args, **kwargs):
6262
obj_iter = itertools.chain(args, kwargs.values())
@@ -81,11 +81,11 @@ def _f(*args, **kwargs):
8181

8282

8383
class bottleneck_switch:
84-
def __init__(self, name: Optional[str] = None, **kwargs):
84+
def __init__(self, name=None, **kwargs):
8585
self.name = name
8686
self.kwargs = kwargs
8787

88-
def __call__(self, alt: Callable) -> Callable:
88+
def __call__(self, alt):
8989
bn_name = self.name or alt.__name__
9090

9191
try:
@@ -167,9 +167,7 @@ def _has_infs(result) -> bool:
167167

168168

169169
def _get_fill_value(
170-
dtype: Dtype,
171-
fill_value: Optional[Scalar] = None,
172-
fill_value_typ: Optional[str] = None,
170+
dtype: Dtype, fill_value: Optional[Scalar] = None, fill_value_typ=None
173171
):
174172
""" return the correct fill value for the dtype of the values """
175173
if fill_value is not None:
@@ -850,7 +848,7 @@ def nansem(
850848
return np.sqrt(var) / np.sqrt(count)
851849

852850

853-
def _nanminmax(meth: str, fill_value_typ: str) -> Callable:
851+
def _nanminmax(meth, fill_value_typ):
854852
@bottleneck_switch(name="nan" + meth)
855853
def reduction(
856854
values: np.ndarray,
@@ -1307,7 +1305,7 @@ def nancorr(
13071305
return f(a, b)
13081306

13091307

1310-
def get_corr_func(method) -> Callable:
1308+
def get_corr_func(method):
13111309
if method in ["kendall", "spearman"]:
13121310
from scipy.stats import kendalltau, spearmanr
13131311
elif method in ["pearson"]:
@@ -1381,7 +1379,7 @@ def _ensure_numeric(x):
13811379
# NA-friendly array comparisons
13821380

13831381

1384-
def make_nancomp(op) -> Callable:
1382+
def make_nancomp(op):
13851383
def f(x, y):
13861384
xmask = isna(x)
13871385
ymask = isna(y)
@@ -1409,7 +1407,7 @@ def f(x, y):
14091407

14101408

14111409
def _nanpercentile_1d(
1412-
values: np.ndarray, mask: np.ndarray, q, na_value: Scalar, interpolation: str
1410+
values: np.ndarray, mask: np.ndarray, q, na_value: Scalar, interpolation
14131411
) -> Union[Scalar, np.ndarray]:
14141412
"""
14151413
Wrapper for np.percentile that skips missing values, specialized to
@@ -1448,7 +1446,7 @@ def nanpercentile(
14481446
na_value,
14491447
mask: np.ndarray,
14501448
ndim: int,
1451-
interpolation: str,
1449+
interpolation,
14521450
):
14531451
"""
14541452
Wrapper for np.percentile that skips missing values.

0 commit comments

Comments
 (0)