Ë
    ÛqjQ  ã                  óZ   — d Z ddlmZ ddlmZ ddlmZ ddlmZ  G d„ d«      Z e«       Z	y	)
z
psycopg capabilities objects
é    )Úannotationsé   )Úpq)Ú_cmodule)ÚNotSupportedErrorc                  óv   — e Zd ZdZdd„Zddd„Zddd„Zddd„Zddd„Zddd„Z	ddd„Z
ddd	„Zdd
„Zdd„Zdd„Zy)ÚCapabilitiesz\
    An object to check if a feature is supported by the libpq available on the client.
    c                ó   — i | _         y )N)Ú_cache)Úselfs    úV/var/www/html/kelly-backend/venv/lib/python3.12/site-packages/psycopg/_capabilities.pyÚ__init__zCapabilities.__init__   s	   € Ø&(ˆ�ó    c                ó*   — | j                  dd|¬«      S )z~Check if the `PGconn.encrypt_password()` method is implemented.

        The feature requires libpq 10.0 and greater.
        zpq.PGconn.encrypt_password()i † ©Úcheck©Ú_has_feature©r   r   s     r   Úhas_encrypt_passwordz!Capabilities.has_encrypt_password   ó   € ð
 × Ñ Ð!?ÀÈuÐ ÓUÐUr   c                ó*   — | j                  dd|¬«      S )zCheck if the `ConnectionInfo.hostaddr` attribute is implemented.

        The feature requires libpq 12.0 and greater.
        zConnection.info.hostaddriÀÔ r   r   r   s     r   Úhas_hostaddrzCapabilities.has_hostaddr   ó   € ð
 × Ñ Ð!;¸VÈ5Ð ÓQÐQr   c                ó*   — | j                  dd|¬«      S )z~Check if the :ref:`pipeline mode <pipeline-mode>` is supported.

        The feature requires libpq 14.0 and greater.
        zConnection.pipeline()éà" r   r   r   s     r   Úhas_pipelinezCapabilities.has_pipeline$   s   € ð
 × Ñ Ð!8¸&ÈÐ ÓNÐNr   c                ó*   — | j                  dd|¬«      S )z€Check if the `pq.PGconn.set_trace_flags()` method is implemented.

        The feature requires libpq 14.0 and greater.
        zPGconn.set_trace_flags()r   r   r   r   s     r   Úhas_set_trace_flagsz Capabilities.has_set_trace_flags+   r   r   c                ó*   — | j                  dd|¬«      S )z}Check if the `Connection.cancel_safe()` method is implemented.

        The feature requires libpq 17.0 and greater.
        zConnection.cancel_safe()é˜ r   r   r   s     r   Úhas_cancel_safezCapabilities.has_cancel_safe2   r   r   c                ó*   — | j                  dd|¬«      S )z³Check if `Cursor.stream()` can handle a `size` parameter value
        greater than 1 to retrieve results by chunks.

        The feature requires libpq 17.0 and greater.
        z4Cursor.stream() with 'size' parameter greater than 1r!   r   r   r   s     r   Úhas_stream_chunkedzCapabilities.has_stream_chunked9   s$   € ð × Ñ ØBÀFÐRWð !ó 
ð 	
r   c                ó*   — | j                  dd|¬«      S )z…Check if the `pq.PGconn.send_closed_prepared()` method is implemented.

        The feature requires libpq 17.0 and greater.
        zPGconn.send_close_prepared()r!   r   r   r   s     r   Úhas_send_close_preparedz$Capabilities.has_send_close_preparedC   r   r   c                ó¢   — || j                   v r| j                   |   }n!| j                  ||«      }|| j                   |<   |sy|rt        |«      ‚y)zê
        Check is a version is supported.

        If `check` is true, raise an exception with an explicative message
        explaining why the feature is not supported.

        The expletive messages, are left to the user.
        TF)r   Ú_get_unsupported_messager   )r   ÚfeatureÚwant_versionr   Úmsgs        r   r   zCapabilities._has_featureJ   sU   € ð �d—k‘kÑ!Ø—+‘+˜gÑ&‰Cà×/Ñ/°¸ÓFˆCØ#&ˆD�K‰K˜Ñ áØÙÜ# CÓ(Ð(àr   c           
     ó¤  — t        j                  «       |k  rUd|› d| j                  «       › dt        j                  t        j                  «       «      › dt        j                  |«      › d�	S t         j                  |k  rQd|› dt         j
                  › dt        j                  t         j                  «      › dt        j                  |«      › d�	S y)	z–
        Return a descriptinve message to describe why a feature is unsupported.

        Return an empty string if the feature is supported.
        zthe feature 'z<' is not available: the client libpq version (imported from z) is z%; the feature requires libpq version z	 or newerz,' is not available: you are using a psycopg[z)] libpq wrapper built with libpq version Ú )r   ÚversionÚ_libpq_sourceÚversion_prettyÚ__build_version__Ú__impl__)r   r)   r*   s      r   r(   z%Capabilities._get_unsupported_message`   sÖ   € ô �:‰:‹<˜,Ò&à ˜yð )<Ø<@×<NÑ<NÓ<PÐ;Qð RÜ×(Ñ(¬¯©«Ó6Ð7ð 8+Ü+-×+<Ñ+<¸\Ó+JÐ*KØð	ðô ×!Ñ! LÒ0à ˜yð ),Ü,.¯K©K¨=ð 9'Ü')×'8Ñ'8¼×9MÑ9MÓ'NÐ&Oð Pä×%Ñ% lÓ3Ð4°Ið	?ðð r   c                ó\   — t         j                  dk(  rt        j                  xs d}d|› �S y)z5Return a string reporting where the libpq comes from.ÚbinaryÚunknownz$the psycopg[binary] package version zsystem libraries)r   r2   r   Ú__version__)r   r.   s     r   r/   zCapabilities._libpq_sourcez   s.   € ä�;‰;˜(Ò"Ü#×/Ñ/Ò<°9ˆGØ9¸'¸ÐCÐCà%r   N)ÚreturnÚNone)F)r   Úboolr7   r9   )r)   Ústrr*   Úintr   r9   r7   r9   )r)   r:   r*   r;   r7   r:   )r7   r:   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r"   r$   r&   r   r(   r/   © r   r   r	   r	      sD   „ ñó)ôVôRôOôRôRô
ôVóó,ô4&r   r	   N)
r?   Ú
__future__r   r-   r   r   Úerrorsr   r	   Úcapabilitiesr@   r   r   Ú<module>rD      s.   ðñõ #å Ý Ý %÷r&ñ r&ñl ‹~�r   