
    gҀ                    V   d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dlm
Z
 d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ  ddl!mZ ddl"m#Z# dd l$m%Z% dd!l&m'Z' erdd"l(m)Z) dd#l"m*Z* dd$l"m+Z+  ed%e	&      Z,e'd'   Z-e%r	d(d)iZ.d*d)iZ/ni Z.i Z/ ej`                  dUd+d)ie. G d, d-ee,                Z1 G d. d/ee1e,            Z2 G d0 d1e jF                  e,         Z3 G d2 d3e3e1e,            Z4 G d4 d5e4e,         Z5 G d6 d7e3ee1e,               Z6 G d8 d9e6e,         Z7 G d: d;e4e8         Z9 G d< d=e4e8         Z: G d> d?e4e         Z; G d@ dAe4e         Z< G dB dCe4e         Z= G dD dEe4e         Z> G dF dGe6e8         Z? G dH dIe6e8         Z@ G dJ dKe6e         ZA G dL dMe6e         ZB G dN dOe6e         ZC G dP dQe6e         ZDdRZEdSZFdVdTZGy)W    )annotationsN)date)datetime)	timedelta)Decimal)Any)cast)Generic)List)Optional)overload)Sequence)Tuple)Type)TYPE_CHECKING)TypeVar)Union   )ADJACENT_TO)CONTAINED_BY)CONTAINS)NOT_EXTEND_LEFT_OF)NOT_EXTEND_RIGHT_OF)OVERLAP)STRICTLY_LEFT_OF)STRICTLY_RIGHT_OF   )types)	operators)
TypeEngine)py310)Literal)ColumnElement)_TE)TypeEngineMixin_T)bound)z()[)z(]z[]slotsTkw_onlyfrozenc                     e Zd ZU dZdZded<   	 dZded<   	 er1 ej                  d      Z
ded	<    ej                  d
      Zded<   n2 ej                  d-ddieZ
ded	<    ej                  d-dd
ieZded<   es	 	 d.dd
d	 	 	 	 	 	 	 d/dZd0dZed0d       Zed0d       Zed0d       Zed0d       Zed0d       Zed0d       Zed1d       Zd2dZd3dZ	 d4	 	 	 	 	 	 	 	 	 	 	 d5dZd6dZd7dZd8dZeZd7dZd7dZ e Z!d7d Z"e"Z#d7d!Z$d7d"Z%	 	 	 	 	 	 	 	 	 	 d9d#Z&d7d$Z'd:d%Z(d:d&Z)d:d'Z*d:d(Z+d:d)Z,d:d*Z-d;d+Z.d;d,Z/y)<Rangea_  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

    NOptional[_T]lowerupperr(   )default_BoundsTypeboundsFboolemptyr1   )r3   r5   c               D    | j                   j                  ||||d       y )N)r/   r0   r3   r5   )__dict__update)selfr/   r0   r3   r5   s        e/var/www/api/v1/venv_getwork_v1/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/ranges.py__init__zRange.__init__a   s'     MM  ""$"	    c                    | j                    S Nr5   r9   s    r:   __bool__zRange.__bool__s   s    ::~r<   c                    | j                   S z$A synonym for the 'empty' attribute.r?   r@   s    r:   isemptyzRange.isemptyv        zzr<   c                    | j                   S rC   r?   r@   s    r:   is_emptyzRange.is_empty|   rE   r<   c                &    | j                   d   dk(  S )z,Return True if the lower bound is inclusive.r   [r3   r@   s    r:   	lower_inczRange.lower_inc        {{1~$$r<   c                <    | j                    xr | j                  du S )zKReturn True if this range is non-empty and lower bound is
        infinite.N)r5   r/   r@   s    r:   	lower_infzRange.lower_inf       
 ::~4$**"44r<   c                &    | j                   d   dk(  S )z,Return True if the upper bound is inclusive.r   ]rJ   r@   s    r:   	upper_inczRange.upper_inc   rL   r<   c                <    | j                    xr | j                  du S )zOReturn True if this range is non-empty and the upper bound is
        infinite.N)r5   r0   r@   s    r:   	upper_infzRange.upper_inf   rO   r<   c                    t               S r>   )AbstractSingleRanger@   s    r:   __sa_type_engine__zRange.__sa_type_engine__   s    "$$r<   c                   | j                   ry| j                  @| j                  du xs0 | j                  d   dk(  r|| j                  k  S || j                  k  S | j                  0| j                  d   dk(  r|| j                  kD  S || j                  k\  S | j                  d   dk(  r|| j                  kD  n|| j                  k\  xr0 | j                  d   dk(  r|| j                  k  S || j                  k  S )z3Return True if this range contains the given value.FNr   )r   ()r5   r/   r0   r3   r9   values     r:   _contains_valuezRange._contains_value   s    ::::::% ;;q>S( 

