def write(self, obj, value, merge=False):
        """
        Returns
            object: full copy of new obj
        """
        full = deepcopy(obj)
        frag = full

        parts, last = self.parts[:-1], self.parts[-1]
        for part in parts:
            if isinstance(frag, dict):
                frag = frag[part]
            elif isinstance(frag, (list, tuple)):
                frag = frag[int(part)]

        if isinstance(frag, dict):
            if last in frag and merge:
                frag[last].update(value)
            else:
                frag[last] = value
        elif isinstance(frag, list):
            if last == '-':
                frag.append(value)
            else:
                frag[int(last)] = value

        return full
def write ( self , obj , value , merge = False ) : full = deepcopy ( obj ) frag = full parts , last = self . parts [ : - 1 ] , self . parts [ - 1 ] for part in parts : if isinstance ( frag , dict ) : frag = frag [ part ] elif isinstance ( frag , ( list , tuple ) ) : frag = frag [ int ( part ) ] if isinstance ( frag , dict ) : if last in frag and merge : frag [ last ] . update ( value ) else : frag [ last ] = value elif isinstance ( frag , list ) : if last == '-' : frag . append ( value ) else : frag [ int ( last ) ] = value return full
Returns
            object: full copy of new obj