Skip to content

Commit 9aa4365

Browse files
committed
CLN: More typing for _reorder_indexer
1 parent 2eb7414 commit 9aa4365

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pandas/core/indexes/multi.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import datetime
22
from sys import getsizeof
3-
from typing import Any, Hashable, List, Optional, Sequence, Union
3+
from typing import Any, Hashable, Iterable, List, Optional, Sequence, Tuple, Union
44
import warnings
55

66
import numpy as np
@@ -9,6 +9,7 @@
99

1010
from pandas._libs import Timestamp, algos as libalgos, index as libindex, lib, tslibs
1111
from pandas._libs.hashtable import duplicated_int64
12+
from pandas._typing import AnyArrayLike, ArrayLike, Scalar
1213
from pandas.compat.numpy import function as nv
1314
from pandas.errors import PerformanceWarning, UnsortedIndexError
1415
from pandas.util._decorators import Appender, cache_readonly
@@ -42,7 +43,6 @@
4243
ensure_index,
4344
)
4445
from pandas.core.indexes.frozen import FrozenList
45-
from pandas.core.indexes.numeric import Int64Index
4646
import pandas.core.missing as missing
4747
from pandas.core.sorting import (
4848
get_group_index,
@@ -3068,7 +3068,9 @@ def _update_indexer(idxr, indexer=indexer):
30683068

30693069
return indexer._ndarray_values
30703070

3071-
def _reorder_indexer(self, seq, indexer: Int64Index) -> Int64Index:
3071+
def _reorder_indexer(
3072+
self, seq: Tuple[Union[Scalar, Iterable, AnyArrayLike], ...], indexer: ArrayLike
3073+
) -> ArrayLike:
30723074
"""
30733075
Reorder an indexer of a MultiIndex (self) so that the label are in the
30743076
same order as given in seq
@@ -3082,10 +3084,8 @@ def _reorder_indexer(self, seq, indexer: Int64Index) -> Int64Index:
30823084
-------
30833085
indexer : a sorted Int64Index indexer of self ordered as seq
30843086
"""
3085-
from typing import Tuple
3086-
30873087
n = len(self)
3088-
keys = tuple() # type: Tuple[np.ndarray, ...]
3088+
keys = tuple()
30893089
# For each level of the sequence in seq, map the level codes with the
30903090
# order they appears in a list-like sequence
30913091
# This mapping is then use to reorder the indexer

0 commit comments

Comments
 (0)