Remember to call _update_parameters after this
        :param source_name:
        :return:
427135
def _remove_source(self, source_name):
        

        assert source_name in self.sources, "Source %s is not part of the current model" % source_name

        source = self.sources.pop(source_name)

        if source.source_type == POINT_SOURCE:

            self._point_sources.pop(source.name)

        elif source.source_type == EXTENDED_SOURCE:

            self._extended_sources.pop(source.name)

        elif source.source_type == PARTICLE_SOURCE:

            self._particle_sources.pop(source.name)

        self._remove_child(source_name)
750870
def update_hparams_from_hparams(target_hparams, source_hparams, prefix):
  """"""
  for (param_name, param_value) in six.iteritems(source_hparams.values()):
    if param_name.startswith(prefix):
      target_hparams.set_hparam(param_name[len(prefix):], param_value)
859508
def update(self, display_name=None, display_description=None):
        
        return self.manager.update(self, display_name=display_name,
                display_description=display_description)
752819
def add_source(self, allow_alias=False, **kwargs):
        """"""
        if not allow_alias and SOURCE.ALIAS in kwargs:
            err_str = "`{}` passed in kwargs, this shouldn't happen!".format(
                SOURCE.ALIAS)
            self._log.error(err_str)
            raise RuntimeError(err_str)

        # Set alias number to be +1 of current number of sources
        if SOURCE.ALIAS not in kwargs:
            kwargs[SOURCE.ALIAS] = str(self.num_sources() + 1)
        source_obj = self._init_cat_dict(Source, self._KEYS.SOURCES, **kwargs)
        if source_obj is None:
            return None

        for item in self.get(self._KEYS.SOURCES, ''):
            if source_obj.is_duplicate_of(item):
                return item[item._KEYS.ALIAS]

        self.setdefault(self._KEYS.SOURCES, []).append(source_obj)
        return source_obj[source_obj._KEYS.ALIAS]
262056
def _update_project(self, project_name):
        ''''''
        project = self.projectdb.get(project_name)
        if not project:
            return None
        return self._load_project(project)
967497
def server_update(
    endpoint_id,
    server_id,
    subject,
    port,
    scheme,
    hostname,
    incoming_data_ports,
    outgoing_data_ports,
):
    
    client = get_client()

    server_doc = assemble_generic_doc(
        "server", subject=subject, port=port, scheme=scheme, hostname=hostname
    )

    # n.b. must be done after assemble_generic_doc(), as that function filters
    # out `None`s, which we need to be able to set for `'unspecified'`
    if incoming_data_ports:
        server_doc.update(
            incoming_data_port_start=incoming_data_ports[0],
            incoming_data_port_end=incoming_data_ports[1],
        )
    if outgoing_data_ports:
        server_doc.update(
            outgoing_data_port_start=outgoing_data_ports[0],
            outgoing_data_port_end=outgoing_data_ports[1],
        )

    res = client.update_endpoint_server(endpoint_id, server_id, server_doc)
    formatted_print(res, text_format=FORMAT_TEXT_RAW, response_key="message")
1228794
def trigger_update_by_trigger_name(self, trigger_name, data, **kwargs):
        ""
        api_path = "/api/v2/triggers/{trigger_name}"
        api_path = api_path.format(trigger_name=trigger_name)
        return self.call(api_path, method="PUT", data=data, **kwargs)
1172286
def _on_socket_push_updates(self, resp):
        
        # TODO: check to make sure resp['meta']['bundleid']==bundleid ?
        # TODO: handle added parameters
        # TODO: handle removed (isDeleted) parameters

        for item in resp['data']:
            if item['id'] in self.uniqueids:
                # then we're updating something in the parameter (or deleting)
                param = self.get_parameter(uniqueid=item['id'])
                for attr, value in item['attributes'].items():
                    if hasattr(param, "_{}".format(attr)):
                        logger.info("updates from server: setting {}@{}={}".
                                    format(attr, param.twig, value))
                        setattr(param, "_{}".format(attr), value)
            else:
                self._attach_param_from_server(item)
580890
def _get_create_update_kwargs(self, value, common_kw):
        
        kw = common_kw.copy()
        kw['body'] = value
        if '_self' in value:
            kw['headers'] = [('Location', value['_self'])]
        return kw
576714
def update(self, params, path, **kwargs):
        
        self.client.request('POST', params, path, **kwargs)
290596
def _param_updated(self, pk):
        """"""
        if self._useV2:
            var_id = struct.unpack('<H', pk.data[:2])[0]
        else:
            var_id = pk.data[0]
        element = self.toc.get_element_by_id(var_id)
        if element:
            if self._useV2:
                s = struct.unpack(element.pytype, pk.data[2:])[0]
            else:
                s = struct.unpack(element.pytype, pk.data[1:])[0]
            s = s.__str__()
            complete_name = '%s.%s' % (element.group, element.name)

            # Save the value for synchronous access
            if element.group not in self.values:
                self.values[element.group] = {}
            self.values[element.group][element.name] = s

            logger.debug('Updated parameter [%s]' % complete_name)
            if complete_name in self.param_update_callbacks:
                self.param_update_callbacks[complete_name].call(
                    complete_name, s)
            if element.group in self.group_update_callbacks:
                self.group_update_callbacks[element.group].call(
                    complete_name, s)
            self.all_update_callback.call(complete_name, s)

            # Once all the parameters are updated call the
            # callback for "everything updated" (after all the param
            # updated callbacks)
            if self._check_if_all_updated() and not self.is_updated:
                self.is_updated = True
                self.all_updated.call()
        else:
            logger.debug('Variable id [%d] not found in TOC', var_id)
560552
def source_setattr():
    

    def source_setattr(value, context, **_params):
        setattr(context["model"].source, context["key"], value)
        return _attr()

    return source_setattr
799059
def source_get(method_name):
    

    def source_get(_value, context, **_params):
        method = getattr(context["model"].source, method_name)
        return _get(method, context["key"], (), {})

    return source_get
819188
def merged_sourcekey(self, **kwargs):
        
        kwargs_copy = self.base_dict.copy()
        kwargs_copy.update(**kwargs)
        self._replace_none(kwargs_copy)        
        try:
            return NameFactory.merged_sourcekey_format.format(**kwargs_copy)
        except KeyError:
            return None
482280
def updateSourceProperty(self, name, value, source=''):
        
        # pick a decent source name
        if source == '':
            source = self.__class__.__name__

        if self.codebase != '':
            assert not isinstance(self.getProperty(name, None), str), \
                "Sourcestep %s has a codebase, other sourcesteps don't" \
                % self.name
            property_dict = self.getProperty(name, {})
            property_dict[self.codebase] = value
            super().setProperty(name, property_dict, source)
        else:
            assert not isinstance(self.getProperty(name, None), dict), \
                "Sourcestep %s does not have a codebase, other sourcesteps do" \
                % self.name
            super().setProperty(name, value, source)
1091921
def _update_param(self):
        

        """

        # Update the gamma parameter.
        if not isinstance(self._gamma_update, type(None)):
            self._gamma = self._gamma_update(self._gamma)

        # Update lambda parameter.
        if not isinstance(self._lambda_update, type(None)):
            self._lambda_param = self._lambda_update(self._lambda_param)
62825
def _update(self, **kwargs):
        """"""
        if 'content' in kwargs:
            content = kwargs.pop('content')
            path = self._construct_path_to_source_content()
            self._http.put(path, json.dumps({'content': content}))
        super(Resource, self)._update(**kwargs)