404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.139.80.218: ~ $
3

d�GZ�_�
@s�dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZmZdZ
dZyddlmZmZWn(ek
r�ddlmZmZeZYnXdZdZd	Zd
Ze	jd0kr�eefZGdd
�d
e�ZGdd�de�ZGdd�de�ZGdd�dee �Z!dd�Z"ej#ej$e"d�Z%d1dd�Z&dd�Z'Gdd�de(�Z)Gdd�de(�Z*Gd d!�d!e*�Z+Gd"d#�d#e*�Z,Gd$d%�d%e*�Z-Gd&d'�d'e*�Z.Gd(d)�d)e*�Z/Gd*d+�d+e*�Z0Gd,d-�d-e(�Z1d.d/�Z2dS)2z Apply JSON-Patches (RFC 6902) �)�unicode_literalsN)�JsonPointer�JsonPointerException�)�MutableMapping�MutableSequenceu Stefan Kögl <stefan@skoegl.net>z1.21z0https://github.com/stefankoegl/python-json-patchzModified BSD License�c@seZdZdZdS)�JsonPatchExceptionzBase Json Patch exceptionN)�__name__�
__module__�__qualname__�__doc__�rr�/usr/lib/python3.6/jsonpatch.pyr	Gsr	c@seZdZdZdS)�InvalidJsonPatchz, Raised if an invalid JSON Patch is created N)r
rrr
rrrrrKsrc@seZdZdZdS)�JsonPatchConflictaRaised if patch could not be applied due to conflict situation such as:
    - attempt to add object key then it already exists;
    - attempt to operate with nonexistence object key;
    - attempt to insert value to array at position beyond of it size;
    - etc.
    N)r
rrr
rrrrrOsrc@seZdZdZdS)�JsonPatchTestFailedz A Test operation failed N)r
rrr
rrrrrXsrcCs@tjt�}x|D]\}}||j|�qWtdd�|j�D��S)z'Convert duplicate keys values to lists.css.|]&\}}|t|�dkr |dn|fVqdS)rrN)�len)�.0�key�valuesrrr�	<genexpr>eszmultidict.<locals>.<genexpr>)�collections�defaultdict�list�append�dict�items)Z
ordered_pairsZmdictr�valuerrr�	multidict\s
r)Zobject_pairs_hookFcCs*t|t�rtj|�}nt|�}|j||�S)aOApply list of patches to specified json document.

    :param doc: Document object.
    :type doc: dict

    :param patch: JSON patch as list of dicts or raw JSON-encoded string.
    :type patch: list or str

    :param in_place: While :const:`True` patch will modify target document.
                     By default patch will be applied to document copy.
    :type in_place: bool

    :return: Patched document object.
    :rtype: dict

    >>> doc = {'foo': 'bar'}
    >>> patch = [{'op': 'add', 'path': '/baz', 'value': 'qux'}]
    >>> other = apply_patch(doc, patch)
    >>> doc is not other
    True
    >>> other == {'foo': 'bar', 'baz': 'qux'}
    True
    >>> patch = [{'op': 'add', 'path': '/baz', 'value': 'qux'}]
    >>> apply_patch(doc, patch, in_place=True) == {'foo': 'bar', 'baz': 'qux'}
    True
    >>> doc == other
    True
    )�
isinstance�
basestring�	JsonPatch�from_string�apply)�doc�patch�in_placerrr�apply_patchos
r(cCstj||�S)a�Generates patch by comparing of two document objects. Actually is
    a proxy to :meth:`JsonPatch.from_diff` method.

    :param src: Data source document object.
    :type src: dict

    :param dst: Data source document object.
    :type dst: dict

    >>> src = {'foo': 'bar', 'numbers': [1, 3, 4, 8]}
    >>> dst = {'baz': 'qux', 'numbers': [1, 4, 7]}
    >>> patch = make_patch(src, dst)
    >>> new = patch.apply(src)
    >>> new == dst
    True
    )r"�	from_diff)�src�dstrrr�
