Normalize all non string & non number args to string types to prevent
race conditions wrt/ the TypeSystem lock when the message is formatted.
779071
private Object [] normalizeMessageArgs(Object [] args) {
    Object [] result = args;
    if(args != null && args.length > 0) {
      result = new Object[args.length];
      for(int i = 0; i < args.length; i++) {
        if(args[i] == null || args[i] instanceof CharSequence || args[i] instanceof Number) {
          result[i] = args[i];
        } else {
          result[i] = args[i].toString();
        }
      }
    }
    return result;
  }
752646
def normalize_int(value: IntConvertible) -> int:
    
    if is_integer(value):
        return cast(int, value)
    elif is_bytes(value):
        return big_endian_to_int(value)
    elif is_hex(value) and is_0x_prefixed(value):
        value = cast(str, value)
        if len(value) == 2:
            return 0
        else:
            return int(value, 16)
    elif is_string(value):
        return int(value)
    else:
        raise TypeError("Unsupported type: Got `{0}`".format(type(value)))
133285
function isNotString(value, message, id) {
    if (message === void 0) { message = ''; }
    if (id === void 0) { id = ''; }
    if (this.enabled && (typeof value === 'string' || value instanceof String)) {
        throw TypeException.expectedType(assertionTypes.IS_NOT_STRING, value, '<string>', message, id);
    }
}
1112988
def normalize(self, inst, value):
        
        if (not (self.or_none and value is None) and
            self.seq):
            value = tuple(value)
        return value
1190733
def format_arg(value):
    
    translator = repr if isinstance(value, six.string_types) else six.text_type
    return translator(value)
592760
function _normalizeArguments(obj) {
    var args = arguments;

    if (!obj || Utils.isFunction(obj)) {
      args = Array.prototype.slice.call(arguments, 0);
      args.unshift({});
    }

    return args;
  }
548613
@Trivial
    public static final String normalizeString(String str) {
        return (str == null || str.length() == 0) ? " " : str;
    }
931498
def _normalize_number_values(self, parameters):
        """"""
        for key, value in parameters.items():
            if isinstance(value, (int, float)):
                parameters[key] = str(Decimal(value).normalize(self._context))
1337787
def normalize_filename(string):
    
    if not isinstance(string, basestring):
        fail("Type of argument must be string, found '{}'"
             .format(type(string)))
    # get the file nomalizer utility
    normalizer = getUtility(IFileNameNormalizer).normalize
    return normalizer(string)
247723
private void validateTypeNotIn(TypeMirror t, Set<TypeKind> invalidKinds) {
        if (invalidKinds.contains(t.getKind()))
            throw new IllegalArgumentException(t.toString());
    }
1142854
def validate(self, value, messages=None):
        
        valid     = True
        primitive = value

        def log(msg):
            if messages is not None:
                messages.append(msg)

        if self.enum:
            if value not in self.enum.values():
                valid = False
                flds = (self.name, str(value))
                log("%s value '%s' not in allowed enumerated values." % flds)
            else:
                primitive = int(self.enum.keys()[self.enum.values().index(value)])

        if self.type:
            if self.type.validate(primitive, messages, self.name) is False:
                valid = False

        return valid
1254348
function normalize(def) {
  if (~noMergeCmds.indexOf(command))
    return stiks.argv.splitArgs(def);
  return stiks.argv.mergeArgs(def, input);
}
83442
void expectStringOrNumber(Node n, JSType type, String msg) {
    if (!type.matchesNumberContext()
        && !type.matchesStringContext()
        && !type.matchesStringContext()) {
      mismatch(n, msg, type, NUMBER_STRING);
    } else {
      expectStringOrNumberOrSymbolStrict(n, type, msg);
    }
  }
975342
function normalizeFns(fns) {
  Object.keys(fns).forEach(function(key) {
    var handler = fns[key];
    if (typeof handler === 'function') {
      fns[key] = {
        enter: handler,
        leave: noop
      };
    }
  });
}
513953
def _normalize_str(self, string):
        
        if string:
            if not isinstance(string, str):
                string = str(string, 'utf-8', 'replace')

            return unicodedata.normalize('NFKD', string).encode(
                'ASCII', 'ignore').decode('ASCII')
        return ''
1170081
def normalize_val(self, value=_nothing):
        
        if isinstance(value, basestring):
            value = self.normalize_text(value)
        if self.ignore_empty_slots and self.value_is_empty(value):
            value = _nothing
        return value
1070892
def normalize_string_keys(old):
    """"""
    new = {}
    for key, value in old.items():
        if isinstance(key, bytes_):
            new[key.decode('utf8')] = value
        else:
            new[key] = value
    return new