관리-도구
편집 파일: lock.cpython-39.opt-1.pyc
a �)gn � @ s2 d dl mZmZmZ eZd dlmZ ddd�ZdS )� )�absolute_import�division�print_function��wraps�missing_lock_attrNc s � �fdd�}|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 s t � ��� �fdd��}|S )Nc sR �d u rt | d � �}n�}|� �| i |��W d � S 1 sD0 Y d S )Nr )�getattr)�args�kwargs�_lock)�attr�func�lock� �6/usr/lib/python3.9/site-packages/ansible/utils/lock.py�inner s z,lock_decorator.<locals>.outer.<locals>.innerr )r r �r r )r r �outer s zlock_decorator.<locals>.outerr )r r r r r r �lock_decorator s r )r N) Z __future__r r r �typeZ __metaclass__� functoolsr r r r r r �<module> s