
    	h                         S r SSKrSSKrSSKrSSKJrJr  SSKJrJr  SSK	J
r
  SSKJr   " S S\R                  5      rS	 r\S
:X  a  \" 5         gg)a=  Python.Dictionary COM Server.

This module implements a simple COM server that acts much like a Python
dictionary or as a standard string-keyed VB Collection.  The keys of
the dictionary are strings and are case-insensitive.

It uses a highly customized policy to fine-tune the behavior exposed to
the COM client.

The object exposes the following properties:

    int Count                       (readonly)
    VARIANT Item(BSTR key)          (propget for Item)
    Item(BSTR key, VARIANT value)   (propput for Item)

    Note that 'Item' is the default property, so the following forms of
    VB code are acceptable:

        set ob = CreateObject("Python.Dictionary")
        ob("hello") = "there"
        ob.Item("hi") = ob("HELLO")

All keys are defined, returning VT_NULL (None) if a value has not been
stored.  To delete a key, simply assign VT_NULL to the key.

The object responds to the _NewEnum method by returning an enumerator over
the dictionary's keys. This allows for the following type of VB code:

    for each name in ob
        debug.print(name, ob(name))
    next
    N)DISPATCH_METHODDISPATCH_PROPERTYGET)policyutil)COMException)S_OKc                   x    \ rS rSr/ r\R                  \R                  SS.rSr	Sr
SrSrSrS	 rS
 rS rS rSrg)DictionaryPolicy+      )item_newenumcountzPython Dictionaryz&{39b61048-c755-11d0-86fa-00c04fc2e03e}zPython.DictionaryzPython.Dictionary.1z,win32com.servers.dictionary.DictionaryPolicyc                 P    U R                  0 5        [        R                  " X5      $ N)_wrap_	pythoncom
WrapObject)selfclsidreqIIDs      nC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\win32com/servers/dictionary.py_CreateInstance_!DictionaryPolicy._CreateInstance_=   s    B##D11    c                     Xl         g r   _obj_)r   obs     r   r   DictionaryPolicy._wrap_A   s    
r   c                    US:X  Ga  [        U5      nUS:  a  [        S[        R                  S9eUS   n[	        U[
        5      (       d  [        S[        R                  S9eUR                  5       nU[        [        -  -  (       a8  US:  a  [        [        R                  S9eU R                  R                  U5      $ US:w  a  [        [        R                  S9eUS   c   U R                  U	 [        $ US   U R                  U'   [        $ US:X  a`  U[        -  (       d  [        [        R                  S9e[        U5      S:w  a  [        [        R                  S9e[        U R                  5      $ U[        R                   :X  a)  ["        R$                  " ['        U R                  5      5      $ [        [        R                  S9e! [         a     [        $ f = f)Nr   r   znot enough parameters)descscodezKey must be a string)r#      )lenr   winerrorDISP_E_BADPARAMCOUNT
isinstancestrDISP_E_TYPEMISMATCHlowerr   r   r   getKeyErrorr   DISP_E_MEMBERNOTFOUNDr   DISPID_NEWENUMr   NewEnumlist)	r   dispidlcidwFlagsargskwargsserviceProviderlkeys	            r   
_invokeex_DictionaryPolicy._invokeex_D   s   Q;D	A1u"08U8U  q'Cc3''"/x7S7S  ))+C+??@q5&X-J-JKKzz~~c**Av")F)FGGAw

3
 K #'q'

3KQ;00")G)GHH4yA~")F)FGGtzz?"Y---<<TZZ 011!?!?@@!    K	s   $G	 	
GGc                     US   R                  5       n U R                  U   4$ ! [         a    [        [        R
                  SS9ef = f)Nr   zMember not found)r#   r"   )r+   _name_to_dispid_r-   r   r&   r.   )r   namesr3   names       r   _getidsofnames_ DictionaryPolicy._getidsofnames_r   sU     Qx~~	))$/11 	44;M 	s	   % #Ar   N)__name__
__module____qualname____firstlineno___com_interfaces_r   DISPID_VALUEr/   r=   
_reg_desc__reg_clsid__reg_progid__reg_verprogid__reg_policy_spec_r   r   r:   r@   __static_attributes__ r   r   r
   r
   +   sY     &&,, %J:K&L+OF2,A\	r   r
   c                  &    SSK Jn   U " [        5      $ )Nr   UseCommandLine)win32com.server.registerrQ   r
   rP   s    r   RegisterrS   ~   s    7*++r   __main__)__doc__r   
pywintypesr&   r   r   win32com.serverr   r   win32com.server.exceptionr   r   BasicWrapPolicyr
   rS   rB   rN   r   r   <module>rZ      sP   B    ; ( 2 Pv-- Pf, zJ r   