Determine whether this range is adjacent to the `other`.
(self, other: Range[_T])
| 475 | return False |
| 476 | |
| 477 | def adjacent_to(self, other: Range[_T]) -> bool: |
| 478 | "Determine whether this range is adjacent to the `other`." |
| 479 | |
| 480 | # Empty ranges are not adjacent to any other range |
| 481 | if self.empty or other.empty: |
| 482 | return False |
| 483 | |
| 484 | slower = self.lower |
| 485 | slower_b = self.bounds[0] |
| 486 | supper = self.upper |
| 487 | supper_b = self.bounds[1] |
| 488 | olower = other.lower |
| 489 | olower_b = other.bounds[0] |
| 490 | oupper = other.upper |
| 491 | oupper_b = other.bounds[1] |
| 492 | |
| 493 | return self._upper_edge_adjacent_to_lower( |
| 494 | supper, supper_b, olower, olower_b |
| 495 | ) or self._upper_edge_adjacent_to_lower( |
| 496 | oupper, oupper_b, slower, slower_b |
| 497 | ) |
| 498 | |
| 499 | def union(self, other: Range[_T]) -> Range[_T]: |
| 500 | """Compute the union of this range with the `other`. |