" djj( :: ;;q>S( 

" djj( {{1~$ DJJ$**$
 {{1~$ DJJ	
 $**$	
r<   c                X   t        | j                  t              st        | j                  t              ryt        | j                  t              st        | j                  t              ryt        | j                  t
              st        | j                  t
              rt        d      S y)uA   Determine the “step” for this range, if it is a discrete one.r   N)days)
isinstancer/   intr0   r   r   r   r@   s    r:   _get_discrete_stepzRange._get_discrete_step   sn     djj#&*TZZ*E

H-JJ2

 

D)Z

D-I!$$r<   c                f   |dv }|dv }||cxu rn n||k(  ry|rdS dS ||rdS dS ||rdS dS ||k(  r||k(  ry|dv }|dv }	| j                         }
|
*|r
|s||
z  }d}n	|r||
z  }d}|r
|	s||
z  }d}	n	|	r||
z  }d}	||k  ry||kD  ry|ry|r|	ry|s|	s||k(  ry|rdS dS |s|rdS dS |	s|rdS dS y)a  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.
        >   rZ   rI   r   r   >   rI   rQ   TF)rb   )r9   value1bound1value2bound2only_valuesvalue1_is_lower_boundvalue2_is_lower_bound
value1_inc
value2_incsteps              r:   _compare_edgeszRange._compare_edges   sN   " !'* 4 &* 4 V#$(==2r99^.25A5^-1525 V& 0z)
z)
&&( %!dNF!%JdNF!&J$!dNF!%JdNF!&JF?f_ j
(,AA 51=2=1q9r92r99r<   c                   t        |t              st        S | j                  r|j                  ry| j                  |j                  k7  ry| j                  }| j
                  d   }|j                  }|j
                  d   }| j                  }| j
                  d   }|j                  }|j
                  d   }	| j                  ||||      dk(  xr | j                  ||||	      dk(  S )zCompare this range to the `other` taking into account
        bounds inclusivity, returning ``True`` if they are equal.
        TFr   r   )r`   r-   NotImplementedr5   r/   r3   r0   ro   
r9   otherslowerslower_bolowerolower_bsuppersupper_boupperoupper_bs
             r:   __eq__zRange.__eq__+  s    
 %'!!::%++ZZ5;;&;;q><<?;;q><<? &(CqH M##FHfhG1L	
r<   c                p   | j                   ry|j                   ry| j                  }| j                  d   }|j                  }|j                  d   }| j                  ||||      dk  ry| j                  }| j                  d   }|j                  }|j                  d   }	| j                  ||||	      dkD  ryy)z7Determine whether this range is a contained by `other`.TFr   r   )r5   r/   r3   ro   r0   rr   s
             r:   contained_byzRange.contained_byF  s     :: ;;;;q><<?vxBQF;;q><<?vxBQFr<   c                f    t        |t              r|j                  |       S | j                  |      S )z.Determine whether this range contains `value`.)r`   r-   r~   r]   r[   s     r:   containszRange.containsc  s0     eU#%%d++''..r<   c                   | j                   s|j                   ry| j                  }| j                  d   }| j                  }| j                  d   }|j                  }|j                  d   }|j                  }|j                  d   }	| j	                  ||||      dk\  r| j	                  ||||	      dk  ry| j	                  ||||      dk\  r| j	                  ||||      dk  ryy)z3Determine whether this range overlaps with `other`.Fr   r   Tr5   r/   r3   r0   ro   
r9   rs   rt   ru   rx   ry   rv   rw   rz   r{   s
             r:   overlapszRange.overlapsm  s     ::;;q>;;q><<?<<? &(CqH##FHfhG1L &(CqH##FHfhG1Lr<   c                    | j                   s|j                   ry| j                  }| j                  d   }|j                  }|j                  d   }| j	                  ||||      dk  S )zBDetermine whether this range is completely to the left of `other`.Fr   r   )r5   r0   r3   r/   ro   )r9   rs   rx   ry   rv   rw   s         r:   strictly_left_ofzRange.strictly_left_of  ^     ::;;q><<? ""68VXFJJr<   c                    | j                   s|j                   ry| j                  }| j                  d   }|j                  }|j                  d   }| j	                  ||||      dkD  S )zCDetermine whether this range is completely to the right of `other`.Fr   r   r   )r9   rs   rt   ru   rz   r{   s         r:   strictly_right_ofzRange.strictly_right_of  r   r<   c                    | j                   s|j                   ry| j                  }| j                  d   }|j                  }|j                  d   }| j                  ||||      dk\  S )z>Determine whether this does not extend to the left of `other`.Fr   )r5   r/   r3   ro   )r9   rs   rt   ru   rv   rw   s         r:   not_extend_left_ofzRange.not_extend_left_of  ^     ::;;q><<? ""68VXF!KKr<   c                    | j                   s|j                   ry| j                  }| j                  d   }|j                  }|j                  d   }| j                  ||||      dk  S )z?Determine whether this does not extend to the right of `other`.Fr   r   )r5   r0   r3   ro   )r9   rs   rx   ry   rz   r{   s         r:   not_extend_right_ofzRange.not_extend_right_of  r   r<   c                <   | j                  ||||d      }|dk(  r<| j                         }|y|dk(  r|dk(  r|||z
  k(  S ||k(  S |dk(  r||k(  S |||z
  k(  S |dk(  rA|dk(  r|dk(  s
|dk(  r|dk(  r| j                         }|y|dk(  xr |dk(  xs |dk(  xr |dk(  S y)	zTDetermine whether an upper bound is immediately successive to a
        lower bound.Trd   FrQ   rI   r   rY   rZ   )ro   rb   )r9   re   rf   rg   rh   resrn   s          r:   _upper_edge_adjacent_to_lowerz#Range._upper_edge_adjacent_to_lower  s     !!&&&&$G"9**,D|}S=!Vd]22!V++S=!V++!Vd]22AX #cMS=cM..0## "cM"S= "cM	 r<   c                `   | j                   s|j                   ry| j                  }| j                  d   }| j                  }| j                  d   }|j                  }|j                  d   }|j                  }|j                  d   }	| j	                  ||||      xs | j	                  ||	||      S )z8Determine whether this range is adjacent to the `other`.Fr   r   )r5   r/   r3   r0   r   r   s
             r:   adjacent_tozRange.adjacent_to  s     ::;;q>;;q><<?<<?11Hfh
 
//Hfh
	
r<   c           	     *   | j                   r|S |j                   r| S | j                  |      s| j                  |      st        d      | j                  }| j
                  d   }| j                  }| j
                  d   }|j                  }|j
                  d   }|j                  }|j
                  d   }	| j                  ||||      dk  r|}
|}n|}
|}| j                  ||||	      dkD  r|}|}n|}|	}t        |
|t        t        ||z               S )zCompute 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.
        zAAdding non-overlapping and non-adjacent ranges is not implementedr   r   rJ   )r5   r   r   
