o nnh@s&ddlmZddlmZdddZdS)) annotationswrapsmissing_lock_attrNcsfdd}|S)aoThis 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(...): cstfdd}|S)NcsRdur t|d}n}||i|WdS1s"wYdS)Nr)getattr)argskwargs_lock)attrfunclock=/usr/local/lib/python3.10/dist-packages/ansible/utils/lock.pyinners  $z,lock_decorator..outer..innerr)r rr r )r routers zlock_decorator..outerr )r r rr rrlock_decorator s r)rN) __future__r functoolsrrr r r rs