Normalizes a font's file format version.

    * **value** must be a :ref:`type-int`.
    * Returned value will be a ``int``.
189171
def normalizeFileFormatVersion(value):
    
    if not isinstance(value, int):
        raise TypeError("File format versions must be instances of "
                        ":ref:`type-int`, not %s."
                        % type(value).__name__)
    return value
717550
def normalize_version(version):
    
    rv = []
    for x in version.split("."):
        try:
            rv.append(int(x))
        except ValueError:
            for y in re.split("([0-9]+)", x):
                if y == '':
                    continue
                try:
                    rv.append(int(y))
                except ValueError:
                    rv.append(y)
    return rv
981624
def normalizeKerningValue(value):
    
    if not isinstance(value, (int, float)):
        raise TypeError("Kerning value must be a int or a float, not %s."
                        % type(value).__name__)
    return value
742614
def normalize_text(self, txt):
        ""
        # - for TTF unicode fonts: unicode object (utf8 encoding)
        # - for built-in fonts: string instances (latin 1 encoding)
        if self.unifontsubset and isinstance(txt, str) and not PY3K:
            txt = txt.decode('utf8')
        elif not self.unifontsubset and isinstance(txt, unicode) and not PY3K:
            txt = txt.encode('latin1')
        return txt
119842
def normalize(filename):
        """"""
        # Default value means we do not resolve a model file.
        if filename == "default":
            return filename
        filename = expanduser(filename)
        if isabs(filename):
            return filename
        else:
            return join(os.getcwd(), filename)
1147225
def version(self, value):
        

        if value is not None:
            assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format(
                "version", value)
        self.__version = value
806000
def normalizeGlyphLeftMargin(value):
    
    if not isinstance(value, (int, float)) and value is not None:
        raise TypeError("Glyph left margin must be an :ref:`type-int-float`, "
                        "not %s." % type(value).__name__)
    return value
632335
def normalize_value(value, snake_case=True):
    
    if not isinstance(value, six.string_types):
        raise TypeError("the value passed to value must be a string")

    if snake_case:
        s1 = first_cap_re.sub(r'\1_\2', value)
        new_value = all_cap_re.sub(r'\1_\2', s1).lower()  # .replace('-', '_')
    else:
        new_value = value.lower()

    return new_value
1017537
function normalizeFontSize(value) {
	// "Strip leading and trailing whitespace from value."
	//
	// Cheap hack, not following the actual algorithm.
	value = value.trim();

	// "If value is not a valid floating point number, and would not be a valid
	// floating point number if a single leading "+" character were stripped,
	// abort these steps and do nothing."
	if (!/^[-+]?[0-9]+(\.[0-9]+)?([eE][-+]?[0-9]+)?$/.test(value)) {
		return null;
	}

	var mode;

	// "If the first character of value is "+", delete the character and let
	// mode be "relative-plus"."
	if (value[0] == "+") {
		value = value.slice(1);
		mode = "relative-plus";
	// "Otherwise, if the first character of value is "-", delete the character
	// and let mode be "relative-minus"."
	} else if (value[0] == "-") {
		value = value.slice(1);
		mode = "relative-minus";
	// "Otherwise, let mode be "absolute"."
	} else {
		mode = "absolute";
	}

	// "Apply the rules for parsing non-negative integers to value, and let
	// number be the result."
	//
	// Another cheap hack.
	var num = parseInt(value);

	// "If mode is "relative-plus", add three to number."
	if (mode == "relative-plus") {
		num += 3;
	}

	// "If mode is "relative-minus", negate number, then add three to it."
	if (mode == "relative-minus") {
		num = 3 - num;
	}

	// "If number is less than one, let number equal 1."
	if (num < 1) {
		num = 1;
	}

	// "If number is greater than seven, let number equal 7."
	if (num > 7) {
		num = 7;
	}

	// "Set value to the string here corresponding to number:" [table omitted]
	value = {
		1: "xx-small",
		2: "small",
		3: "medium",
		4: "large",
		5: "x-large",
		6: "xx-large",
		7: "xxx-large"
	}[num];

	return value;
}
415343
def check_format(format, subtype=None, endian=None):
    
    try:
        return bool(_format_int(format, subtype, endian))
    except (ValueError, TypeError):
        return False
637292
def normalize_field(self, value):
        
        if self.default is not None:
            if value is None or value == '':
                value = self.default
        return value
302485
def normalize_path(path, filetype=FILE):
    
    if not path:
        raise ValueError('"{0}" is not a valid path.'.format(path))
    if not os.path.exists(path):
        raise ValueError('"{0}" does not exist.'.format(path))
    if filetype == FILE and not os.path.isfile(path):
        raise ValueError('"{0}" is not a file.'.format(path))
    elif filetype == DIR and not os.path.isdir(path):
        raise ValueError('"{0}" is not a dir.'.format(path))

    return os.path.abspath(path)
1116959
def humanize_filesize(value):
    

    value = float(value)

    if value == 1:
        return '1 Byte'
    elif value < 1024:
        return '%d Bytes' % value
    elif value < 1024:
        return '%dB' % value

    for i, s in enumerate(SUFFIXES):
        unit = 1024 ** (i + 2)
        if value < unit:
            return '%.1f %s' % ((1024 * value / unit), s)
    return '%.1f %s' % ((1024 * value / unit), s)
1060436
def _normalize(self, key, value):
        

        # None value should not be converted by normalizer
        if value is None:
            return None

        normalize_func = getattr(self, 'normalize_{0}'.format(key),
                                 lambda x: x)

        return normalize_func(value)
446581
function normalizeValue(value, info) {
  if (typeof value === 'number') {
    value = String(value)
  } else if (typeof value === 'boolean') {
    value = info.attribute
  } else if (typeof value === 'object' && 'length' in value) {
    value = (info.commaSeparated ? commaSeparated : spaceSeparated)(value)
  }

  return value
}
855498
def normalizeGlyphUnicode(value):
    
    if not isinstance(value, (int, basestring)) or isinstance(value, bool):
        raise TypeError("Glyph unicode must be a int or hex string, not %s."
                        % type(value).__name__)
    if isinstance(value, basestring):
        try:
            value = int(value, 16)
        except ValueError:
            raise ValueError("Glyph unicode hex must be a valid hex string.")
    if value < 0 or value > 1114111:
        raise ValueError("Glyph unicode must be in the Unicode range.")
    return value
1198536
def normalize(value, unit):
    
    if value < 0:
        raise ValueError('Negative value: %s %s.' % (value, unit))

    if unit in functions.get_keys(INFORMATION_UNITS):
        return _normalize_information(value, unit)
    elif unit in TIME_UNITS:
        return _normalize_time(value, unit)
    else:
        # Unknown unit, just return it
        return functions.format_value(value), unit