make_patch�sr,c@s�eZdZdZdd�Zdd�Zdd�ZeZdd	�Zd
d�Z	dd
�Z
dd�Zedd��Z
eddd��Zdd�Zedd��Zd dd�Zdd�ZdS)!r"agA JSON Patch is a list of Patch Operations.

    >>> patch = JsonPatch([
    ...     {'op': 'add', 'path': '/foo', 'value': 'bar'},
    ...     {'op': 'add', 'path': '/baz', 'value': [1, 2, 3]},
    ...     {'op': 'remove', 'path': '/baz/1'},
    ...     {'op': 'test', 'path': '/baz', 'value': [1, 3]},
    ...     {'op': 'replace', 'path': '/baz/0', 'value': 42},
    ...     {'op': 'remove', 'path': '/baz/1'},
    ... ])
    >>> doc = {}
    >>> result = patch.apply(doc)
    >>> expected = {'foo': 'bar', 'baz': [42]}
    >>> result == expected
    True

    JsonPatch object is iterable, so you could easily access to each patch
    statement in loop:

    >>> lpatch = list(patch)
    >>> expected = {'op': 'add', 'path': '/foo', 'value': 'bar'}
    >>> lpatch[0] == expected
    True
    >>> lpatch == patch.patch
    True

    Also JsonPatch could be converted directly to :class:`bool` if it contains
    any operation statements:

    >>> bool(patch)
    True
    >>> bool(JsonPatch([]))
    False

    This behavior is very handy with :func:`make_patch` to write more readable
    code:

    >>> old = {'foo': 'bar', 'numbers': [1, 3, 4, 8]}
    >>> new = {'baz': 'qux', 'numbers': [1, 4, 7]}
    >>> patch = make_patch(old, new)
    >>> if patch:
    ...     # document have changed, do something useful
    ...     patch.apply(old)    #doctest: +ELLIPSIS
    {...}
    cCs||_ttttttd�|_dS)N)�remove�add�replace�moveZtest�copy)r&�RemoveOperation�AddOperation�ReplaceOperation�
MoveOperation�
TestOperation�
CopyOperation�
operations)�selfr&rrr�__init__�szJsonPatch.__init__cCs|j�S)zstr(self) -> self.to_string())�	to_string)r9rrr�__str__�szJsonPatch.__str__cCs
t|j�S)N)�boolr&)r9rrr�__bool__�szJsonPatch.__bool__cCs
t|j�S)N)�iterr&)r9rrr�__iter__�szJsonPatch.__iter__cCstt|j��S)N)�hash�tuple�_ops)r9rrr�__hash__�szJsonPatch.__hash__cCst|t�sdS|j|jkS)NF)r r"rC)r9�otherrrr�__eq__�s
zJsonPatch.__eq__cCs
||kS)Nr)r9rErrr�__ne__�szJsonPatch.__ne__cCst|�}||�S)z�Creates JsonPatch instance from string source.

        :param patch_str: JSON patch as raw string.
        :type patch_str: str

        :return: :class:`JsonPatch` instance.
        )�
