a
    –§»a¹j  ã                  @   s  d Z ddlmZ ddlmZ ddlZddlm  m	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„ ƒZ0ed7d8„ ƒZ1ed9d:„ ƒZ2ed;d<„ ƒZ3ed=d>„ ƒZ4ed?d@„ ƒZ5edAdB„ ƒZ6edCdD„ ƒZ7edEdF„ ƒZ8G dGdH„ dHeƒZ9ej:ddddddddde9j;e9j;e9j;e9j;e9j;dddddddddddddddddde9j;ddddddddddddddde9j<e9j=B e9j<e9j=B e9j<e9j=B e9j<e9j=B e9j<e9j=B e9j<e9j=B e9j<e9j=B e9j<e9j=B e9j<e9j=B e9j<e9j=B ddddddde9j>e9j=B e9j>e9j=B e9j>e9j=B e9j>e9j=B e9j>e9j=B e9j>e9j=B e9j>e9j>e9j>e9j>e9j>e9j>e9j>e9j>e9j>e9j>e9j>e9j>e9j>e9j>e9j>e9j>e9j>e9j>e9j>e9j>dddddde9j?e9j=B e9j?e9j=B e9j?e9j=B e9j?e9j=B e9j?e9j=B e9j?e9j=B e9j?e9j?e9j?e9j?e9j?e9j?e9j?e9j?e9j?e9j?e9j?e9j?e9j?e9j?e9j?e9j?e9j?e9j?e9j?e9j?ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd�g ej@dI�ZAej:g dJ¢ejBdI�ZCej:g dK¢ejBdI�ZDG dLdM„ dMeƒZEej:ddddddddddeEjFeEjGB eEjFeEjFeEjFeEjHB ddddddddddddddeEjFeEjFeEjFddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddeEjFdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd�g ej@dI�ZIedNdO„ ƒZJedPdQ„ ƒZKedRdS„ ƒZLedTdU„ ƒZMedVdW„ ƒZNedXdY„ ƒZOedZd[„ ƒZPed\d]„ ƒZQed^d_„ ƒZRed`da„ ƒZSedbdc„ ƒZTeddde„ ƒZUedfdg„ ƒZVd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+   úW/home/yuhw/wc/pochoir/venv/lib/python3.9/site-packages/numba/cpython/unicode_support.pyr   :   s   r   c                 C   s   t dƒ‚d S )Nz(Calling the Python definition is invalid)ÚRuntimeError©Úar+   r+   r,   Ú_PyUnicode_gettyperecordL   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   sJ  |   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ÚlcÚTypeÚfunctionr   Ú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   ÚbyrefÚbufÚxÚresr+   r+   r,   ÚdetailsY   sD    
ù	þz$_gettyperecord_impl.<locals>.details)
Ú
isinstancer   ÚIntegerr
   Ú
NamedTupler<   r=   r>   r   r;   )Ú	typingctxÚ	codepointrU   ZtuptyÚsigr+   r+   r,   Ú_gettyperecord_implP   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>–   ó    z$gettyperecord_impl.<locals>.<lambda>N)rV   r   ZUnicodeTypeZnumba.cpython.unicoder^   rW   )r/   rd   r+   r]   r,   Úgettyperecord_impl„   s    rh   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,   rU   ¤   s    
þz(_PyUnicode_ExtendedCase.<locals>.details)rV   r   rW   r
   r;   r<   )rY   ÚindexrU   r[   r+   r+   r,   Ú_PyUnicode_ExtendedCase›   s
    	
rj   c                 C   s,   t | ƒ}|jtj@ r"t|jd@ ƒS | |j S )Néÿÿ  )r0   r8   r   r*   rj   r5   ©ÚchÚctyper+   r+   r,   Ú_PyUnicode_ToTitlecaseµ   s    ro   c                 C   s   t | ƒ}|jtj@ dkS ©Nr   )r0   r8   r   r"   rl   r+   r+   r,   Ú_PyUnicode_IsTitlecase¾   s    rq   c                 C   s   t | ƒ}|jtj@ dkS rp   )r0   r8   r   r$   rl   r+   r+   r,   Ú_PyUnicode_IsXidStartÅ   s    rr   c                 C   s   t | ƒ}|jtj@ dkS rp   )r0   r8   r   r%   rl   r+   r+   r,   Ú_PyUnicode_IsXidContinueÌ   s    rs   c                 C   s   t | ƒ}|jtj@ r|jS dS ©Néÿÿÿÿ)r0   r8   r   r   r6   rl   r+   r+   r,   Ú_PyUnicode_ToDecimalDigitÒ   s    rv   c                 C   s   t | ƒ}|jtj@ r|jS dS rt   )r0   r8   r   r   r7   rl   r+   r+   r,   Ú_PyUnicode_ToDigitÛ   s    rw   c                 C   s   t | ƒ}|jtj@ dkS rp   )r0   r8   r   r'   rl   r+   r+   r,   Ú_PyUnicode_IsNumericä   s    rx   c                 C   s   t | ƒ}|jtj@ dkS rp   )r0   r8   r   r&   rl   r+   r+   r,   Ú_PyUnicode_IsPrintableë   s    ry   c                 C   s   t | ƒ}|jtj@ dkS rp   )r0   r8   r   r   rl   r+   r+   r,   Ú_PyUnicode_IsLowercaseò   s    rz   c                 C   s   t | ƒ}|jtj@ dkS rp   )r0   r8   r   r#   rl   r+   r+   r,   Ú_PyUnicode_IsUppercaseù   s    r{   c                 C   s   t | ƒ}|jtj@ dkS rp   )r0   r8   r   r    rl   r+   r+   r,   Ú_PyUnicode_IsLineBreakÿ   s    r|   c                 C   s   t ‚d S re   ©ÚNotImplementedError©rm   r+   r+   r,   Ú_PyUnicode_ToUppercase  s    r€   c                 C   s   t ‚d S re   r}   r   r+   r+   r,   Ú_PyUnicode_ToLowercase
  s    r�   c                 C   s\   t | ƒ}|jtj@ rJ|jd@ }|jd? }t|ƒD ]}t|| ƒ||< q0|S | |j |d< dS ©Nrk   é   r   r   )r0   r8   r   r*   r4   Úrangerj   ©rm   rT   rn   ri   ÚnÚir+   r+   r,   Ú_PyUnicode_ToLowerFull  s    

rˆ   c                 C   s\   t | ƒ}|jtj@ rJ|jd@ }|jd? }t|ƒD ]}t|| ƒ||< q0|S | |j |d< dS r‚   )r0   r8   r   r*   r5   r„   rj   r…   r+   r+   r,   Ú_PyUnicode_ToTitleFull  s    

r‰   c                 C   s\   t | ƒ}|jtj@ rJ|jd@ }|jd? }t|ƒD ]}t|| ƒ||< q0|S | |j |d< dS r‚   )r0   r8   r   r*   r3   r„   rj   r…   r+   r+   r,   Ú_PyUnicode_ToUpperFull,  s    

rŠ   c                 C   st   t | ƒ}tj}|j|@ rj|jd? d@ rj|jd@ |jd?  }|jd? d@ }t|ƒD ]}t|| ƒ||< qP|S t| |ƒS )Né   é   rk   rƒ   )r0   r   r*   r8   r4   r„   rj   rˆ   )rm   rT   rn   Zextended_case_maskri   r†   r‡   r+   r+   r,   Ú_PyUnicode_ToFoldedFull;  s    r�   c                 C   s   t | ƒ}|jtj@ dkS rp   )r0   r8   r   r)   rl   r+   r+   r,   Ú_PyUnicode_IsCasedI  s    rŽ   c                 C   s   t | ƒ}|jtj@ dkS rp   )r0   r8   r   r(   rl   r+   r+   r,   Ú_PyUnicode_IsCaseIgnorableP  s    r�   c                 C   s   t | ƒdk rdS dS ©Nr   r   )rw   r   r+   r+   r,   Ú_PyUnicode_IsDigitW  s    r‘   c                 C   s   t | ƒdk rdS dS r�   )rv   r   r+   r+   r,   Ú_PyUnicode_IsDecimalDigit_  s    r’   c                 C   s   t | ƒ}|jtj@ dkS rp   )r0   r8   r   r!   rl   r+   r+   r,   Ú_PyUnicode_IsSpaceg  s    r“   c                 C   s   t | ƒ}|jtj@ dkS rp   )r0   r8   r   r   rl   r+   r+   r,   Ú_PyUnicode_IsAlpham  s    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ï   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Œ  r�  rð   rñ   rò   ró   rô   r   rõ   rö   r÷   rø   rù   rú   rû   rü   rý   rþ   rÿ   r   r  r  r  r  r  r  r  r  r	  r
  r  r  r  r  r  r  r  r  r  r  r  r  r  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  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Ž  `  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.
    rs  )r   Úuint8r   r+   r+   r,   Ú_Py_CHARMASK„  s    r“  c                 C   s   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�  s    r•  c                 C   s   t t| ƒ S )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š  s    r—  c                 C   s   t t| ƒ tj@ S )z8
    Equivalent to the CPython macro `Py_ISLOWER()`
    )Ú_Py_ctype_tabler“  r•   r—   r   r+   r+   r,   Ú_Py_ISLOWER¥  s    r™  c                 C   s   t t| ƒ tj@ S )z8
    Equivalent to the CPython macro `Py_ISUPPER()`
    )r˜  r“  r•   r˜   r   r+   r+   r,   Ú_Py_ISUPPER¯  s    rš  c                 C   s   t t| ƒ tj@ S )z8
    Equivalent to the CPython macro `Py_ISALPHA()`
    )r˜  r“  r•   r™   r   r+   r+   r,   Ú_Py_ISALPHA¹  s    r›  c                 C   s   t t| ƒ tj@ S )z8
    Equivalent to the CPython macro `Py_ISDIGIT()`
    )r˜  r“  r•   rš   r   r+   r+   r,   Ú_Py_ISDIGITÃ  s    rœ  c                 C   s   t t| ƒ tj@ S )z9
    Equivalent to the CPython macro `Py_ISXDIGIT()`
    )r˜  r“  r•   r�   r   r+   r+   r,   Ú_Py_ISXDIGITÍ  s    r�  c                 C   s   t t| ƒ tj@ S )z8
    Equivalent to the CPython macro `Py_ISALNUM()`
    )r˜  r“  r•   r›   r   r+   r+   r,   Ú_Py_ISALNUM×  s    rž  c                 C   s   t t| ƒ tj@ S )z8
    Equivalent to the CPython macro `Py_ISSPACE()`
    )r˜  r“  r•   rœ   r   r+   r+   r,   Ú_Py_ISSPACEá  s    rŸ  c                 C   s   t t| ƒ tj@ S )z&Check if character is ASCII line break)Ú_Py_ctype_islinebreakr“  rŽ  r�  r   r+   r+   r,   Ú_Py_ISLINEBREAKé  s    r¡  c                 C   s   t t| ƒ tj@ S )z#Check if character is line feed `
`)r   r“  rŽ  r�  r   r+   r+   r,   Ú_Py_ISLINEFEEDï  s    r¢  c                 C   s   t t| ƒ tj@ S )z)Check if character is carriage return ``)r   r“  rŽ  r‘  r   r+   r+   r,   Ú_Py_ISCARRIAGERETURNõ  s    r£  )WÚ__doc__Úcollectionsr   Úenumr   ÚnumpyÚnpZllvmlite.llvmpy.coreZllvmpyÚcorer?   Z
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\   rh   rj   ro   rq   rr   rs   rv   rw   rx   ry   rz   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














































        € ø 
€ ÷ 
!ß&
!ß$

"""""""""""""èç





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