Create a fallback preference object,
        This is used when you have model instances that do not match
        any registered preferences, see #41
978832
def _fallback(self, section_name, pref_name):
        
        message = (
            'Creating a fallback preference with ' +
            'section "{}" and name "{}".' +
            'This means you have preferences in your database that ' +
            'don\'t match any registered preference. ' +
            'If you want to delete these entries, please refer to the ' +
            'documentation: https://django-dynamic-preferences.readthedocs.io/en/latest/lifecycle.html')  # NOQA
        warnings.warn(message.format(section_name, pref_name))

        class Fallback(MissingPreference):
            section = Section(name=section_name) if section_name else None
            name = pref_name
            default = ''
            help_text = 'Obsolete: missing in registry'

        return Fallback()
488226
private void initializeOverrideBackButton(final SharedPreferences sharedPreferences) {
        String key = getString(R.string.override_navigation_icon_preference_key);
        boolean defaultValue = Boolean.valueOf(
                getString(R.string.override_navigation_icon_preference_default_value));
        boolean overrideNavigationIcon = sharedPreferences.getBoolean(key, defaultValue);
        overrideNavigationIcon(overrideNavigationIcon);
    }
984645
def get_fallback_language(self, language_code=None, site_id=None):
        
        choices = self.get_active_choices(language_code, site_id=site_id)
        if choices and len(choices) > 1:
            # Still take the last, like previous code.
            # With multiple fallback languages that means taking the base language.
            # Hence, upgrade the code to use get_fallback_languages() instead.
            return choices[-1]
        else:
            return None
1114284
function preferencesGet(name) {
    return this.initializedPromise.then(function () {
      var defaultValue = DEFAULT_PREFERENCES[name];

      if (defaultValue === undefined) {
        throw new Error('preferencesGet: \'' + name + '\' is undefined.');
      } else {
        var prefValue = this.prefs[name];

        if (prefValue !== undefined) {
          return prefValue;
        }
      }
      return defaultValue;
    }.bind(this));
  }
633936
def manager(self, **kwargs):
        """"""
        return PreferencesManager(registry=self, model=self.preference_model, **kwargs)
1357373
def _create_model(self, view_getter=None, source_getters=None,
                      model_factory=None, officer=None):
        

        if view_getter is not None:
            d = defer.succeed(view_getter)
            d.addCallback(self._retrieve_view)
            d.addCallback(self._check_view)
        else:
            # views are inherited
            d = defer.succeed(self.model.view)

        d.addCallback(self._retrieve_model, source_getters,
                      model_factory, officer)

        d.addErrback(self._filter_errors)
        return d
1025432
def create(model: ModelFactory, discount_factor: float, target_update_frequency: int,
           max_grad_norm: float, double_dqn: bool = False):
    
    return DistributionalDeepQLearning(
        model_factory=model,
        discount_factor=discount_factor,
        double_dqn=double_dqn,
        target_update_frequency=target_update_frequency,
        max_grad_norm=max_grad_norm
    )
133233
public void rollback(List<Type> saved_undet) {
        Assert.check(saved_undet != null);
        //restore bounds (note: we need to preserve the old instances)
        ListBuffer<Type> newUndetVars = new ListBuffer<>();
        ListBuffer<Type> newInferenceVars = new ListBuffer<>();
        while (saved_undet.nonEmpty() && undetvars.nonEmpty()) {
            UndetVar uv = (UndetVar)undetvars.head;
            UndetVar uv_saved = (UndetVar)saved_undet.head;
            if (uv.qtype == uv_saved.qtype) {
                uv_saved.dupTo(uv, types);
                undetvars = undetvars.tail;
                saved_undet = saved_undet.tail;
                newUndetVars.add(uv);
                newInferenceVars.add(uv.qtype);
            } else {
                undetvars = undetvars.tail;
            }
        }
        undetvars = newUndetVars.toList();
        inferencevars = newInferenceVars.toList();
    }
359640
def user_preference_form_builder(instance, preferences=[], **kwargs):
    
    return preference_form_builder(
        UserPreferenceForm,
        preferences,
        model={'instance': instance},
        **kwargs)