_jsonloads)�clsZ	patch_strr&rrrr#�s	zJsonPatch.from_stringTcCs*t�}|jdd||�t|j��}||�S)aOCreates JsonPatch instance based on comparing of two document
        objects. Json patch would be created for `src` argument against `dst`
        one.

        :param src: Data source document object.
        :type src: dict

        :param dst: Data source document object.
        :type dst: dict

        :return: :class:`JsonPatch` instance.

        >>> src = {'foo': 'bar', 'numbers': [1, 3, 4, 8]}
        >>> dst = {'baz': 'qux', 'numbers': [1, 4, 7]}
        >>> patch = JsonPatch.from_diff(src, dst)
        >>> new = patch.apply(src)
        >>> new == dst
        True
        �N)�DiffBuilder�_compare_valuesr�execute)rIr*r+�optimizationZbuilderZopsrrrr)szJsonPatch.from_diffcCstj|j�S)z!Returns patch set as JSON string.)�json�dumpsr&)r9rrrr;!szJsonPatch.to_stringcCstt|j|j��S)N)rB�map�_get_operationr&)r9rrrrC%szJsonPatch._opsFcCs,|stj|�}x|jD]}|j|�}qW|S)a/Applies the patch to given object.

        :param obj: Document object.
        :type obj: dict

        :param in_place: Tweaks way how patch would be applied - directly to
                         specified `obj` or to his copy.
        :type in_place: bool

        :return: Modified `obj`.
        )r1�deepcopyrCr$)r9�objr'�	operationrrrr$)s


zJsonPatch.applycCsTd|krtd��|d}t|t�s*td��||jkrBtdj|���|j|}||�S)N�opz&Operation does not contain 'op' memberzOperation must be a stringzUnknown operation {0!r})rr r!r8�format)r9rUrVrIrrrrR>s


zJsonPatch._get_operationN)T)F)r
rrr
r:r<r>Z__nonzero__r@rDrFrG�classmethodr#r)r;�propertyrCr$rRrrrrr"�s -
r"c@s^eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Ze	dd
��Z
e	dd��Zejdd��ZdS)�PatchOperationz'A single operation inside a JSON Patch.cCs |d|_t|j�|_||_dS)N�path)�locationr�pointerrU)r9rUrrrr:Qs
zPatchOperation.__init__cCstd��dS)zAAbstract method that applies patch operation to specified object.z!should implement patch operation.N)�NotImplementedError)r9rTrrrr$VszPatchOperation.applycCstt|jj���S)N)rA�	frozensetrUr)r9rrrrDZszPatchOperation.__hash__cCst|t�sdS|j|jkS)NF)r rZrU)r9rErrrrF]s
zPatchOperation.__eq__cCs
||kS)Nr)r9rErrrrGbszPatchOperation.__ne__cCsdj|jjdd��S)N�/r���)�joinr]�parts)r9rrrr[eszPatchOperation.pathcCs2yt|jjd�Stk
r,|jjdSXdS)Nrrara)�intr]rc�
ValueError)r9rrrriszPatchOperation.keycCs*t|�|jjd<|jj|_|j|jd<dS)Nrr[ra)�strr]rcr[r\rU)r9rrrrrps
N)
r
rrr
r:r$rDrFrGrYr[r�setterrrrrrZNsrZc@s(eZdZdZdd�Zdd�Zdd�ZdS)	r2z/Removes an object property or an array element.cCsX|jj|�\}}y
||=Wn8ttfk
rR}zdj|�}t|��WYdd}~XnX|S)Nz&can't remove non-existent object '{0}')r]�to_last�KeyError�
IndexErrorrWr)r9rT�subobj�part�ex�msgrrrr$zs

zRemoveOperation.applycCs0|j|kr,|j|kr$|jd7_n|d8}|S)Nr)r[r)r9r[rrrr�_on_undo_remove�s


zRemoveOperation._on_undo_removecCs0|j|kr,|j|kr$|jd8_n|d8}|S)Nr)r[r)r9r[rrrr�_on_undo_add�s


zRemoveOperation._on_undo_addN)r
rrr
r$rorprrrrr2ws
r2c@s(eZdZdZdd�Zdd�Zdd�ZdS)	r3z,Adds an object property or an array element.cCs�y|jd}Wn*tk
r8}ztd��WYdd}~XnX|jj|�\}}t|t�r�|dkrh|j|�q�|t|�ks||dkr�t	d��q�|j
||�n4t|t�r�|dkr�|}q�|||<ntdj
t|����|S)Nrz/The operation does not contain a 'value' member�-rzcan't insert outside of listzinvalid document type {0})rUrirr]rhr rrrr�insertr�	TypeErrorrW�type)r9rTrrmrkrlrrrr$�s$



