Re-assign source, returning previous setting.
350009
public JavaFileObject useSource(JavaFileObject file) {
        JavaFileObject prev = (source == null ? null : source.getFile());
        source = getSource(file);
        return prev;
    }
535209
def restore_state(self):
        
        settings = QSettings()
        try:
            last_path = settings.value('directory', type=str)
        except TypeError:
            last_path = ''
        self.output_directory.setText(last_path)
154412
def restoreSettings(self, settings, merge=False, loadProfile=True):
        
        value = unwrapVariant(settings.value('profile_toolbar'))
        if not value:
            return
        
        self.loadString(value, merge, loadProfile=loadProfile)
1151696
def myreplace(astr, thefind, thereplace):
    """"""
    alist = astr.split(thefind)
    new_s = alist.split(thereplace)
    return new_s
661991
def get_and_set(self, value):
        '''
        
        '''
        with self._reference.get_lock():
            oldval = self._reference.value
            self._reference.value = value
            return oldval
411270
def temporarily_enabled(self):
        
        old_setting = self.options.enabled
        self.enable()
        try:
            yield
        finally:
            self.options.enabled = old_setting
38997
def reread(self):
        
        logger.debug("Loading settings from %s",
                     os.path.abspath(self.filename))
        conf = self.read_conf()
        changed = self.creds.reread()
        checks = self.parser.parse_checks(conf)
        if self.checks != checks:
            self.checks = checks
            return True
        else:
            return changed
903216
def reassign(self, from_email, user_ids):
        """"""
        endpoint = '/'.join((self.endpoint, self.id,))

        if from_email is None or not isinstance(from_email, six.string_types):
            raise MissingFromEmail(from_email)

        if user_ids is None or not isinstance(user_ids, list):
            raise InvalidArguments(user_ids)
        if not all([isinstance(i, six.string_types) for i in user_ids]):
            raise InvalidArguments(user_ids)

        assignees = [
            {
                'assignee': {
                    'id': user_id,
                    'type': 'user_reference',
                }
            }
            for user_id in user_ids
        ]

        add_headers = {'from': from_email, }
        data = {
            'incident': {
                'type': 'incident',
                'assignments': assignees,
            }
        }

        result = self.request('PUT',
                              endpoint=endpoint,
                              add_headers=add_headers,
                              data=data,)
        return result
229013
def _reset_build(self, sources):
        """"""
        from ambry.orm.exc import NotFoundError

        for p in self.dataset.partitions:
            if p.type == p.TYPE.SEGMENT:
                self.log("Removing old segment partition: {}".format(p.identity.name))
                try:
                    self.wrap_partition(p).local_datafile.remove()
                    self.session.delete(p)
                except NotFoundError:
                    pass

        for s in sources:

            # Don't delete partitions fro mother bundles!
            if s.reftype == 'partition':
                continue

            p = s.partition
            if p:
                try:
                    self.wrap_partition(p).local_datafile.remove()
                    self.session.delete(p)
                except NotFoundError:
                    pass

            if s.state in (self.STATES.BUILDING, self.STATES.BUILT):
                s.state = self.STATES.INGESTED

        self.commit()
31778
function _assign(target, ...sources) {

    sources.forEach(source => {
        Object.keys(source || {}).forEach(
            key => target[key] = source[key]
        );
    });

    return target;
}
1295737
def find_previous(self):
        """"""
        state = self.find(changed=False, forward=False, rehighlight=False,
                          multiline_replace_check=False)
        self.editor.setFocus()
        return state
487500
function reset() {
  const oldOptions = options()
  options({
    wishes: [],
    noWishMerge: true,
    previousId: 0,
    enteredMagicWords: {},
    context: _defaultContext,
    previousContext: _defaultContext,
    enabled: true,
  })
  return oldOptions
}
433860
def update(self, key, value=None, dir=False, ttl=None, refresh=False,
               prev_value=None, prev_index=None, timeout=None):
        """"""
        return self.adapter.set(key, value, dir=dir, ttl=ttl, refresh=refresh,
                                prev_value=prev_value, prev_index=prev_index,
                                prev_exist=True, timeout=timeout)
1187595
def use(self, key, value):
        
        old_value = self[key]
        try:
            self[key] = value
            yield self
        finally:
            self[key] = old_value
1316212
def source(self, value):
        
        if value == self._defaults['source'] and 'source' in self._values:
            del self._values['source']
        else:
            self._values['source'] = value
140505
def reconfig(main_parser, args=sys.argv[1:]):

    """"""

    parsed, remaining_args = parser().parse_known_args(args)
    configure(parsed.config_paths, os.getcwd())
    return main_parser().parse_args(remaining_args)
267422
function assignProperties(dest, source) {
  for (var attr in source) {
    if (source.hasOwnProperty(attr)) {
      dest[attr] = source[attr];
    }
  }
}