o
    dij                     @   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+   [/home/ubuntu/SoloSpeech/.venv/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 )
Nnumba_gettyperecordnameupperlowertitledecimaldigitflagsr   )get_value_typer   void_Py_UCS4intc
as_pointerucharushortllvmliteirFunctionTyper   get_or_insert_functionmodulealloca_oncecallappendload
make_tuplereturn_typetupler   )contextbuilder	signatureargsll_void
ll_Py_UCS4ll_intcll_intc_ptrll_ucharll_uchar_ptr	ll_ushortll_ushort_ptrfntyfnr4   r5   r6   r7   r8   r9   byrefbufxresr+   r+   r,   detailsZ   sD   
	z$_gettyperecord_impl.<locals>.details)

isinstancer   Integerr
   
NamedTupler=   r?   r@   r   r<   )	typingctx	codepointr_   tuptysigr+   r+   r,   _gettyperecord_implQ   s   %rg   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
ValueErrorrg   r<   )r/   msg
code_pointdatarh   r+   r,   impl   s   
z gettyperecord_impl.<locals>.implc                 S   s   t t| S N)rg   r<   r.   r+   r+   r,   <lambda>   s    z$gettyperecord_impl.<locals>.<lambda>N)r`   r   UnicodeTypenumba.cpython.unicoderi   ra   )r/   ro   r+   rh   r,   gettyperecord_impl   s   rt   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 )N numba_get_PyUnicode_ExtendedCaser2   r   )r:   r<   r   r=   rA   rB   rC   r   rD   rE   rG   )rM   rN   rO   rP   rR   rS   rY   rZ   r+   r+   r,   r_      s   
z(_PyUnicode_ExtendedCase.<locals>.details)r`   r   ra   r
   r<   r=   )rc   indexr_   rf   r+   r+   r,   _PyUnicode_ExtendedCase   s
   
	rw   c                 C   s,   t | }|jtj@ rt|jd@ S | |j S )N  )r0   r9   r   r*   rw   r6   chctyper+   r+   r,   _PyUnicode_ToTitlecase   s   
r|   c                 C      t | }|jtj@ dkS Nr   )r0   r9   r   r"   ry   r+   r+   r,   _PyUnicode_IsTitlecase      r   c                 C   r}   r~   )r0   r9   r   r$   ry   r+   r+   r,   _PyUnicode_IsXidStart   r   r   c                 C   r}   r~   )r0   r9   r   r%   ry   r+   r+   r,   _PyUnicode_IsXidContinue   r   r   c                 C      t | }|jtj@ r|jS dS N)r0   r9   r   r   r7   ry   r+   r+   r,   _PyUnicode_ToDecimalDigit      r   c                 C   r   r   )r0   r9   r   r   r8   ry   r+   r+   r,   _PyUnicode_ToDigit   r   r   c                 C   r}   r~   )r0   r9   r   r'   ry   r+   r+   r,   _PyUnicode_IsNumeric   r   r   c                 C   r}   r~   )r0   r9   r   r&   ry   r+   r+   r,   _PyUnicode_IsPrintable   r   r   c                 C   r}   r~   )r0   r9   r   r   ry   r+   r+   r,   _PyUnicode_IsLowercase   r   r   c                 C   r}   r~   )r0   r9   r   r#   ry   r+   r+   r,   _PyUnicode_IsUppercase   r   r   c                 C   r}   r~   )r0   r9   r   r    ry   r+   r+   r,   _PyUnicode_IsLineBreak   r   r   c                 C      t rp   NotImplementedErrorrz   r+   r+   r,   _PyUnicode_ToUppercase     r   c                 C   r   rp   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 Nrx      r   r   )r0   r9   r   r*   r5   rangerw   rz   r^   r{   rv   nir+   r+   r,   _PyUnicode_ToLowerFull     

r   c                 C   r   r   )r0   r9   r   r*   r6   r   rw   r   r+   r+   r,   _PyUnicode_ToTitleFull  r   r   c                 C   r   r   )r0   r9   r   r*   r4   r   rw   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      rx   r   )r0   r   r*   r9   r5   r   rw   r   )rz   r^   r{   extended_case_maskrv   r   r   r+   r+   r,   _PyUnicode_ToFoldedFull<  s   
r   c                 C   r}   r~   )r0   r9   r   r)   ry   r+   r+   r,   _PyUnicode_IsCasedJ  r   r   c                 C   r}   r~   )r0   r9   r   r(   ry   r+   r+   r,   _PyUnicode_IsCaseIgnorableQ  r   r   c                 C      t | dk rdS dS Nr   r   )r   r   r+   r+   r,   _PyUnicode_IsDigitX     r   c                 C   r   r   )r   r   r+   r+   r,   _PyUnicode_IsDecimalDigit`  r   r   c                 C   r}   r~   )r0   r9   r   r!   ry   r+   r+   r,   _PyUnicode_IsSpaceh  r   r   c                 C   r}   r~   )r0   r9   r   r   ry   r+   r+   r,   _PyUnicode_IsAlphan  r   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   )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/  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{  r|  r}  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  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   llvmlite.irrA   numpynp
numba.corer   r   numba.core.imputilsr   numba.core.extendingr   r   r	   numba.core.errorsr
   r   uint32r<   _Py_TAB_Py_LINEFEED_Py_CARRIAGE_RETURN	_Py_SPACEr   r0   rg   rt   rw   r|   r   r   r   r   r   r   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{|}~                                                                                                                                                                                                                                   	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  
  
!
&!$

	























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