Skip to content

Commit 1e92983

Browse files
committed
Rabased and added typing
1 parent 9ef40b9 commit 1e92983

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pandas/core/indexes/range.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from datetime import timedelta
22
import operator
33
from sys import getsizeof
4+
from typing import Union
45
import warnings
56

67
import numpy as np
@@ -334,7 +335,7 @@ def is_monotonic_decreasing(self):
334335
def has_duplicates(self):
335336
return False
336337

337-
def __contains__(self, key):
338+
def __contains__(self, key: Union[int, np.integer]) -> bool:
338339
hash(key)
339340
try:
340341
key = ensure_python_int(key)
@@ -648,10 +649,10 @@ def __floordiv__(self, other):
648649
return self._simple_new(start, start + 1, 1, name=self.name)
649650
return self._int64index // other
650651

651-
def all(self):
652+
def all(self) -> bool:
652653
return 0 not in self._range
653654

654-
def any(self):
655+
def any(self) -> bool:
655656
return any(self._range)
656657

657658
@classmethod

pandas/tests/indexes/test_range.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def test_dtype(self):
247247
def test_cached_data(self):
248248
# GH 26565, GH26617
249249
# Calling RangeIndex._data caches an int64 array of the same length at
250-
# self._cached_data. This tests whether _cached_data has been set.
250+
# self._cached_data. This test checks whether _cached_data has been set
251251
idx = RangeIndex(0, 100, 10)
252252

253253
assert idx._cached_data is None

0 commit comments

Comments
 (0)