Make a new upwardable. Register it, and add a `change` method which notifies when it is to be replaced.
337743
function make(x, options = {}) {
  var {debug = DEBUG_ALL} = options;
  var u;

  debug = DEBUG && debug;

  if (x === undefined) u = makeUndefined();
  else if (x === null) u = makeNull();
  else {
    u = Object(x);
    if (!is(u)) {
      add(u, debug);
      defineProperty(u, 'change', { value: change });
    }
  }
  if (debug) console.debug(...channel.debug("Created upwardable", u._upwardableId, "from", x));
  return u;
}
11831
def add_new_reset_method(cls):
    
    orig_reset = cls.reset

    def new_reset(self, seed=None):
        logger.debug(f"Calling reset() on {self} (seed={seed})")
        orig_reset(self, seed)
        for c in self._dependent_generators:
            c.reset_dependent_generator(seed)
        return self

    cls.reset = new_reset
396981
def replace(self, target):
        
        if sys.version_info < (3, 3):
            raise NotImplementedError("replace() is only available "
                                      "with Python 3.3 and later")
        if self._closed:
            self._raise_closed()
        self._accessor.replace(self, target)
251608
def change(self, key, value):
        """"""
        self.obj[key] = value
        self.changes.append("Updating build:{}.{}={}"
                            .format(self.obj['name'], key, value))
        return self
479885
void updateReplace() {

        boolean replace = m_replace.getValue().booleanValue();

        m_replaceResource.setVisible(replace ? SearchType.resourcetype.equals(m_searchType.getValue()) : replace);
        m_replacePattern.setVisible(
            replace
            ? !SearchType.resourcetype.equals(m_searchType.getValue())
                & !SearchType.renameContainer.equals(m_searchType.getValue())
            : replace);

        m_newName.setVisible(replace ? SearchType.renameContainer.equals(m_searchType.getValue()) : replace);
        m_oldName.setVisible(replace ? SearchType.renameContainer.equals(m_searchType.getValue()) : replace);

        m_workProject.setVisible(replace);

        m_search.setCaption(
            replace
            ? CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_REPLACE_0)
            : CmsVaadinUtils.getMessageText(Messages.GUI_SOURCESEARCH_SEARCH_0));

    }
802935
def update_or_create(self, *args, **kwargs):
        
        obj, created = super().update_or_create(*args, **kwargs)

        if not created:
            return self.with_signal(result=(obj, created))

        return obj, created
759676
def add(self, resource, replace=False):
        
        if isinstance(resource, collections.Iterable):
            for r in resource:
                self.resources.add(r, replace)
        else:
            self.resources.add(resource, replace)
587706
def intf_up(self, interface):
        '''
        
        '''
        if interface.name not in self._devinfo:
            self._devinfo[interface.name] = interface
            if self._devupdown_callback:
                self._devupdown_callback(interface, 'up')
        else:
            raise ValueError("Interface already registered")
983523
def RegisterCheck(cls, check, source="unknown", overwrite_if_exists=False):
    """"""
    if not overwrite_if_exists and check.check_id in cls.checks:
      raise DefinitionError(
          "Check named %s already exists and "
          "overwrite_if_exists is set to False." % check.check_id)
    check.loaded_from = source
    cls.checks[check.check_id] = check
    cls.triggers.Update(check.triggers, check)
858087
def register_created(cls, key, image):
        """"""

        if key in cls._stock:
            logger.info('Warning, replacing resource ' + str(key))
        cls._stock[key] = {'type': 'created', 'image': image}
        logger.info('%s registered as %s' % ('data', key))
799193
def _on_prop_changed(self, instance, meth_name, res, args, kwargs):
        """"""
        Adapter._on_prop_changed(self)
665487
def changed(self, item):
        
        if self._rejectChanges:
            raise errors.ChangeRejected()
        if self.transaction is not None:
            self.transaction.add(item)
            self.touched.add(item)
757920
def replace(self, request, id):
        """"""
        try:
            object = self.model.objects.get(id=id)
        except self.model.DoesNotExist:
            return self._render(
                request = request,
                template = '404',
                context = {
                    'error': 'The %s could not be found.' % self.model.__name__.lower()
                },
                status = 404,
                prefix_template_path = False
            )

        form = (self.form or generate_form(self.model))(request.PUT, instance=object)

        if form.is_valid():
            object = form.save()

            return self.show(request, id)
        else:
            return self._render(
                request = request,
                template = 'edit',
                context = {
                    'form': form
                },
                status = 400
            )
261409
def replace(self, new):
        """"""
        assert self.parent is not None, str(self)
        assert new is not None
        if not isinstance(new, list):
            new = [new]
        l_children = []
        found = False
        for ch in self.parent.children:
            if ch is self:
                assert not found, (self.parent.children, self, new)
                if new is not None:
                    l_children.extend(new)
                found = True
            else:
                l_children.append(ch)
        assert found, (self.children, self, new)
        self.parent.changed()
        self.parent.children = l_children
        for x in new:
            x.parent = self.parent
        self.parent = None
304091
def addChanged(self):
        
        if self.addWidget.currentIndex() == 0:
            return
        typ = asUnicode(self.addWidget.currentText())
        self.param.addNew(typ)
        self.addWidget.setCurrentIndex(0)
730437
def register_success(self, upgrade):
        """"""
        u = Upgrade(upgrade=upgrade.name, applied=datetime.now())
        db.session.add(u)
        db.session.commit()
1159904
def update_or_create(cls, org, provider, exists):
        
        instance, created = cls.objects.update_or_create(
            org=org,
            provider=provider,
            defaults={'exists': exists},
        )

        return instance, created