�
q�Rb�* � �F � d Z ddlmZ dZdZdZdZ ddlmZ e Z
d� Zn# e$ r e
Zd � ZY nw xY w dd
lmZmZ n# e$ r dd
lmZmZ Y nw xY wddlmZmZ ddlZddlZ e� � Zdd�Zefd�Zd� Z G d� de� � Z G d� de� � Z G d� de� � Zd� Zd� Z dS )z7 Identify specific nodes in a JSON document (RFC 6901) � )�unicode_literalsu Stefan Kögl <stefan@skoegl.net>z2.3z2https://github.com/stefankoegl/python-json-pointerzModified BSD License)�izipc �, � | � d� � S )N�raw_unicode_escape)�encode��us �-/usr/lib/python3/dist-packages/jsonpointer.py�<lambda>r / s � �1�8�8�$8�9�9� � c � � | S �N� r s r
r r 2 s � �1� r )�Mapping�Sequence)�tee�chainNTc �N � t |� � }|� | ||� � S )a� Resolves pointer against doc and sets the value of the target within doc.
With inplace set to true, doc is modified as long as pointer is not the
root.
>>> obj = {'foo': {'anArray': [ {'prop': 44}], 'another prop': {'baz': 'A string' }}}
>>> set_pointer(obj, '/foo/anArray/0/prop', 55) == {'foo': {'another prop': {'baz': 'A string'}, 'anArray': [{'prop': 55}]}}
True
>>> set_pointer(obj, '/foo/yet another prop', 'added prop') == {'foo': {'another prop': {'baz': 'A string'}, 'yet another prop': 'added prop', 'anArray': [{'prop': 55}]}}
True
>>> obj = {'foo': {}}
>>> set_pointer(obj, '/foo/a%20b', 'x') == {'foo': {'a%20b': 'x' }}
True
)�JsonPointer�set)�doc�pointer�value�inplaces r
�set_pointerr A s' |