Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib/python3.5/site-packages/aioredis/commands/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib/python3.5/site-packages/aioredis/commands/__pycache__/list.cpython-35.pyc



�(Z��@s-ddlmZmZGdd�d�ZdS)�)�_NOTSET�wait_okc@s!eZdZdZdddedd�Zdddedd�Zded	d
�Zdedd�Zd
dd�Z	dd�Z
dedd�Zdd�Zdd�Z
dedd�Zdd�Zdd�Zdd�Zded d!�Zded"d#�Zd$d%�Zd&d'�Zd(S))�ListCommandsMixinzVList commands mixin.

    For commands details see: http://redis.io/commands#list
    �timeoutr�encodingcGsYt|t�std��|dkr3td��||f}|jd||d|�S)z�Remove and get the first element in a list, or block until
        one is available.

        :raises TypeError: if timeout is not int
        :raises ValueError: if timeout is less then 0
        ztimeout argument must be intrztimeout must be greater equal 0sBLPOPr)�
isinstance�int�	TypeError�
ValueError�execute)�self�keyrr�keys�args�r�G/opt/alt/python35/lib/python3.5/site-packages/aioredis/commands/list.py�blpop
s
zListCommandsMixin.blpopcGsYt|t�std��|dkr3td��||f}|jd||d|�S)z�Remove and get the last element in a list, or block until one
        is available.

        :raises TypeError: if timeout is not int
        :raises ValueError: if timeout is less then 0
        ztimeout argument must be intrztimeout must be greater equal 0sBRPOPr)rrr	r
r)rr
rrrrrrr�brpops
zListCommandsMixin.brpopcCsOt|t�std��|dkr3td��|jd|||d|�S)z�Remove and get the last element in a list, or block until one
        is available.

        :raises TypeError: if timeout is not int
        :raises ValueError: if timeout is less then 0
        ztimeout argument must be intrztimeout must be greater equal 0s
BRPOPLPUSHr)rrr	r
r)r�	sourcekey�destkeyrrrrr�
brpoplpush&szListCommandsMixin.brpoplpushcCs4t|t�std��|jd||d|�S)zaGet an element from a list by its index.

        :raises TypeError: if index is not int
        zindex argument must be intsLINDEXr)rrr	r)rr
�indexrrrr�lindex4szListCommandsMixin.lindexFcCs+|sdnd}|jd||||�S)zjInserts value in the list stored at key either before or
        after the reference value pivot.
        sAFTERsBEFOREsLINSERT)r)rr
Zpivot�value�before�whererrr�linsert=szListCommandsMixin.linsertcCs|jd|�S)z-Returns the length of the list stored at key.sLLEN)r)rr
rrr�llenDszListCommandsMixin.llencCs|jd|d|�S)z@Removes and returns the first element of the list stored at key.sLPOPr)r)rr
rrrr�lpopHszListCommandsMixin.lpopcGs|jd|||�S)zWInsert all the specified values at the head of the list
        stored at key.
        sLPUSH)r)rr
r�valuesrrr�lpushLszListCommandsMixin.lpushcCs|jd||�S)zrInserts value at the head of the list stored at key, only if key
        already exists and holds a list.
        sLPUSHX)r)rr
rrrr�lpushxRszListCommandsMixin.lpushxcCsRt|t�std��t|t�s6td��|jd|||d|�S)zzReturns the specified elements of the list stored at key.

        :raises TypeError: if start or stop is not int
        zstart argument must be intzstop argument must be intsLRANGEr)rrr	r)rr
�start�stoprrrr�lrangeXs
zListCommandsMixin.lrangecCs1t|t�std��|jd|||�S)z�Removes the first count occurrences of elements equal to value
        from the list stored at key.

        :raises TypeError: if count is not int
        zcount argument must be intsLREM)rrr	r)rr
�countrrrr�lremcszListCommandsMixin.lremcCs1t|t�std��|jd|||�S)zaSets the list element at index to value.

        :raises TypeError: if index is not int
        zindex argument must be intsLSET)rrr	r)rr
rrrrr�lsetmszListCommandsMixin.lsetcCsXt|t�std��t|t�s6td��|jd|||�}t|�S)z�Trim an existing list so that it will contain only the specified
        range of elements specified.

        :raises TypeError: if start or stop is not int
        zstart argument must be intzstop argument must be intsLTRIM)rrr	rr)rr
r"r#Zfutrrr�ltrimvszListCommandsMixin.ltrimcCs|jd|d|�S)z?Removes and returns the last element of the list stored at key.sRPOPr)r)rr
rrrr�rpop�szListCommandsMixin.rpopcCs|jd||d|�S)z�Atomically returns and removes the last element (tail) of the
        list stored at source, and pushes the element at the first element
        (head) of the list stored at destination.
        s	RPOPLPUSHr)r)rrrrrrr�	rpoplpush�szListCommandsMixin.rpoplpushcGs|jd|||�S)zWInsert all the specified values at the tail of the list
        stored at key.
        sRPUSH)r)rr
rrrrr�rpush�szListCommandsMixin.rpushcCs|jd||�S)zrInserts value at the tail of the list stored at key, only if
        key already exists and holds a list.
        sRPUSHX)r)rr
rrrr�rpushx�szListCommandsMixin.rpushxN)�__name__�
__module__�__qualname__�__doc__rrrrrrrrr r!r$r&r'r(r)r*r+r,rrrrrs$	
	
rN)Z
aioredis.utilrrrrrrr�<module>s