Normalize params and calculate aspect.
16043
def _normalize_params(image, width, height, crop):
    
    if width is None and height is None:
        raise ValueError("Either width or height must be set. Otherwise "
                         "resizing is useless.")

    if width is None or height is None:
        aspect = float(image.width) / float(image.height)

        if crop:
            raise ValueError("Cropping the image would be useless since only "
                             "one dimention is give to resize along.")

        if width is None:
            width = int(round(height * aspect))
        else:
            height = int(round(width / aspect))

    return (width, height, crop)
177961
def normalize(self):
        """"""
        vlength = self.length()

        #Make sure the length isn't 0
        if vlength > 0:
            self.x /= vlength
            self.y /= vlength
            self.z /= vlength
        else:
            return Vector3(0, 0, 0)
1185496
def _normalize(value):
        
        if hasattr(value, 'value'):
            value = value.value
        if value is not None:
            value = long(value)
        return value
1164818
public void normalizeScale() {
		double sum = 0;

		sum += SpecializedOps_DDRM.elementSumSq(T1);
		sum += SpecializedOps_DDRM.elementSumSq(T2);
		sum += SpecializedOps_DDRM.elementSumSq(T3);

		double n = Math.sqrt(sum);

		CommonOps_DDRM.scale(1.0/n,T1);
		CommonOps_DDRM.scale(1.0/n,T2);
		CommonOps_DDRM.scale(1.0/n,T3);
	}
1318915
function normalize(result) {
  return {
    relevance: result.relevance || 0,
    language: result.language || null,
    value: result.value || []
  }
}
1216263
def normalize(rendered):
    """"""
    out = ''.join([line.strip()
                   for line in rendered.splitlines()
                   if line.strip()])
    out = out.replace(', ', ',')
    return out
631514
def _normalize_options(options):
    """"""
    normalized_options = {}
    for key, value in iteritems(options):
        optname = str(key).lower()
        intname = INTERNAL_URI_OPTION_NAME_MAP.get(optname, key)
        normalized_options[intname] = options[key]
    return normalized_options
1251450
def normalize(self):
        """"""
        chrfunc = chr if py3k else HTMLEntity._unichr
        if self.named:
            return chrfunc(htmlentities.name2codepoint[self.value])
        if self.hexadecimal:
            return chrfunc(int(self.value, 16))
        return chrfunc(int(self.value))
239002
def normalize(expr):
    """"""
    lhs = normalize(expr.lhs)
    rhs = normalize(expr.rhs)
    return type(expr)(lhs, rhs, start=lhs.start, end=rhs.end)
173227
function normalize (specs) {
  const arrayedSpecs = Array.isArray(specs) ? specs : [specs]
  const objectifiedSpecs = arrayedSpecs.map(normalizeSpec)
  return objectifiedSpecs
}
26448
def normalize(v, axis=None, eps=1e-10):
  """"""
  return v / max(anorm(v, axis=axis, keepdims=True), eps)
896575
@SuppressWarnings("all")
  public void normalize() {
    // Start on samples
    int samplesPerFrame = (int) ((float) getSamplesPerSecond() / (float) getFramesPerSecond());
    setFrames(getFrames() + (int) (getSamples() * (1.0f / samplesPerFrame)));
    setSamples(getSamples() % samplesPerFrame);

    setSeconds(getSeconds() + (int) ((float) getFrames() / getFramesPerSecond()));
    setFrames((int) (getFrames() % getFramesPerSecond()));

    while (getSeconds() >= 60) {
      setSeconds(getSeconds() - 60);
      setMinutes(getMinutes() + 1);
    }
    while (getMinutes() >= 60) {
      setMinutes(getMinutes() - 60);
      setHours(getHours() + 1);
    }
  }
139576
def _normalize_params(self, *paths, **query_kwargs):
        """"""
        kwargs = {}

        if paths:
            fragment = paths[-1]
            if fragment:
                if fragment.startswith("#"):
                    kwargs["fragment"] = fragment
                    paths.pop(-1)

            kwargs["path"] = "/".join(self.normalize_paths(*paths))

        kwargs["query_kwargs"] = query_kwargs
        return kwargs
837731
function normalize(argumts, offset, chaining) {
  var args;

  if (argumts.length > 0) {
    args = slice(argumts, offset);
  } else {
    return undefined;
  }

  // data is always sent as a list
  if (args.length === 1) {
    if (chaining || (Array.isArray(args[0]) && args[0].length > 0)) {
      return args[0];
    } else {
      return [args[0]];
    }
  } else {
    return args;
  }
}
634752
function normalize(reasons: { [string]: (Change, context: any) => any }): * {
    return (change, reason, context) => {
        const reasonFn = reasons[reason];
        if (reasonFn) {
            reasonFn(change, context);
        }
    };
}
834409
def norm_locale (loc):
    """"""
    loc = locale.normalize(loc)
    # split up the locale into its base components
    pos = loc.find('@')
    if pos >= 0:
        loc = loc[:pos]
    pos = loc.find('.')
    if pos >= 0:
        loc = loc[:pos]
    pos = loc.find('_')
    if pos >= 0:
        loc = loc[:pos]
    return loc
1148487
def normalize(self):
        

        if self.moc is None:
            raise CommandError('No MOC information present for normalization')

        order = int(self.params.pop())
        self.moc.normalize(order)