ó
    ““,j  ã                   óÄ   • S r SSKrSSKrSSKJr  SSKJr  SS jrS r " S S	5      r	 " S
 S\	5      r
\	\R                  SS4S jr " S S5      r\4S jr " S S5      rg)zGeneral Server side utilitiesé    Né   )Úpolicy)ÚCOMExceptionc                 ó  • Uc  [         R                  nUS:X  a$  SSKnUR                  R                  R
                  nUb  US:X  a	  U" U 5      n OU" X 5      n [        R                  " U 5      n Ub  U R                  U5      n U $ )z¿Wraps an object in a PyGDispatch gateway.

Returns a client side PyI{iid} interface.

Interface and gateway support must exist for the specified IID, as
the QueryInterface() method is used.

Nr   r   )	r   ÚDefaultPolicyÚwin32com.server.dispatcherÚserverÚ
dispatcherÚDefaultDebugDispatcherÚ	pythoncomÚ
WrapObjectÚQueryInterface)ÚobÚiidÚ	usePolicyÚuseDispatcherÚwin32coms        Ú¢C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\win32com/server/util.pyÚwrapr   
   s�   € ð ÑÜ×(Ñ(ˆ	Ø˜ÓÛ)à Ÿ™×2Ñ2×IÑIˆØÑ °Ó 2Ù�r‹]‰á˜9Ó)ˆô 
×	Ò	˜bÓ	!€BØ
�Ø×Ñ˜sÓ#ˆØ€Ió    c                 ó€   • [         R                  " U 5      n [        U S5      (       a  U R                  n U R                  $ )zjUnwraps an interface.

Given an interface which wraps up a Gateway, return the object behind
the gateway.
r   )r   ÚUnwrapObjectÚhasattrr   Ú_obj_)r   s    r   Úunwrapr   %   s3   € ô 
×	Ò	 Ó	#€Bäˆr�8×ÑØ�Y‰YˆØ�8‰8€Or   c                   óf   • \ rS rSrSr/ SQrS\R                  4S jrS r	S r
S rS	 rS
 rS rSrg)ÚListEnumeratoré2   aV  A class to expose a Python sequence as an EnumVARIANT.

Create an instance of this class passing a sequence (list, tuple, or
any sequence protocol supporting object) and it will automatically
support the EnumVARIANT interface for the object.

See also the @NewEnum@ function, which can be used to turn the
instance into an actual COM server.
)ÚNextÚSkipÚResetÚCloner   c                 ó(   • Xl         X l        X0l        g ©N)Ú_list_ÚindexÚ_iid_)ÚselfÚdatar&   r   s       r   Ú__init__ÚListEnumerator.__init__?   s   € ØŒØŒ
Ø�
r   c                 ó$   • XR                   :X  a  gg )Nr   )r'   )r(   r   s     r   Ú_query_interface_Ú ListEnumerator._query_interface_D   s   € Ø—*‘*ÓØð r   c                 ót   • U R                   U R                  U R                  U-    nU R                  U5        U$ r$   )r%   r&   r    ©r(   ÚcountÚresults      r   r   ÚListEnumerator.NextH   s0   € Ø—‘˜TŸZ™Z¨$¯*©*°uÑ*<Ð=ˆØ�	‰	�%ÔØˆr   c                 óŠ   • U R                   U-   nU[        U R                  5      :”  a  [        U R                  5      nX l         g r$   )r&   Úlenr%   )r(   r1   Úends      r   r    ÚListEnumerator.SkipM   s4   € Ø�j‰j˜5Ñ ˆØ”�T—[‘[Ó!Ó!Ü�d—k‘kÓ"ˆCØ�
r   c                 ó   • SU l         g ©Nr   )r&   ©r(   s    r   r!   ÚListEnumerator.ResetS   s	   € Øˆ�
r   c                 ól   • U R                  U R                  U R                  U R                  5      5      $ r$   )Ú_wrapÚ	__class__r%   r&   r:   s    r   r"   ÚListEnumerator.CloneV   s$   € Ø�z‰z˜$Ÿ.™.¨¯©°d·j±jÓAÓBÐBr   c                 ó   • [        U5      $ r$   ©r   ©r(   r   s     r   r=   ÚListEnumerator._wrapY   ó   € Ü�B‹xˆr   )r'   r%   r&   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú_public_methods_r   ÚIID_IEnumVARIANTr*   r-   r   r    r!   r"   r=   Ú__static_attributes__© r   r   r   r   2   s>   † ñò :Ðà#$¨)×*DÑ*Dô ò
òò
òòCõr   r   c                   ó   • \ rS rSrSrS rSrg)ÚListEnumeratorGatewayé]   aR  A List Enumerator which wraps a sequence's items in gateways.

