Ë
    Ç[;j:  ã                   ó.  — d dl Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	 ddlm
Z
 ddlmZ dd	lmZ d dlZd dlZd dlZ G d
„ de	j"                  «      Z G d„ de«      Z G d„ dej(                  «      Z G d„ de«      Z G d„ dej.                  «      Zdd„Zy)é    Né   )Úparse_from_stringsÚStringParseContext)ÚFileSourceDescriptor)ÚCompileError)ÚSymtab)ÚNaming)ÚCode)ÚOptionsc                   ó,   ‡ — e Zd Zd„ Zˆ fd„Zdd„Zˆ xZS )ÚNonManglingModuleScopec                 ó”   — || _         d | _        |j                  dd«      | _        t	        j
                  j                  | g|¢­i |¤Ž y )NÚcppF)ÚprefixÚcython_scopeÚpopr   r   ÚModuleScopeÚ__init__)Úselfr   ÚargsÚkws       údG:\00. PROJECTS\API\Inventory\templateJSON\kerjaOCR\Lib\site-packages\Cython/Compiler/UtilityCode.pyr   zNonManglingModuleScope.__init__   sA   € ØˆŒØ ˆÔØ—6‘6˜% Ó'ˆŒÜ×Ñ×#Ñ# DÐ6¨4Ò6°2Ó6ó    c                 ó4   •— d|_         t        ‰| �	  |||«      S )NT)ÚusedÚsuperÚadd_imported_entry)r   ÚnameÚentryÚposÚ	__class__s       €r   r   z)NonManglingModuleScope.add_imported_entry   s   ø€ ØˆŒ
Ü‰wÑ)¨$°°sÓ;Ð;r   c                 óê   — |rR|t         j                  t         j                  t         j                  t         j                  fv r| j
                  }|›|›�S t        j                  j                  | |«      S ©N)	r	   Útypeobj_prefixÚfunc_prefixÚ
var_prefixÚpyfunc_prefixr   r   r   Úmangle)r   r   r   s      r   r(   zNonManglingModuleScope.mangle   s^   € ÙØœ&×/Ñ/´×1CÑ1CÄV×EVÑEVÔX^×XlÑXlÐmÑmð Ÿ™�Ù#¡TÐ*Ð*ä×%Ñ%×,Ñ,¨T°6Ó:Ð:r   r#   )Ú__name__Ú
__module__Ú__qualname__r   r   r(   Ú__classcell__©r!   s   @r   r   r      s   ø„ ò7ô<÷;r   r   c                   ó   — e Zd ZdZdd„Zy)ÚCythonUtilityCodeContextNc                 ó  — |rt        d«      ‚|| j                  k7  r(|| j                  vrt        d«      ‚| j                  |   S | j                  €)t	        | j
                  |d | | j                  ¬«      | _        | j                  S )Nz/Relative imports not supported in utility code.z%Only the cython cimport is supported.)Úparent_moduleÚcontextr   )ÚAssertionErrorÚmodule_nameÚmodulesÚscoper   r   r   )r   r4   Úfrom_moduler    Úneed_pxdÚabsolute_fallbackÚrelative_imports          r   Úfind_modulez$CythonUtilityCodeContext.find_module)   s   € ÙÜ Ð!RÓSÐSØ˜$×*Ñ*Ò*Ø $§,¡,Ñ.Ü$Ð%LÓMÐMà—|‘| KÑ0Ð0à�:‰:ÐÜ/Ø—‘˜[¸ÀdÐPT×PXÑPXôZˆDŒJð �z‰zÐr   )NNTTF)r)   r*   r+   r6   r;   © r   r   r/   r/   &   s   „ Ø€Eôr   r/   c                   óŽ   ‡ — e Zd ZdZdZ	 	 	 dd„Zd„ Zd„ Zd„ Zdd„Z	dd„Z
