Avro map.

Represented as vanilla objects.
190225
function MapType(attrs, opts) {
  Type.call(this);

  if (!attrs.values) {
    throw new Error(f('missing map values: %j', attrs));
  }
  this._values = createType(attrs.values, opts);

  // Addition by Edwin Elia
  var keys = attrs.keys;
  if (!keys) {
    keys = 'string';
  }
  this._keys = createType(keys, opts);
}
363700
def map_leafs(func, mapping):
    """"""

    def _inner(mapping, path=None):
        if path is None:
            path = []

        for key, val in mapping.items():
            if isinstance(val, collections.Mapping):
                _inner(val, path + [key])
            else:
                mapping[key] = func(val, path=path+[key])

        return mapping

    return _inner(copy.deepcopy(mapping))
1195964
static Map<String, Object> valueAsMap(Map<String, Object> map, Key key, Map<String, Object> defaultValue) {
        if (map.containsKey(key.key)) {
            Object rawOrMap = map.get(key.key);
            if (rawOrMap instanceof Map) {
                @SuppressWarnings("unchecked")
                Map<String, Object> submap = (Map<String, Object>) rawOrMap;
                return submap;
            } else {
                return defaultValue;
            }
        }
        return defaultValue;
    }
1269385
def map_representer(dumper, value):
    

    value = ODict(value.items())

    if len(value.keys()) == 1:
        key = list(value.keys())[0]

        if key in CONVERTED_SUFFIXES:
            return fn_representer(dumper, key, value[key])

        if key.startswith(FN_PREFIX):
            return fn_representer(dumper, key[4:], value[key])

    return dumper.represent_mapping(TAG_MAP, value, flow_style=False)
741069
function map(obj, callback) {
  var result = {};
  for (var key in obj) {
    if (Object.prototype.hasOwnProperty.call(obj, key)) {
      if (typeof callback === 'function') {
        result[key] = callback.call(obj, obj[key], key, obj);
      }
    }
  }
  return result;
}
1320532
private Collection<HColumn<String, byte[]>> createColumnSet(Object obj) {
    Map<String, HColumn<String, byte[]>> map = createColumnMap(obj);
    if (null != map) {
      return map.values();
    } else {
      return null;
    }
  }
288872
private Object newMap(Object obj, Element node) throws Exception {
		String id = getAttribute(node, "id");

		Map<Object, Object> map = new HashMap<>();
		if (id != null) {
			_idMap.put(id, map);
		}

		Element[] children = getChildren(node);
		for (int i = 0; i < children.length; i++) {

			Element element = children[i];

			if (!element.getTagName().equals("Entry")) {
				throw new IllegalStateException("Not an Entry");
			}

			Element key = null;
			Element value = null;

			Element[] entries = getChildren(element);
			for (int j = 0; j < entries.length; j++) {
				Element item = entries[j];
				if (!item.getTagName().equals("Item")) {
					throw new IllegalStateException("Not an Item");
				}
				if (key == null) {
					key = item;
				} else {
					value = item;
				}
			}

			if (key == null || value == null) {
				throw new IllegalStateException("Missing Item in Entry");
			}
			String kid = getAttribute(key, "id");
			String vid = getAttribute(value, "id");

			Object k = value(obj, key);
			Object v = value(obj, value);
			map.put(k, v);

			if (kid != null) {
				_idMap.put(kid, k);
			}
			if (vid != null) {
				_idMap.put(vid, v);
			}
		}

		return map;
	}
633592
def _get_avro_type(val):
    
    if isinstance(val, dict):
        assert val.get("class") == "File" or "File" in val.get("class")
        return "File"
    elif isinstance(val, (tuple, list)):
        types = []
        for ctype in [_get_avro_type(v) for v in val]:
            if isinstance(ctype, dict):
                nested_types = [x["items"] for x in types if isinstance(x, dict)]
                if ctype["items"] not in nested_types:
                    if isinstance(ctype["items"], (list, tuple)):
                        for t in ctype["items"]:
                            if t not in types:
                                types.append(t)
                    else:
                        if ctype not in types:
                            types.append(ctype)
            elif isinstance(ctype, (list, tuple)):
                for x in ctype:
                    if x not in types:
                        types.append(x)
            elif ctype not in types:
                types.append(ctype)
        # handle empty types, allow null
        if len(types) == 0:
            types = ["null"]
            # empty lists
            if isinstance(val, (list, tuple)) and len(val) == 0:
                types.append({"type": "array", "items": ["null"]})
        types = _avoid_duplicate_arrays(types)
        # Avoid empty null only arrays which confuse some runners
        if len(types) == 1 and types[0] == "null":
            types.append("string")
        return {"type": "array", "items": (types[0] if len(types) == 1 else types)}
    elif val is None:
        return ["null"]
    # encode booleans as string True/False and unencode on other side
    elif isinstance(val, bool) or isinstance(val, six.string_types) and val.lower() in ["true", "false", "none"]:
        return ["string", "null", "boolean"]
    elif isinstance(val, int):
        return "long"
    elif isinstance(val, float):
        return "double"
    else:
        return "string"