ValueErrorr/   r3   r0   ro   r-   r	   r2   r9   rs   rt   ru   rx   ry   rv   rw   rz   r{   rlowerrlower_brupperrupper_bs                 r:   unionzRange.union  s    ::L;;K}}U#D,<,<U,C- 
 ;;q>;;q><<?<<?vxBQFFHFHvxBQFFHFHF4X5H#I
 	
r<   c                $    | j                  |      S r>   )r   r9   rs   s     r:   __add__zRange.__add__@  s    zz%  r<   c           	        | j                   s|j                   r| S | j                  }| j                  d   }| j                  }| j                  d   }|j                  }|j                  d   }|j                  }|j                  d   }	| j	                  ||||      }
| j	                  ||||	      }|
dk  r|dkD  rt        d      | j	                  ||||	      }| j	                  ||||      }|dkD  s|dk  r| S |
dk\  r|dk  rt        ddd      S |
dk  ra|dk\  r\|dk  rW|dk(  rdnd	}|dk7  r*|d	k7  r%| j	                  ||||      dk(  rt        ddd      S t        ||t        t        ||z         
      S |
dk\  ra|dk\  r\|dk  rW|	d	k(  rdnd}|dk7  r*|d	k7  r%| j	                  ||||      dk(  rt        ddd      S t        ||t        t        ||z         
      S J d|  d|        )zCompute 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.
        r   r   z5Subtracting a strictly inner range is not implementedNTr?   rI   rY   rQ   rJ   rZ   zUnhandled case computing z - )	r5   r/   r3   r0   ro   r   r-   r	   r2   )r9   rs   rt   ru   rx   ry   rv   rw   rz   r{   sl_vs_olsu_vs_ousl_vs_ousu_vs_olr   r   s                   r:   
differencezRange.differenceC  s0    ::K;;q>;;q><<?<<?&&vxJ&&vxJa<HqLG  &&vxJ&&vxJ a<8a<K q=X]t400 q=X]x1}&#os3HCO''&(K T4t44X-@A  q=X]x1}&#os3HCO''&(K T4t44X-@A  	C1$s5'BBur<   c                $    | j                  |      S r>   )r   r   s     r:   __sub__zRange.__sub__  s    u%%r<   c           	        | j                   s|j                   s| j                  |      st        ddd      S | j                  }| j                  d   }| j
                  }| j                  d   }|j                  }|j                  d   }|j
                  }|j                  d   }	| j                  ||||      dk  r|}
