Mini Shell

Direktori : /lib64/python3.6/site-packages/pyanaconda/__pycache__/
Upload File :
Current File : //lib64/python3.6/site-packages/pyanaconda/__pycache__/queuefactory.cpython-36.pyc

3

@��e�
�@s,ddlZddlmZmZGdd�de�ZdS)�N)�
lowerASCII�
upperASCIIc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�QueueFactorya�Constructs a new object wrapping a Queue.Queue, complete with constants
       and sending functions for each type of message that can be put into the
       queue.

       Creating a new object using this class is done like so:

           q = QueueFactory("progress")

       And then adding messages to it is done like so:

           q.addMessage("init", 0)
           q.addMessage("step", 1)

       The first call will create a new constant named PROGRESS_CODE_INIT and a
       method named send_init that takes zero arguments.  The second call will
       create a new constant named PROGRESS_CODE_STEP and a method named send_step
       that takes one argument.

       Reusing names within the same class is not allowed.
    cCs ||_d|_g|_tj�|_dS)Nr)�name�_QueueFactory__counter�_QueueFactory__names�queueZQueue�q)�selfr�r�$/usr/lib64/python3.6/queuefactory.py�__init__,szQueueFactory.__init__cs����fdd�}�|_|S)Ncs6t|��kr"td��t|�f���jj�|f�dS)Nz*%s() takes exactly %d arguments (%d given))�len�	TypeErrorr	Zput)�args)�argc�constant�
methodNamer
rrZ__method5sz*QueueFactory._makeMethod.<locals>.__method)�__name__)r
rrrZ_QueueFactory__methodr)rrrr
r�_makeMethod4szQueueFactory._makeMethodcCs�||jkrtd|j|f��t|j�dt|�}t|||j�|jd7_dt|�}|jt||�||�}t|||�|jj	|�dS)Nz'%s queue already has a message named %sZ_CODE_�Zsend_)
r�AttributeErrorrr�setattrrrr�getattr�append)r
rrZ
const_nameZmethod_name�methodrrr�
addMessage?s
zQueueFactory.addMessageN)r�
__module__�__qualname__�__doc__r
rrrrrrrsr)rZpyanaconda.core.utilrr�objectrrrrr�<module>s