
    ;e                         d Z ddlZddlZddlmZ i ZdZdgZej        Z G d de	e
          Zd	 Zd
 Z ej        e           ej        dk    rd Z ej        e           dS dS )a2   Standard "encodings" Package

    Standard Python encoding modules are stored in this package
    directory.

    Codec modules must have names corresponding to normalized encoding
    names as defined in the normalize_encoding() function below, e.g.
    'utf-8' must be implemented by the module 'utf_8.py'.

    Each codec module must export the following interface:

    * getregentry() -> codecs.CodecInfo object
    The getregentry() API must return a CodecInfo object with encoder, decoder,
    incrementalencoder, incrementaldecoder, streamwriter and streamreader
    attributes which adhere to the Python Codec Interface Standard.

    In addition, a module may optionally also define the following
    APIs which are then used by the package's codec search function:

    * getaliases() -> sequence of encoding name strings to use as aliases

    Alias names returned by getaliases() must be normalized encoding
    names as defined by normalize_encoding().

Written by Marc-Andre Lemburg (mal@lemburg.com).

(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.

    N   )aliasesz--unknown--*c                       e Zd ZdS )CodecRegistryErrorN)__name__
__module____qualname__     )/usr/lib/python3.11/encodings/__init__.pyr   r   (   s        Dr   r   c                 J   t          | t                    rt          | d          } g }d}| D ]c}|                                s|dk    rE|r|r|                    d           |                                r|                    |           d}ad}dd                    |          S )ae   Normalize an encoding name.

        Normalization works as follows: all non-alphanumeric
        characters except the dot used for Python package names are
        collapsed and replaced with a single underscore, e.g. '  -;#'
        becomes '_'. Leading and trailing underscores are removed.

        Note that encoding names should be ASCII only.

    asciiF._T )
isinstancebytesstrisalnumappendisasciijoin)encodingcharspunctcs       r   normalize_encodingr   +   s     (E"" *x))EE  99;; 	!s(( " "S!!!yy{{  QEEEE775>>r   c                    t                               | t                    }|t          ur|S t          |           }t                              |          p-t                              |                    dd                    }|||g}n|g}|D ]5}|rd|v r		 t          d|z   t          d          } n# t          $ r Y 2w xY wd }	 |j	        }n# t          $ r d }Y nw xY w|d t           | <   d S  |            }t          |t          j                  sdt          |          cxk    rdk    s"n t          d|j        d	|j        d
          t%          |d                   rt%          |d                   r|d         t%          |d                   r}|d         t%          |d                   r`t          |          dk    r|d         t%          |d                   r0t          |          dk    r=|d         5t%          |d                   s t          d|j        d	|j        d          t          |          dk     s|d         ;|ddt          |          z
  z  |j                            dd          d         fz   z  }t          j        | }|t           | <   	 |                                }|D ]}	|	t          vr
|t          |	<   n# t          $ r Y nw xY w|S )Nr   r   z
encodings.r   )fromlistlevel      zmodule "z" (z) failed to registerr            zincompatible codecs in module ")   )N)_cacheget_unknownr   _aliasesreplace
__import___import_tailImportErrorgetregentryAttributeErrorr   codecs	CodecInfolenr   r   __file__callablesplit
getaliases)
r   entrynorm_encodingaliased_encodingmodnamesmodnamemodr1   codecaliasesaliass
             r   search_functionrB   G   sw    JJx**EH 'x00M||M22 E||M$9$9#s$C$CDD #$!# "?   	#..
	 \G3l#$& & &C E  	 	 	 D	 o    {xt KMMEeV-.. )CJJ####!####$$(+clll&D E E Ea!! 	E%();); 	E!H %();); !H %();); JJNNuQx3HU1X<N<N3JJNNuQx3HU1X<N<N3$$(+clll&D E E Eu::a<<58+WaE

l+s|/A/A#q/I/I!/L.NNNE %( F8*~~'' " 	* 	*EH$$")	*     Ls6   B55
CCC CC$K 
KKwin32c                     	 dd l }d|                                z  }| |k    rdd l}|j                                        S d S # t
          $ r Y d S w xY w)Nr   zcp%s)_winapiGetACPencodings.mbcsmbcsr1   r0   )r   rE   ansi_code_page	encodingss       r   _alias_mbcsrK      s{    	NNN#gnn&6&66N>))%%%% ~11333 *)  	 	 	DD	s   =A 
AA)__doc__r3   sysr   r   r)   r+   r/   r,   LookupErrorSystemErrorr   r   rB   registerplatformrK   r   r   r   <module>rR      s    <  



      	u?	 	 	 	 	k 	 	 	  8R R Rj       <7
	 	 	 FOK     ! r   