� M�gRt����dZddlmZddlZddlZddlZddlZddlZ ddlm Z n#e $r ddlm Z YnwxYw ddl m Z n #e $re Z YnwxYwddlmZmZdZdZ ddlmZmZn#e $r ddlmZmZeZYnwxYwd Zd Zd Zd Zejd kreefZGd�de��ZGd�de��Z Gd�de��Z!Gd�dee"��Z#d�Z$ej%ej&e$���Z'defd�Z(efd�Z)Gd�de*��Z+Gd�de+��Z,Gd�d e+��Z-Gd!�d"e+��Z.Gd#�d$e+��Z/Gd%�d&e+��Z0Gd'�d(e+��Z1Gd)�d*e*��Z2Gd+�d,e*��Z3d-�Z4dS).z Apply JSON-Patches (RFC 6902) �)�unicode_literalsN)�Sequence)�MappingProxyType)� JsonPointer�JsonPointerException�)�MutableMapping�MutableSequenceu Stefan Kögl <stefan@skoegl.net>z1.33z0https://github.com/stefankoegl/python-json-patchzModified BSD License)�rc��eZdZdZdS)�JsonPatchExceptionzBase Json Patch exceptionN��__name__� __module__� __qualname__�__doc__���Y/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/jsonpatch.pyr r P�������#�#�#�#rr c��eZdZdZdS)�InvalidJsonPatchz, Raised if an invalid JSON Patch is created NrrrrrrTs������6�6�6�6rrc��eZdZdZdS)�JsonPatchConflicta Raised if patch could not be applied due to conflict situation such as: - attempt to add object key when it already exists; - attempt to operate with nonexistence object key; - attempt to insert value to array at position beyond its size; - etc. NrrrrrrXs���������rrc��eZdZdZdS)�JsonPatchTestFailedz A Test operation failed Nrrrrrrarrrc���tjt��}|D] \}}||�|���!t d�|���D����S)z'Convert duplicate keys values to lists.c3�ZK�|]&\}}|t|��dkr|dn|fV��'dS)rrN)�len)�.0�key�valuess r� <genexpr>zmultidict.<locals>.<genexpr>lsY������ �C�� �3�v�;�;�!�+�+�f�Q�i�i��8������r)� collections� defaultdict�list�append�dict�items)� ordered_pairs�mdictr!�values r� multidictr-esz�� � #�D� )� )�E�#�!�!� ��U� �c� ���%� � � � � ���!�;�;�=�=���� � �r)�object_pairs_hookFc��t|t��rt�||���}nt||���}|�||��S)a�Apply 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 :param pointer_cls: JSON pointer class to use. :type pointer_cls: Type[JsonPointer] :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 �� pointer_cls)� isinstance� basestring� JsonPatch� from_string�apply)�doc�patch�in_placer1s r� apply_patchr:xsW��B�%��$�$�:��%�%�e��%�E�E����%�[�9�9�9�� �;�;�s�H� %� %�%rc�<�t�|||���S)a!Generates patch by comparing 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 :param pointer_cls: JSON pointer class to use. :type pointer_cls: Type[JsonPointer] >>> 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 r0)r4� from_diff)�src�dstr1s r� make_patchr?�s��* � � �s�C�[� � A� A�Arc��eZdZdZefd�Zd�Zd�Zd�Zd�Z e d���Z e d���Z e j d ���Z d S) �PatchOperationz'A single operation inside a JSON Patch.c�~�||_|�d��std���t|d|j��r |dj|_|d|_nO|d|_ |�|j��|_n!#t$r}td���d}~wwxYw||_dS)N�pathz#Operation must have a 'path' memberzInvalid 'path') r1� __contains__rr2rC�location�pointer� TypeError� operation)�selfrHr1�exs r�__init__zPatchOperation.__init__�s���&����%�%�f�-�-� J�"�#H�I�I� I� �i��'��)9� :� :� 9�%�f�-�2�D�M�$�V�,�D�L�L�%�f�-�D�M� 9�#�/�/�� �>�>�� � ��� 9� 9� 9�&�'7�8�8�8����� 9����#����s�5B� B3�B.�.B3c� �td���)zGAbstract method that applies a patch operation to the specified object.z%should implement the patch operation.)�NotImplementedError)rI�objs rr6zPatchOperation.apply�s��!�"I�J�J�Jrc�h�tt|j�������S�N)�hash� frozensetrHr)�rIs r�__hash__zPatchOperation.__hash__�s&���I�d�n�2�2�4�4�5�5�6�6�6rc�P�t|t��sdS|j|jkS�NF)r2rArH�rI�others r�__eq__zPatchOperation.__eq__�s(���%��0�0� ��5��~���0�0rc��||k SrPrrWs r�__ne__zPatchOperation.__ne__�����5�=�!�!rc�P�d�|jjdd���S)N�/�����)�joinrF�partsrSs rrCzPatchOperation.path�s"���x�x�� �*�3�B�3�/�0�0�0rc�� t|jjd��S#t$r|jjdcYSwxYw)Nr_)�intrFra� ValueErrorrSs rr!zPatchOperation.key�sP�� *��t�|�)�"�-�.�.� .��� *� *� *��<�%�b�)� )� )� )� *���s�!�A�Ac�~�t|��|jjd<|jj|_|j|jd<dS)Nr_rC)�strrFrarCrErH)rIr,s rr!zPatchOperation.key�s7��!$�U���� ��2��� �)�� �!%����v���rN)rrrrrrKr6rTrYr[�propertyrCr!�setterrrrrArA�s�������1�1�.9�#�#�#�#�$K�K�K�7�7�7�1�1�1� "�"�"��1�1��X�1��*�*��X�*�  �Z�/�/��Z�/�/�/rrAc�$�eZdZdZd�Zd�Zd�ZdS)�RemoveOperationz/Removes an object property or an array element.c�\�|j�|��\}}t|t��r7t|t��s"t d�|����� ||=n=#ttf$r)}d�|��}t|���d}~wwxYw|S)Nzinvalid array index '{0}'z(can't remove a non-existent object '{0}') rF�to_lastr2rrcr�format�KeyError� IndexErrorr)rIrN�subobj�partrJ�msgs rr6zRemoveOperation.apply�s����|�+�+�C�0�0� ��� �f�h� '� '� Q� �4��0E�0E� Q�&�'B�'I�'I�$�'O�'O�P�P� P� )��t� � ���*�%� )� )� )�<�C�C�D�I�I�C�#�C�(�(� (����� )����� s�+A/�/B)�$B$�$B)c�^�|j|kr!|j|kr|xjdz c_n|dz}|S�Nr�rCr!�rIrCr!s r�_on_undo_removezRemoveOperation._on_undo_remove�s9�� �9�� � ��x�3������A� �����q���� rc�^�|j|kr!|j|kr|xjdzc_n|dz}|Srtrurvs r� _on_undo_addzRemoveOperation._on_undo_add�9�� �9�� � ��x�#�~�~����A� �����q���� rN�rrrrr6rwryrrrrjrj�sG������9�9� � � ��������rrjc�$�eZdZdZd�Zd�Zd�ZdS)� AddOperationz,Adds an object property or an array element.c�r� |jd}n!#t$r}td���d}~wwxYw|j�|��\}}t |t ��r[|dkr|�|��n�|t|��ks|dkrtd���|� ||��nyt |t��r |�|}n_|||<nY|�/td� t|�������td� |j|�����|S)Nr,�/The operation does not contain a 'value' member�-rzcan't insert outside of list�invalid document type {0}�2unable to fully resolve json pointer {0}, part {1})rHrnrrFrlr2r r'rr�insertr rGrm�typerE)rIrNr,rJrprqs rr6zAddOperation.applys[�� C��N�7�+�E�E��� C� C� C�"�A�C�C� C����� C�����|�+�+�C�0�0� ��� �f�o� .� .� z��s�{�{�� � �e�$�$�$�$���F� � �#�#�t�a�x�x�'�(F�G�G�G�� � �d�E�*�*�*�*� ��� /� /� z��|����$��t� � ��|�� ;� B� B�4��<�<� P� P�Q�Q�Q�'�(\�(c�(c�dh�dq�sw�(x�(x�y�y�y�� �� � .�)�.c�^�|j|kr!|j|kr|xjdz c_n|dz }|Srtrurvs rrwzAddOperation._on_undo_remove3rzrc�^�|j|kr!|j|kr|xjdzc_n|dz }|Srtrurvs rryzAddOperation._on_undo_add;rzrNr{rrrr}r}sH������6�6����@�������rr}c�$�eZdZdZd�Zd�Zd�ZdS)�ReplaceOperationz?Replaces an object property or an array element by a new value.c�� |jd}n!#t$r}td���d}~wwxYw|j�|��\}}|�|S|dkrtd���t |t ��r)|t|��ks|dkrtd���n�t |t��r)||vr$d� |��}t|���nY|�/td� t|�������td � |j |�����|||<|S) Nr,rr�z7'path' with '-' can't be applied to 'replace' operationrzcan't replace outside of listz)can't replace a non-existent object '{0}'r�r�)rHrnrrFrlr2r rrr rmrGr�rE)rIrNr,rJrprqrrs rr6zReplaceOperation.applyGsp�� C��N�7�+�E�E��� C� C� C�"�A�C�C� C����� C�����|�+�+�C�0�0� ��� �<��L� �3�;�;�"�#\�]�]� ]� �f�o� .� .� z��s�6�{�{�"�"�d�Q�h�h�'�(G�H�H�H�'/���� /� /� z��6�!�!�A�H�H��N�N��'��,�,�,�"��|�� ;� B� B�4��<�<� P� P�Q�Q�Q�'�(\�(c�(c�dh�dq�sw�(x�(x�y�y�y���t� �� r�c��|SrPrrvs rrwz ReplaceOperation._on_undo_removeg���� rc��|SrPrrvs rryzReplaceOperation._on_undo_addjr�rNr{rrrr�r�DsH������I�I����@�������rr�c�p�eZdZdZd�Zed���Zed���Zejd���Zd�Z d�Z dS) � MoveOperationz?Moves an object property or an array element to a new location.c��� t|jd|j��r|jd}n |�|jd��}n!#t$r}t d���d}~wwxYw|�|��\}} ||}n5#tt f$r!}tt|�����d}~wwxYw|j |kr|St|t��r)|j � |��rtd���td|jdd�|j���� |��}td|j|d�|j���� |��}|S) N�from�.The operation does not contain a 'from' memberz*Cannot move values into their own children�remove��oprCr0�add�r�rCr,)r2rHr1rnrrlrorrfrFr �containsrjr6r}rE�rIrN�from_ptrrJrprqr,s rr6zMoveOperation.applyqs��� B��$�.��0�$�2B�C�C� D��>�&�1����+�+�D�N�6�,B�C�C����� B� B� B�"�@�B�B� B����� B���� �'�'��,�,� ��� -��4�L�E�E���*�%� -� -� -�#�C��G�G�,�,� ,����� -���� �<�8� #� #��J� �f�n� -� -� R�� �%�%�h�/�/� R�#�$P�Q�Q� Q����N�6�*� � ��'�)�)�)�*/��s��� � ���M�� � ��'� )�)�)�*/��s��� � � s0�AA� A/�A*�*A/� B�C�%C�Cc��|�|jd��}d�|jdd���S)Nr�r^r_)r1rHr`ra�rIr�s r� from_pathzMoveOperation.from_path�s9���#�#�D�N�6�$:�;�;���x�x���s��s�+�,�,�,rc��|�|jd��} t|jd��S#t$r|jdcYSwxYw�Nr�r_)r1rHrcrarGr�s r�from_keyzMoveOperation.from_key�sd���#�#�D�N�6�$:�;�;�� &��x�~�b�)�*�*� *��� &� &� &��>�"�%� %� %� %� &���s�<�A�Ac��|�|jd��}t|��|jd<|j|jd<dSr�)r1rHrfrarC)rIr,r�s rr�zMoveOperation.from_key�sB���#�#�D�N�6�$:�;�;�� ��Z�Z���r��!)����v���rc��|j|kr!|j|kr|xjdz c_n|dz}|j|kr!|j|kr|xjdz c_n|dz }|Srt�r�r�rCr!rvs rrwzMoveOperation._on_undo_remove�sn�� �>�T� !� !��}��#�#�� � ��"� � � ��q��� �9�� � ��x�#�~�~����A� �����q���� rc��|j|kr!|j|kr|xjdzc_n|dz}|j|kr!|j|kr|xjdzc_n|dz }|Srtr�rvs rryzMoveOperation._on_undo_add�sn�� �>�T� !� !��}�s�"�"�� � ��"� � � ��q��� �9�� � ��x�#�~�~����A� �����q���� rN) rrrrr6rgr�r�rhrwryrrrr�r�ns�������I�I�#�#�#�J�-�-��X�-��&�&��X�&��_�/�/��_�/� � � � � � � � rr�c��eZdZdZd�ZdS)� TestOperationz!Test value by specified location.c ��� |j�|��\}}|�|}n|j�||��}n.#t$r!}t t |�����d}~wwxYw |jd}n!#t$r}td���d}~wwxYw||krAd}t |� |t|��|t|�������|S)Nr,rz0{0} ({1}) is not equal to tested value {2} ({3})) rFrl�walkrrrfrHrnrrmr�)rIrNrprq�valrJr,rrs rr6zTestOperation.apply�s�� /��<�/�/��4�4�L�F�D��|�����l�'�'���5�5����#� /� /� /�%�c�"�g�g�.�.� .����� /���� C��N�7�+�E�E��� C� C� C�"�A�C�C� C����� C���� �%�<�<�D�C�%�c�j�j��d�3�i�i�16��U� � �'E�'E�F�F� F�� s/�=A� A+� A&�&A+�/ A=�= B�B�BN�rrrrr6rrrr�r��s)������+�+�����rr�c��eZdZdZd�ZdS)� CopyOperationzA Copies an object property or an array element to a new location c��� |�|jd��}n!#t$r}td���d}~wwxYw|�|��\}} t j||��}n5#ttf$r!}tt|�����d}~wwxYwtd|j |d�|j���� |��}|S)Nr�r�r�r�r0) r1rHrnrrl�copy�deepcopyrorrfr}rEr6r�s rr6zCopyOperation.apply�s�� B��'�'���v�(>�?�?�H�H��� B� B� B�"�@�B�B� B����� B���� �'�'��,�,� ��� -��M�&��,�/�/�E�E���*�%� -� -� -�#�C��G�G�,�,� ,����� -�������M�� � ��'� )�)�)�*/��s��� � � s*� #� A�<�A�A8�8B*� B%�%B*Nr�rrrr�r��s)������K�K�����rr�c ��eZdZeej��Zee��Ze e e e e eed���Z efd�Zd�Zd�ZeZd�Zd�Zd�Zd�Zed efd ���Zed d efd ���Zdd �Zed���Zdd�Z d�Z!d S)r4)r�r��replace�move�testr�c��||_||_|jD];}t|t��rt d���|�|���<dS)NzMDocument is expected to be sequence of operations, got a sequence of strings.)r8r1r2r3r�_get_operation)rIr8r1r�s rrKzJsonPatch.__init__2sw���� �&��� �*� $� $�B��"�j�)�)� Q�&�(P�Q�Q�Q� � � �� #� #� #� #� $� $rc�*�|���S)zstr(self) -> self.to_string())� to_stringrSs r�__str__zJsonPatch.__str__Js���~�~���rc�*�t|j��SrP)�boolr8rSs r�__bool__zJsonPatch.__bool__N����D�J���rc�*�t|j��SrP)�iterr8rSs r�__iter__zJsonPatch.__iter__Sr�rc�D�tt|j����SrP)rQ�tuple�_opsrSs rrTzJsonPatch.__hash__Vs���E�$�)�$�$�%�%�%rc�P�t|t��sdS|j|jkSrV)r2r4r�rWs rrYzJsonPatch.__eq__Ys(���%��+�+� ��5��y�E�J�&�&rc��||k SrPrrWs rr[zJsonPatch.__ne__^r\rNc�D�|p|j}||��}|||���S)a�Creates JsonPatch instance from string source. :param patch_str: JSON patch as raw string. :type patch_str: str :param loads: A function of one argument that loads a serialized JSON string. :type loads: function :param pointer_cls: JSON pointer class to use. :type pointer_cls: Type[JsonPointer] :return: :class:`JsonPatch` instance. r0)� json_loader)�cls� patch_str�loadsr1r�r8s rr5zJsonPatch.from_stringas4�� �.�s�� �� �I�&�&���s�5�k�2�2�2�2rTc���|p|j}t||||���}|�dd||��t|�����}|||���S)aCCreates JsonPatch instance based on comparison 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 :param dumps: A function of one argument that produces a serialized JSON string. :type dumps: function :param pointer_cls: JSON pointer class to use. :type pointer_cls: Type[JsonPointer] :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 r0�N)� json_dumper� DiffBuilder�_compare_valuesr&�execute) r�r=r>� optimization�dumpsr1r��builder�opss rr<zJsonPatch.from_diffusl��>�.�s�� ��c�3� ��M�M�M������D�#�s�3�3�3��7�?�?�$�$�%�%���s�3�K�0�0�0�0rc�4�|p|j}||j��S)z!Returns patch set as JSON string.)r�r8)rIr�r�s rr�zJsonPatch.to_string�s!���/�t�/� ��{�4�:�&�&�&rc�P�tt|j|j����SrP)r��mapr�r8rSs rr�zJsonPatch._ops�s���S��,�d�j�9�9�:�:�:rFc�p�|stj|��}|jD]}|�|��}�|S)a5Applies the patch to a given object. :param obj: Document object. :type obj: dict :param in_place: Tweaks the way how patch would be applied - directly to specified `obj` or to its copy. :type in_place: bool :return: Modified `obj`. )r�r�r�r6)rIrNr9rHs rr6zJsonPatch.apply�sD��� %��-��$�$�C��� '� '�I��/�/�#�&�&�C�C�� rc��d|vrtd���|d}t|t��std���||jvr"td�|�����|j|}|||j���S)Nr�z&Operation does not contain 'op' memberzOperation's op must be a stringzUnknown operation {0!r}r0)rr2r3� operationsrmr1)rIrHr�r�s rr�zJsonPatch._get_operation�s��� �y� � �"�#K�L�L� L� �t�_���"�j�)�)� F�"�#D�E�E� E� �T�_� $� $�"�#<�#C�#C�B�#G�#G�H�H� H��o�b�!���s�9�$�*:�;�;�;�;rrP)F)"rrr� staticmethod�jsonr�r�� _jsonloadsr�rrjr}r�r�r�r�r�rrKr�r�� __nonzero__r�rTrYr[� classmethodr5r<r�rgr�r6r�rrrr4r4�s��������,�t�z�*�*�K��,�z�*�*�K�!�!�!��#���� #�#���J�,�Z+6�$�$�$�$�0 � � � � � ��K� � � �&�&�&�'�'�'� "�"�"��*.�K�3�3�3��[�3�&�(,�D�#�"1�"1�"1��[�"1�H'�'�'�'� �;�;��X�;�����* <� <� <� <� <rr4c�r�eZdZejefd�Zd�Zd�Zd�Z d�Z d�Z d�Z d�Z d �Zd �Zd �Zd �Zd �Zd�ZdS)r�c��||_||_iig|_ggg|_gx|_}||_||_||dg|dd�<dSrP)r�r1� index_storage�index_storage2�_DiffBuilder__root�src_doc�dst_doc)rIr�r�r�r1�roots rrKzDiffBuilder.__init__�s[���� �&��� �"�X���!�2�h������ �d��� ��� ���t�$��Q�Q�Q���rc��|t|��f} |j|}|�|��}|�|g||<dS||�|��dS#t$r&|j|�||f��YdSwxYwrP)r�r��getr'rGr�)rIr,�index�st� typed_key�storage�storeds r� store_indexzDiffBuilder.store_index�s����D��K�K�(� � ?��(��,�G��[�[��+�+�F��~�&+�W�� �"�"�"�� �"�)�)�%�0�0�0�0�0��� ?� ?� ?� � �� #� *� *�I�u�+=� >� >� >� >� >� >� ?���s�*A�A�,B � B c�|�|t|��f} |j|�|��}|r|���SdS#t$rf|j|}t t|��dz dd��D]3}||d|kr|�|��dccYS�4YdSwxYw)Nrr_r)r�r�r��poprGr��ranger)rIr,r�r�r�r��is r� take_indexzDiffBuilder.take_index�s����D��K�K�(� � -��'��+�/�/� �:�:�F�� $��z�z�|�|�#� $� $��� -� -� -��)�"�-�G��3�w�<�<��>�2�r�2�2� -� -���1�:�a�=�I�-�-�"�;�;�q�>�>�!�,�,�,�,�,�,�.� -� -� -� -���s�5A � A)B;�6B;�:B;c�J�|j}|d}|||gx|d<|d<|dS)Nrr�r�)rIr�r��lasts rr�zDiffBuilder.insert�s4���{���A�w��!�4��,�,��Q��$�q�'��A�w�rc�4�|\}}}||d<||d<g|dd�<dS)Nrrr)rIr�� link_prev� link_next�_s rr�zDiffBuilder.remove�s1��"'�� �9�a� � �!� � � �!� ���a�a�a���rc#�`K�|j}|d}||ur|dV�|d}||u�dSdS�Nr�r�)rI�startr��currs r� iter_fromzDiffBuilder.iter_from�sP�����{���Q�x���$����q�'�M�M�M���7�D��$������rc#�`K�|j}|d}||ur|dV�|d}||u�dSdSr�r�)rIr�r�s rr�zDiffBuilder.__iter__sP�����{���A�w���$����q�'�M�M�M���7�D��$������rc#�K�|j}|d}||ur�|d|ur�|d|dd}}|j|jkrpt|��tkrXt|��tkr@t d|j|jdd�|j���jV�|dd}��|djV�|d}||u��dSdS)Nrr�r�r,r�r0)r�rEr�rjr}r�rHr1)rIr�r��op_first� op_seconds rr�zDiffBuilder.executes �����{���A�w���$����A�w�d�"�"�&*�1�g�t�A�w�q�z�)���$� �(:�:�:��X���/�9�9��Y���<�7�7�*�'� )� 2�!*�!4�W�!=�,�,�$(�#3� 5�5�5�6?� ?�?�?�  ��7�1�:�D���q�'�#� #� #� #���7�D��$������rc���|�|t��}|��|d}t|j��tkrUt|��tkr=|�|��D]'}|�|j|j��|_�(|�|��|j t||��krDtd|j t||��d�|j ���}|� |��dSdStdt||��|d�|j ���}|� |��}|�||t ��dS)Nr�r��r�r�rCr0r�r�)r�� _ST_REMOVEr�r!rcrrwrCr�rE� _path_joinr�r1r�r}r��_ST_ADD) rIrCr!�itemr�r��v�new_op� new_indexs r� _item_addedzDiffBuilder._item_addedss������j�1�1�� � ��q��B��B�F�|�|�s�"�"�t�C�y�y�C�'7�'7�����.�.�@�@�A��.�.�r�w���?�?�B�F�F� �K�K�� � � ��{�j��s�3�3�3�3�&� ��K�&�t�S�1�1�(�(� $�/� 1�1�1�� � � �F�#�#�#�#�#� 4�3�"��"�4��-�-��#�#� �+� -�-�-�F� � � �F�+�+�I� � � �T�9�g� 6� 6� 6� 6� 6rc���tdt||��d�|j���}|�|t��}|�|��}|��|d}|j�|j��d}t|��tkr=|� |��D]'} | � |j |j��|_�(|�|��|j|jkr+t#d|j|jd�|j���}||d<dS|�|��dS|�||t&��dS)Nr�r�r0r�rr�r)rjrr1r�r r�rFrlr�r�r&rryrCr!r�rEr�r�r) rIrCr!r r r�r r�� added_itemr s r� _item_removedzDiffBuilder._item_removed5sq�� ���t�S�)�)�" �" ��'�)�)�)������g�.�.���K�K��'�'� � � ��q��B� ��+�+�D�L�9�9�!�<�J��J���4�'�'�����.�.�=�=�A��^�^�B�G�R�V�<�<�B�F�F� �K�K�� � � ���"�+�-�-�&� �"�O��K�(�(� $�/� 1�1�1�� &� �!� � � �� � �I�&�&�&�&�&� � � �T�9�j� 9� 9� 9� 9� 9rc �|�|�tdt||��|d�|j�����dS)Nr�r�r0)r�r�rr1)rIrCr!r s r�_item_replacedzDiffBuilder._item_replacedVsY�� � � �$���t�S�)�)��& �& ��'� )�)�)� *� *� *� *� *rc��t|�����}t|�����}||z }||z }|D],}|�|t|��||���-|D],}|�|t|��||���-||zD]&}|�||||||���'dSrP)�set�keysrrfrr�) rIrCr=r>�src_keys�dst_keys� added_keys� removed_keysr!s r�_compare_dictszDiffBuilder._compare_dicts]s����s�x�x�z�z�?�?���s�x�x�z�z�?�?����(� ��(�*� �� 9� 9�C� � � �t�S��X�X�s�3�x� 8� 8� 8� 8�� 7� 7�C� � � �T�3�s�8�8�S��X� 6� 6� 6� 6��h�&� @� @�C� � � ��s�C��H�c�#�h� ?� ?� ?� ?� @� @rc��t|��t|��}}t||��}t||��}t|��D�]1}||kr�||||} } | | kr� t | t ��r;t | t ��r&|�t||��| | ���pt | t��r;t | t��r&|� t||��| | ����|� ||| ��|� ||| ����||kr|� ||||����|� ||||����3dSrP) r�max�minr�r2r rrr �_compare_listsrr) rIrCr=r>�len_src�len_dst�max_len�min_lenr!�old�news rrzDiffBuilder._compare_listsls����s�8�8�S��X�X����g�w�'�'���g�w�'�'����>�>� 6� 6�C��W�}�}��s�8�S��X�S���#�:�:����^�4�4� 5��s�N�3�3� 5��'�'� �4��(=�(=�s�C�H�H�H�H���_�5�5�5�"�3��8�8�5��'�'� �4��(=�(=�s�C�H�H�H�H��&�&�t�S�#�6�6�6��$�$�T�3��4�4�4�4��7�"�"��"�"�4��#�c�(�;�;�;�;�� � ��s�C��H�5�5�5�5�- 6� 6rc���t|t��r<t|t��r'|�t||��||��dSt|t��r<t|t��r'|�t||��||��dS|�|��|�|��krdS|�|||��dSrP)r2r rrr rr�r)rIrCr!r=r>s rr�zDiffBuilder._compare_values�s��� �c�>� *� *� 0��3��/�/� 0� � � � �4�� 5� 5�s�C� @� @� @� @� @� ��_� -� -� 0��3��0�0� 0� � � � �4�� 5� 5�s�C� @� @� @� @� @��Z�Z��_�_�� � �3��� /� /� �F� � � ��c�3� /� /� /� /� /rN)rrrr�r�rrKr�r�r�r�rr�r�rrrrrr�rrrr�r��s�������/3�z�{�%�%�%�%� ?� ?� ?� -� -� -���� ��� ���������(7�7�7�2:�:�:�B*�*�*� @� @� @�6�6�6�80�0�0�0�0rr�c��|�|S|dzt|���dd���dd��zS)Nr^�~z~0z~1)rfr�rus rrr�sA�� �{�� � �#�:��C���(�(��d�3�3�;�;�C��F�F� F�Fr)5r� __future__rr$r�� functoolsr��sys�collections.abcr� ImportError�typesrr(� jsonpointerrrr rr r �unicoderf� __author__� __version__� __website__� __license__� version_info�bytesr3� Exceptionr rr�AssertionErrorrr-�partialr�r�r:r?�objectrArjr}r�r�r�r�r4r�rrrr�<module>r;sY��B&�%�'�'�'�'�'�'����� � � � ����� � � � � � � � �%�(�(�(�(�(�(�(���%�%�%�$�$�$�$�$�$�$�$�%�����&�&�&�&�&�&�&��������������:�9�9�9�9�9�9�9� �� � ��?�?�?�?�?�?�?�?�?������;�;�;�;�;�;�;�;� �C�C�C����� 0� �� �@� �$� ���v������J�$�$�$�$�$��$�$�$�7�7�7�7�7�)�7�7�7������*����$�$�$�$�$�,�n�$�$�$� � � � �Y� �t�z�Y� G� G� G� �&+� �%&�%&�%&�%&�P&1�B�B�B�B�03/�3/�3/�3/�3/�V�3/�3/�3/�l�����n����D1�1�1�1�1�>�1�1�1�h'�'�'�'�'�~�'�'�'�TS�S�S�S�S�N�S�S�S�l�����N����6�����N����2M<�M<�M<�M<�M<��M<�M<�M<�`T0�T0�T0�T0�T0�&�T0�T0�T0�nG�G�G�G�Gs-�%� 3�3�>�A�A�A!�!A3�2A3
Memory