zAddOperation.applycCs0|j|kr,|j|kr$|jd7_n|d7}|S)Nr)r[r)r9r[rrrrro�s


zAddOperation._on_undo_removecCs0|j|kr,|j|kr$|jd8_n|d7}|S)Nr)r[r)r9r[rrrrrp�s


zAddOperation._on_undo_addN)r
rrr
r$rorprrrrr3�sr3c@s(eZdZdZdd�Zdd�Zdd�ZdS)	r4z=Replaces an object property or an array element by new value.cCs�y|jd}Wn*tk
r8}ztd��WYdd}~XnX|jj|�\}}|dkrV|St|t�r~|t|�kst|dkr�td��n8t|t	�r�||kr�dj
|�}t|��ntdj
t|����|||<|S)Nrz/The operation does not contain a 'value' memberrzcan't replace outside of listz'can't replace non-existent object '{0}'zinvalid document type {0})
rUrirr]rhr rrrrrWrsrt)r9rTrrmrkrlrnrrrr$�s$




zReplaceOperation.applycCs|S)Nr)r9r[rrrrro�sz ReplaceOperation._on_undo_removecCs|S)Nr)r9r[rrrrrp�szReplaceOperation._on_undo_addN)r
rrr
r$rorprrrrr4�sr4c@sNeZdZdZdd�Zedd��Zedd��Zejdd��Zd	d
�Z	dd�Z
d
S)r5z=Moves an object property or an array element to new location.c!Cs�yt|jd�}Wn*tk
r<}ztd��WYdd}~XnX|j|�\}}y||}Wn2ttfk
r�}ztt|���WYdd}~XnX|j|kr�|St	|t
�r�|jj|�r�td��td|jdd��j
|�}td|j|d��j
|�}|S)N�fromz.The operation does not contain a 'from' memberz(Cannot move values into its own childrenr-)rVr[r.)rVr[r)rrUrirrhrjrrfr]r r�containsr2r$r3r\)r9rT�from_ptrrmrkrlrrrrr$�s2


zMoveOperation.applycCs"t|jd�}dj|jdd��S)Nrur`rra)rrUrbrc)r9rwrrr�	from_pathszMoveOperation.from_pathcCs<t|jd�}yt|jd�Stk
r6|jdSXdS)Nrurrara)rrUrdrcrs)r9rwrrr�from_keys
zMoveOperation.from_keycCs,t|jd�}t|�|jd<|j|jd<dS)Nrurra)rrUrfrcr[)r9rrwrrrryscCs\|j|kr,|j|kr$|jd7_n|d8}|j|krX|j|krP|jd7_n|d7}|S)Nr)rxryr[r)r9r[rrrrro#s



zMoveOperation._on_undo_removecCs\|j|kr,|j|kr$|jd8_n|d8}|j|krX|j|krP|jd8_n|d7}|S)Nr)rxryr[r)r9r[rrrrrp0s



zMoveOperation._on_undo_addN)r
rrr
r$rYrxryrgrorprrrrr5�s"
r5c@seZdZdZdd�ZdS)r6z!Test value by specified location.c#Cs�y0|jj|�\}}|dkr |}n|jj||�}Wn.tk
r^}ztt|���WYdd}~XnXy|jd}Wn*tk
r�}ztd��WYdd}~XnX||kr�d}t|j	|t
|�|t
|����|S)Nrz/The operation does not contain a 'value' memberz0{0} ({1}) is not equal to tested value {2} ({3}))r]rh�walkrrrfrUrirrWrt)r9rTrkrl�valrmrrnrrrr$As"zTestOperation.applyN)r
rrr
r$rrrrr6>sr6c@seZdZdZdd�ZdS)r7zA Copies an object property or an array element to a new location c!Cs�yt|jd�}Wn*tk
r<}ztd��WYdd}~XnX|j|�\}}ytj||�}Wn2ttfk
r�}ztt	|���WYdd}~XnXt
d|j|d��j|�}|S)Nruz.The operation does not contain a 'from' memberr.)rVr[r)
rrUrirrhr1rSrjrrfr3r\r$)r9rTrwrmrkrlrrrrr$\s 
zCopyOperation.applyN)r
rrr
r$rrrrr7Ysr7c@s|eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)rKcCs4iig|_ggg|_g|_}||dg|dd�<dS)N)�
index_storage�index_storage2�_DiffBuilder__root)r9�rootrrrr:ts


