o
    "4g                     @  s  U d Z ddlmZ ddlZddlZddlZddlmZmZ ddl	m
Z
 ddlmZ ddlmZ er7dd	lmZ e
jZi d
dddddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+i d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTZi ZdUedV< edWdX e D  edYdX e D  dZd[ e D Zdrd`daZdsdcddZedtdgdhZedudidjZdvdwdndoZedpej ej ej  dqZ!dS )xz3
Mappings between PostgreSQL and Python encodings.
    )annotationsN)AnyTYPE_CHECKING   )
ConnStatus)NotSupportedError)cache)BaseConnectionBIG5big5EUC_CNgb2312EUC_JIS_2004euc_jis_2004EUC_JPeuc_jpEUC_KReuc_krGB18030gb18030GBKgbk
ISO_8859_5z	iso8859-5
ISO_8859_6z	iso8859-6
ISO_8859_7z	iso8859-7
ISO_8859_8z	iso8859-8JOHABjohabKOI8Rzkoi8-rKOI8Uzkoi8-uLATIN1z	iso8859-1LATIN10z
iso8859-16LATIN2z	iso8859-2LATIN3z	iso8859-3LATIN4z	iso8859-4LATIN5z	iso8859-9LATIN6z
iso8859-10LATIN7z
iso8859-13LATIN8z
iso8859-14LATIN9z
iso8859-15SHIFT_JIS_2004shift_jis_2004SJIS	shift_jis	SQL_ASCIIasciiUHCcp949UTF8utf-8WIN1250cp1250WIN1251cp1251WIN1252cp1252WIN1253cp1253WIN1254cp1254cp1255cp1256cp1257cp1258cp866cp874)WIN1255WIN1256WIN1257WIN1258WIN866WIN874zdict[bytes, str]	py_codecsc                 c  s     | ]\}}|  |fV  qd S )Nencode.0kv rQ   [/var/www/html/authentication-server/venv/lib/python3.10/site-packages/psycopg/_encodings.py	<genexpr>H   s    rS   c                 c  s0    | ]\}}d |v r| d d |fV  qdS )_ N)replacerL   rM   rQ   rQ   rR   rS   K   s    &c                 C  s   i | ]	\}}||  qS rQ   rK   rM   rQ   rQ   rR   
<dictcomp>O   s    rW   connBaseConnection[Any] | Nonereturnstrc                 C  s   | r| j jS dS )z
    Return the Python encoding name of a psycopg connection.

    Default to utf8 if the connection has no encoding info.
    r3   )pgconn	_encoding)rX   rQ   rQ   rR   conn_encodingR      r^   conninfoc                 C  sN   ddl m} || }|d}|r%z	tt| W S  ty$   Y dS w dS )z
    Return the Python encoding name passed in a conninfo string. Default to utf8.

    Because the input is likely to come from the user and not normalised by the
    server, be somewhat lenient (non-case-sensitive lookup, ignore noise chars).
    r   )conninfo_to_dictclient_encodingr3   )r`   ra   getpg2pyencr[   rL   r   )r`   ra   paramspgencrQ   rQ   rR   conninfo_encoding[   s   
rg   namebytesc                 C  s   t t| j S )zzConvert a Python encoding name to PostgreSQL encoding name.

    Raise LookupError if the Python encoding is unknown.
    )	pg_codecscodecslookuprh   )rh   rQ   rQ   rR   py2pgenco   r_   rm   c                 C  sH   zt | dddd  W S  ty#   | dd}td|w )zConvert a PostgreSQL encoding name to Python encoding name.

    Raise NotSupportedError if the PostgreSQL encoding is not supported by
    Python.
       -       _utf8rV   zcodec not available in Python: )rJ   rV   upperKeyErrordecoder   )rh   snamerQ   rQ   rR   rd   x   s   rd   fsprefixc                 C  sH   |   s| d dv r||  } |   std| } | d dkr"||  } | S )z
    Reduce a string to a valid Python identifier.

    Replace all non-valid chars with '_' and prefix the value with `!prefix` if
    the first letter is an '_'.
    r   
1234567890rT   )isidentifier	_re_cleansub)rw   rx   rQ   rQ   rR   _as_python_identifier   s   r}   z[^z_])rX   rY   rZ   r[   )r`   r[   rZ   r[   )rh   r[   rZ   ri   )rh   ri   rZ   r[   )rv   )rw   r[   rx   r[   rZ   r[   )"__doc__
__future__r   restringrk   typingr   r   	pq._enumsr   errorsr   _compatr   _connection_baser	   OK
_py_codecsrJ   __annotations__updateitemsrj   r^   rg   rm   rd   r}   compileascii_lowercaseascii_uppercasedigitsr{   rQ   rQ   rQ   rR   <module>   s    	
 !"#$%&'/


	