o
    "4g                     @  sX   d Z ddlmZ ddlmZmZmZ ddlmZ er ddl	m
Z
 G dd dee Zd	S )
z)
The Column object in Cursor.description
    )annotations)AnySequenceTYPE_CHECKING
attrgetter   )
BaseCursorc                   @  s   e Zd ZdZd'ddZedd	 d
 D Zd(ddZd)ddZe	d(ddZ
d*ddZe	d(ddZe	d)ddZe	d+ddZe	d+ddZe	d+dd Ze	d+d!d"Ze	d,d$d%Zd&S )-ColumnpsycopgcursorBaseCursor[Any, Any]indexintc                 C  sv   |j }|sJ ||}|r||j| _nd|d  | _||| _|jj	| j| _
||| _||| _d S )Ncolumn_r   )pgresultfnamedecode	_encoding_nameftype_ftypeadapterstypesget_typefmod_fmodfsize_fsize)selfr   r   resr    r"   X/var/www/html/authentication-server/venv/lib/python3.10/site-packages/psycopg/_column.py__init__   s   
zColumn.__init__c                 c  s    | ]}t |V  qd S Nr   ).0attrr"   r"   r#   	<genexpr>#   s
    
zColumn.<genexpr>z[
            name type_code display_size internal_size precision scale null_ok
            returnstrc                 C  s   d| j d| j d| j dS )Nz<Column z, type: z (oid: z)>)nametype_display	type_coder    r"   r"   r#   __repr__*   s   
zColumn.__repr__c                 C     dS )N   r"   r.   r"   r"   r#   __len__0   s   zColumn.__len__c                 C  s$   | j st| jS | j j| j| jdS )zA pretty representation of the column type.

        It is composed by the type name, followed by eventual modifiers and
        brackets to signify arrays, e.g. :sql:`text`, :sql:`varchar(42)`,
        :sql:`date[]`.
        )oidr   )r   r*   r-   get_type_displayr   r.   r"   r"   r#   r,   3   s   
zColumn.type_displayr   c                   s4   t |trt fdd j| D S  j|  S )Nc                 3  s    | ]}| V  qd S r%   r"   )r&   getterr.   r"   r#   r(   B   s    z%Column.__getitem__.<locals>.<genexpr>)
isinstanceslicetuple_attrs)r    r   r"   r.   r#   __getitem__@   s   
zColumn.__getitem__c                 C     | j S )zThe name of the column.)r   r.   r"   r"   r#   r+   F      zColumn.namec                 C  r;   )zThe numeric OID of the column.)r   r.   r"   r"   r#   r-   K   r<   zColumn.type_code
int | Nonec                 C     | j r
| j | jS dS )z;The field size, for string types such as :sql:`varchar(n)`.N)r   get_display_sizer   r.   r"   r"   r#   display_sizeP      zColumn.display_sizec                 C  s   | j }|dkr	|S dS )z=The internal field size for fixed-size types, None otherwise.r   N)r   )r    r   r"   r"   r#   internal_sizeU   s   zColumn.internal_sizec                 C  r>   )z/The number of digits for fixed precision types.N)r   get_precisionr   r.   r"   r"   r#   	precision[   rA   zColumn.precisionc                 C  r>   )z:The number of digits after the decimal point if available.N)r   	get_scaler   r.   r"   r"   r#   scale`   rA   zColumn.scalebool | Nonec                 C  r0   )zAlways `!None`Nr"   r.   r"   r"   r#   null_oke   s   zColumn.null_okN)r   r   r   r   )r)   r*   )r)   r   )r   r   r)   r   )r)   r=   )r)   rG   )__name__
__module____qualname__r$   r8   splitr9   r/   r2   propertyr,   r:   r+   r-   r@   rB   rD   rF   rH   r"   r"   r"   r#   r
      s4    



r
   N)__doc__
__future__r   typingr   r   r   operatorr   _cursor_baser	   r
   r"   r"   r"   r#   <module>   s    