154793
def get_object(self, queryset=None):
        
        if queryset is None:
            queryset = self.get_queryset()

        slug = self.kwargs[self.slug_url_kwarg]
        choices = self.get_language_choices()

        obj = None
        using_fallback = False
        prev_choices = []
        for lang_choice in choices:
            try:
                # Get the single item from the filtered queryset
                # NOTE. Explicitly set language to the state the object was fetched in.
                filters = self.get_translated_filters(slug=slug)
                obj = queryset.translated(lang_choice, **filters).language(lang_choice).get()
            except ObjectDoesNotExist:
                # Translated object not found, next object is marked as fallback.
                using_fallback = True
                prev_choices.append(lang_choice)
            else:
                break

        if obj is None:
            tried_msg = ", tried languages: {0}".format(", ".join(choices))
            error_message = translation.ugettext("No %(verbose_name)s found matching the query") % {'verbose_name': queryset.model._meta.verbose_name}
            raise Http404(error_message + tried_msg)

        # Object found!
        if using_fallback:
            # It could happen that objects are resolved using their fallback language,
            # but the actual translation also exists. Either that means this URL should
            # raise a 404, or a redirect could be made as service to the users.
            # It's possible that the old URL was active before in the language domain/subpath
            # when there was no translation yet.
            for prev_choice in prev_choices:
                if obj.has_translation(prev_choice):
                    # Only dispatch() and render_to_response() can return a valid response,
                    # By breaking out here, this functionality can't be broken by users overriding render_to_response()
                    raise FallbackLanguageResolved(obj, prev_choice)

        return obj
1085391
def preferences_class_prepared(sender, *args, **kwargs):
    
    cls = sender
    if issubclass(cls, Preferences):
        # Add singleton manager to subclasses.
        cls.add_to_class('singleton', SingletonManager())
        # Add property for preferences object to preferences.preferences.
        setattr(preferences.Preferences, cls._meta.object_name, property(lambda x: cls.singleton.get()))
63675
def fallbackPackage(package_name, fallback_package_name):
    '''
    
    
    '''
    importer = Finder(package_name, fallback_package_name)
    sys.meta_path.append(importer)
1011583
def _setDefault(self, **kwargs):
        
        for param, value in kwargs.items():
            p = getattr(self, param)
            if value is not None and not isinstance(value, JavaObject):
                try:
                    value = p.typeConverter(value)
                except TypeError as e:
                    raise TypeError('Invalid default param value given for param "%s". %s'
                                    % (p.name, e))
            self._defaultParamMap[p] = value
        return self
702633
def parse_fallback(self):
        """"""
        if self.strict:
            raise PywavefrontException("Unimplemented OBJ format statement '%s' on line '%s'"
                                       % (self.values[0], self.line.rstrip()))
        else:
            logger.warning("Unimplemented OBJ format statement '%s' on line '%s'"
                            % (self.values[0], self.line.rstrip()))
166490
function merge(obj, fallbackObj) {
			var name, value, fallbackValue;

			if ( !fallbackObj ) {
				return;
			}

			for ( name in fallbackObj ) {

				if ( fallbackObj.hasOwnProperty(name) ) {

					value = obj[ name ];
					fallbackValue = fallbackObj[ name ];

					if ( value === undefined ) {
						// 'undefined': value doesn't exist in delta, so take it from the fallback object
						// Note: undefined is not a valid value in JSON, so we can't misunderstand an existing undefined
						obj[name] = fallbackValue;
					} else if ( value === null ) {
						// 'null' is used by the delta tooling as a marker that a value must not be taken form the fallback
						delete obj[name];
					} else if ( typeof value === 'object' && typeof fallbackValue === 'object' ) {
						// both values are objects, merge them recursively
						merge(value, fallbackValue);
					}

				}

			}

		}
946487
protected function fallbackValue($value, $fValue, $fKey)
    {
        return $value != null ? $value : $this->checkValue($fValue, $fKey);
    }
1290288
def update_preferences
        if @preferences_changed
          @preferences_changed.each do |group, preferences|
            group_id, group_type = Preference.split_group(group)
            
            preferences.keys.each do |name|
              # Find an existing preference or build a new one
              attributes = {:name => name, :group_id => group_id, :group_type => group_type}
              preference = find_preferences(attributes).first || stored_preferences.build(attributes)
              preference.value = preferred(name, group)
              preference.save!
            end
          end
          
          @preferences_changed.clear
        end
      end