Convert the scale to an annualzation factor.  If scale is None then attempt to resolve from frame. If scale is a scalar then
        use it. If scale is a string then use it to lookup the annual factor
337555
def _resolve_periods_in_year(scale, frame):
    
    if scale is None:
        return periodicity(frame)
    elif isinstance(scale, basestring):
        return periodicity(scale)
    elif np.isscalar(scale):
        return scale
    else:
        raise ValueError("scale must be None, scalar, or string, not %s" % type(scale))
1262574
public void scaleYResolution(double factor) {
        this.y_resolution = Math.max(1.0, this.y_resolution * factor);
        updateYResolution();
        updateUpperYValue();
        updateCanvas(true);
    }
1287845
function(scales) {
        if(scales == null) {
            return;
        }
        var resolutions, i, len;
        len = scales.length;
        resolutions = new Array(len);
        for(i=0; i<len; i++) {
            resolutions[i] = OpenLayers.Util.getResolutionFromScale(
                scales[i], this.units);
        }
        return resolutions;
    }
1306179
def get_seconds(value, scale):
  
  scales = {
    'seconds': lambda x: x,
    'minutes': lambda x: x * 60,
    'hours': lambda x: x * 60 * 60,
    'days': lambda x: x * 60 * 60 * 24,
    'weeks': lambda x: x * 60 * 60 * 24 * 7,
    'months': lambda x: x * 60 * 60 * 24 * 30,
    'years': lambda x: x * 60 * 60 * 24 * 365,
  }
  return scales[scale](value)
910386
public static double toGrowthFactorFromAnnualReturn(double annualReturn, CalendarDateUnit growthFactorUnit) {
        double tmpAnnualGrowthFactor = PrimitiveMath.ONE + annualReturn;
        double tmpYearsPerGrowthFactorUnit = CalendarDateUnit.YEAR.convert(growthFactorUnit);
        return PrimitiveMath.POW.invoke(tmpAnnualGrowthFactor, tmpYearsPerGrowthFactorUnit);
    }
143894
def mag_scale_rel(value):
    
    value = value.strip()
    if value not in SCALEREL:
        raise ValueError(
            "'%s' is not a recognized magnitude-scale relationship" % value)
    return value
564025
private int yearLength() {
        int year = internalGet(YEAR);
        if (internalGetEra() == BCE) {
            year = 1 - year;
        }
        return yearLength(year);
    }
788022
def apply_scale(self, scale):
        
        dimension = self.vertices.shape[1]
        matrix = np.eye(dimension + 1)
        matrix[:dimension, :dimension] *= scale
        self.apply_transform(matrix)
267382
def _ensure_valid_index(self, value):
        
        # GH5632, make sure that we are a Series convertible
        if not len(self.index) and is_list_like(value):
            try:
                value = Series(value)
            except (ValueError, NotImplementedError, TypeError):
                raise ValueError('Cannot set a frame with no defined index '
                                 'and a value that cannot be converted to a '
                                 'Series')

            self._data = self._data.reindex_axis(value.index.copy(), axis=1,
                                                 fill_value=np.nan)
460220
def scalar(magnitude = value)
      if special?
        unit.scalar(magnitude)
      else
        Number.rationalize(value) * Number.rationalize(unit.scalar)
      end
    end
1039131
def get_conversion(scale, limits):
    
    fb = float(scale) / float(limits['b'][1] - limits['b'][0])
    fl = float(scale) / float(limits['l'][1] - limits['l'][0])
    fr = float(scale) / float(limits['r'][1] - limits['r'][0])

    conversion = {"b": lambda x: (x - limits['b'][0]) * fb,
                  "l": lambda x: (x - limits['l'][0]) * fl,
                  "r": lambda x: (x - limits['r'][0]) * fr}

    return conversion
1132469
def _parse_scale(scale_exp):
    """"""

    m = re.search("(\w+?)\{(.*?)\}", scale_exp)
    if m is None:
        raise InvalidFormat('Unable to parse the given time period.')
    scale = m.group(1)
    range = m.group(2)

    if scale not in SCALES:
        raise InvalidFormat('%s is not a valid scale.' % scale)

    ranges = re.split("\s", range)

    return scale, ranges
819443
def _convert_to_scale(self):
        
        d = self._d
        s = (self._s - self._offset) % 86400.
        d -= int((s + self._offset) // 86400)
        return d, s
1075610
def convert_units(self, from_units, to_units):
        '''
        

        '''
        from blmath import units
        factor = units.factor(
            from_units=from_units,
            to_units=to_units,
            units_class='length'
        )
        self.scale(factor)
118322
public void scale(float scale) {
        if (scale != 1.0f) {
            left = (int) (left * scale + 0.5f);
            top = (int) (top * scale + 0.5f);
            right = (int) (right * scale + 0.5f);
            bottom = (int) (bottom * scale + 0.5f);
        }
    }
1350757
def scaleField(self, scalingFactor):
        
        self.B = self.B._replace(val=self.B.val * scalingFactor)
538239
function bcscale(scale) {
    scale = parseInt(scale, 10);
    if (isNaN(scale)) {
        return false;
    }
    if (scale < 0) {
        return false;
    }
    libbcmath.scale = scale;
    return true;
}