
    Vh                    $    d dl mZ d dlmZ ddZy)    )annotationswrapsNc                      fd}|S )ao  This decorator is a generic implementation that allows you
    to either use a pre-defined instance attribute as the location
    of the lock, or to explicitly pass a lock object.

    This code was implemented with ``threading.Lock`` in mind, but
    may work with other locks, assuming that they function as
    context managers.

    When using ``attr``, the assumption is the first argument to
    the wrapped method, is ``self`` or ``cls``.

    Examples:

        @lock_decorator(attr='_callback_lock')
        def send_callback(...):

        @lock_decorator(lock=threading.Lock())
        def some_method(...):
    c                4     t                fd       }|S )Nc                 l    t        | d         }n}|5   | i |cd d d        S # 1 sw Y   y xY w)Nr   )getattr)argskwargs_lockattrfunclocks      B/home/dcms/DCMS/lib/python3.12/site-packages/ansible/utils/lock.pyinnerz,lock_decorator.<locals>.outer.<locals>.inner   sD     |Q. -T,V,- - -s   *3r   )r   r   r   r   s   ` r   outerzlock_decorator.<locals>.outer   s     	t	- 
	-      )r   r   r   s   `` r   lock_decoratorr   	   s    ( Lr   )missing_lock_attrN)
__future__r   	functoolsr   r   r   r   r   <module>r      s    #  r   