Configures a new model, updates an existing model's settings, or updates global settings
4294
function config(name, options) {
    if (isObject(name)) {
      extend(global, name);
      return;
    }
    var previous = (registry[name] && registry[name].$config) ? registry[name].$config() : null,
        base = extend({}, previous ? extend({}, previous) : extend({}, DEFAULTS, DEFAULT_METHODS));

    options = deepExtend(copy(base), options);

    if (!options.url) {
      options.url = global.base.replace(/\/$/, '') + '/' + hyphenate(name);
    }
    registry[name] = new ModelClass(options);
  }
609195
def set_model(self, model):
        
        if self.model:
            self.model.unregister_observer(self)
        self.model = model
        if self.model:
            self.model.register_observer(self)
            self.model_notification()
        else:
            self.set_widget(None)
        self.widget.set_sensitive(bool(self.model))
537332
def main(global_config, **settings):
    
    if sys.version_info[0] < 3:
        reload(sys)
        sys.setdefaultencoding('utf-8')

    settings = dict(settings)
    # Scoping sessions for Pyramid ensure session are commit/rollback
    # after the template has been rendered
    create_engine(settings, scoped=True)

    authn_policy = RouteSwitchAuthPolicy(secret=settings['pyshop.cookie_key'],
                                         callback=groupfinder)
    authz_policy = ACLPolicy()
    route_prefix = settings.get('pyshop.route_prefix')

    config = Configurator(settings=settings,
                          root_factory=RootFactory,
                          route_prefix=route_prefix,
                          locale_negotiator=locale_negotiator,
                          authentication_policy=authn_policy,
                          authorization_policy=authz_policy)
    config.end()

    return config.make_wsgi_app()
1092959
function Model(name, config) {
	this.name = name;

	utils.defaultsDeep(config, {
		attributes: {},
		sharedMethods: {},
		clientMethods: {},
		serverMethods: {},
		hooks: {},
		options: {
			allowREST: true,
			middlewares: [],
			generateClientModel: true,
			hooks: {}
		},
		relationships: {}
	});

	//Copy all configs to the model object
	for(var c in config) {
		if(config.hasOwnProperty(c)) {
			this[c] = config[c];
		}
	}

	return this;
}
1047769
def initialise():
    
    global settings, project_settings

    # Global changes settings
    settings = Changes.load()

    # Project specific settings
    project_settings = Project.load(GitHubRepository(auth_token=settings.auth_token))
219251
function(cb) {
        var method = cb ? 'on' : 'off';
        this[method]('change', function(model) {
          var newModel = this._updateModel(model);
          if(_.isFunction(cb)){
            cb.call(this, newModel);
          }
        }, this);
      }
526360
def updateModel(self, X_all, Y_all, X_new, Y_new):
        
        if self.model is None:
            self._create_model(X_all, Y_all)
        else:
            self.model.set_XY(X_all, Y_all)

        # WARNING: Even if self.max_iters=0, the hyperparameters are bit modified...
        if self.max_iters > 0:
            # --- update the model maximizing the marginal likelihood.
            if self.optimize_restarts==1:
                self.model.optimize(optimizer=self.optimizer, max_iters = self.max_iters, messages=False, ipython_notebook=False)
            else:
                self.model.optimize_restarts(num_restarts=self.optimize_restarts, optimizer=self.optimizer, max_iters = self.max_iters, verbose=self.verbose)
218651
def update_settings(self, settings):
        
        new_settings = copy.copy(self._settings)
        new_settings.update(settings)
        if self.settings != new_settings:
            yield from self._stop()
            self._settings = settings
            self._controller.save()
            if self.enable:
                yield from self.start()
        else:
            # When user fix something on his system and try again
            if self.enable and not self.current_engine().running:
                yield from self.start()
681786
def set_model(self, model):
        '''
        
        '''
        self.model = model
        if self.model:
            self.model.set_notification_handler(self)
            self.handle_stage_changed(model)
        return self
505284
def set_settings(new_settings, options = {}, request_options = {})
      client.put(Protocol.settings_uri(name, options), new_settings.to_json, :write, request_options)
    end
1003172
def _setup(self, request):
        '''
        
        '''

        # Get details from self
        info = model_inspect(self)
        self._appname = getattr(self, 'appname', info['appname'])
        self._modelname = getattr(self, 'modelname', info['modelname'])

        # Get user information
        if not hasattr(self, 'user'):
            self.user = self.request.user
        # Get profile
        self.profile = get_profile(self.user)

        # Get language
        self.language = get_language()

        # Default value for no foreign key attribute
        if 'no_render_as_foreign' not in self.extra_context:
            self.extra_context['no_render_as_foreign'] = []
187551
def configure(cls, global_, key, val):
        
        # first retrieve current configuration
        scope = 'global' if global_ else 'local'
        if scope not in cls._conffiles:
            cls._conffiles[scope] = {}
        config = cls._conffiles.get(scope, {})
        # apply modification to fields
        cls._set(scope, key, val)
        conf_file = cls.home_config if global_ else cls.local_config
        # save configuration to file
        cls.save(os.path.expanduser(conf_file), config)
401084
function configure(options) {
    if (options && isArray(options.globalMessages)) {
        globalMessages = options.globalMessages;
    }
    if (options && isObject(options.errorTypes)) {
        errorTypes = options.errorTypes;
    }
}
1179320
function update(model) {
  var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

  if (!model) {
    throw new Error('No model provided.');
  }
  var currentState = model.toJSON({ shallow: true });
  currentState.id = String(currentState.id);

  return _destructure2['default'](model, params).then(function (destructured) {
    var attributes = destructured.attributes;
    var relations = destructured.relations;

    return _transact2['default'](model, function (transaction) {
      return model.save(attributes, {
        patch: true,
        method: 'update',
        transacting: transaction
      }).tap(function (model) {
        return _relate2['default'](model, relations, 'update', transaction);
      }).then(function (model) {
        // if model didn't change, return null
        // model.previousAttributes() is broken.
        // https://github.com/tgriesser/bookshelf/issues/326
        var updatedState = model.toJSON({ shallow: true });
        updatedState.id = String(updatedState.id);
        return _lodash2['default'].isEqual(currentState, updatedState) ? null : model;
      });
    });
  });
}
1176170
function(model, options) {
      options = options ? _.clone(options) : {};
      var wait = options.wait;
      model = this._prepareModel(model, options);
      if (!model) return false;
      if (!wait) this.add(model, options);
      var collection = this;
      var success = options.success;
      options.success = function(m, resp, callbackOpts) {
        if (wait) collection.add(m, callbackOpts);
        if (success) success.call(callbackOpts.context, m, resp, callbackOpts);
      };
      model.save(null, options);
      return model;
    }
36645
def configure(settings: Settings):
    
    if not settings or not isinstance(settings, Settings):
        raise TypeError('Settings is expected to be non-None and of type Settings')
    global SETTINGS  # pylint: disable=global-statement
    SETTINGS = settings
697524
def update_model_params(self, **params):
        """
        for key, value in params.items():
            if not hasattr(self, key):
                setattr(self, key, value)  # set parameter for the first time.
            elif getattr(self, key) is None:
                setattr(self, key, value)  # update because this parameter is still None.
            elif value is not None:
                setattr(self, key, value)