File: //opt/cloudlinux/venv/lib64/python3.11/site-packages/psycopg2/__pycache__/_range.cpython-311.pyc
�
    � h>H  �                   ��  � d Z ddlZddlmZmZ ddlmZmZmZ ddlm	Z	m
Z
mZ  G d� d�  �        Zd.d	�Z
 G d
� d�  �        Z G d� d
�  �        Z G d� de�  �        Z G d� de�  �        Z G d� de�  �        Z G d� de�  �        Z G d� de�  �        Z eee�  �          eeeddd��  �        Ze�                    �   �           eeeddd��  �        Ze�                    �   �           eeedd d!��  �        Ze�                    �   �           ed"ed#d$d%��  �        Ze�                    �   �           ed&ed'd(d)��  �        Ze�                    �   �           ed*ed+d,d-��  �        Ze�                    �   �          dS )/z1Implementation of the Range type and adaptation
�    N)�ProgrammingError�InterfaceError)�	ISQLQuote�adapt�register_adapter)�new_type�new_array_type�
register_typec                   �  � e Zd ZdZdZdd�Zd� Zd� Zed	� �   �         Z	ed
� �   �         Z
ed� �   �         Zed� �   �         Zed
� �   �         Z
ed� �   �         Zed� �   �         Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� ZdS )�Rangea�  Python representation for a PostgreSQL |range|_ type.
    :param lower: lower bound for the range. `!None` means unbound
    :param upper: upper bound for the range. `!None` means unbound
    :param bounds: one of the literal strings ``()``, ``[)``, ``(]``, ``[]``,
        representing whether the lower or upper bounds are included
    :param empty: if `!True`, the range is empty
    ��_lower�_upper�_boundsN�[)Fc                 �   � |s-|dvrt          d|���  �        �|| _        || _        || _        d S d x| _        x| _        | _        d S )N)r   z(]z()z[]zbound flags not valid: )�
ValueErrorr   r   r   )�self�lower�upper�bounds�emptys        �D/opt/cloudlinux/venv/lib/python3.11/site-packages/psycopg2/_range.py�__init__zRange.__init__/   s_   � �� 	<��5�5�5� �!E�6�!E�!E�F�F�F��D�K��D�K�!�D�L�L�L�7;�;�D�K�;�$�+�����    c                 �   � | j         �| j        j        � d�S d�                    | j        j        | j        | j        | j         �  �        S )Nz(empty=True)z{}({!r}, {!r}, {!r}))r   �	__class__�__name__�formatr   r   �r   s    r   �__repr__zRange.__repr__:   sJ   � ��<���n�-�;�;�;�;�)�0�0���1H���T�[�$�,�8� 8� 
8r   c                 �   � | j         �dS | j         d         t          | j        �  �        dt          | j        �  �        | j         d         g}d�                    |�  �        S )Nr   r   z, �   � )r   �strr   r   �join)r   �itemss     r   �__str__z
Range.__str__A   sY   � ��<���7� 
�L��O�������������L��O�
�� �w�w�u�~�~�r   c                 �   � | j         S )z:The lower bound of the range. `!None` if empty or unbound.)r   r    s    r   r   zRange.lowerN   �   � � �{�r   c                 �   � | j         S )z:The upper bound of the range. `!None` if empty or unbound.)r   r    s    r   r   zRange.upperS   r*   r   c                 �   � | j         du S )z`!True` if the range is empty.N�r   r    s    r   �isemptyz
Range.isemptyX   s   � � �|�t�#�#r   c                 �&