
    XaJj&                     :    d Z dZddlmZ  G d d      Z e       Zy)a:  
A number of Cocoa API's have a 'context' argument that is a plain 'void*'
in ObjC, and an Integer value in Python.  The 'context' object defined here
allows you to get a unique integer number that can be used as the context
argument for any Python object, and retrieve that object later on using the
context number.

Usage::

    ...
    ctx = objc.context.register(myContext)
    someObject.observeValueForKeyPath_ofObject_change_context_(
        kp, obj, {}, ctx)
    ...

and in the callback::

    def observeValueForKeyPath_ofObject_change_context_(self,
        kp, obj, change, ctx):

        myContext = objc.context.get(ctx)
        ...

Use ``objc.context.unregister`` to remove the registration of ``myObject``
when you're done. The argument to unregister is the same object as was
passed in during registration.
)context    )Anyc                   :    e Zd Zd ZdedefdZdefdZdefdZy)ContextRegistryc                     i | _         y N	_registry)selfs    W/Users/ahmed/devFolder/claude-voice/.venv/lib/python3.12/site-packages/objc/_context.py__init__zContextRegistry.__init__"   s	        valuereturnc                 :    t        |      }|| j                  |<   |S r   )idr
   )r   r   uniqs      r   registerzContextRegistry.register%   s    %y$tr   c                 P    	 | j                   t        |      = y # t        $ r Y y w xY wr   )r
   r   KeyError)r   r   s     r   
unregisterzContextRegistry.unregister*   s)    	r%y) 		s    	%%c                      | j                   |   S r   r	   )r   r   s     r   getzContextRegistry.get0   s    ~~d##r   N)	__name__
__module____qualname__r   r   intr   r   r    r   r   r   r   !   s2    c c 
 $3 $r   r   N)__doc____all__typingr   r   r   r   r   r   <module>r"      s(   8  $ $& 
r   