
    R
hD                    `    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	dS )	z
psycopg capabilities objects
    )annotations   )_cmodulepq)NotSupportedErrorc                  x    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dS )Capabilitiesz\
    An object to check if a feature is supported by the libpq available on the client.
    returnNonec                    i | _         d S )N)_cache)selfs    `/var/www/html/01_SiteInternet/03_Maps/venv/lib/python3.11/site-packages/psycopg/_capabilities.py__init__zCapabilities.__init__   s    &(    Fcheckboolc                2    |                      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 r   _has_featurer   r   s     r   has_encrypt_passwordz!Capabilities.has_encrypt_password        
   !?u UUUr   c                2    |                      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        
   !;V5 QQQr   c                2    |                      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NNr   c                2    |                      dd|          S )zCheck 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                2    |                      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_safe1   r   r   c                2    |                      dd|          S )zCheck 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_chunked8   s)       BFRW ! 
 
 	
r   c                2    |                      dd|          S )zCheck 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_preparedB   r   r   featurestrwant_versionintc                    || j         v r| j         |         }n |                     ||          }|| j         |<   |sdS |rt          |          dS )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   r*   r,   r   msgs        r   r   zCapabilities._has_featureI   sh     dk!!+g&CC//FFC#&DK  	4 	#C(((5r   c           
        t          j                    |k     rVd| d|                                  dt          j        t          j                               dt          j        |           d	S t           j        |k     rGd| dt           j         dt          j        t           j                   dt          j        |           d	S dS )	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     :<<,&&  <@<N<N<P<P (66  ,.+<\+J+J   !L00? ? ?,.K? ?')'89M'N'N? ? %l33	? ? ? 2r   c                L    t           j        dk    rt          j        pd}d| S dS )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_sourcey   s0    ;(""#/<9GC'CCC%%r   N)r
   r   )F)r   r   r
   r   )r*   r+   r,   r-   r   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/   r4    r   r   r	   r	      s;        ) ) ) )V V V V VR R R R RO O O O OR R R R RR R R R R
 
 
 
 
V V V V V   ,   4& & & & & &r   r	   N)
r?   
__future__r   r2   r   r   errorsr   r	   capabilitiesr@   r   r   <module>rD      s     # " " " " "         % % % % % %r& r& r& r& r& r& r& r&l |~~r   