o
    ij                     @   s  d Z ddlmZ ddlm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mZmZ ddlmZ ed	d
Ze
jZdZdZdZdZG dd deZdd Zedd Ze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%ed%d& Z&ed'd( Z'ed)d* Z(ed+d, Z)ed-d. Z*ed/d0 Z+ed1d2 Z,ed3d4 Z-ed5d6 Z.ed7d8 Z/ed9d: Z0ed;d< Z1ed=d> Z2ed?d@ Z3edAdB Z4edCdD Z5edEdF Z6G dGdH dHeZ7ej8g ddddddddde7j9e7j9e7j9e7j9e7j9dddddddddddddddddde7j9ddddddddddddddde7j:e7j;B e7j:e7j;B e7j:e7j;B e7j:e7j;B e7j:e7j;B e7j:e7j;B e7j:e7j;B e7j:e7j;B e7j:e7j;B e7j:e7j;B ddddddde7j<e7j;B e7j<e7j;B e7j<e7j;B e7j<e7j;B e7j<e7j;B e7j<e7j;B e7j<e7j<e7j<e7j<e7j<e7j<e7j<e7j<e7j<e7j<e7j<e7j<e7j<e7j<e7j<e7j<e7j<e7j<e7j<e7j<dddddde7j=e7j;B e7j=e7j;B e7j=e7j;B e7j=e7j;B e7j=e7j;B e7j=e7j;B e7j=e7j=e7j=e7j=e7j=e7j=e7j=e7j=e7j=e7j=e7j=e7j=e7j=e7j=e7j=e7j=e7j=e7j=e7j=e7j=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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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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ej>dIZ?ej8g dJej@dIZAej8g dKej@dIZBG dLdM dMeZCej8g ddddddddddeCjDeCjEB eCjDeCjDeCjDeCjFB ddddddddddddddeCjDeCjDeCjD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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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eCjD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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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ddddddddddddddddddddej>dIZGedNdO ZHedPdQ ZIedRdS ZJedTdU ZKedVdW ZLedXdY ZMedZd[ ZNed\d] ZOed^d_ ZPed`da ZQedbdc ZReddde ZSedfdg ZTdS )hz
This module contains support functions for more advanced unicode operations.
This is not a public API and is for Numba internal use only. Most of the
functions are relatively straightforward translations of the functions with the
same name in CPython.
    )
namedtuple)IntEnumN)typescgutils)impl_ret_untracked)overload	intrinsicregister_jitable)TypingError
typerecordz%upper lower title decimal digit flags	   
          c                   @   sH   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdS )_PyUnicode_TyperecordMasks               r   @         i   i   i   i   i    i @  N)__name__
__module____qualname__
ALPHA_MASKDECIMAL_MASK
DIGIT_MASK
LOWER_MASKLINEBREAK_MASK
SPACE_MASK
TITLE_MASK
UPPER_MASKXID_START_MASKXID_CONTINUE_MASKPRINTABLE_MASKNUMERIC_MASKCASE_IGNORABLE_MASK
CASED_MASKEXTENDED_CASE_MASK r+   r+   l/var/www/html/eduruby.in/lip-sync/lip-sync-env/lib/python3.10/site-packages/numba/cpython/unicode_support.pyr   ;   s     r   c                 C   s   t d)Nz(Calling the Python definition is invalid)RuntimeErrorar+   r+   r,   _PyUnicode_gettyperecordM   s   r0   c                 C   sP   t |tjs
tddd }ttjtjtjtjtjtjgt}|t	}||fS )z~
    Provides the binding to numba_gettyperecord, returns a `typerecord`
    namedtuple of properties from the codepoint.
    zcodepoint must be an integerc              
   S   sH  |  tj}|  t}|  tj}| }|  tj}| }	|  tj}
|
 }tj	
||||||	|	|g}tj|j|dd}tj||dd}tj||dd}tj||dd}tj||dd}tj||dd}tj||
dd}||||||g}|||d	 g|  g }|D ]
}||| q| ||jt|}t| ||j|S )
NZnumba_gettyperecordnameupperlowertitledecimaldigitflagsr   )get_value_typer   void_Py_UCS4intcZ
as_pointerucharushortllvmliteirFunctionTyper   get_or_insert_functionmoduleZalloca_oncecallappendloadZ
make_tuplereturn_typetupler   )contextbuilder	signatureargsZll_void
ll_Py_UCS4ll_intcZll_intc_ptrZll_ucharZll_uchar_ptrZ	ll_ushortZll_ushort_ptrfntyfnr3   r4   r5   r6   r7   r8   Zbyrefbufxresr+   r+   r,   detailsZ   sD   
	z$_gettyperecord_impl.<locals>.details)

isinstancer   Integerr
   
NamedTupler<   r=   r>   r   r;   )	typingctx	codepointrT   Ztuptysigr+   r+   r,   _gettyperecord_implQ   s   %r[   c                    s@   t | tjrddlm   fdd}|S t | tjrdd S dS )z
    Provides a _PyUnicode_gettyperecord binding, for convenience it will accept
    single character strings and code points.
    r   _get_code_pointc                    s2   t | dkrd}t| | d}tt|}|S )Nr   z.gettyperecord takes a single unicode characterr   )len
ValueErrorr[   r;   )r/   msg
code_pointdatar\   r+   r,   impl   s   
z gettyperecord_impl.<locals>.implc                 S   s   t t| S N)r[   r;   r.   r+   r+   r,   <lambda>   s    z$gettyperecord_impl.<locals>.<lambda>N)rU   r   ZUnicodeTypeZnumba.cpython.unicoder]   rV   )r/   rc   r+   r\   r,   gettyperecord_impl   s   rf   c                 C   s.   t |tjs
tddd }ttj}||fS )z
    Accessor function for the _PyUnicode_ExtendedCase array, binds to
    numba_get_PyUnicode_ExtendedCase which wraps the array and does the lookup
    zExpected an indexc                 S   sJ   |  t}|  tj}tj||g}tj|j	|dd}|
||d gS )NZ numba_get_PyUnicode_ExtendedCaser1   r   )r9   r;   r   r<   r?   r@   rA   r   rB   rC   rD   )rI   rJ   rK   rL   rM   rN   rO   rP   r+   r+   r,   rT      s   
z(_PyUnicode_ExtendedCase.<locals>.details)rU   r   rV   r
   r;   r<   )rX   indexrT   rZ   r+   r+   r,   _PyUnicode_ExtendedCase   s
   
	rh   c                 C   s,   t | }|jtj@ rt|jd@ S | |j S )N  )r0   r8   r   r*   rh   r5   chctyper+   r+   r,   _PyUnicode_ToTitlecase   s   
rm   c                 C      t | }|jtj@ dkS Nr   )r0   r8   r   r"   rj   r+   r+   r,   _PyUnicode_IsTitlecase      rp   c                 C   rn   ro   )r0   r8   r   r$   rj   r+   r+   r,   _PyUnicode_IsXidStart   rq   rr   c                 C   rn   ro   )r0   r8   r   r%   rj   r+   r+   r,   _PyUnicode_IsXidContinue   rq   rs   c                 C      t | }|jtj@ r|jS dS N)r0   r8   r   r   r6   rj   r+   r+   r,   _PyUnicode_ToDecimalDigit      rw   c                 C   rt   ru   )r0   r8   r   r   r7   rj   r+   r+   r,   _PyUnicode_ToDigit   rx   ry   c                 C   rn   ro   )r0   r8   r   r'   rj   r+   r+   r,   _PyUnicode_IsNumeric   rq   rz   c                 C   rn   ro   )r0   r8   r   r&   rj   r+   r+   r,   _PyUnicode_IsPrintable   rq   r{   c                 C   rn   ro   )r0   r8   r   r   rj   r+   r+   r,   _PyUnicode_IsLowercase   rq   r|   c                 C   rn   ro   )r0   r8   r   r#   rj   r+   r+   r,   _PyUnicode_IsUppercase   rq   r}   c                 C   rn   ro   )r0   r8   r   r    rj   r+   r+   r,   _PyUnicode_IsLineBreak   rq   r~   c                 C      t rd   NotImplementedErrorrk   r+   r+   r,   _PyUnicode_ToUppercase     r   c                 C   r   rd   r   r   r+   r+   r,   _PyUnicode_ToLowercase  r   r   c                 C   \   t | }|jtj@ r%|jd@ }|jd? }t|D ]
}t|| ||< q|S | |j |d< dS Nri      r   r   )r0   r8   r   r*   r4   rangerh   rk   rS   rl   rg   nir+   r+   r,   _PyUnicode_ToLowerFull     

r   c                 C   r   r   )r0   r8   r   r*   r5   r   rh   r   r+   r+   r,   _PyUnicode_ToTitleFull  r   r   c                 C   r   r   )r0   r8   r   r*   r3   r   rh   r   r+   r+   r,   _PyUnicode_ToUpperFull-  s   

r   c                 C   st   t | }tj}|j|@ r5|jd? d@ r5|jd@ |jd?  }|jd? d@ }t|D ]
}t|| ||< q(|S t| |S )N      ri   r   )r0   r   r*   r8   r4   r   rh   r   )rk   rS   rl   Zextended_case_maskrg   r   r   r+   r+   r,   _PyUnicode_ToFoldedFull<  s   
r   c                 C   rn   ro   )r0   r8   r   r)   rj   r+   r+   r,   _PyUnicode_IsCasedJ  rq   r   c                 C   rn   ro   )r0   r8   r   r(   rj   r+   r+   r,   _PyUnicode_IsCaseIgnorableQ  rq   r   c                 C      t | dk rdS dS Nr   r   )ry   r   r+   r+   r,   _PyUnicode_IsDigitX     r   c                 C   r   r   )rw   r   r+   r+   r,   _PyUnicode_IsDecimalDigit`  r   r   c                 C   rn   ro   )r0   r8   r   r!   rj   r+   r+   r,   _PyUnicode_IsSpaceh  rq   r   c                 C   rn   ro   )r0   r8   r   r   rj   r+   r+   r,   _PyUnicode_IsAlphan  rq   r   c                   @   s(   e Zd ZdZdZdZdZdZdZdZ	dS )	_PY_CTFr   r      r   r   r   r   N)
r   r   r   LOWERUPPERALPHADIGITALNUMSPACEXDIGITr+   r+   r+   r,   r   }  s    r   )Zdtype(   r   r   r   r   r         r   r   r   r         r         r            r            r                        r   !   "   #   $   %   &   '   (   )   *   +   ,   -   .   /   0   1   2   3   4   5   6   7   8   9   :   ;   <   =   >   ?   r   a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y   z   [   \   ]   ^   _   `   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   {   |   }   ~      r                                                                                                                                                                                                                                                                                                                                                                                                (   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z   r   r   r   r   r   r   r|  r}  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r  r	  r
  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r!  r"  r#  r$  r%  r&  r'  r(  r)  r*  r+  r,  r-  r.  r/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r:  r;  r<  r=  r>  r?  r@  rA  rB  rC  rD  rE  rF  rG  rH  rI  rJ  rK  rL  rM  rN  rO  rP  rQ  rR  rS  rT  rU  rV  rW  rX  rY  rZ  r[  r\  r]  r^  r_  r`  ra  rb  rc  rd  re  rf  rg  rh  ri  rj  rk  rl  rm  rn  ro  rp  rq  rr  rs  rt  ru  rv  rw  rx  ry  rz  r{  c                   @   s   e Zd ZdZdZdZdS )
_PY_CTF_LBr   r   r   N)r   r   r   
LINE_BREAK	LINE_FEEDCARRIAGE_RETURNr+   r+   r+   r,   r  a  s    r  c                 C   s   t | t d@ S )zk
    Equivalent to the CPython macro `Py_CHARMASK()`, masks off all but the
    lowest 256 bits of ch.
    r{  )r   uint8r   r+   r+   r,   _Py_CHARMASK  s   r  c                 C      t t|  S )zw
    Equivalent to the CPython macro `Py_TOUPPER()` converts an ASCII range
    code point to the upper equivalent
    )_Py_ctype_toupperr  r   r+   r+   r,   _Py_TOUPPER     r  c                 C   r  )zw
    Equivalent to the CPython macro `Py_TOLOWER()` converts an ASCII range
    code point to the lower equivalent
    )_Py_ctype_tolowerr  r   r+   r+   r,   _Py_TOLOWER  r  r  c                 C      t t|  tj@ S )z8
    Equivalent to the CPython macro `Py_ISLOWER()`
    )_Py_ctype_tabler  r   r   r   r+   r+   r,   _Py_ISLOWER     r  c                 C   r  )z8
    Equivalent to the CPython macro `Py_ISUPPER()`
    )r  r  r   r   r   r+   r+   r,   _Py_ISUPPER  r  r  c                 C   r  )z8
    Equivalent to the CPython macro `Py_ISALPHA()`
    )r  r  r   r   r   r+   r+   r,   _Py_ISALPHA  r  r  c                 C   r  )z8
    Equivalent to the CPython macro `Py_ISDIGIT()`
    )r  r  r   r   r   r+   r+   r,   _Py_ISDIGIT  r  r  c                 C   r  )z9
    Equivalent to the CPython macro `Py_ISXDIGIT()`
    )r  r  r   r   r   r+   r+   r,   _Py_ISXDIGIT  r  r  c                 C   r  )z8
    Equivalent to the CPython macro `Py_ISALNUM()`
    )r  r  r   r   r   r+   r+   r,   _Py_ISALNUM  r  r  c                 C   r  )z8
    Equivalent to the CPython macro `Py_ISSPACE()`
    )r  r  r   r   r   r+   r+   r,   _Py_ISSPACE  r  r  c                 C   r  )z&Check if character is ASCII line break)_Py_ctype_islinebreakr  r  r  r   r+   r+   r,   _Py_ISLINEBREAK     r  c                 C   r  )z#Check if character is line feed `
`)r  r  r  r  r   r+   r+   r,   _Py_ISLINEFEED  r  r  c                 C   r  )z)Check if character is carriage return ``)r  r  r  r  r   r+   r+   r,   _Py_ISCARRIAGERETURN  r  r  )U__doc__collectionsr   enumr   Zllvmlite.irr?   numpynpZ
numba.corer   r   Znumba.core.imputilsr   Znumba.core.extendingr   r   r	   Znumba.core.errorsr
   r   Zuint32r;   Z_Py_TABZ_Py_LINEFEEDZ_Py_CARRIAGE_RETURNZ	_Py_SPACEr   r0   r[   rf   rh   rm   rp   rr   rs   rw   ry   rz   r{   r|   r}   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   arrayr   r   r   r   r   r<   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r+   r+   r+   r,   <module>   s
   
3
























	
 !"#$%&'()*+,-./0
1
2
3
4
5
6
7
8
9
:;<=>?@A
B
C
D
E
F
GHIJKLMNOPQRSTUVWXYZ[\]^_`a
b
c
d
e
f
ghijklmnopqrstuvwxyz{|}~                                                                                                                                                                                                                                   	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  
  
!
&!$

	























	
	
	
	
	
	