eˆ fd	„«       Zedd
„«       Z	 	 dd„Zed„ «       Zˆ xZS )ÚCythonUtilityCodeaR  
    Utility code written in the Cython language itself.

    The @cname decorator can set the cname for a function, method of cdef class.
    Functions decorated with @cname('c_func_name') get the given cname.

    For cdef classes the rules are as follows:
        obj struct      -> <cname>_obj
        obj type ptr    -> <cname>_type
        methods         -> <class_cname>_<method_cname>

    For methods the cname decorator is optional, but without the decorator the
    methods will not be prototyped. See Cython.Compiler.CythonScope and
    tests/run/cythonscope.pyx for examples.
    Tc
                 ó,  — i }
|�Mddl m} |j                  «       D ]  \  }}t        ||«      sŒ|||<   ||
|<   Œ t	        j
                  ||||«      }|| _        || _        || _        || _	        |xs g | _
        || _        |	| _        || _        |
| _        y )Nr   )ÚBaseType)Ú
PyrexTypesr@   ÚitemsÚ
isinstancer
   Úsub_tempitaÚimplr   Úfiler   ÚrequiresÚ
from_scopeÚouter_module_scopeÚcompiler_directivesÚcontext_types)r   rE   r   r   rG   rF   rH   r2   rJ   rI   rK   r@   ÚkeyÚvalues                 r   r   zCythonUtilityCode.__init__L   s¡   € ð ˆØÐÝ,Ø%Ÿm™mžo‘
��UÜ˜e XÕ.Ø#&�G˜C‘LØ).�M #Ò&ð .ô ×#Ñ# D¨'°4¸Ó>ˆDØˆŒ	ØˆŒ	ØˆŒ	ØˆŒØ š BˆŒØ$ˆŒØ"4ˆÔØ#6ˆÔ Ø*ˆÕr   c                 óf   — t        |t        «      r!| j                  «       |j                  «       k(  S y)NF)rC   r>   Ú_equality_params)r   Úothers     r   Ú__eq__zCythonUtilityCode.__eq__g   s-   € Ü�eÔ.Ô/Ø×(Ñ(Ó*¨e×.DÑ.DÓ.FÑFÐFàr   c                 ó¦   — | j                   }t        |t        «      r|j                  }t        |t        «      rŒ| j                  || j
                  fS r#   )rI   rC   r   Úouter_scoperE   rJ   )r   rS   s     r   rO   z"CythonUtilityCode._equality_paramsm   sG   € Ø×-Ñ-ˆÜ˜Ô&<Ô=Ø%×1Ñ1ˆKô ˜Ô&<Õ=à�y‰y˜+ t×'?Ñ'?Ð?Ð?r   c                 ó,   — t        | j                  «      S r#   )ÚhashrE   )r   s    r   Ú__hash__zCythonUtilityCode.__hash__s   s   € Ü�D—I‘I‹Ðr   c                 óŠ  ‡ — ddl m} |g}ddlm}m} t        ‰ j                  ‰ j                  |r|j                  «       nd|r|j                  j                  nd ¬«      }‰ j                  |_        ||_        t        ‰ j                  ‰ j                  |dd¬«      }|j                  |d|¬	«      }	|r4g }
