MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / adjacent_to

Method adjacent_to

lib/sqlalchemy/dialects/postgresql/ranges.py:477–497  ·  view source on GitHub ↗

Determine whether this range is adjacent to the `other`.

(self, other: Range[_T])

Source from the content-addressed store, hash-verified

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`.

Callers 5

unionMethod · 0.95
test_adjacentMethod · 0.45
test_adjacent_toMethod · 0.45
test_adjacent_to_objMethod · 0.45

Calls 1

Tested by 3

test_adjacentMethod · 0.36
test_adjacent_toMethod · 0.36
test_adjacent_to_objMethod · 0.36