|}n|}
|}| j                  ||||	      dkD  r|}|	}n|}|}t        |
|t        t        ||z               S )zdCompute the intersection of this range with the `other`.

        .. versionadded:: 2.0.10

        NTr?   r   r   rJ   )	r5   r   r-   r/   r3   r0   ro   r	   r2   r   s                 r:   intersectionzRange.intersection  s     ::DMM%,@t400;;q>;;q><<?<<?vxBQFFHFHvxBQFFHFHX%89
 	
r<   c                $    | j                  |      S r>   )r   r   s     r:   __mul__zRange.__mul__  s      ''r<   c                "    | j                         S r>   )
_stringifyr@   s    r:   __str__zRange.__str__  s      r<   c                    | j                   ry| j                  | j                  }}|dn|}|dn|}t        d| j                        \  }}| | d| | S )Nr5    zTuple[str, str],)r5   r/   r0   r	   r3   )r9   lrb0b1s        r:   r   zRange._stringify  sa    ::zz4::1)B)B'5BaS!RD!!r<    )NN)r/   r.   r0   r.   r3   r2   r5   r4   )returnr4   )r   zAbstractSingleRange[_T])r\   r&   r   r4   )r   r   )F)re   r.   rf   strrg   r.   rh   r   ri   r4   r   ra   )rs   r   r   r4   )rs   	Range[_T]r   r4   )r\   zUnion[_T, Range[_T]]r   r4   )
re   r.   rf   r   rg   r.   rh   r   r   r4   )rs   r   r   r   )r   r   )0__name__
__module____qualname____doc__r/   __annotations__r0   r   dataclassesfieldr3   r5   	dc_kwonlyr!   r;   rA   propertyrD   rG   rK   rN   rR   rT   rW   r]   rb   ro   r|   r~   r   __contains__r   r   
__lshift__r   
__rshift__r   r   r   r   r   r   r   r   r   r   r   r   r   r<   r:   r-   r-   ;   sf   * E<E</k//=='k''6t6/k//JJ	JJ'k''CCCtC #'"&	
 #'		  	
  	 	$  
  
 % %
 5 5 % %
 5 5 % %
