File: //lib64/python3.6/site-packages/zmq/__pycache__/decorators.cpython-36.pyc
3
VS�_z � @ sl d Z dZddlmZ ddlZddlmZ G dd� de�ZG d d
� d
e�Z G dd� de�Z
d
d� Zdd� ZdS )ai Decorators for running functions with context/sockets.
.. versionadded:: 15.3
Like using Contexts and Sockets as context managers, but with decorator syntax.
Context and sockets are closed at the end of the function.
For example::
from zmq.decorators import context, socket
@context()
@socket(zmq.PUSH)
def work(ctx, push):
...
�context�socket� )�wrapsN)�
basestringc @ s2 e Zd ZdZddd�Zdd� Zdd� Zd d
� ZdS )�
_DecoratorzThe mini decorator factoryNc C s
|| _ d S )N)�_target)�self�target� r
�"/usr/lib64/python3.6/decorators.py�__init__# s z_Decorator.__init__c s( �j � ��\�� �� ���fdd�}|S )a�
The main logic of decorator
Here is how those arguments works::
@out_decorator(*dec_args, *dec_kwargs)
def func(*wrap_args, **wrap_kwargs):
...
And in the ``wrapper``, we simply create ``self.target`` instance via
``with``::
target = self.get_target(*args, **kwargs)
with target(*dec_args, **dec_kwargs) as obj:
...
c s t � ���� ��fdd��}|S )Nc sl �j | |�}|� ���L}�r.�|kr.||�<