|	D ]+  }|
j!                  |«       t#        ||j$                  «      sŒ+ n |
}	|j'                  |«      }|j(                  }|j+                  |	||¬
«      }	d„ }‰ j,                  r.|j+                  |	 |‰ j,                  «      |j$                  ¬
«      }	‰ j.                  D ][  }t#        |t0        «      sŒt3        |d«      sŒ!|rŒ$|j+                  |	 ||j4                  j6                  «      |j$                  ¬
«      }	Œ] ‰ j8                  r#ˆ fd„}|j+                  |	||j$                  ¬
«      }	‰ j:                  r#ˆ fd„}|j+                  |	||j$                  ¬
«      }	|j=                  |	|d¬«      \  }}|rJ |«       ‚|‰ _        |S )Nr   )ÚAutoTestDictTransform)ÚPipelineÚParseTreeTransformsF)rJ   r   ÚoptionsT)r2   Úallow_struct_enum_decoratorÚin_utility_codeÚpyx)Úexclude_classes)Úbeforec                 ó   ‡ — ˆ fd„}|S )Nc                 ó>   •— | j                   j                  ‰«       | S r#   )r6   Úmerge_in)Úmodule_noder6   s    €r   Úmerge_scope_transformzNCythonUtilityCode.get_tree.<locals>.merge_scope.<locals>.merge_scope_transform›   s   ø€ Ø×!Ñ!×*Ñ*¨5Ô1Ø"Ð"r   r<   )r6   re   s   ` r   Úmerge_scopez/CythonUtilityCode.get_tree.<locals>.merge_scopeš   s   ø€ ô#ð )Ð(r   Útreec                 ó>   •— ‰j                   | j                  _        | S r#   )rI   r6   rS   )rd   r   s    €r   Úscope_transformz3CythonUtilityCode.get_tree.<locals>.scope_transform­   s   ø€ Ø04×0GÑ0G�×!Ñ!Ô-Ø"Ð"r   c                 óÜ   •— t        «       }‰j                  j                  «       D ]C  \  }}t        |d|«      }| j                  j                  ||d d¬«      }||ur||_        d|_        ŒE | S )Nr   Úextern)Ú
visibilityT)ÚobjectrK   rB   Úgetattrr6   Údeclare_typer   Úin_cinclude)rd   Údummy_entryr   ÚtypeÚold_type_entryr   r   s         €r   ri   z3CythonUtilityCode.get_tree.<locals>.scope_transform·   sv   ø€ Ü$›h�Ø"&×"4Ñ"4×":Ñ":Ö"<‘J�D˜$ô &-¨T°7¸KÓ%H�NØ'×-Ñ-×:Ñ:¸4ÀÀtÐX`Ð:Óa�EØ%¨[Ñ8Ø%3˜œ
Ø(,�EÕ%ð #=ð #Ð"r   )Ú	printtree)ÚAnalysedTreeTransformsrX   Ú rY   rZ   r/   r   rJ   Úis_cppr2   r[   r   r   r   rE   Úcreate_pipelineÚappendrC   ÚAnalyseDeclarationsTransformÚCnameDirectivesTransformÚInterpretCompilerDirectivesÚinsert_into_pipelinerH   rG   r>   Úhasattrrg   r6   rI   rK   Úrun_pipeline)r   Úentries_onlyr   rX   ÚexcludesrY   rZ   r2   rg   ÚpipelineÚpÚtÚ	transformr`   rf   Údepri   Úerrs   `                 r   Úget_treezCythonUtilityCode.get_treev   sC  ø€ ÝAð *Ð*ˆç3Ü*Ø�I‰I¨4×+CÑ+CÙ)5�×#Ñ#Ô%¸5Ù4@�L×(Ñ(×0Ò0ÀdôLˆð Ÿ™ˆŒØ+ˆÔä!Ø�I‰I�t—y‘y¨'ÈtØ ô"ˆð ×+Ñ+¨G°UÈHÐ+ÓUˆáØˆAÛ�Ø—‘˜”Ü˜aÐ!4×!QÑ!QÕRÙð ð
 ˆHà'×@Ñ@ÀÓIˆ	ð %×@Ñ@ˆØ×0Ñ0°¸9Ø8>ð 1ó @ˆò	)ð �?Š?Ø×4Ñ4Ø™+ d§o¡oÓ6Ø*×GÑGð 5ó IˆHð —=”=ˆCÜ˜#Ô0Õ1´g¸cÀ6Õ6JÒS_Ø#×8Ñ8Ø™k¨#¯(©(¯.©.Ó9Ø.×KÑKð 9ó M‘ð !ð ×"Ò"ô#ð  ×4Ñ4Ø˜/Ø*×GÑGð 5ó IˆHð ×Òô#ð  ×4Ñ4Ø˜/Ø*×GÑGð 5ó IˆHð ×+Ñ+¨H°dÀeÐ+ÓL‰ˆˆdÙÐ˜ÓˆwØˆŒ	Øˆr   c                  ó   — y r#   r<   )r   ÚglobalstateÚused_bys      r   Úput_codezCythonUtilityCode.put_codeÍ   s   € Ør   c                 ó’   •— t        j                  d|«      r t        j                  j	                  ||«      S t        ‰| �  ||fi |¤ŽS )Nz[.]c(pp)?::)ÚreÚsearchr
   ÚUtilityCodeÚload_cachedr   Úload)ÚclsÚutil_code_nameÚ	from_fileÚkwargsr!   s       €r   r’   zCythonUtilityCode.loadÐ   sB   ø€ ä�9‰9�] NÔ3ô ×#Ñ#×/Ñ/°À	ÓJÐJÜ‰w‰|˜N¨IÑ@¸Ñ@Ð@r   c                 óZ   —  | j                   ||fi |¤Ž}|j                  |j                  fS )zR
        Load a utility code as a string. Returns (proto, implementation)
        )r’   ÚprotorE   )r“   r”   r•   r–   Úutils        r   Úload_as_stringz CythonUtilityCode.load_as_stringØ   s.   € ð
 ˆs�x‰x˜¨	Ñ<°VÑ<ˆØ�z‰z˜4Ÿ9™9Ð$Ð$r   c                 óÖ  — | j                  d|¬«      }|j                  j                  }|j                  d«       |j                  d«       |j                  d«       |j                  d«       |j	                  «       D ]  }| |_        ||_        Œ |j                  }|j                  |d|¬«       ||_        | j                  D ]"  }	|	j                  sŒ|	j                  ||¬«       Œ$ |S )	zÉ
        Declare all entries from the utility code in dest_scope. Code will only
        be included for used entries. If module_name is given, declare the
        type entries with that name.
        T)r€   r   r)   Ú__file__Ú__builtins__Ú__doc__)Úmerge_unusedÚ	allowlist©r   )rˆ   r6   Úentriesr   ÚvaluesÚutility_code_definitionr   rc   rG   Úis_cython_utilityÚdeclare_in_scope)