<4 "WW W 	W
 W W 
Wr
6:/ L@K "JK #JLL-- - 	-
 - 
-^
,,
\!JCX&$
L(!
"r<   r-   c                  "    e Zd ZdZedd       Zy)
MultiRangea?  Represents a multirange sequence.

    This list subclass is an utility to allow automatic type inference of
    the proper multi-range SQL type depending on the single range values.
    This is useful when operating on literal multi-ranges::

        import sqlalchemy as sa
        from sqlalchemy.dialects.postgresql import MultiRange, Range

        value = literal(MultiRange([Range(2, 4)]))

        select(tbl).where(tbl.c.value.op("@")(MultiRange([Range(-3, 7)])))

    .. versionadded:: 2.0.26

    .. seealso::

        - :ref:`postgresql_multirange_list_use`.
    c                    t               S r>   )AbstractMultiRanger@   s    r:   rW   zMultiRange.__sa_type_engine__  s    !##r<   N)r   zAbstractMultiRange[_T])r   r   r   r   r   rW   r   r<   r:   r   r     s    ( $ $r<   r   c                       e Zd ZdZdZdZedd       Ze	 	 	 	 	 	 d	d       Z	 	 	 	 	 	 d
 fdZ G d dej                  e
e            Z xZS )AbstractRangez0Base class for single and multi Range SQL types.Tc                     y r>   r   r9   clskws      r:   adaptzAbstractRange.adapt  s    7:r<   c                     y r>   r   r   s      r:   r   zAbstractRange.adapt  s     r<   c                    t        |t        t        f      r=|| j                  ur/| j                  } t        | d|| j                  fd|i             S t        |   |      S )a	  Dynamically adapt a range type to an abstract impl.

        For example ``INT4RANGE().adapt(_Psycopg2NumericRange)`` should
        produce a type that will have ``_Psycopg2NumericRange`` behaviors
        and also render as ``INT4RANGE`` in SQL and DDL.

        	RangeImpl__visit_name__)