If a sequence contains items (objects) that have not been wrapped for
return through the COM layers, then a ListEnumeratorGateway can be
used to wrap those items before returning them (from the Next() method).

See also the @ListEnumerator@ class and the @NewEnum@ function.
c                 ó®   • U R                   U R                  U R                  U-    nU R                  U5        [        [	        U R
                  U5      5      $ r$   )r%   r&   r    ÚlistÚmapr=   r0   s      r   r   ÚListEnumeratorGateway.Nextg   sA   € Ø—‘˜TŸZ™Z¨$¯*©*°uÑ*<Ð=ˆØ�	‰	�%ÔÜ”C˜Ÿ
™
 FÓ+Ó,Ð,r   rM   N)rE   rF   rG   rH   rI   r   rL   rM   r   r   rO   rO   ]   s   † ñõ-r   rO   c                 ó"   • U" XS9n[        XRX4S9$ )a�  Creates a new enumerator COM server.

This function creates a new COM Server that implements the
IID_IEnumVARIANT interface.

A COM server that can enumerate the passed in sequence will be
created, then wrapped up for return through the COM framework.
Optionally, a custom COM server for enumeration can be passed
(the default is @ListEnumerator@), and the specific IEnum
interface can be specified.
)r   )r   r   rA   )ÚseqÚclsr   r   r   r   s         r   ÚNewEnumrX   m   s   € ñ$ 
ˆSÑ	€BÜ� 9ÑJÐJr   c                   óR   • \ rS rSrSr/ SQrSS jrS r\rS r	S r
S	 rS
 rS rSrg)Ú
