Ë
    ¼vëj  ã                  óR   — d Z ddlmZ ddlmZmZ ddlmZ  G d„ d«      Z e«       Z	y)	z
psycopg capabilities objects
é    )Úannotationsé   )Ú_cmoduleÚpq)ÚNotSupportedErrorc                  óŠ   — 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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/strategist-ai/venv/lib/python3.12/site-packages/psycopg/_capabilities.pyÚ__init__zCapabilities.__init__   s	   € Ø&(ˆ�ó    c                ó*   — | j                  dd|¬«      S )zþCheck if the `PGconn.full_protocol_version()` method is implemented.

        If the method is implemented, then `ConnectionInfo.full_protocol_version`
        will return a meaningful value.

        The feature requires libpq 18.0 and greater.
        z!pq.PGconn.full_protocol_version()i ¿ ©Úcheck©Ú_has_feature©r   r   s     r   Úhas_full_protocol_versionz&Capabilities.has_full_protocol_version   s#   € ð × Ñ Ø/°¸uð !ó 
ð 	
r   c                ó*   — | j                  dd|¬«      S )z}Check if the `PGconn.encrypt_password()` method is implemented.

        The feature requires libpq 10.0 or greater.
        zpq.PGconn.encrypt_password()i † r   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 or 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 or 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 or greater.
        zPGconn.set_trace_flags()r   r   r   r   s     r   Úhas_set_trace_flagsz Capabilities.has_set_trace_flags6   r   r   c                ó*   — | j                  dd|¬«      S )z|Check if the `pq.PGconn.used_gssapi` attribute is implemented.

        The feature requires libpq 16.0 or greater.
        zPGconn.used_gssapii q r   r   r   s     r   Úhas_used_gssapizCapabilities.has_used_gssapi=   s   € ð
 × Ñ Ð!5°vÀUÐ ÓKÐKr   c                ó*   — | j                  dd|¬«      S )z|Check if the `Connection.cancel_safe()` method is implemented.

        The feature requires libpq 17.0 or greater.
        zConnection.cancel_safe()é˜ r   r   r   s     r   Úhas_cancel_safezCapabilities.has_cancel_safeD   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 or greater.
        z4Cursor.stream() with 'size' parameter greater than 1r%   r   r   r   s     r   Úhas_stream_chunkedzCapabilities.has_stream_chunkedK   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 or greater.
        zPGconn.send_close_prepared()r%   r   r   r   s     r   Úhas_send_close_preparedz$Capabilities.has_send_close_preparedU   r   r   c                ó¤   — 	 | j                   |   }|sy|rt        |«      ‚y# t        $ r$ | j                  ||«      }|| j                   |<   Y Œ=w xY w)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   ÚKeyErrorÚ_get_unsupported_messager   )r   ÚfeatureÚwant_versionr   Úmsgs        r   r   zCapabilities._has_feature\   s_   € ð	'Ø—+‘+˜gÑ&ˆCñ
 ØÙÜ# CÓ(Ð(àøô ò 	'Ø×/Ñ/°¸ÓFˆCØ#&ˆD�K‰K˜Ó ð	'ús   ‚" ¢*AÁA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_messager   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   r7   r   Ú__version__)r   r3   s     r   r4   zCapabilities._libpq_sourceŒ   s.   € ä�;‰;˜(Ò"Ü#×/Ñ/Ò<°9ˆGØ9¸'¸ÐCÐCà%r   N)ÚreturnÚNone)F)r   Úboolr<   r>   )r.   Ústrr/   Úintr   r>   r<   r>   )r.   r?   r/   r@   r<   r?   )r<   r?   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r!   r#   r&   r(   r*   r   r-   r4   © r   r   r	   r	      sO   „ ñó)ô

ôVôRôOôRôLôRô
ôVóó,ô4&r   r	   N)
rD   Ú
__future__r   r2   r   r   Úerrorsr   r	   ÚcapabilitiesrE   r   r   ú<module>rI      s+   ðñõ #ç Ý %÷E&ñ E&ñR ‹~�r   