1312562
function mapObject(o, fn, ctxt) {
  var result = {};
  for (var key in o) {
    if (o.hasOwnProperty(key)) {
      result[key] = fn.call(ctxt, o[key], key, o);
    }
  }
  return result;
}
1061691
function map(obj, cb, context) {
    if (!(obj && cb)) {
        return;
    }
    if (obj.map && obj.map === nativeMap) {
        return obj.map(cb, context);
    }
    else {
        var result = [];
        for (var i = 0, len = obj.length; i < len; i++) {
            result.push(cb.call(context, obj[i], i, obj));
        }
        return result;
    }
}
348280
function map(arr, iter) {
    if (Immutable.Map.isMap(arr)) {
        var type = 'Map';
        if (Immutable.OrderedMap.isOrderedMap(arr)) {
            type = 'OrderedMap';
        }

        return mapAsList(arr, function(value, key) {
            return Q(iter(value, key))
            .then(function(result) {
                return [key, result];
            });
        })
        .then(function(result) {
            return Immutable[type](result);
        });
    } else {
        return mapAsList(arr, iter)
        .then(function(result) {
            return Immutable.List(result);
        });
    }
}
796769
def to_map_with_default(value, default_value):
        
        result = RecursiveMapConverter.to_nullable_map(value)
        return result if result != None else default_value
529427
function objectToMap(obj, path, map) {
  path = path ? path + '/' : '';
  map = map || {};
  for (let key of Object.keys(obj)) {
    let p = path + key;
    let value = obj[key];
    if (typeof value === 'object') {
      objectToMap(value, p, map);
    } else {
      map[p] = value;
    }
  }
  return map;
}
867768
function map (obj) {
  var key, val, arr = []
  for (key in obj) {
    val = obj[key]
    if (Array.isArray(val))
      for (var i = 0; i < val.length; i++)
        arr.push([key, val[i]])
    else if (typeof val === 'object')
      for (var prop in val)
        arr.push([key + '[' + prop + ']', val[prop]])
    else
      arr.push([key, val])
  }
  return arr
}
228640
def mapper(module, entry_point,
           modpath='pkg_resources', globber='root', modname='es6',
           fext=JS_EXT, registry=_utils):
    

    modname_f = modname if callable(modname) else _utils['modname'][modname]

    return {
        modname_f(modname_fragments): join(base, subpath)
        for modname_fragments, base, subpath in modgen(
            module, entry_point=entry_point,
            modpath=modpath, globber=globber,
            fext=fext, registry=_utils)
    }
368912
private Obj compileObject(Map<String, ? extends Object> m, PathMap pathMap) {
		for(String k : discardedKeys) {
			m.remove(k);
		}
		Obj res = Obj.make();
		for(Entry<String, ? extends Object> entry : m.entrySet()) {
			String k = entry.getKey();
			Object v = entry.getValue();
			if(v == null) {
				continue;
			} else if(v instanceof Collection<?>) {
				if(pathMap.isTraversable(k)) {
					Arr arr = res.arr(k);
					for(Object o : (Collection<?>)v) {
						Object x = evalScalarOrObject(k, o, pathMap);
						arr.add(x);
					}
				}
			} else {
				Object x = evalScalarOrObject(k, v, pathMap);
				if(x != null) {
					res.put(k, x);
				}
			}
		}
		return res;
	}
493650
function mapValues(object, iteratee) {
    var newObject = Object.assign({}, object);
    return Object.keys(object).reduce(function (records, key) {
        records[key] = iteratee(object[key], key, object);
        return records;
    }, newObject);
}