Replace the Object in a range that is known to exist
436845
public void replace(SimpleTest test, Object target) {
    for (int i = 0; i < size; i++)
      if (ranges[i].correspondsTo(test)) {
        ranges[i].target = target;
        return;
      }
    throw new IllegalStateException();
  }
396981
def replace(self, target):
        
        if sys.version_info < (3, 3):
            raise NotImplementedError("replace() is only available "
                                      "with Python 3.3 and later")
        if self._closed:
            self._raise_closed()
        self._accessor.replace(self, target)
909456
function applyReplacer (value, replacer) {
  if (typeof replacer === 'function') {
    const input = {
      '': value
    }
    return applyFunctionReplacer(input, replacer)['']
  }

  if (
    isArray(replacer)
    // Array replacer only works for plain object
    && isPlainObject(value)
  ) {
    return applyFunctionReplacer(value, (k, v) => ~ replacer.indexOf(k)
      ? v
      : undefined)
  }

  return value
}
1151696
def myreplace(astr, thefind, thereplace):
    """"""
    alist = astr.split(thefind)
    new_s = alist.split(thereplace)
    return new_s
994071
function replaceKeyDeep(obj, keyMap) {
  return Object.keys(obj).reduce((memo, key)=> {

    // determine which key we are going to use
    let targetKey = keyMap[key] ? keyMap[key] : key;

    // assign the new value
    memo[targetKey] = obj[key];

    // recurse if an array
    if (Array.isArray(memo[targetKey])) {
      memo[targetKey].forEach((val, idx) => {
        if (Object.prototype.toString.call(val) === '[object Object]') {
          memo[targetKey][idx] = replaceKeyDeep(val, keyMap);
        }
      });
    } else if (Object.prototype.toString.call(memo[targetKey]) === '[object Object]') {
      // recurse if Object
      memo[targetKey] = replaceKeyDeep(memo[targetKey], keyMap);
    }

    // return the modified object
    return memo;
  }, {});
}
218043
@Override
	public int replace(int handle, Object obj) throws DataStoreException
    {
        if (SAFE_MODE) checkHandle(handle);
    	data[handle] = obj;
    	return handle;
    }
1276554
def _update_range(self, data, **kwargs):
        
        self._client.update_range(data=data, **kwargs)
1059492
def replace(self, replacements):
        

        for old_var, new_var in replacements.items():
            old_var_id = id(old_var)
            if old_var_id in self._object_mapping:
                # FIXME: we need to check if old_var still exists in the storage
                old_so = self._object_mapping[old_var_id]  # type: StoredObject
                self._store(old_so.start, new_var, old_so.size, overwrite=True)

        return self
392374
def varReplace(basedir, raw, vars, lookup_fatal=True, depth=0, expand_lists=False):
    '''  '''
    # this code originally from yum

    if (depth > 20):
        raise errors.AnsibleError("template recursion depth exceeded")

    done = [] # Completed chunks to return

    while raw:
        m = _varFind(basedir, raw, vars, lookup_fatal, depth)
        if not m:
            done.append(raw)
            break

        # Determine replacement value (if unknown variable then preserve
        # original)

        replacement = m['replacement']
        if expand_lists and isinstance(replacement, (list, tuple)):
            replacement = ",".join(replacement)
        if isinstance(replacement, (str, unicode)):
            replacement = varReplace(basedir, replacement, vars, lookup_fatal, depth=depth+1, expand_lists=expand_lists)
        if replacement is None:
            replacement = raw[m['start']:m['end']]

        start, end = m['start'], m['end']
        done.append(raw[:start])          # Keep stuff leading up to token
        done.append(unicode(replacement)) # Append replacement value
        raw = raw[end:]                   # Continue with remainder of string

    return ''.join(done)
100557
def replace(self, uid, ical, filename=None):
        """"""
        return self.replace_vobject(uid, readOne(ical), filename)
75112
def alter_object(self, obj):
        
        for attname, field, replacer in self.replacers:
            currentval = getattr(obj, attname)
            replacement = replacer(self, obj, field, currentval)
            setattr(obj, attname, replacement)
685091
def update(self, iterable):
        """"""
        if isinstance(iterable, RangeSet):
            # keep padding unless is has not been defined yet
            if self.padding is None and iterable.padding is not None:
                self.padding = iterable.padding
        assert type(iterable) is not str
        set.update(self, iterable)
757920
def replace(self, request, id):
        """"""
        try:
            object = self.model.objects.get(id=id)
        except self.model.DoesNotExist:
            return self._render(
                request = request,
                template = '404',
                context = {
                    'error': 'The %s could not be found.' % self.model.__name__.lower()
                },
                status = 404,
                prefix_template_path = False
            )

        form = (self.form or generate_form(self.model))(request.PUT, instance=object)

        if form.is_valid():
            object = form.save()

            return self.show(request, id)
        else:
            return self._render(
                request = request,
                template = 'edit',
                context = {
                    'form': form
                },
                status = 400
            )
1102136
def replace!(oth)
      if self.class != oth.class
        raise ArgumentError, "expected #{self.class} object"
      end

      component.each do |c|
        self.__send__("#{c}=", oth.__send__(c))
      end
    end
1341536
def _replace_nan(a, val):
    
    mask = isnull(a)
    return where_method(val, mask, a), mask
57649
function(str, obj) {
    var replacer = function(wholeMatch, key) {
      return obj[key] === undefined ? wholeMatch : obj[key];
    },
    regexp = new RegExp('{{\\s*([a-z0-9-_]+)\\s*}}',"ig");

    for(var beforeReplace = ""; beforeReplace !== str; str = (beforeReplace = str).replace(regexp, replacer)){

    }
    return str;
  }
360839
def replace_each(text, items, count=None, strip=False):
    '''
    
    '''
    for a,b in items:
        text = replace(text, a, b, count=count, strip=strip)
    return text