zDiffBuilder.__init__cCshy:|j|}|j|�}|dkr*|g||<n||j|�Wn(tk
rb|j|j||f�YnXdS)N)r|�getrrsr})r9r�index�st�storage�storedrrr�store_indexzs

zDiffBuilder.store_indexcCs�y |j|j|�}|r|j�SWnZtk
rz|j|}x:tt|�ddd�D]"}||d|krP|j|�dSqPWYnXdS)Nrrrara)r|r��poprsr}�ranger)r9rr�r�r��irrr�
take_index�s
zDiffBuilder.take_indexcCs,|j}|d}|||g|d<|d<|dS)Nrr)r~)r9rVrZlastrrrrr�szDiffBuilder.insertcCs*|\}}}||d<||d<g|dd�<dS)Nrrr)r9r�Z	link_prevZ	link_next�_rrrr-�s
zDiffBuilder.removeccs2|j}|d}x||k	r,|dV|d}qWdS)Nr�)r~)r9�startr�currrrr�	iter_from�s


zDiffBuilder.iter_fromccs2|j}|d}x||k	r,|dV|d}qWdS)Nrr�)r~)r9rr�rrrr@�s


zDiffBuilder.__iter__ccs�|j}|d}x�||k	r�|d|k	r�|d|dd}}|j|jkr�t|�tkr�t|�tkr�td|j|jdd��jV|dd}q|djV|d}qWdS)Nrr�r/r)rVr[r)r~r\rtr2r3r4rU)r9rr�Zop_firstZ	op_secondrrrrM�s 
zDiffBuilder.executec	Cs�|j|t�}|dk	r�|d}t|j�tkrPx$|j|�D]}|j|j|j�|_q6W|j|�|j	t
||�kr�td|j	t
||�d��}|j|�n.t
dt
||�|d��}|j|�}|j||t�dS)Nr�r0)rVrur[r.)rVr[r)r��
_ST_REMOVErtrrdr�ror[r-r\�
_path_joinr5rrr3r��_ST_ADD)	r9r[r�itemr�rV�v�new_op�	new_indexrrr�_item_added�s&


zDiffBuilder._item_addedc	Cs�tdt||�d��}|j|t�}|j|�}|dk	r�|d}t|j�tkrnx$|j|�D]}|j	|j
|j�|_qTW|j|�|j|jkr�t
d|j|jd��}||d<q�|j|�n|j||t�dS)Nr-)rVr[r�r0)rVrur[)r2r�r�r�rrrtrrdr�rpr[r-r\r5r�r�)	r9r[rr�r�r�r�rVr�rrr�
_item_removed�s&


zDiffBuilder._item_removedcCs |jtdt||�|d���dS)Nr/)rVr[r)rrr4r�)r9r[rr�rrr�_item_replaced�szDiffBuilder._item_replacedc	Cs�t|j��}t|j��}||}||}x"|D]}|j|t|�||�q.Wx"|D]}|j|t|�||�qRWx(||@D]}|j||||||�qzWdS)N)�set�keysr�rfr�rL)	r9r[r*r+Zsrc_keysZdst_keysZ
added_keysZremoved_keysrrrr�_compare_dicts�s

zDiffBuilder._compare_dictscCst|�t|�}}t||�}t||�}x�t|�D]�}||kr�||||}	}
|	|
krZq0q�t|	t�r�t|
t�r�|jt||�|	|
�q�t|	t�r�t|
t�r�|j	t||�|	|
�q�|j
|||	�|j|||
�q0||kr�|j
||||�q0|j||||�q0WdS)N)r�max�minr�r rr�r�r�_compare_listsr�r�)r9r[r*r+Zlen_srcZlen_dstZmax_lenZmin_lenr�old�newrrrr�s&





zDiffBuilder._compare_listscCsr||krdSt|t�r6t|t�r6|jt||�||�n8t|t�r`t|t�r`|jt||�||�n|j|||�dS)N)r rr�r�rr�r�)r9r[rr*r+rrrrL's



zDiffBuilder._compare_valuesN)r
rrr:r�r�rrr-r�r@rMr�r�r�r�r�rLrrrrrKrsrKcCs,|dkr|S|dt|�jdd�jdd�S)Nr`�~z~0z~1)rfr/)r[rrrrr�7sr�)rr)F)3r
Z
__future__rrr1�	functools�inspect�	itertoolsrO�sysZjsonpointerrrr�r��collections.abcrr�ImportErrorZunicoderf�
__author__�__version__Z__website__Z__license__�version_info�bytesr!�	Exceptionr	rr�AssertionErrorrr�partial�loadsrHr(r,�objectr"rZr2r3r4r5r6r7rKr�rrrr�<module>!sT

	
%&)2$SF

Filemanager

Name Type Size Permission Actions
_version.cpython-36.opt-1.pyc File 134 B 0644
_version.cpython-36.pyc File 134 B 0644
configargparse.cpython-36.opt-1.pyc File 29.67 KB 0644
configargparse.cpython-36.pyc File 29.67 KB 0644
configobj.cpython-36.opt-1.pyc File 57.59 KB 0644
configobj.cpython-36.pyc File 57.8 KB 0644
decorator.cpython-36.opt-1.pyc File 12.05 KB 0644
decorator.cpython-36.pyc File 12.14 KB 0644
distro.cpython-36.opt-1.pyc File 35.37 KB 0644
distro.cpython-36.pyc File 35.44 KB 0644
easy_install.cpython-36.opt-1.pyc File 259 B 0644
easy_install.cpython-36.pyc File 259 B 0644
hwdata.cpython-36.opt-1.pyc File 5.01 KB 0644
hwdata.cpython-36.pyc File 5.01 KB 0644
jsonpatch.cpython-36.opt-1.pyc File 21.58 KB 0644
jsonpatch.cpython-36.pyc File 21.58 KB 0644
jsonpointer.cpython-36.opt-1.pyc File 8.43 KB 0644
jsonpointer.cpython-36.pyc File 8.54 KB 0644
magic.cpython-36.opt-1.pyc File 9.24 KB 0644
magic.cpython-36.pyc File 9.24 KB 0644
prettytable.cpython-36.opt-1.pyc File 43.36 KB 0644
prettytable.cpython-36.pyc File 44.03 KB 0644
pyparsing.cpython-36.opt-1.pyc File 196.32 KB 0644
pyparsing.cpython-36.pyc File 196.32 KB 0644
seobject.cpython-36.opt-1.pyc File 84.91 KB 0644
seobject.cpython-36.pyc File 84.91 KB 0644
six.cpython-36.opt-1.pyc File 24.43 KB 0644
six.cpython-36.pyc File 24.43 KB 0644
socks.cpython-36.opt-1.pyc File 22.6 KB 0644
socks.cpython-36.pyc File 22.6 KB 0644
sockshandler.cpython-36.opt-1.pyc File 3.59 KB 0644
sockshandler.cpython-36.pyc File 3.59 KB 0644
validate.cpython-36.opt-1.pyc File 43.27 KB 0644
validate.cpython-36.pyc File 43.34 KB 0644