r   Ú
dest_scoper   r   r    rg   r¢   r   Úoriginal_scoper†   s
             r   r¦   z"CythonUtilityCode.declare_in_scopeà   sÎ   € ð �}‰}¨$¸\ˆ}ÓJˆà—*‘*×$Ñ$ˆØ�‰�JÔØ�‰�JÔØ�‰�NÔ#Ø�‰�IÔà—^‘^Ö%ˆEØ,0ˆEÔ)ØˆE�Jð &ð Ÿ™ˆØ×Ñ˜N¸ÈÐÔSØˆŒ
à—=”=ˆCØ×$Ó$Ø×$Ñ$ Z¸lÐ$ÕKð !ð Ðr   c                 óT   — ddl m} t        |«      }d}|D ]  }|| v sŒ| |   ||<   Œ |S )a   
        Cython utility code should usually only pick up a few directives from the
        environment (those that intentionally control its function) and ignore most
        other compiler directives. This function provides a sensible default list
        of directives to copy.
        r   )Ú_directive_defaults)ÚbindingÚalways_allow_keywordsÚallow_none_for_extension_argsÚauto_pickleÚccomplexÚc_string_typeÚc_string_encodingzoptimize.inline_defnode_callszoptimize.unpack_method_callsz&optimize.unpack_method_calls_in_pyinitzoptimize.use_switch)r   rª   Údict)Úcurrent_directivesrª   Úutility_code_directivesÚinherited_directive_namesr   s        r   Úfilter_inherited_directivesz-CythonUtilityCode.filter_inherited_directivesý   sI   € õ 	1Ü"&Ð':Ó";Ðð%MÐ!ó .ˆDØÐ)Ò)Ø0BÀ4Ñ0HÐ'¨Ò-ð .ð 'Ð&r   )Ú	__pyxutilrv   NNNNNN)FNr#   ©FNN)r)   r*   r+   rž   r¥   r   rQ   rO   rV   rˆ   rŒ   Úclassmethodr’   rš   r¦   Ústaticmethodr¶   r,   r-   s   @r   r>   r>   9   s‡   ø„ ñð  ÐàCGØOSØ$(ó+ò6ò@òóUónð óAó ðAð ò%ó ð%ð EIØ#'óð: ñ'ó ô'r   r>   c                   ó*   ‡ — e Zd Zˆ fd„Zdˆ fd„	Zˆ xZS )ÚTemplatedFileSourceDescriptorc                 ó4   •— t         ‰| �  ||«       || _        y r#   )r   r   Ú_context)r   ÚfilenameÚpath_descriptionr2   r!   s       €r   r   z&TemplatedFileSourceDescriptor.__init__  s   ø€ Ü‰Ñ˜Ð#3Ô4Øˆ�r   c                 óf  •— t         ‰| �  ||«      5 }|j                  «       }t        j                  || j
                  | j                  «      }t        j                  t        j                  |j                  |j                  «      «      |j                  |¬«      }d d d «       |S # 1 sw Y   S xY w)N)ÚencodingÚerrors)r   Úget_file_objectÚreadr
   rD   r¾   r¿   ÚioÚTextIOWrapperÚBytesIOÚencoderÂ   )r   rÂ   Úerror_handlingÚfÚdataÚretÚstreamr!   s          €r   rÄ   z-TemplatedFileSourceDescriptor.get_file_object  s†   ø€ Ü‰WÑ$ X¨~Ô>À!Ø—6‘6“8ˆDÜ×"Ñ" 4¨¯©¸¿¹ÓFˆCä×%Ñ%¤b§j¡j°·±¸A¿J¹JÓ1GÓ&HÐST×S]ÑS]ÐftÔuˆF÷	 ?ð
 ˆ÷ ?ð
 ˆús   ’B