issubclassAbstractSingleRangeImplAbstractMultiRangeImpl	__class__r   typesuperr   )r9   r   r   
visit_namer   s       r:   r   zAbstractRange.adapt  st     s46LMN4>>) ,,J4,i(dnn%!:.   7=%%r<   c                  p    e Zd ZdZddZddZddZddZeZddZ	e	Z
ddZddZdd	Zdd
ZddZddZy) AbstractRange.comparator_factoryz-Define comparison operations for range types.c                B    | j                   j                  t        |      S )a
  Boolean expression. Returns true if the right hand operand,
            which can be an element or a range, is contained within the
            column.

            kwargs may be ignored by this operator but are required for API
            conformance.
            )exproperater   )r9   rs   r   s      r:   r   z)AbstractRange.comparator_factory.contains  s     99$$Xu55r<   c                B    | j                   j                  t        |      S )zsBoolean expression. Returns true if the column is contained
            within the right hand operand.
            )r   r   r   r   s     r:   r~   z-AbstractRange.comparator_factory.contained_by#  s     99$$\599r<   c                B    | j                   j                  t        |      S )zBoolean expression. Returns true if the column overlaps
            (has points in common with) the right hand operand.
            )r   r   r   r   s     r:   r   z)AbstractRange.comparator_factory.overlaps)  s     99$$We44r<   c                B    | j                   j                  t        |      S )zsBoolean expression. Returns true if the column is strictly
            left of the right hand operand.
            )r   r   r   r   s     r:   r   z1AbstractRange.comparator_factory.strictly_left_of/  s     99$$%5u==r<   c                B    | j                   j                  t        |      S )ztBoolean expression. Returns true if the column is strictly
            right of the right hand operand.
            )r   r   r   r   s     r:   r   z2AbstractRange.comparator_factory.strictly_right_of7  s     99$$%6>>r<   c                B    | j                   j                  t        |      S )zBoolean expression. Returns true if the range in the column
            does not extend right of the range in the operand.
            )r   r   r   r   s     r:   r   z4AbstractRange.comparator_factory.not_extend_right_of?  s     99$$%8%@@r<   c                B    | j                   j                  t        |      S )zBoolean expression. Returns true if the range in the column
            does not extend left of the range in the operand.
            )r   r   r   r   s     r:   r   z3AbstractRange.comparator_factory.not_extend_left_ofE  s     99$$%7??r<   c                B    | j                   j                  t        |      S )z}Boolean expression. Returns true if the range in the column
            is adjacent to the range in the operand.
            )r   r   r   r   s     r:   r   z,AbstractRange.comparator_factory.adjacent_toK  s     99$$[%88r<   c                V    | j                   j                  t        j                  |      S zRange expression. Returns the union of the two ranges.
            Will raise an exception if the resulting range is not
            contiguous.
            )r   r   r   addr   s     r:   r   z&AbstractRange.comparator_factory.unionQ      
 99$$Y]]E::r<   c                V    | j                   j                  t        j                  |      S r   )r   r   r   subr   s     r:   r   z+AbstractRange.comparator_factory.differenceX  r   r<   c                V    | j                   j                  t        j                  |      S )zRange expression. Returns the intersection of the two ranges.
            Will raise an exception if the resulting range is not
            contiguous.
            )r   r   r   mulr   s     r:   r   z-AbstractRange.comparator_factory.intersection_  r   r<   N)rs   r   r   r   r   ColumnElement[bool])rs   r   r   r   )rs   r   r   zColumnElement[Range[_T]])r   r   r   r   r   r~   r   r   r   r   r   r   r   r   r   r   r   r   r<   r:   comparator_factoryr     sL    ;	6	:	5	> &
	? '
	A	@	9	;	;	;r<   r   )r   z	Type[_TE]r   r   r   r$   )r   zType[TypeEngineMixin]r   r   r   TypeEngine[Any])r   z-Type[Union[TypeEngine[Any], TypeEngineMixin]]r   r   r   r   )r   r   r   r   render_bind_cast__abstract__r   r   r    
Comparatorr-   r   r   __classcell__)r   s   @r:   r   r     s    :L: :(03	  &: &  & 
	 &DN;Z225:> N; N;r<   r   c                      e Zd ZdZdZddZy)rV   zBase for PostgreSQL RANGE types.

    These are types that return a single :class:`_postgresql.Range` object.

    .. seealso::

        `PostgreSQL range functions <https://www.postgresql.org/docs/current/static/functions-range.html>`_

    Tc                   |j                   |j                   n|j                  }t        |t              rt	        |      r
t               S t               S t        |t        t        f      r
t               S t        |t              r |j                  s
t               S t               S t        |t              r
t               S t         j"                  S r>   )r/   r0   r`   ra   	_is_int32	INT4RANGE	INT8RANGEr   floatNUMRANGEr   tzinfoTSRANGE	TSTZRANGEr   	DATERANGEsqltypesNULLTYPE)r9   r\   specs      r:   _resolve_for_literalz(AbstractSingleRange._resolve_for_literalt  s    #kk5u{{5;;dC   {" {"w./:h'$(KK79@Y[@d#; $$$r<   N)r\   z
Range[Any]r   r   r   r   r   r   r   r  r   r<   r:   rV   rV   g  s     L%r<   rV   c                      e Zd ZdZy)r   zQMarker for AbstractSingleRange that will apply a subclass-specific
    adaptationNr   r   r   r   r   r<   r:   r   r         r<   r   c                      e Zd ZdZdZddZy)r   zBase for PostgreSQL MULTIRANGE types.

    these are types that return a sequence of :class:`_postgresql.Range`
    objects.

    Tc                   |st         j                  S |d   }|j                  |j                  n|j                  }t	        |t
              r&t        d |D              r
