MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / __eq__

Method __eq__

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

Compare this range to the `other` taking into account bounds inclusivity, returning ``True`` if they are equal.

(self, other: Any)

Source from the content-addressed store, hash-verified

266 return 0
267
268 def __eq__(self, other: Any) -> bool:
269 """Compare this range to the `other` taking into account
270 bounds inclusivity, returning ``True`` if they are equal.
271 """
272
273 if not isinstance(other, Range):
274 return NotImplemented
275
276 if self.empty and other.empty:
277 return True
278 elif self.empty != other.empty:
279 return False
280
281 slower = self.lower
282 slower_b = self.bounds[0]
283 olower = other.lower
284 olower_b = other.bounds[0]
285 supper = self.upper
286 supper_b = self.bounds[1]
287 oupper = other.upper
288 oupper_b = other.bounds[1]
289
290 return (
291 self._compare_edges(slower, slower_b, olower, olower_b) == 0
292 and self._compare_edges(supper, supper_b, oupper, oupper_b) == 0
293 )
294
295 def contained_by(self, other: Range[_T]) -> bool:
296 "Determine whether this range is a contained by `other`."

Callers

nothing calls this directly

Calls 1

_compare_edgesMethod · 0.95

Tested by

no test coverage detected