return a boolean if this key is IN the index We *only* accept an Interval Parameters ---------- key : Interval Returns ------- bool
(self, key: Any)
| 455 | return IntervalTree(left, right, closed=self.closed) |
| 456 | |
| 457 | def __contains__(self, key: Any) -> bool: |
| 458 | """ |
| 459 | return a boolean if this key is IN the index |
| 460 | We *only* accept an Interval |
| 461 | |
| 462 | Parameters |
| 463 | ---------- |
| 464 | key : Interval |
| 465 | |
| 466 | Returns |
| 467 | ------- |
| 468 | bool |
| 469 | """ |
| 470 | hash(key) |
| 471 | if not isinstance(key, Interval): |
| 472 | if is_valid_na_for_dtype(key, self.dtype): |
| 473 | return self.hasnans |
| 474 | return False |
| 475 | |
| 476 | try: |
| 477 | self.get_loc(key) |
| 478 | return True |
| 479 | except KeyError: |
| 480 | return False |
| 481 | |
| 482 | def _getitem_slice(self, slobj: slice) -> IntervalIndex: |
| 483 | """ |
nothing calls this directly
no test coverage detected