Map an object's values, replacing existing ones.
436088
function mapObjectInPlace(o, fn, ctxt) {
  for (let key in o) {
    if (o.hasOwnProperty(key)) {
      o[key] = fn.call(ctxt, o[key], key, o);
    }
  }
  return o;
}
181463
def update_mappings(self):
        """"""
        self.pos2id = dict((v, k) for k, v in self.id2pos.iteritems())
        assert len(self.pos2id) == len(self.id2pos), "duplicate ids or positions detected"
1304152
function (object) {
            var index = this.data.indexOf(object);
            if (index !== -1) {
                this.data.splice(index, 1);
            }
            this.eachMap(function (map, mapName) {
                this.removeObjectFromMap(mapName, object);
            });
            delete this.mapValues[object.id];
            return this;
        }
700102
def _map(value, istart, istop, ostart, ostop):
    
    return ostart + (ostop - ostart) * ((value - istart) / (istop - istart))
555723
def map(self, options=None):
        """"""
        for path, data in self.paths.items():
            for obj in self.create_class(data, options=options):
                self.add_object(obj)
904823
function replaceParams(ast, keys) {
  Object.keys(ast)
    .filter(key => {
      const value = ast[key]
      return Array.isArray(value) || (typeof value === 'object' && value !== null)
    })
    .forEach(key => {
      const expr = ast[key]

      if (!(typeof expr === 'object' && expr.type === 'param')) return replaceParams(expr, keys)

      if (typeof keys[expr.value] === 'undefined') throw new Error(`no value for parameter :${expr.value} found`)
      ast[key] = createValueExpr(keys[expr.value])
      return null
    })

  return ast
}
1123973
public static Map<String, Object> replaceDataReferences(final Map<String, Object> input,
                                                             final Map<String, Map<String, String>> data,
                                                            Converter<String, String> converter,
                                                            boolean failIfUnexpanded,
                                                            boolean blankIfUnexpanded
    )
    {
        final HashMap<String, Object> output = new HashMap<>();
        for (final String s : input.keySet()) {
            Object o = input.get(s);
            output.put(s, replaceDataReferencesInObject(o, data, converter, failIfUnexpanded, blankIfUnexpanded));
        }
        return output;
    }
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)
912911
def update_mapping(self):
        
        """
        self.mapping = dict([(f.name, f) for f in iter(self)])
1242495
function replaceStringPlaceholders(string, args) {
    for (var i = 1; i < args.length; i++) {
        var value = args[i];
        if (typeof value === "object") {
            value = JSON.stringify(value);
        }

        string = string.replace("{}", value);
    }

    return string;
}
710237
private String replaceProperties(String message, Map<String, String> map) {
        if (map != null) {
            for (Entry<String, String> entr : map.entrySet()) {
                message = StringUtils.replace(message, "@{" + entr.getKey() + "}", entr.getValue());
            }
        }
        return message;
    }
1112605
function mapValues (mapping) {
      var result = {}
      for (var property in mapping) {
        result[property] = parseInt(values[mapping[property]], 10)
      }
      return result
    }
244894
def update(self, f):
        """"""

        for p in self.__mapper__.attrs:

            if p.key == 'oid':
                continue
            try:
                setattr(self, p.key, getattr(f, p.key))

            except AttributeError:
                # The dict() method copies data property values into the main dict,
                # and these don't have associated class properties.
                continue
1173090
protected void replaceValue(Map<String, Object> content, String key, Object value) {
		if (content.containsKey(key) && value != null) {
			content.put(key, value);
		}
	}
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
719226
def map_values(f, D):
    ''''''
    return { key:f(val) for key,val in D.iteritems() }
243873
def _remap_fields(cls, kwargs):
        """"""
        mapped = {}
        for key in kwargs:
            if key in cls._remap:
                mapped[cls._remap[key]] = kwargs[key]
            else:
                mapped[key] = kwargs[key]
        return mapped