Viewing File: /opt/imunify360/venv/lib/python3.11/site-packages/pyrsistent/__pycache__/_plist.cpython-311.pyc



]je @ddlmZmZddlmZddlmZGddeZGddeZ	Gdd	e	Z
eje
eje
Gd
de	ZejeejeeZ
ddZdZdS))SequenceHashable)Integral)reducec4eZdZdZdZdZdZdZdZdZ	dS)	
_PListBuilderzc
    Helper class to allow construction of a list without
    having to reverse it in the end.
    )_head_tailc6t|_t|_dSN)_EMPTY_PLISTr	r
selfs q/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib/python3.11/site-packages/pyrsistent/_plist.py__init__z_PListBuilder.__init__
s!
!


c|js|||_|j|_n&|||j_|jj|_|jSr)r
r	rest)relemconstructors   r_appendz_PListBuilder._appendsNz	)$T**DJDJJ)k$//DJODJzrc0||dS)Nc,t|tSr)PListr
)es r<lambda>z+_PListBuilder.append_elem.<locals>.<lambda>sE!\,B,Brrrrs  rappend_elemz_PListBuilder.append_elems||D"B"BCCCrc0||dS)Nc|Sr)ls rrz,_PListBuilder.append_plist.<locals>.<lambda>s!rr)rpls  rappend_plistz_PListBuilder.append_plists||B,,,rc|jSr)r	rs rbuildz_PListBuilder.build!s
zrN)
__name__
__module____qualname____doc__	__slots__rrrr%r'r"rrrrss#I"""DDD---rrceZdZdZejZejZdZdZdZ	e	Z
dZdZdZ
e
ZdZd	Zd
ZdZdZd
ZdZdZdS)
_PListBase)__weakref__c0tt|ffSr)plistlistrs r
__reduce__z_PListBase.__reduce__.stDzzm##rc4td|DS)a
        Return the length of the list, computed by traversing it.

        This is obviously O(n) but with the current implementation
        where a list is also a node the overhead of storing the length
        in every node would be quite significant.
        c3K|]}dVdS)Nr").0_s  r	<genexpr>z%_PListBase.__len__.<locals>.<genexpr>:s"##1######r)sumrs r__len__z_PListBase.__len__2s!##d######rcFdt|S)Nz
plist({0}))formatr2rs r__repr__z_PListBase.__repr__<s""4::...rc"t||S)z
        Return a new list with elem inserted as new head.

        >>> plist([1, 2]).cons(3)
        plist([3, 1, 2])
        )rrs  rconsz_PListBase.cons@sT4   rc>|}|D]}||}|S)a 
        Return a new list with all elements of iterable repeatedly cons:ed to the current list.
        NB! The elements will be inserted in the reverse order of the iterable.
        Runs in O(len(iterable)).

        >>> plist([1, 2]).mcons([3, 4])
        plist([4, 3, 1, 2])
        r@)riterableheadrs    rmconsz_PListBase.mconsIs.	#	#D99T??DDrcpt}|}|r#||j}|j}|#|S)a
        Return a reversed version of list. Runs in O(n) where n is the length of the list.

        >>> plist([1, 2, 3]).reverse()
        plist([3, 2, 1])

        Also supports the standard reversed function.

        >>> reversed(plist([1, 2, 3]))
        plist([3, 2, 1])
        )r1r@firstr)rresultrDs   rreversez_PListBase.reverseXsE	[[,,F9D	
rct}|}d}|r4||kr.||j|j}|dz
}|r||k.|s	|tfS||fS)z
        Spilt the list at position specified by index. Returns a tuple containing the
        list up until index and the list after the index. Runs in O(index).

        >>> plist([1, 2, 3, 4]).split(2)
        (plist([1, 2]), plist([3, 4]))
        rr6)rrrGrr
r')rindexlb
right_listis     rsplitz_PListBase.splitms__

	QYYNN:+,,,#J
FA	QYY
	&%%xxzz:%%rc#:K|}|r|jV|j}|dSdSrrGr)rlis  r__iter__z_PListBase.__iter__sC
	(NNNB					rczt|tstSt|t|kSr)
