
    i              	           % S r SSKrSSKJrJrJr  0 r\\\\\\         4   \	S'    " S S\
5      rSS\S\S	\S
\4S jjrSS\S\S	\S
\4S jjr\rS\S
\\   4S jrS\S\S	\S
\4S jrg)u  Transliterate Unicode text into plain 7-bit ASCII.

Example usage:

>>> from unidecode import unidecode
>>> unidecode("北亰")
"Bei Jing "

The transliteration uses a straightforward map, and doesn't have alternatives
for the same character based on language, position, or anything else.

A standard string object will be returned. If you need bytes, use:

>>> unidecode("Κνωσός").encode("ascii")
b'Knosos'
    N)DictOptionalSequenceCachec                   B   ^  \ rS rSrSS\S\\   SS4U 4S jjjrSrU =r	$ )	UnidecodeError   Nmessageindexreturnc                 8   > [         [        U ]  U5        X l        g)zuRaised for Unidecode-related errors.

The index attribute contains the index of the character that caused
the error.
N)superr   __init__r   )selfr
   r   	__class__s      V/home/kali/github-search/github-env/lib/python3.13/site-packages/unidecode/__init__.pyr   UnidecodeError.__init__   s     	nd,W5
    )r   )N)
__name__
__module____qualname____firstlineno__strr   intr   __static_attributes____classcell__)r   s   @r   r   r      s&     HSM T  r   r   stringerrorsreplace_strr   c                 b     U R                  S5      nU $ ! [         a     Of = f[        XU5      $ )u  Transliterate an Unicode object into an ASCII string

>>> unidecode("北亰")
"Bei Jing "

This function first tries to convert the string using ASCII codec.
If it fails (because of non-ASCII characters), it falls back to
transliteration using the character tables.

This is approx. five times faster if the string only contains ASCII
characters, but slightly slower than unicode_expect_nonascii if
non-ASCII characters are present.

errors specifies what to do with characters that have not been
found in replacement tables. The default is 'ignore' which ignores
the character. 'strict' raises an UnidecodeError. 'replace'
substitutes the character with replace_str (default is '?').
'preserve' keeps the original character.

Note that if 'preserve' is used the returned string might not be
ASCII!
ASCII)encodeUnicodeEncodeError
_unidecode)r   r   r   
bytestrings       r   unidecode_expect_asciir&   #   s?    0]]7+
   
 fk22s    
""c                     [        XU5      $ )uw   Transliterate an Unicode object into an ASCII string

>>> unidecode("北亰")
"Bei Jing "

See unidecode_expect_ascii.
)r$   )r   r   r   s      r   unidecode_expect_nonasciir(   D   s     fk22r   charc                    [        U 5      nUS:  a  [        U 5      $ US:  a  g SUs=::  a  S::  a$  O  O![        R                  " SU < S3[        S5        US-	  nUS	-  n [
        U   nU(       a  [        U5      U:  a  XC   $ g ! [         aV     [        S
U-  [        5       [        5       S/5      nO! [         a    S [
        U'     g f = fUR                  =[
        U'   n Nzf = f)N   i i   i  zSurrogate character z; will be ignored. You might be using a narrow Python build.         zunidecode.x%03xdata)ordr   warningswarnRuntimeWarningr   KeyError
__import__globalslocalsImportErrorr/   len)r)   	codepointsectionpositiontablemods         r   _get_repl_strr?   Q   s    D	I44y7$f$GKN&	+ 1nG3H
*g Uh&  *	.8')VXPVxXC 	!E'N	
 "%)g*s6    	B 
C$"B21C$2C	C$C		C$#C$c                    / n[        U 5       Hd  u  pE[        U5      nUc@  US:X  a  SnO7US:X  a  [        SXT4-  U5      eUS:X  a  UnOUS:X  a  UnO[        SU< 35      eUR                  U5        Mf     SR	                  U5      $ )Nignore strictz4no replacement found for character %r in position %dreplacepreservez#invalid value for errors parameter )	enumerater?   r   appendjoin)r   r   r   retvalr   r)   repls          r   r$   r$   u   s    F (T"<!8#$ &),0=&9:?A A9$":%$PV%XYYd! )$ 776?r   )rA   ?)__doc__r1   typingr   r   r   r   r   r   __annotations__
ValueErrorr   r&   r(   	unidecoder?   r$    r   r   <module>rR      s      + +68tC(8C=1223 8Z 33 3 3S 3[^ 3B	3c 	33 	3PS 	3^a 	3 #	" " "Hs C S S r   