B&Â&B0)NN)r)   r*   r+   r   rÄ   r,   r-   s   @r   r¼   r¼     s   ø„ ô ÷ñ r   r¼   c                   ó*   — e Zd Zd„ Zd„ Z	 	 dd„Zd„ Zy)ÚCythonSharedUtilityCodec                 óJ   — || _         || _        || _        || _        d | _        y r#   )Ú	_pxd_nameÚ_shared_utility_qualified_nameÚtemplate_contextrG   Ú_shared_library_scope)r   Úpxd_nameÚshared_utility_qualified_namerÔ   rG   s        r   r   z CythonSharedUtilityCode.__init__#  s(   € Ø!ˆŒØ.KˆÔ+Ø 0ˆÔØ ˆŒØ%)ˆÕ"r   c                 ó¼  — |}|j                  | j                  d¬«      D ]  \  }}|j                  ||¬«      }Œ t        j                  j                  t        j                  j                  t        j                  «      d   d| j                  «      }	 | j                  j                  dt        j                  «      t        j                  j                  |«      d   z   }t        ||| j                  «      }d|_        |j!                  ||| j                  «      \  }}	|	\  }
}|
|f|j"                  | j                  <   d|_        |r|‚	 |S # t&        $ r Y |S w xY w)	NF)r:   )Ú
as_packager   ÚUtilityÚ.r   T)Ú_split_qualified_namerÓ   Úfind_submoduleÚosÚpathÚjoinÚsplitÚCythonrœ   rÒ   ÚreplaceÚsepÚsplitextr¼   rÔ   r]   Úprocess_pxdÚutility_pxdsÚpxd_file_loadedr   )r   r2   r6   r   Ú
is_packageÚpxd_pathnameÚrel_pathÚsource_descr‡   ÚresultÚpxd_codenodesÚ	pxd_scopes               r   r;   z#CythonSharedUtilityCode.find_module*  sL  € ØˆØ %× ;Ñ ;¸D×<_Ñ<_ÐqvÐ ;Ö wÑˆD�*Ø×(Ñ(¨¸*Ð(ÓE‰Eð !xô —w‘w—|‘|Ü�G‰G�M‰Mœ&Ÿ/™/Ó*¨1Ñ-ØØ�N‰Nó
ˆð
	Ø×:Ñ:×BÑBÀ3ÌÏÉÓOÔRT×RYÑRY×RbÑRbÐcoÓRpÐqrÑRsÑsˆHÜ7¸ÀhÐPT×PeÑPeÓfˆKØ*.ˆKÔ'Ø!×-Ñ-¨k¸5À$×BeÑBeÓf‰KˆC�Ø)/Ñ&ˆ]˜IØ4AÀ9Ð3MˆG× Ñ  §¡Ñ0Ø$(ˆEÔ!ÙØ�	ð ð ˆøô ò 	ØØˆð	ús   ÂB6E Å	EÅENc                 óü  — | j                   |j                  j                  vr | j                  |j                  «      | _        | j
                  D ]&  }|j                  sŒ|j                  t        |¬«       Œ( | j                  j                  D ])  }|j                  |j                  ||j                  «       Œ+ | j                  j                  D ])  }|j                  |j                  ||j                  «       Œ+ |S )Nr¡   )rÒ   r2   rç   r;   rÕ   rG   r¥   r¦   r6   Úc_class_entriesr   r   r    Úvar_entries)r   r§   r   r   r    r†   Úes          r   r¦   z(CythonSharedUtilityCode.declare_in_scopeB  sÅ   € à�>‰> ×!5Ñ!5×!BÑ!BÑBØ)-×)9Ñ)9¸,×:NÑ:NÓ)OˆDÔ&Ø—=”=ˆCØ×$Ó$Ø×$Ñ$¤U¸Ð$ÕFð !ð ×+Ñ+×;Ô;ˆAØ×)Ñ)¨!¯&©&°!°Q·U±UÕ;ð <à×+Ñ+×7Ô7ˆAØ×)Ñ)¨!¯&©&°!°Q·U±UÕ;ð 8àÐr   c                 óž   — | j                   |j                  j                  vr | j                  |j                  «      | _        | j                  S r#   )rÒ   r2   rç   r;   rÕ   )r   r   s     r   Úget_shared_library_scopez0CythonSharedUtilityCode.get_shared_library_scopeO  s?   € Ø�>‰> ×!5Ñ!5×!BÑ!BÑBØ)-×)9Ñ)9¸,×:NÑ:NÓ)OˆDÔ&Ø×)Ñ)Ð)r   r¸   )r)   r*   r+   r   r;   r¦   rõ   r<   r   r   rÐ   rÐ   "  s    „ ò*òð0 EIØ#'óó*r   rÐ   c                 ó@   — t        | g|¢­i |¤Žj                  |«       y)z`
    Declare some declarations given as Cython code in declaration_string
    in scope env.
    N)r>   r¦   )Údeclaration_stringÚenvÚprivate_typer   r–   s        r   Údeclare_declarations_in_scoperú   U  s"   € ô Ð(Ð:¨4Ò:°6Ñ:×KÑKÈCÕPr   )T)râ   ÚTreeFragmentr   r   ÚScanningr   ÚErrorsr   rv   r   r	   r
   r   Úos.pathrÞ   rŽ   rÆ   r   r   r/   ÚUtilityCodeBaser>   r¼   ÚAbstractUtilityCoderÐ   rú   r<   r   r   Ú<module>r     s€   ðÛ ß @Ý *Ý  Ý Ý Ý Ý ã Û 	Û 	ô;˜V×/Ñ/ô ;ô.Ð1ô ô&W'˜×,Ñ,ô W'ôtÐ$8ô ô0*˜d×6Ñ6ô 0*ôfQr   