isinstancer.NotImplementedtuple)rothers  r__lt__z_PListBase.__lt__s1%,,	"!!T{{U5\\))rct|tstS|}|}|r&|r$|j|jksdS|j}|j}|r|$|o|S)z
        Traverses the lists, checking equality of elements.

        This is an O(n) operation, but preserves the standard semantics of list equality.
        F)rUr.rVrGr)rrX	self_head
other_heads    r__eq__z_PListBase.__eq__sz%,,	"!!	
	)J	)?j&666u!I#J		)J	)}/Z/rct|tr\|j3|j,|j|jdkr||jSt
t||St|ts$tdt|jz|dkr|t|z
}	||j
S#t$r}td|d}~wwxYw)Nr6z-'%s' object cannot be interpreted as an indexrPList index out of range)rUslicestartstopstep_dropr1rWr	TypeErrortyper(lenrGAttributeError
IndexError)rrKrs   r__getitem__z_PListBase.__getitem__seU##	-{&5:+=5:CUY^YcghYhYhzz%+...tU+,,,%**	dKdSXkkNbbccc199SYYE	@::e$$**	@	@	@788a?	@sC
C=(C88C=cd|dkrtd|}|dkr|j}|dz}|dk|S)Nrr_r6)rir)rcountrDs   rrdz_PListBase._dropsJ1997888aii9DQJEaiirc:tt|Sr)hashrWrs r__hash__z_PListBase.__hash__sE$KK   rct}|}|rH|j|kr||jS||j|j}|Htd|)a

        Return new list with first element equal to elem removed. O(k) where k is the position
        of the element that is removed.

        Raises ValueError if no matching element is found.

        >>> plist([1, 2, 1]).remove(1)
        plist([2, 1])
        z{0} not found in PList)rrGr%rr
ValueErrorr=)rrbuilderrDs    rremovez_PListBase.removes //	zT!!++DI666
+++9D	188>>???rN)r(r)r*r,rrlrKr3r;r>__str__r@rErI__reversed__rOrSrYr]rjrdrorsr"rrr.r.%s I

NENE$$$$$$///G!!!


&L&&&,***000&@@@.			!!!@@@@@rr.c0eZdZdZdZfdZdZeZxZS)ra
    Classical Lisp style singly linked list. Adding elements to the head using cons is O(1).
    Element access is O(k) where k is the position of the element in the list. Taking the
    length of the list is O(n).

    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:`l` or :py:func:`plist` to
    create an instance.

    Some examples:

    >>> x = plist([1, 2])
    >>> y = x.cons(3)
    >>> x
    plist([1, 2])
    >>> y
    plist([3, 1, 2])
    >>> y.first
    3
    >>> y.rest == x
    True
    >>> y[:2]
    plist([3, 1])
    rQcttt||}||_||_|Sr)superr__new__rGr)clsrGrinstance	__class__s    rryz
PList.__new__s3$$,,S11
rcdS)NTr"rs r__bool__zPList.__bool__str)	r(r)r*r+r,ryr~__nonzero__
__classcell__)r|s@rrrsQ4"IKKKKKrrcHeZdZdZdZeZedZedZdS)_EmptyPListr"cdS)NFr"rs rr~z_EmptyPList.__bool__
surc td)NzEmpty PList has no first)rhrs rrGz_EmptyPList.firsts7888rc|Srr"rs rrz_EmptyPList.restsrN)	r(r)r*r,r~rpropertyrGrr"rrrr
saIK
99X9Xrrr"Fcz|s#t|}|td|tS)a 
    Creates a new persistent list containing all elements of iterable.
    Optional parameter reverse specifies if the elements should be inserted in
    reverse order or not.

    >>> plist([1, 2, 3])
    plist([1, 2, 3])
    >>> plist([1, 2, 3], reverse=True)
    plist([3, 2, 1])
    c,||SrrB)r$rs  rrzplist.<locals>.<lambda>/s2774==r)r2rIrr
)rCrIs  rr1r1 s?>>00(LIIIrc t|S)zj
    Creates a new persistent list containing all arguments.

    >>> l(1, 2, 3)
    plist([1, 2, 3])
    )r1)elementss rr#r#2s??rN)r"F)collections.abcrrnumbersr	functoolsrobjectrr.rregisterrr
r1r#r"rr<module>rs........F>v@v@v@v@v@v@v@v@r%%%%%J%%%P%%




*


 ++{}}JJJJ$r
Back to Directory File Manager