def add(self, pointer, value):
        """Add element to sequence, member to mapping.

        :param pointer: the path to add in it
        :param value: the new value
        :return: resolved document
        :rtype: Target


        The pointer must reference one of:

        -   The root of the target document - whereupon the specified value
            becomes the entire content of the target document.

        -   A member to add to an existing mapping - whereupon the supplied
            value is added to that mapping at the indicated location.  If the
            member already exists, it is replaced by the specified value.

        -   An element to add to an existing sequence - whereupon the supplied
            value is added to the sequence at the indicated location.
            Any elements at or above the specified index are shifted one
            position to the right.
            The specified index must no be greater than the number of elements
            in the sequence.
            If the "-" character is used to index the end of the sequence, this
            has the effect of appending the value to the sequence.

        """
        doc = deepcopy(self.document)
        parent, obj = None, doc
        try:
            for token in Pointer(pointer):
                parent, obj = obj, token.extract(obj, bypass_ref=True)
            else:
                if isinstance(parent, MutableSequence):
                    raise OutOfRange(parent)
                if isinstance(parent, Mapping):
                    raise OutOfBounds(parent)
                raise Error('already setted')
        except (OutOfBounds, OutOfRange, LastElement) as error:
            if not token.last:
                raise NonexistentTarget(obj)
            value = deepcopy(value)
            if isinstance(error, OutOfBounds):
                error.obj[str(token)] = value
            elif isinstance(error, OutOfRange):
                error.obj.insert(int(token), value)
            elif isinstance(error, LastElement):
                error.obj.append(value)

        return Target(doc)
def add ( self , pointer , value ) : doc = deepcopy ( self . document ) parent , obj = None , doc try : for token in Pointer ( pointer ) : parent , obj = obj , token . extract ( obj , bypass_ref = True ) else : if isinstance ( parent , MutableSequence ) : raise OutOfRange ( parent ) if isinstance ( parent , Mapping ) : raise OutOfBounds ( parent ) raise Error ( 'already setted' ) except ( OutOfBounds , OutOfRange , LastElement ) as error : if not token . last : raise NonexistentTarget ( obj ) value = deepcopy ( value ) if isinstance ( error , OutOfBounds ) : error . obj [ str ( token ) ] = value elif isinstance ( error , OutOfRange ) : error . obj . insert ( int ( token ) , value ) elif isinstance ( error , LastElement ) : error . obj . append ( value ) return Target ( doc )
Add element to sequence, member to mapping.

        :param pointer: the path to add in it
        :param value: the new value
        :return: resolved document
        :rtype: Target


        The pointer must reference one of:

        -   The root of the target document - whereupon the specified value
            becomes the entire content of the target document.

        -   A member to add to an existing mapping - whereupon the supplied
            value is added to that mapping at the indicated location.  If the
            member already exists, it is replaced by the specified value.

        -   An element to add to an existing sequence - whereupon the supplied
            value is added to the sequence at the indicated location.
            Any elements at or above the specified index are shifted one
            position to the right.
            The specified index must no be greater than the number of elements
            in the sequence.
            If the "-" character is used to index the end of the sequence, this
            has the effect of appending the value to the sequence.