Refetch instance data from the API.
357474
def refresh(self):
      '''
      '''
      # There's no GET endpoint for steps, so get the parent guide and loop
      # through its steps until we find the right one.
      response = requests.get('%s/guides/%s' % (API_BASE_URL, self.guideid))
      attributes = response.json()
      
      for step in attributes['steps']:
         if step['stepid'] == self.stepid:
            self._update(step)
            return
      raise Exception('Step with id %s not found in guide %s.' \
                      % (self.stepid, self.guideid))
448272
function reprovisionInstance(uuid, image_uuid, callback) {
    assert.string(uuid, 'uuid');
    assert.string(image_uuid, 'image_uuid');

    var opts = {};
    opts.image_uuid = image_uuid;

    return (this.put(sprintf('/instances/%s/upgrade', uuid), opts, callback));
}
876663
def set_data(self, data):
        """"""
        for key, val in data.items():
            setattr(self, key, val)
        self.uptime['reloaded'] = datetime.now()
188160
def refresh(self):
        """"""
        connection = self.model._meta.dj_connection
        return connection.connection.indices.refresh(indices=connection.database)
1121991
def modify(self, **params):
        """"""
        data = self.api_client.update_current_user(**params)
        self.update(data)
        return data
437524
def update(instance, full_clean=True, post_save=False, **kwargs):
    ""

    # apply the updated args to the instance to mimic the change
    # note that these might slightly differ from the true database values
    # as the DB could have been updated by another thread. callers should
    # retrieve a new copy of the object if up-to-date values are required
    for k, v in kwargs.iteritems():
        if isinstance(v, ExpressionNode):
            v = resolve_expression_node(instance, v)
        setattr(instance, k, v)

    # clean instance before update
    if full_clean:
        instance.full_clean()

    # fields that use auto_now=True should be updated corrected, too!
    for field in instance._meta.fields:
        if hasattr(field, 'auto_now') and field.auto_now and field.name not in kwargs:
            kwargs[field.name] = field.pre_save(instance, False)

    rows_affected = instance.__class__._default_manager.filter(
        pk=instance.pk).update(**kwargs)

    if post_save:
        signals.post_save.send(sender=instance.__class__, instance=instance)

    return rows_affected
854995
def inspect_object(obj, refresh=True):
    
    if hasattr(obj, "inspect"):
        return obj.inspect(refresh=refresh)
    return obj.get_metadata(refresh=refresh)
382845
def upgrade_api(request, client, version):
    """"""

    min_ver, max_ver = api_versions._get_server_version_range(client)
    if min_ver <= api_versions.APIVersion(version) <= max_ver:
        client = _nova.novaclient(request, version)
    return client
222901
def perform_partial_update(self, data, instance):
        

        for key, val in data.items():
            setattr(instance, key, val)
1359192
def refresh(self, data):
        
        modules = data.get("module")
        # for i3status modules we have to refresh the whole i3status output.
        update_i3status = False
        for module_name in self.find_modules(modules):
            module = self.py3_wrapper.output_modules[module_name]
            if self.debug:
                self.py3_wrapper.log("refresh %s" % module)
            if module["type"] == "py3status":
                module["module"].force_update()
            else:
                update_i3status = True
        if update_i3status:
            self.py3_wrapper.i3status_thread.refresh_i3status()
373227
def refresh(self):
        """"""
        pipe = self.redis.pipeline()
        pipe.hget(EXPERIMENT_REDIS_KEY_TEMPLATE % self.name, "metadata")
        pipe.hget(EXPERIMENT_REDIS_KEY_TEMPLATE % self.name, "choices")
        pipe.hget(EXPERIMENT_REDIS_KEY_TEMPLATE % self.name, "default-choice")
        results = pipe.execute()

        if results[0] == None:
            raise ExperimentException(self.name, "Does not exist")

        self.metadata = parse_json(results[0])
        self.choice_names = parse_json(results[1]) if results[1] != None else []
        self.default_choice = escape.to_unicode(results[2])
        self._choices = None
1051547
def instance(cls, *args, **kwgs):
        """"""
        if not hasattr(cls, "_instance"):
            cls._instance = cls(*args, **kwgs)
        return cls._instance
312104
def _update(self, resource, update_dict=None, params=None, **kwargs):
        """"""
        url = self._client._build_url(resource, **kwargs)
        response = self._client._request('PUT', url, json=update_dict, params=params)

        if response.status_code != requests.codes.ok:  # pragma: no cover
            raise APIError("Could not update {} ({})".format(self.__class__.__name__, response.json().get('results')))
        else:
            self.refresh()
1351606
def update(self, instance, oldValue, newValue, subKey):
    """"""
    histogram = self.__get__(instance, None)
    histogram[subKey] += newValue - oldValue
155347
def refresh(self):
        # type: () -> None
        """"""
        src = self._client.reload(self)
        self.__dict__.update(src.__dict__)
706654
def _get_instance_changes(current, state):
    '''
    
    '''
    # get keys
    current_keys = set(current.keys())
    state_keys = set(state.keys())

    # compare configs
    changed = salt.utils.data.compare_dicts(current, state)
    for change in salt.utils.data.compare_dicts(current, state):
        if change in changed and changed[change]['old'] == "":
            del changed[change]
        if change in changed and changed[change]['new'] == "":
            del changed[change]

    return changed
1047362
def refresh(self):
      '''
      '''
      response = requests.get('%s/media/images/%s' % (API_BASE_URL, self.id))
      attributes = response.json()
      
      #self.exif = attributes['exif']
      self.height = attributes['height']
      self.width = attributes['width']
      #self.ratio = attributes['ratio']
      #self.markup = attributes['markup']
      #self.srcid = attributes['srcid']
      
      image = attributes['image']
      # Images are allowed to have different sizes, depending on the dimensions
      # of the original image.  To avoid doing a bunch of explicit 'in' checks,
      # splat the variables into scope.
      del(image['id'])
      for size in image:
         vars(self)[size] = image[size]