Skip to content

Commit 298c472

Browse files
check_untyped_defs pandas.core.algorithms
1 parent 53260f6 commit 298c472

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

pandas/core/algorithms.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
intended for public consumption
44
"""
55
from textwrap import dedent
6-
from typing import Dict
6+
from typing import Callable, Dict
77
from warnings import catch_warnings, simplefilter, warn
88

99
import numpy as np
@@ -1474,7 +1474,9 @@ def _take_nd_object(arr, indexer, out, axis, fill_value, mask_info):
14741474
}
14751475

14761476

1477-
def _get_take_nd_function(ndim, arr_dtype, out_dtype, axis=0, mask_info=None):
1477+
def _get_take_nd_function(
1478+
ndim: int, arr_dtype, out_dtype, axis: int = 0, mask_info=None
1479+
) -> Callable:
14781480
if ndim <= 2:
14791481
tup = (arr_dtype.name, out_dtype.name)
14801482
if ndim == 1:
@@ -1499,13 +1501,13 @@ def _get_take_nd_function(ndim, arr_dtype, out_dtype, axis=0, mask_info=None):
14991501
func = _convert_wrapper(func, out_dtype)
15001502
return func
15011503

1502-
def func(arr, indexer, out, fill_value=np.nan):
1504+
def f(arr, indexer, out, fill_value=np.nan):
15031505
indexer = ensure_int64(indexer)
15041506
_take_nd_object(
15051507
arr, indexer, out, axis=axis, fill_value=fill_value, mask_info=mask_info
15061508
)
15071509

1508-
return func
1510+
return f
15091511

15101512

15111513
def take(arr, indices, axis=0, allow_fill=False, fill_value=None):
@@ -1691,9 +1693,9 @@ def take_nd(
16911693
# at this point, it's guaranteed that dtype can hold both the arr values
16921694
# and the fill_value
16931695
if out is None:
1694-
out_shape = list(arr.shape)
1695-
out_shape[axis] = len(indexer)
1696-
out_shape = tuple(out_shape)
1696+
out_shape_ = list(arr.shape)
1697+
out_shape_[axis] = len(indexer)
1698+
out_shape = tuple(out_shape_)
16971699
if arr.flags.f_contiguous and axis == arr.ndim - 1:
16981700
# minor tweak that can make an order-of-magnitude difference
16991701
# for dataframes initialized directly from 2-d ndarrays
@@ -1935,13 +1937,13 @@ def diff(arr, n, axis=0):
19351937
f = _diff_special[arr.dtype.name]
19361938
f(arr, out_arr, n, axis)
19371939
else:
1938-
res_indexer = [slice(None)] * arr.ndim
1939-
res_indexer[axis] = slice(n, None) if n >= 0 else slice(None, n)
1940-
res_indexer = tuple(res_indexer)
1940+
res_indexer_ = [slice(None)] * arr.ndim
1941+
res_indexer_[axis] = slice(n, None) if n >= 0 else slice(None, n)
1942+
res_indexer = tuple(res_indexer_)
19411943

1942-
lag_indexer = [slice(None)] * arr.ndim
1943-
lag_indexer[axis] = slice(None, -n) if n > 0 else slice(-n, None)
1944-
lag_indexer = tuple(lag_indexer)
1944+
lag_indexer_ = [slice(None)] * arr.ndim
1945+
lag_indexer_[axis] = slice(None, -n) if n > 0 else slice(-n, None)
1946+
lag_indexer = tuple(lag_indexer_)
19451947

19461948
# need to make sure that we account for na for datelike/timedelta
19471949
# we don't actually want to subtract these i8 numbers

setup.cfg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,6 @@ check_untyped_defs=False
173173
[mypy-pandas._version]
174174
check_untyped_defs=False
175175

176-
[mypy-pandas.core.algorithms]
177-
check_untyped_defs=False
178-
179176
[mypy-pandas.core.arrays.categorical]
180177
check_untyped_defs=False
181178

0 commit comments

Comments
 (0)