ó
ŋb]c           @   s$  d  d l  m Z d d l m Z d Z d e f d     YZ d e e j f d	     YZ	 e	 e d
 <d e e j f d     YZ
 e
 e d <d e e j f d     YZ e e d <d e e j f d     YZ e e d <d e e j f d     YZ e e d <d e e j f d     YZ e e d <d S(   i   (   t   ischema_namesi   (   t   typest	   INT4RANGEt	   INT8RANGEt   NUMRANGEt   RangeOperatorsc           B   s*   e  Z d  Z d e j j f d     YZ RS(   sI  
    This mixin provides functionality for the Range Operators
    listed in Table 9-44 of the `postgres documentation`__ for Range
    Functions and Operators. It is used by all the range types
    provided in the ``postgres`` dialect and can likely be used for
    any range types you create yourself.

    __ http://www.postgresql.org/docs/devel/static/functions-range.html

    No extra support is provided for the Range Functions listed in
    Table 9-45 of the postgres documentation. For these, the normal
    :func:`~sqlalchemy.sql.expression.func` object should be used.

    t   comparator_factoryc           B   st   e  Z d  Z d   Z d   Z d   Z d   Z d   Z e Z d   Z	 e	 Z
 d   Z d   Z d	   Z d
   Z RS(   s-   Define comparison operations for range types.c         C   s?   | d k r% t t j |   j |  S|  j j d  |  Sd S(   s<   Boolean expression. Returns true if two ranges are not equals   <>N(   t   Nonet   superR   R   t   __ne__t   exprt   op(   t   selft   other(    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyR	   !   s    c         K   s   |  j  j d  |  S(   sĪ   Boolean expression. Returns true if the right hand operand,
            which can be an element or a range, is contained within the
            column.
            s   @>(   R
   R   (   R   R   t   kw(    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyt   contains*   s    c         C   s   |  j  j d  |  S(   ss   Boolean expression. Returns true if the column is contained
            within the right hand operand.
            s   <@(   R
   R   (   R   R   (    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyt   contained_by1   s    c         C   s   |  j  j d  |  S(   s   Boolean expression. Returns true if the column overlaps
            (has points in common with) the right hand operand.
            s   &&(   R
   R   (   R   R   (    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyt   overlaps7   s    c         C   s   |  j  j d  |  S(   ss   Boolean expression. Returns true if the column is strictly
            left of the right hand operand.
            s   <<(   R
   R   (   R   R   (    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyt   strictly_left_of=   s    c         C   s   |  j  j d  |  S(   st   Boolean expression. Returns true if the column is strictly
            right of the right hand operand.
            s   >>(   R
   R   (   R   R   (    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyt   strictly_right_ofE   s    c         C   s   |  j  j d  |  S(   s   Boolean expression. Returns true if the range in the column
            does not extend right of the range in the operand.
            s   &<(   R
   R   (   R   R   (    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyt   not_extend_right_ofM   s    c         C   s   |  j  j d  |  S(   s   Boolean expression. Returns true if the range in the column
            does not extend left of the range in the operand.
            s   &>(   R
   R   (   R   R   (    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyt   not_extend_left_ofS   s    c         C   s   |  j  j d  |  S(   s}   Boolean expression. Returns true if the range in the column
            is adjacent to the range in the operand.
            s   -|-(   R
   R   (   R   R   (    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyt   adjacent_toY   s    c         C   s   |  j  j d  |  S(   s   Range expression. Returns the union of the two ranges.
            Will raise an exception if the resulting range is not
            contigous.
            t   +(   R
   R   (   R   R   (    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyt   __add___   s    (   t   __name__t
   __module__t   __doc__R	   R   R   R   R   t
   __lshift__R   t
   __rshift__R   R   R   R   (    (    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyR      s   										(   R   R   R   t   sqltypest   Concatenablet
   ComparatorR   (    (    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyR      s   c           B   s   e  Z d  Z d Z RS(   s.   Represent the PostgreSQL INT4RANGE type.

    R   (   R   R   R   t   __visit_name__(    (    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyR   g   s   t	   int4rangec           B   s   e  Z d  Z d Z RS(   s.   Represent the PostgreSQL INT8RANGE type.

    R   (   R   R   R   R!   (    (    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyR   r   s   t	   int8rangec           B   s   e  Z d  Z d Z RS(   s-   Represent the PostgreSQL NUMRANGE type.

    R   (   R   R   R   R!   (    (    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyR   }   s   t   numranget	   DATERANGEc           B   s   e  Z d  Z d Z RS(   s.   Represent the PostgreSQL DATERANGE type.

    R%   (   R   R   R   R!   (    (    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyR%      s   t	   dateranget   TSRANGEc           B   s   e  Z d  Z d Z RS(   s,   Represent the PostgreSQL TSRANGE type.

    R'   (   R   R   R   R!   (    (    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyR'      s   t   tsranget	   TSTZRANGEc           B   s   e  Z d  Z d Z RS(   s.   Represent the PostgreSQL TSTZRANGE type.

    R)   (   R   R   R   R!   (    (    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyR)      s   t	   tstzrangeN(   R   R   R   (   t   baseR    t    R   R   t   __all__t   objectR   t
   TypeEngineR   R   R   R%   R'   R)   (    (    (    sD   lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyt   <module>   s   Y




