Wrapper function so that the default mapping is only built when needed
332651
def get_default_locale_callable():
    
    exec_dir = os.path.dirname(os.path.realpath(__file__))
    xml_path = os.path.join(exec_dir, 'data', 'FacebookLocales.xml')

    fb_locales = _build_locale_table(xml_path)

    def default_locale(request):
        """
        Guess an appropiate FB locale based on the active Django locale.
        If the active locale is available, it is returned. Otherwise,
        it tries to return another locale with the same language. If there
        isn't one avaible, 'en_US' is returned.
        """
        chosen = 'en_US'
        language = get_language()
        if language:
            locale = to_locale(language)
            lang, _, reg = locale.partition('_')

            lang_map = fb_locales.get(lang)
            if lang_map is not None:
                if reg in lang_map['regs']:
                    chosen = lang + '_' + reg
                else:
                    chosen = lang + '_' + lang_map['default']
        return chosen

    return default_locale
1102260
function remapLoadRecord(load, mapFunction) {
    load = extend({}, load);
    load.name = mapFunction(load.name, load.name);
    var depMap = {};
    Object.keys(load.depMap).forEach(function(dep) {
      depMap[dep] = mapFunction(load.depMap[dep], dep);
    });
    load.depMap = depMap;
    return load;
  }
1211383
public static <K, V> V getIfAbsentDefault(Map<K, V> map, K key, V defaultValue)
    {
        V result = map.get(key);
        if (MapIterate.isAbsent(result, map, key))
        {
            result = defaultValue;
        }
        return result;
    }
238978
private boolean isMappingUsingDefault(String path, String mapping) {

        String key = path + ":" + mapping;
        return m_mappingsUsingDefault.contains(key);
    }
1360932
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  if (_.isArray(objValue)) { // don't merge arrays
    return srcValue;
  } else if (_.isObject(objValue) && objValue._mergeStrategy == 'replace') {
    if (_.isObject(srcValue)) {
      Object.defineProperty(srcValue, '_mergeStrategy', {
        value: 'replace', configurable: true
      });
    }
    return srcValue;
  }
  else if (_.isObject(srcValue) && srcValue._mergeStrategy == 'replace') {
    return srcValue;
  }
  return undefined;
}
1161290
def allow_bare_decorator(cls):
    

    @wraps(cls)
    def wrapper(*args, **kwargs):
        """"Wrapper for real decorator"""

        # If we weren't only passed a bare class, return class instance
        if kwargs or len(args) != 1 or not isclass(args[0]):  # pylint: disable=no-else-return
            return cls(*args, **kwargs)
        # Otherwise, pass call to instance with default values
        else:
            return cls()(args[0])

    return wrapper
1015743
def _constructor(cls, mapping, configuration):
        
        sequence_type, default_factory, pass_key = configuration
        return cls(default_factory, mapping, sequence_type=sequence_type,
                   pass_key=pass_key)
279332
def inject_default_call(self, high):
        '''
        
        '''
        for chunk in high:
            state = high[chunk]
            if not isinstance(state, collections.Mapping):
                continue
            for state_ref in state:
                needs_default = True
                if not isinstance(state[state_ref], list):
                    continue
                for argset in state[state_ref]:
                    if isinstance(argset, six.string_types):
                        needs_default = False
                        break
                if needs_default:
                    state[state_ref].insert(-1, '__call__')
1150698
function loadAdapterMap(opts) {
        var defaultMap = { service: 'default' };
        var adapterMap = {};
        _.extend(adapterMap, opts.adapterMap, defaultMap);
        return adapterMap;
    }
864037
def set_default(*params):
    
    p0 = params[0]
    agg = p0 if p0 or _get(p0, CLASS) in data_types else {}
    for p in params[1:]:
        p = unwrap(p)
        if p is None:
            continue
        _all_default(agg, p, seen={})
    return wrap(agg)
1200498
def wrap_default(self, data, renderer_context):
        

        wrapper = self.dict_class()
        view = renderer_context.get("view", None)
        request = renderer_context.get("request", None)

        model = self.model_from_obj(view)
        resource_type = self.model_to_resource_type(model)

        if isinstance(data, list):
            many = True
            resources = data
        else:
            many = False
            resources = [data]

        items = []
        links = self.dict_class()
        linked = self.dict_class()
        meta = self.dict_class()

        for resource in resources:
            converted = self.convert_resource(resource, data, request)
            item = converted.get('data', {})
            linked_ids = converted.get('linked_ids', {})
            if linked_ids:
                item["links"] = linked_ids
            items.append(item)

            links.update(converted.get('links', {}))
            linked = self.update_nested(linked,
                                        converted.get('linked', {}))
            meta.update(converted.get('meta', {}))

        if many:
            wrapper[resource_type] = items
        else:
            wrapper[resource_type] = items[0]

        if links:
            links = self.prepend_links_with_name(links, resource_type)
            wrapper["links"] = links

        if linked:
            wrapper["linked"] = linked

        if meta:
            wrapper["meta"] = meta

        return wrapper
806678
def url_defaults(self, func: Callable, name: AppOrBlueprintKey=None) -> Callable:
        
        self.url_default_functions[name].append(func)
        return func
194770
function withoutRedundantParameters( place, parameters ) {
   const { defaultParameters = {} } = place;
   const remainingParameters = {};
   forEach( parameters, ( value, key ) => {
      if( !( key in defaultParameters ) || defaultParameters[ key ] !== value ) {
         remainingParameters[ key ] = value;
      }
   } );
   return remainingParameters;
}
641390
def hasDefault(self, param):
        
        param = self._resolveParam(param)
        return param in self._defaultParamMap
368776
def _only_main(func):
    """"""
    @wraps(func)
    def wrapper(self, *args, **kwargs):
        if not self.is_main:
            return getattr(self.main, func.__name__)(*args, **kwargs)
        return func(self, *args, **kwargs)
    return wrapper
857987
def _init_map(self, record_types=None, **kwargs):
        """"""

        osid_objects.OsidSourceableForm._init_map(self)
        osid_objects.OsidObjectForm._init_map(self, record_types=record_types)
        self._my_map['copyrightRegistration'] = self._copyright_registration_default
        self._my_map['assignedRepositoryIds'] = [str(kwargs['repository_id'])]
        self._my_map['copyright'] = self._copyright_default
        self._my_map['title'] = self._title_default
        self._my_map['distributeVerbatim'] = self._distribute_verbatim_default
        self._my_map['createdDate'] = self._created_date_default
        self._my_map['distributeAlterations'] = self._distribute_alterations_default
        self._my_map['principalCreditString'] = self._principal_credit_string_default
        self._my_map['publishedDate'] = self._published_date_default
        self._my_map['sourceId'] = self._source_default
        self._my_map['providerLinkIds'] = self._provider_links_default
        self._my_map['publicDomain'] = self._public_domain_default
        self._my_map['distributeCompositions'] = self._distribute_compositions_default
        self._my_map['compositionId'] = self._composition_default
        self._my_map['published'] = self._published_default
        self._my_map['assetContents'] = []
341671
def _generate_field_with_default(**kwargs):
        """"""
        field = kwargs['field']
        if callable(field.default):
            return field.default()
        return field.default