t               S t               S t	        |t        t        f      r
t               S t	        |t              r |j                  s
t               S t               S t	        |t               r
t#               S t         j                  S )Nr   c              3  2   K   | ]  }t        |        y wr>   )r   ).0r   s     r:   	<genexpr>z:AbstractMultiRange._resolve_for_literal.<locals>.<genexpr>  s     /A9Q<s   )r  r  r/   r0   r`   ra   allINT4MULTIRANGEINT8MULTIRANGEr   r   NUMMULTIRANGEr   r   TSMULTIRANGETSTZMULTIRANGEr   DATEMULTIRANGE)r9   r\   firstr  s       r:   r  z'AbstractMultiRange._resolve_for_literal  s    $$$a#kk5u{{5;;dC  ///%''%''w./ ?"h')-<>J.:JJd#!## $$$r<   N)r\   zSequence[Range[Any]]r   r   r  r   r<   r:   r   r     s     L%r<   r   c                      e Zd ZdZy)r   zPMarker for AbstractMultiRange that will apply a subclass-specific
    adaptationNr  r   r<   r:   r   r     r  r<   r   c                      e Zd ZdZd Zy)r   z(Represent the PostgreSQL INT4RANGE type.Nr   r   r   r   r   r   r<   r:   r   r     
    2 Nr<   r   c                      e Zd ZdZd Zy)r   z(Represent the PostgreSQL INT8RANGE type.Nr  r   r<   r:   r   r     r  r<   r   c                      e Zd ZdZd Zy)r   z'Represent the PostgreSQL NUMRANGE type.Nr  r   r<   r:   r   r     s
    1Nr<   r   c                      e Zd ZdZd Zy)r   z(Represent the PostgreSQL DATERANGE type.Nr  r   r<   r:   r   r     r  r<   r   c                      e Zd ZdZd Zy)r   &Represent the PostgreSQL TSRANGE type.Nr  r   r<   r:   r   r     s
    0Nr<   r   c                      e Zd ZdZd Zy)r   (Represent the PostgreSQL TSTZRANGE type.Nr  r   r<   r:   r   r     r  r<   r   c                      e Zd ZdZd Zy)r  z-Represent the PostgreSQL INT4MULTIRANGE type.Nr  r   r<   r:   r  r    
    7%Nr<   r  c                      e Zd ZdZd Zy)r  z-Represent the PostgreSQL INT8MULTIRANGE type.Nr  r   r<   r:   r  r    r"  r<   r  c                      e Zd ZdZd Zy)r  z,Represent the PostgreSQL NUMMULTIRANGE type.Nr  r   r<   r:   r  r    s
    6$Nr<   r  c                      e Zd ZdZd Zy)r  z-Represent the PostgreSQL DATEMULTIRANGE type.Nr  r   r<   r:   r  r    r"  r<   r  c                      e Zd ZdZd Zy)r  r  Nr  r   r<   r:   r  r    s
    0#Nr<   r  c                      e Zd ZdZd Zy)r  r   Nr  r   r<   r:   r  r    s
    2%Nr<   r  ii   c                    | j                   d u xs" t        | j                   cxk  xr	 t        k  nc xr2 | j                  d u xs" t        | j                  cxk  xr	 t        k  S c S r>   )r/   _min_int_32_max_int_32r0   )r   s    r:   r   r     sP    GGtOD{aggDD 	4@;!''@[@@r<   r   )r   z
Range[int]r   r4   )H
__future__r   r   r   r   r   decimalr   typingr   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  sqlsql.type_apir    utilr!   util.typingr"   sql.elementsr#   r$   r%   r&   r2   dc_slotsr   	dataclassr-   r   r   rV   r   r   r   ra   r   r   r   r   r   r   r  r  r  r  r  r  r*  r)  r   r   r<   r:   <module>r5     sK   #                   " #  ) *  ' ( !  &  "-#/T,-HD!IHI /d/h/L
"GBK L
" 0L
"^$eBi $4;H''+ ;D %-b	2  %F1"5 
!%xb	':; !%H/3 
!#C( !!#C( ! "7+  !#D) !!(+ !#H- !&', &&', &%&w/ %&'- &$%h/ $&'1 & r<   