%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.9/site-packages/passlib/utils/compat/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.9/site-packages/passlib/utils/compat/__pycache__/_ordered_dict.cpython-39.pyc

a

f�Wc� �@sHdZzddlmZWney2ddlmZYn0Gdd�de�ZdS)z�passlib.utils.compat._ordered_dict -- backport of collections.OrderedDict for py26

taken from stdlib-suggested recipe at http://code.activestate.com/recipes/576693/

this should be imported from passlib.utils.compat.OrderedDict, not here.
�)�	get_identc@s�eZdZdZdd�Zejfdd�Zejfdd�Zdd	�Zd
d�Z	dd
�Z
d0dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�ZeZe�Zefdd �Zd1d"d#�Zifd$d%�Zd&d'�Zd(d)�Zed2d*d+��Zd,d-�Zd.d/�Zd!S)3�OrderedDictz)Dictionary that remembers insertion ordercOspt|�dkrtdt|���z
|jWn4tyZg|_}||dg|dd�<i|_Yn0|j|i|��dS)z�Initialize an ordered dictionary.  Signature is the same as for
        regular dictionaries, but keyword arguments are not recommended
        because their insertion order is arbitrary.

        �z$expected at most 1 arguments, got %dN)�len�	TypeError�_OrderedDict__root�AttributeError�_OrderedDict__map�_OrderedDict__update)�self�args�kwds�root�r�F/usr/lib/python3.9/site-packages/passlib/utils/compat/_ordered_dict.py�__init__s

zOrderedDict.__init__cCsF||vr6|j}|d}|||g|d<|d<|j|<||||�dS)z!od.__setitem__(i, y) <==> od[i]=yrrN)rr	)r�key�valueZdict_setitemr�lastrrr�__setitem__)s
 zOrderedDict.__setitem__cCs0|||�|j�|�\}}}||d<||d<dS)z od.__delitem__(y) <==> del od[y]rrN)r	�pop)rrZdict_delitem�	link_prev�	link_nextrrr�__delitem__3s
zOrderedDict.__delitem__ccs.|j}|d}||ur*|dV|d}qdS)zod.__iter__() <==> iter(od)r�N�r�rrZcurrrrr�__iter__<s

zOrderedDict.__iter__ccs.|j}|d}||ur*|dV|d}qdS)z#od.__reversed__() <==> reversed(od)rrNrrrrr�__reversed__Ds

zOrderedDict.__reversed__cCsbz@|j��D]}|dd�=q|j}||dg|dd�<|j��WntyRYn0t�|�dS)z.od.clear() -> None.  Remove all items from od.N)r	�
itervaluesr�clearr�dict)rZnoderrrrr LszOrderedDict.clearTcCs||std��|j}|r8|d}|d}||d<||d<n |d}|d}||d<||d<|d}|j|=t�||�}||fS)z�od.popitem() -> (k, v), return and remove a (key, value) pair.
        Pairs are returned in LIFO order if last is true or FIFO order if false.

        zdictionary is emptyrrr)�KeyErrorrr	r!r)rrr�linkrrrrrrr�popitemXs 
zOrderedDict.popitemcCst|�S)zod.keys() -> list of keys in od)�list�rrrr�keysqszOrderedDict.keyscs�fdd��D�S)z#od.values() -> list of values in odcsg|]}�|�qSrr��.0rr&rr�
<listcomp>w�z&OrderedDict.values.<locals>.<listcomp>rr&rr&r�valuesuszOrderedDict.valuescs�fdd��D�S)z.od.items() -> list of (key, value) pairs in odcsg|]}|�|f�qSrrr(r&rrr*{r+z%OrderedDict.items.<locals>.<listcomp>rr&rr&r�itemsyszOrderedDict.itemscCst|�S)z0od.iterkeys() -> an iterator over the keys in od)�iterr&rrr�iterkeys}szOrderedDict.iterkeysccs|D]}||VqdS)z2od.itervalues -> an iterator over the values in odNr�r�krrrr�szOrderedDict.itervaluesccs|D]}|||fVqdS)z=od.iteritems -> an iterator over the (key, value) items in odNrr0rrr�	iteritems�szOrderedDict.iteritemscOs�t|�dkr tdt|�f��n|s,td��|d}d}t|�dkrL|d}t|t�rn|D]}||||<qZn<t|d�r�|��D]}||||<q�n|D]\}}|||<q�|��D]\}}|||<q�dS)	a�od.update(E, **F) -> None.  Update od from dict/iterable E and F.

        If E is a dict instance, does:           for k in E: od[k] = E[k]
        If E has a .keys() method, does:         for k in E.keys(): od[k] = E[k]
        Or if E is an iterable of items, does:   for k, v in E: od[k] = v
        In either case, this is followed by:     for k, v in F.items(): od[k] = v

        rz8update() takes at most 2 positional arguments (%d given)z,update() takes at least 1 argument (0 given)rrrr'N)rr�
isinstancer!�hasattrr'r-)rr
r�otherrrrrr�update�s(	�


zOrderedDict.updatecCs0||vr||}||=|S||jur,t|��|S)z�od.pop(k[,d]) -> v, remove specified key and return the corresponding value.
        If key is not found, d is returned if given, otherwise KeyError is raised.

        )�_OrderedDict__markerr")rr�default�resultrrrr�s
zOrderedDict.popNcCs||vr||S|||<|S)zDod.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in odr)rrr8rrr�
setdefault�szOrderedDict.setdefaultcCsft|�t�f}||vrdSd||<z6|s>d|jjfW||=Sd|jj|��fW||=S||=0dS)zod.__repr__() <==> repr(od)z...rz%s()z%s(%r)N)�id�
_get_ident�	__class__�__name__r-)rZ
_repr_runningZcall_keyrrr�__repr__�s��zOrderedDict.__repr__csX�fdd��D�}t����}tt��D]}|�|d�q(|rL�j|f|fS�j|ffS)z%Return state information for picklingcsg|]}|�|g�qSrr)r)r1r&rrr*�r+z*OrderedDict.__reduce__.<locals>.<listcomp>N)�vars�copyrrr=)rr-Z	inst_dictr1rr&r�
__reduce__�szOrderedDict.__reduce__cCs
|�|�S)z!od.copy() -> a shallow copy of od)r=r&rrrrA�szOrderedDict.copycCs|�}|D]}|||<q
|S)z�OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S
        and values equal to v (which defaults to None).

        r)�cls�iterabler�drrrr�fromkeys�s
zOrderedDict.fromkeyscCs6t|t�r*t|�t|�ko(|��|��kSt�||�S)z�od.__eq__(y) <==> od==y.  Comparison to another OD is order-sensitive
        while comparison to a regular mapping is order-insensitive.

        )r3rrr-r!�__eq__�rr5rrrrG�s
 zOrderedDict.__eq__cCs
||kS)NrrHrrr�__ne__�szOrderedDict.__ne__)T)N)N)r>�
__module__�__qualname__�__doc__rr!rrrrr r$r'r,r-r/rr2r6r
�objectr7rr:r?rBrA�classmethodrFrGrIrrrrr
s4
	




	rN)rL�threadrr<�ImportErrorZdummy_threadr!rrrrr�<module>s


Zerion Mini Shell 1.0