class Range(Generic[
Represent a PostgreSQL range. E.g.:: r = Range(10, 50, bounds="()") The calling style is similar to that of psycopg and psycopg2, in part to allow easier migration from previous SQLAlchemy versions that used these objects directly. :param lower: Lower bound value, or None :param upper: Upper bound value, or None :param bounds: keyword-only, optional string value that is one of ``"()"``, ``"[)"``, ``"(]"``, ``"[]"``. Defaults to ``"[)"``. :param empty: keyword-only, optional bool indicating this is an "empty" range .. versionadded:: 2.0
Method | __add__ |
Undocumented |
Method | __bool__ |
Undocumented |
Method | __eq__ |
Compare this range to the `other` taking into account bounds inclusivity, returning ``True`` if they are equal. |
Method | __init__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | __sub__ |
Undocumented |
Method | adjacent |
Determine whether this range is adjacent to the `other`. |
Method | contained |
Determine whether this range is a contained by `other`. |
Method | contains |
Determine whether this range contains `value`. |
Method | difference |
Compute the difference between this range and the `other`. |
Method | not |
Determine whether this does not extend to the left of `other`. |
Method | not |
Determine whether this does not extend to the right of `other`. |
Method | overlaps |
Determine whether this range overlaps with `other`. |
Method | strictly |
Determine whether this range is completely to the left of `other`. |
Method | strictly |
Determine whether this range is completely to the right of `other`. |
Method | union |
Compute the union of this range with the `other`. |
Class Variable | bounds |
Undocumented |
Class Variable | empty |
Undocumented |
Class Variable | lower |
the lower bound |
Class Variable | upper |
the upper bound |
Property | __sa |
Undocumented |
Property | is |
A synonym for the 'empty' attribute. |
Property | isempty |
A synonym for the 'empty' attribute. |
Property | lower |
Return True if the lower bound is inclusive. |
Property | lower |
Return True if this range is non-empty and lower bound is infinite. |
Property | upper |
Return True if the upper bound is inclusive. |
Property | upper |
Return True if this range is non-empty and the upper bound is infinite. |
Method | _compare |
Compare two range bounds. |
Method | _contains |
Return True if this range contains the given value. |
Method | _get |
Determine the “step” for this range, if it is a discrete one. |
Method | _stringify |
Undocumented |
Method | _upper |
Determine whether an upper bound is immediately successive to a lower bound. |
Compare this range to the `other` taking into account bounds inclusivity, returning ``True`` if they are equal.
Optional[ _T]
= None, upper: Optional[ _T]
= None, *, bounds: _BoundsType
= '[)', empty: bool
= False):
(source)
¶
Undocumented
Compute the difference between this range and the `other`. This raises a ``ValueError`` exception if the two ranges are "disjunct", that is neither adjacent nor overlapping.
Compute the union of this range with the `other`. This raises a ``ValueError`` exception if the two ranges are "disjunct", that is neither adjacent nor overlapping.
Optional[ _T]
, bound1: str
, value2: Optional[ _T]
, bound2: str
, only_values: bool
= False) -> int
:
(source)
¶
Compare two range bounds. Return -1, 0 or 1 respectively when `value1` is less than, equal to or greater than `value2`. When `only_value` is ``True``, do not consider the *inclusivity* of the edges, just their values.