| Server IP : 209.205.66.10 / Your IP : 216.73.216.173 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ammon 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64 User : ( 1006) PHP Version : 8.5.8 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/pyrsistent/__pycache__/ |
Upload File : |
o
���a�/ � @ sr d dl mZmZ d dlmZmZ d dlmZ d dlm Z G dd� de
�Ze�e� e�e� d
d d
�Z
dd� ZdS )� )�Sequence�Hashable)�islice�chain)�Integral)�plistc s( e Zd ZdZdZd=� fdd� Zedd� �Zedd � �Ze d
d� �Z
dd
� Zdd� ZeZ
edd� �Zd>dd�Zd>dd�Ze dd� �Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� Ze d)d*� �Zd+d,� Zd-d.� Zd/d0� Zd1d2� Zd3d4� Zd5d6� Z e Z!d7d8� Z"d9d:� Z#d;d<� Z$e%j&Z&� Z'S )?�PDequea�
Persistent double ended queue (deque). Allows quick appends and pops in both ends. Implemented
using two persistent lists.
A maximum length can be specified to create a bounded queue.
Fully supports the Sequence and Hashable protocols including indexing and slicing but
if you need fast random access go for the PVector instead.
Do not instantiate directly, instead use the factory functions :py:func:`dq` or :py:func:`pdeque` to
create an instance.
Some examples:
>>> x = pdeque([1, 2, 3])
>>> x.left
1
>>> x.right
3
>>> x[0] == x.left
True
>>> x[-1] == x.right
True
>>> x.pop()
pdeque([1, 2])
>>> x.pop() == x[:-1]
True
>>> x.popleft()
pdeque([2, 3])
>>> x.append(4)
pdeque([1, 2, 3, 4])
>>> x.appendleft(4)
pdeque([4, 1, 2, 3])
>>> y = pdeque([1, 2, 3], maxlen=3)
>>> y.append(4)
pdeque([2, 3, 4], maxlen=3)
>>> y.appendleft(4)
pdeque([4, 1, 2], maxlen=3)
)�
_left_list�_right_list�_length�_maxlen�__weakref__Nc sV t t| ��| �}||_||_||_|d ur&t|t�std��|dk r&t d��||_
|S )Nz An integer is required as maxlenr zmaxlen must be non-negative)�superr �__new__r r
r �
isinstancer � TypeError�
ValueErrorr )�cls� left_list�
right_list�length�maxlen�instance�� __class__� �4/usr/lib/python3/dist-packages/pyrsistent/_pdeque.pyr 2 s
zPDeque.__new__c C � t �| j| j�S )z.
Rightmost element in dqueue.
)r �_tip_from_listsr
r ��selfr r r �rightB � zPDeque.rightc C r )z-
Leftmost element in dqueue.
)r r r r
r r r r �leftI r"