Apply this theme to a model.

        .. warning::
            Typically, don't call this method directly. Instead, set the theme
            on the :class:`~bokeh.document.Document` the model is a part of.
762726
def apply_to_model(self, model):
        ''' 

        '''
        model.apply_theme(self._for_class(model.__class__))

        # a little paranoia because it would be Bad(tm) to mess
        # this up... would be nicer if python had a way to freeze
        # the dict.
        if len(_empty_dict) > 0:
            raise RuntimeError("Somebody put stuff in _empty_dict")
794667
def apply(self, ax):
        
        for th in self.themeables.values():
            th.apply(ax)
265582
def apply(self, doc, clear, **kwargs):
        

        # Reattach doc with the current session or DetachedInstanceError happens
        doc = self.session.merge(doc)
        # Iterate over each mention class
        for i, mention_class in enumerate(self.mention_classes):
            tc_to_insert = defaultdict(list)
            # Generate TemporaryContexts that are children of the context using
            # the mention_space and filtered by the Matcher
            self.child_context_set.clear()
            for tc in self.matchers[i].apply(self.mention_spaces[i].apply(doc)):
                rec = tc._load_id_or_insert(self.session)
                if rec:
                    tc_to_insert[tc._get_table()].append(rec)
                self.child_context_set.add(tc)

            # Bulk insert temporary contexts
            for table, records in tc_to_insert.items():
                stmt = insert(table.__table__).values(records)
                self.session.execute(stmt)

            # Generates and persists mentions
            mention_args = {"document_id": doc.id}
            for child_context in self.child_context_set:
                # Assemble mention arguments
                for arg_name in mention_class.__argnames__:
                    mention_args[arg_name + "_id"] = child_context.id

                # Checking for existence
                if not clear:
                    q = select([mention_class.id])
                    for key, value in list(mention_args.items()):
                        q = q.where(getattr(mention_class, key) == value)
                    mention_id = self.session.execute(q).first()
                    if mention_id is not None:
                        continue

                # Add Mention to session
                yield mention_class(**mention_args)
904972
def setModel( self, model ):
        
        if model == self._model:
            return False
            
        self._model = model
        
        if not self._record and model:
            self._record = model()
        
        if model:
            uifile = model.schema().property('uifile')
            if ( uifile ):
                self.setUiFile(uifile)
        
        self.rebuild()
        
        return True
376962
def set(self, models):
        
        # Do not add None values to selection
        if models is None:
            models = set()

        models = self._check_model_types(models)
        if len(models) > 1:
            models = reduce_to_parent_states(models)

        self._selected = set(models)
1995
def theme_set(new):
    
    if (not isinstance(new, theme) and
            not issubclass(new, theme)):
        raise PlotnineError("Expecting object to be a theme")

    out = get_option('current_theme')
    set_option('current_theme', new)
    return out
767723
def apply(self, builder):
        """"""

        if 'theme' in self.attributes:
            builder.apply_theme(
                self.attributes['theme'],
                builder.theme_options,
            )
825566
def contribute_to_class(self, model, name, **kwargs):
        
        super(LocalizedField, self).contribute_to_class(model, name, **kwargs)
        setattr(model, self.name, self.descriptor_class(self))
251993
function applyModelFields (model, definition) {
	for (var field in definition.fields) {
		if (field === 'definition') {
			throw new Error('Invalid model definition provided. "definition" is a reserved word');
		}
		addProperty(model, field, definition.fields[field]);
	}
}
475111
def apply_figure(self, figure):
        
        for th in self.themeables.values():
            th.apply_figure(figure)
1165169
def set_theme(self, theme):
        
        if theme in THEMES:
            self.palette = THEMES[theme]
            if self._scroll_bar:
                # TODO: fix protected access.
                self._scroll_bar._palette = self.palette
464009
def document_to_model(document)
      identity_map.retrieve_or_store model_class, document.key do
        model = model_class.new(document.to_h)

        model.key = document.key
        model.rev = document.revision

        handle_related_documents(model)

        model
      end
    end
1239182
def set(self, model, property_name, value):
        
        if type(model) is dict:
            model[property_name] = value
        elif hasattr(model, 'set_' + property_name):
            setter = getattr(model, 'set_' + property_name)
            setter(value)
        else:
            try:
                setattr(model, property_name, value)
            except AttributeError:
                pass
930118
def setModel(self, model):
        
        self.paramList.setModel(model)
        model.hintRequested.connect(self.hintRequested)
        model.rowsInserted.connect(self.updateTitle)
        model.rowsRemoved.connect(self.updateTitle)
        self.updateTitle()
667152
def apply(self, *args, **kwargs):
        
        return self.__class__(self._frame.apply(*args, **kwargs),
                              metadata=self.metadata,
                              _metadata=self._metadata)
90698
def add_model(self, model):
        
        if model.identity not in self._models.keys():
            self._models[model.identity] = model
        else:
            raise ValueError("{} has already been defined".format(model.identity))
42642
def apply_style(*style_names)
      if style_names
        selected.each do |selected_view|
          style_names.each do |style_name|
            apply_style_to_view selected_view, style_name
          end
        end
      end
      self
    end