|
Server : Apache System : Linux server.mata-lashes.com 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 User : matalashes ( 1004) PHP Version : 8.1.29 Disable Function : NONE Directory : /usr/local/lib64/python3.6/site-packages/pyrsistent/__pycache__/ |
Upload File : |
3
G�KdJ � @ s� d dl mZmZmZmZ d dlmZ d dlmZ dd� Z G dd� de
�Zeje� eje� eje� eje� dd � Z
d
d� Zee� �ZdS )
� )� Container�Iterable�Sized�Hashable)�reduce)�pmapc C s | j || j|d�d �S )Nr � )�set�get)Zcounters�element� r �6/tmp/pip-build-8nxjc3nm/pyrsistent/pyrsistent/_pbag.py�_add_to_counters s r c @ s� e Zd ZdZd%Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
dd� Zdd� Zdd� Z
dd� Zdd� ZeZeZeZdd� Zdd� Zdd� Zd d!� Zd"d#� Zd$S )&�PBaga�
A persistent bag/multiset type.
Requires elements to be hashable, and allows duplicates, but has no
ordering. Bags are hashable.
Do not instantiate directly, instead use the factory functions :py:func:`b`
or :py:func:`pbag` to create an instance.
Some examples:
>>> s = pbag([1, 2, 3, 1])
>>> s2 = s.add(4)
>>> s3 = s2.remove(1)
>>> s
pbag([1, 1, 2, 3])
>>> s2
pbag([1, 1, 2, 3, 4])
>>> s3
pbag([1, 2, 3, 4])
�_counts�__weakref__c C s
|| _ d S )N)r )�self�countsr r r
�__init__# s z
PBag.__init__c C s t t| j|��S )z�
Add an element to the bag.
>>> s = pbag([1])
>>> s2 = s.add(1)
>>> s3 = s.add(2)
>>> s2
pbag([1, 1])
>>> s3
pbag([1, 2])
)r r r )r r r r r
�add&