
    pj                    l    d Z ddlmZ ddlm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dS )z>
Objects to return information about a PostgreSQL connection.
    )annotations)Path)tzinfo   )pq)
get_tzinfo)make_conninfoc                     e Zd ZdZdZd&dZed'd            Zed'd	            Zed'd
            Zed(d            Z	ed'd            Z
ed'd            Zed'd            Zed'd            Zd)dZed'd            Zed*d            Zed+d            Zed,d            Zd-dZed(d            Zed(d            Zed'd            Zed.d!            Zed'd"            Zd/d$Zd%S )0ConnectionInfoz1Allow access to information about the connection.psycopgpgconnpq.abc.PGconnc                    || _         d S N)r   )selfr   s     h/lsinfo/ai/hellotax_ai/data_center/backend/venv/lib/python3.11/site-packages/psycopg/_connection_info.py__init__zConnectionInfo.__init__   s        returnstrc                    dS )z7A string representing the database vendor connected to.
PostgreSQL r   s    r   vendorzConnectionInfo.vendor   s	     |r   c                ,    |                      d          S )zBThe server host name of the active connection. See :pq:`PQhost()`.host_get_pgconn_attrr   s    r   r   zConnectionInfo.host        $$V,,,r   c                ,    |                      d          S )z@The server IP address of the connection. See :pq:`PQhostaddr()`.hostaddrr   r   s    r   r"   zConnectionInfo.hostaddr#        $$Z000r   intc                F    t          |                     d                    S )z6The port of the active connection. See :pq:`PQport()`.port)r$   r   r   s    r   r&   zConnectionInfo.port(   s      4((00111r   c                ,    |                      d          S )z6The database name of the connection. See :pq:`PQdb()`.dbr   r   s    r   dbnamezConnectionInfo.dbname-   s     $$T***r   c                ,    |                      d          S )z4The user name of the connection. See :pq:`PQuser()`.userr   r   s    r   r+   zConnectionInfo.user2   r    r   c                ,    |                      d          S )z3The password of the connection. See :pq:`PQpass()`.passwordr   r   s    r   r-   zConnectionInfo.password7   r#   r   c                ,    |                      d          S )zi
        The command-line options passed in the connection request.
        See :pq:`PQoptions`.
        optionsr   r   s    r   r/   zConnectionInfo.options<   s     $$Y///r   dict[str, str]c                2   | j         d t          j                                        D                                 dd           t          t          j                    dz                                            d<   fd| j	        j
        D             S )a\  Return the connection parameters values.

        Return all the parameters set to a non-default value, which might come
        either from the connection string and parameters passed to
        `~Connection.connect()` or from environment variables. The password
        is never returned (you can read it using the `password` attribute).
        c                6    i | ]}|j         	|j        |j         S r   )compiledkeyword).0is     r   
<dictcomp>z1ConnectionInfo.get_parameters.<locals>.<dictcomp>O   s0     
 
 
z% Iqz%%%r   s   channel_bindings   preferz.pgpasss   passfilec                    i | ]j}|j         a|j        dk    rV|j                             |j                  k    7|j                                      |j                                       kS )Ns   password)valr4   getdecode)r5   r6   defaultspyencs     r   r7   z1ConnectionInfo.get_parameters.<locals>.<dictcomp>X   su     
 
 
u 	[((ai0000	 IU##QU\\%%8%8 100r   )encodingr   Conninfoget_defaults
setdefaultr   r   homeencoder   info)r   r<   r=   s    @@r   get_parameterszConnectionInfo.get_parametersD   s     
 
[--//
 
 
 	.	::: #DIKK)$; < < C C E E
 
 
 
 
[%
 
 
 	
r   c                >    t          di |                                 S )a  Return the connection string to connect to the database.

        The string contains all the parameters set to a non-default value,
        which might come either from the connection string and parameters
        passed to `~Connection.connect()` or from environment variables. The
        password is never returned (you can read it using the `password`
        attribute).
        r   )r	   rE   r   s    r   dsnzConnectionInfo.dsn`   s$     55t2244555r   pq.ConnStatusc                >    t          j        | j        j                  S )z3The status of the connection. See :pq:`PQstatus()`.)r   
ConnStatusr   statusr   s    r   rK   zConnectionInfo.statusl   s     }T[/000r   pq.TransactionStatusc                >    t          j        | j        j                  S )zl
        The current in-transaction status of the session.
        See :pq:`PQtransactionStatus()`.
        )r   TransactionStatusr   transaction_statusr   s    r   rO   z!ConnectionInfo.transaction_statusq   s     #DK$BCCCr   pq.PipelineStatusc                >    t          j        | j        j                  S )zb
        The current pipeline status of the client.
        See :pq:`PQpipelineStatus()`.
        )r   PipelineStatusr   pipeline_statusr   s    r   rS   zConnectionInfo.pipeline_statusy   s      !<===r   
param_name
str | Nonec                    | j                             |                    | j                            }||                    | j                  ndS )zs
        Return a parameter setting of the connection.

        Return `None` is the parameter is unknown.
        N)r   parameter_statusrC   r>   r;   )r   rT   ress      r   rW   zConnectionInfo.parameter_status   sF     k**:+<+<T]+K+KLL,/Oszz$-(((Er   c                    | j         j        S )zZ
        An integer representing the server version. See :pq:`PQserverVersion()`.
        )r   server_versionr   s    r   rZ   zConnectionInfo.server_version   s    
 {))r   c                    | j         j        S )zy
        The process ID (PID) of the backend process handling this connection.
        See :pq:`PQbackendPID()`.
        )r   backend_pidr   s    r   r\   zConnectionInfo.backend_pid   s     {&&r   c                ,    |                      d          S )z
        The error message most recently generated by an operation on the connection.
        See :pq:`PQerrorMessage()`.
        error_messager   r   s    r   r^   zConnectionInfo.error_message   s     $$_555r   r   c                *    t          | j                  S )z6The Python timezone info of the connection's timezone.)r   r   r   s    r   timezonezConnectionInfo.timezone   s     $+&&&r   c                    | j         j        S )z:The Python codec name of the connection's client encoding.)r   	_encodingr   s    r   r>   zConnectionInfo.encoding   s     {$$r   namec                `    t          | j        |          }|                    | j                  S r   )getattrr   r;   r>   )r   rc   values      r   r   zConnectionInfo._get_pgconn_attr   s'    t{D11||DM***r   N)r   r   )r   r   )r   r$   )r   r0   )r   rH   )r   rL   )r   rP   )rT   r   r   rU   )r   r   )rc   r   r   r   )__name__
__module____qualname____doc__r   propertyr   r   r"   r&   r)   r+   r-   r/   rE   rG   rK   rO   rS   rW   rZ   r\   r^   r`   r>   r   r   r   r   r   r      s       ;;J       X - - - X- 1 1 1 X1 2 2 2 X2 + + + X+ - - - X- 1 1 1 X1 0 0 0 X0
 
 
 
8 	6 	6 	6 X	6 1 1 1 X1 D D D XD > > > X>F F F F * * * X* ' ' ' X' 6 6 6 X6 ' ' ' X' % % % X%+ + + + + +r   r   N)rj   
__future__r   pathlibr   datetimer    r   _tzr   conninfor	   r   r   r   r   <module>rr      s     # " " " " "                         # # # # # #\+ \+ \+ \+ \+ \+ \+ \+ \+ \+r   