Set a new conversion ratio immediately.
177274
def set_ratio(self, new_ratio):
        """"""
        from samplerate.lowlevel import src_set_ratio
        return src_set_ratio(self._state, new_ratio)
1305283
def Set(self, value, fields=None):
    """"""
    self._metric_values[_FieldsToKey(fields)] = self._value_type(value)
610985
public void initialize(double ratio) {
    if(!(ratio > 0 && ratio < Double.POSITIVE_INFINITY)) {
      LOG.warning("Invalid ratio: " + ratio, new Throwable());
      ratio = 1.4;
    }
    this.ratio = ratio;
    if(plot != null) {
      LOG.warning("Already initialized.");
      lazyRefresh();
      return;
    }
    reinitialize();
    // register context listener
    context.addResultListener(this);
    context.addVisualizationListener(this);
  }
1076525
def __set_unit_price(self, value):
        '''
        
        '''
        try:
            if value < 0:
                raise ValueError()

            self.__unit_price = Decimal(str(value))
        except ValueError:
            raise ValueError("Unit Price must be a positive number")
578615
void setBalance(
    int       b)
  {
    if ( (b == -1) || (b == 0) || (b == 1) )
      _balance = (short) b;
    else
     {
       String x = "Attempt to set invalid balance factor: " + b;
       throw new IllegalArgumentException(x);
     }
  }
1321896
def set(self, new_value):
        
        return self._encode_invoke(atomic_reference_set_codec,
                                   new_value=self._to_data(new_value))
1291279
def do_counter_conversion(self):
        """"""
        if self.is_counter:
            if self._previous_counter_value is None:
                prev_value = self.latest_value
            else:
                prev_value = self._previous_counter_value
            self._previous_counter_value = self.latest_value
            self.latest_value = self.latest_value - prev_value
739473
public void setMonth(int newMonth) {
		if (newMonth < 0 || newMonth == Integer.MIN_VALUE) {
			setMonth(0, true);
		} else if (newMonth > 11) {
			setMonth(11, true);
		} else {
			setMonth(newMonth, true);
		}
	}
1118706
def Set(self, value, context=None):
    """"""
    if self.has_error: return
    if self.value is None:
      self.value = value
      self._context["old_value"] = value
      self._context.update({"old_" + k: v for k, v in context.items()})
    elif self.value != value:
      self.has_error = True
      self._context["new_value"] = value
      self._context.update({"new_" + k: v for k, v in context.items()})
497616
def setnx(self, key, value):
        """"""
        return self.set(key, value, nx=True)
1004600
def do_transform(self):
        """"""
        if not self.transform:
            return
        try:
            self.latest_value = utils.Transform(
                expr=self.transform, value=self.latest_value,
                timedelta=self.time_between_updates().total_seconds()).result()
        except (TypeError, ValueError):
            logger.warn("Invalid transformation '%s' for metric %s",
                        self.transfrom, self.pk)
        self.transform = ''
350546
function() {
      var t = this,
          newValue = t.eval_control(t.key, t.depth);

      // Set the new value if it has changed from the current value
      if (!_.isEqual(newValue, t.get('value'))) {
        t.set({value: newValue});
      }
    }
724558
def setattr(self, attr, new_value, close_the_changeset=True):
        """"""
        existing_value = getattr(self, attr, None)
        if existing_value != new_value:
            setattr(self, attr, new_value)
            self._changeset[attr] = new_value

        if close_the_changeset and self._changeset:
            self._call_callbacks()
1016617
def set_time_rate(self, value):
        '''
        
        '''
        if isinstance(value, float) is False:
            raise TypeError("The type of __time_rate must be float.")

        if value <= 0.0:
            raise ValueError("The value of __time_rate must be greater than 0.0")

        self.__time_rate = value
1295445
def convert(self, value, units, newunits):
        
        return value * self._units[units] / self._units[newunits]
529025
protected function updateConversion()
    {
        $this->convertFrom = strtoupper($this->getOption(self::ENCODING));
        $this->shouldConvert = $this->convertFrom != 'UTF-8';
    }
1152760
def setChanged(self,value=1):
        """"""
        # set through dictionary to avoid another call to __setattr__
        if value:
            self.__dict__['flags'] = self.flags | _changedFlag
        else:
            self.__dict__['flags'] = self.flags & ~_changedFlag