Collectionéƒ   zA collection of VARIANT values.)ÚItemÚCountÚAddÚRemoveÚInsertNc                 ó<   • Uc  / nXl         U(       a
  SS/U l        g g )Nr\   r]   )r)   rJ   )r(   r)   ÚreadOnlys      r   r*   ÚCollection.__init__ˆ   s(   € Ø‰<ØˆDØŒ	ö Ø%+¨WÐ$5ˆDÕ!ð r   c                 óÚ   • [        U5      S:w  a  [        [        R                  S9e U R                  US      $ ! [
         a&  n[        [        R                  [        U5      S9eS nAff = f)Nr   ©Úscoder   ©rf   Údesc)r5   r   ÚwinerrorÚDISP_E_BADPARAMCOUNTr)   Ú
IndexErrorÚDISP_E_BADINDEXÚstr)r(   Úargsrh   s      r   r\   ÚCollection.Item–   s`   € Üˆt‹9˜‹>Ü¤X×%BÑ%BÑCÐCð	OØ—9‘9˜T !™WÑ%Ð%øÜó 	OÜ¤X×%=Ñ%=ÄCÈÃIÑNÐNûð	Oús   ¨: º
A*Á!A%Á%A*c                 ó,   • [        U R                  5      $ r$   )r5   r)   r:   s    r   r]   ÚCollection.Count¡   s   € Ü�4—9‘9‹~Ðr   c                 ó:   • U R                   R                  U5        g r$   )r)   Úappend)r(   Úvalues     r   r^   ÚCollection.Add¤   s   € Ø�	‰	×Ñ˜Õr   c                 ó†   •  U R                   U	 g ! [         a&  n[        [        R                  [        U5      S9eS nAff = f)Nrg   )r)   rk   r   ri   rl   rm   )r(   r&   rh   s      r   r_   ÚCollection.Remove§   s=   € ð	OØ—	‘	˜%Ñ øÜó 	OÜ¤X×%=Ñ%=ÄCÈÃIÑNÐNûð	Oús   ‚ �
A š!;»A c                 ó¨   •  [        U5      nU R                  R                  X5        g ! [        [        4 a    [        [        R
                  S9ef = f)Nre   )ÚintÚ
ValueErrorÚ	TypeErrorr   ri   ÚDISP_E_TYPEMISMATCHr)   Úinsert)r(   r&   rt   s      r   r`   ÚCollection.Insert­   sN   € ð	CÜ˜“JˆEð 	�	‰	×Ñ˜Õ&øô œIÐ&ó 	CÜ¤X×%AÑ%AÑBÐBð	Cús	   ‚) ©(Ac                 ó,   • [        U R                  5      $ r$   )rX   r)   r:   s    r   Ú_NewEnumÚCollection._NewEnum´   s   € Ü�t—y‘yÓ!Ð!r   )rJ   r)   r9   )rE   rF   rG   rH   rI   rJ   r*   r\   Ú_value_r]   r^   r_   r`   r€   rL   rM   r   r   rZ   rZ   ƒ   s7   † Ù%âCÐô6òOð €Gòò òOò'õ"r   rZ   c                 óž   • [         R                  " [        R                  " U" U 5      5      [         R                  [         R                  5      $ )a{  Creates a new COM collection object

This function creates a new COM Server that implements the
common collection protocols, including enumeration. (_NewEnum)

A COM server that can enumerate the passed in sequence will be
created, then wrapped up for return through the COM framework.
Optionally, a custom COM server for enumeration can be passed
(the default is @Collection@).
)r   r   r   r   ÚIID_IDispatch)rV   rW   s     r   ÚNewCollectionr…   ¸   s9   € ô ×ÒÜ×Ò™S ›XÓ&¬	×(?Ñ(?Ä×AXÑAXóð r   c                   ó`   • \ rS rSr/ SQr\R                  /rS rS r	S r
S rS rS rS	 rS
rg)Ú
FileStreaméÈ   )ÚReadÚWriter"   ÚCopyToÚSeekc                 ó   • Xl         g r$   ©Úfile)r(   r�   s     r   r*   ÚFileStream.__init__Ì   s   € Ø�	r   c                 ó8   • U R                   R                  U5      $ r$   )r�   Úread)r(   Úamounts     r   r‰   ÚFileStream.ReadÏ   s   € Ø�y‰y�~‰~˜fÓ%Ð%r   c                 óN   • U R                   R                  U5        [        U5      $ r$   )r�   Úwriter5   )r(   r)   s     r   rŠ   ÚFileStream.WriteÒ   s   € Ø�	‰	�‰˜ÔÜ�4‹yÐr   c                 óV   • U R                  U R                  U R                  5      5      $ r$   )r=   r>   r�   r:   s    r   r"   ÚFileStream.CloneÖ   s   € Ø�z‰z˜$Ÿ.™.¨¯©Ó3Ó4Ð4r   c                 óv   • U R                   R                  U5      n[        U5      nUR                  U5        XD4$ r$   )r�   r’   r5   rŠ   )r(   ÚdestÚcbr)   Úcbreads        r   r‹   ÚFileStream.CopyToÙ   s1   € Ø�y‰y�~‰~˜bÓ!ˆÜ�T“ˆØ�
‰
�4ÔØˆ~Ðr   c                 ól   • U R                   R                  X5        U R                   R                  5       $ r$   )r�   ÚseekÚtell)r(   ÚoffsetÚorigins      r   rŒ   ÚFileStream.Seekß   s#   € à�	‰	�‰�vÔ&Ø�y‰y�~‰~ÓÐr   c                 ó   • [        U5      $ r$   rA   rB   s     r   r=   ÚFileStream._wrapä   rD   r   rŽ   N)rE   rF   rG   rH   rJ   r   ÚIID_IStreamÚ_com_interfaces_r*   r‰   rŠ   r"   r‹   rŒ   r=   rL   rM   r   r   r‡   r‡   È   s:   † ÚCÐØ!×-Ñ-Ð.Ðòò&òò5òò õ
r   r‡   )NNN)rI   r   ri   Ú r   Ú	exceptionr   r   r   r   rO   rK   rX   rZ   r…   r‡   rM   r   r   Ú<module>r«      sn   ðÙ #ã Û å Ý #ôò6
÷(ñ (ôV-˜Nô -ð$ 	Ø×"Ñ"ØØôK÷,2"ñ 2"ðj &ô ÷ ò r   