B
    þ¦†\Ž  ã               @   sØ   d dl mZ ddlmZ dZG dd„ deƒZG dd„ deejƒZ	e	ed	< G d
d„ deejƒZ
e
ed< G dd„ deejƒZeed< G dd„ deejƒZeed< G dd„ deejƒZeed< G dd„ deejƒZeed< dS )é   )Úischema_namesé   )Útypes)Ú	INT4RANGEÚ	INT8RANGEÚNUMRANGEc               @   s$   e Zd ZdZG dd„ dejjƒZdS )ÚRangeOperatorsaI  
    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.

    c                   sp   e Zd ZdZ‡ fd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‡  ZS )z!RangeOperators.comparator_factoryz-Define comparison operations for range types.c                s.   |dkrt tj| ƒ |¡S | j d¡|ƒS dS )z<Boolean expression. Returns true if two ranges are not equalNz<>)Úsuperr   Úcomparator_factoryÚ__ne__ÚexprÚop)ÚselfÚother)Ú	__class__© úDlib/python3.7/site-packages/sqlalchemy/dialects/postgresql/ranges.pyr   !   s    z(RangeOperators.comparator_factory.__ne__c             K   s   | j  d¡|ƒS )z¤Boolean expression. Returns true if the right hand operand,
            which can be an element or a range, is contained within the
            column.
            z@>)r   r   )r   r   Úkwr   r   r   Úcontains*   s    z*RangeOperators.comparator_factory.containsc             C   s   | j  d¡|ƒS )zsBoolean expression. Returns true if the column is contained
            within the right hand operand.
            z<@)r   r   )r   r   r   r   r   Úcontained_by1   s    z.RangeOperators.comparator_factory.contained_byc             C   s   | j  d¡|ƒS )z„Boolean expression. Returns true if the column overlaps
            (has points in common with) the right hand operand.
            z&&)r   r   )r   r   r   r   r   Úoverlaps7   s    z*RangeOperators.comparator_factory.overlapsc             C   s   | j  d¡|ƒS )zsBoolean expression. Returns true if the column is strictly
            left of the right hand operand.
            z<<)r   r   )r   r   r   r   r   Ústrictly_left_of=   s    z2RangeOperators.comparator_factory.strictly_left_ofc             C   s   | j  d¡|ƒS )ztBoolean expression. Returns true if the column is strictly
            right of the right hand operand.
            z>>)r   r   )r   r   r   r   r   Ústrictly_right_ofE   s    z3RangeOperators.comparator_factory.strictly_right_ofc             C   s   | j  d¡|ƒS )z‡Boolean expression. Returns true if the range in the column
            does not extend right of the range in the operand.
            z&<)r   r   )r   r   r   r   r   Únot_extend_right_ofM   s    z5RangeOperators.comparator_factory.not_extend_right_ofc             C   s   | j  d¡|ƒS )z†Boolean expression. Returns true if the range in the column
            does not extend left of the range in the operand.
            z&>)r   r   )r   r   r   r   r   Únot_extend_left_ofS   s    z4RangeOperators.comparator_factory.not_extend_left_ofc             C   s   | j  d¡|ƒS )z}Boolean expression. Returns true if the range in the column
            is adjacent to the range in the operand.
            z-|-)r   r   )r   r   r   r   r   Úadjacent_toY   s    z-RangeOperators.comparator_factory.adjacent_toc             C   s   | j  d¡|ƒS )zœRange expression. Returns the union of the two ranges.
            Will raise an exception if the resulting range is not
            contigous.
            ú+)r   r   )r   r   r   r   r   Ú__add___   s    z)RangeOperators.comparator_factory.__add__)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   Ú
__lshift__r   Ú
__rshift__r   r   r   r   Ú__classcell__r   r   )r   r   r
      s   	r
   N)r   r   r    r!   ÚsqltypesZConcatenableZ
Comparatorr
   r   r   r   r   r      s   r   c               @   s   e Zd ZdZd ZdS )r   z.Represent the PostgreSQL INT4RANGE type.

    N)r   r   r    r!   Ú__visit_name__r   r   r   r   r   g   s   r   Z	int4rangec               @   s   e Zd ZdZd ZdS )r   z.Represent the PostgreSQL INT8RANGE type.

    N)r   r   r    r!   r&   r   r   r   r   r   r   s   r   Z	int8rangec               @   s   e Zd ZdZd ZdS )r   z-Represent the PostgreSQL NUMRANGE type.

    N)r   r   r    r!   r&   r   r   r   r   r   }   s   r   Znumrangec               @   s   e Zd ZdZd ZdS )Ú	DATERANGEz.Represent the PostgreSQL DATERANGE type.

    N)r   r   r    r!   r&   r   r   r   r   r'   ˆ   s   r'   Z	daterangec               @   s   e Zd ZdZd ZdS )ÚTSRANGEz,Represent the PostgreSQL TSRANGE type.

    N)r   r   r    r!   r&   r   r   r   r   r(   “   s   r(   Ztsrangec               @   s   e Zd ZdZd ZdS )Ú	TSTZRANGEz.Represent the PostgreSQL TSTZRANGE type.

    N)r   r   r    r!   r&   r   r   r   r   r)   ž   s   r)   Z	tstzrangeN)Úbaser   Ú r   r%   Ú__all__Úobjectr   Z
TypeEnginer   r   r   r'   r(   r)   r   r   r   r   Ú<module>   s   Y