Returns true if the input type is a numeric primitive type, such as int, float, proto enum, and
number.
769847
public static boolean isNumericPrimitive(SoyType type) {
    SoyType.Kind kind = type.getKind();
    if (NUMERIC_PRIMITIVES.contains(kind)) {
      return true;
    }
    return type.isAssignableFrom(NUMBER_TYPE) || NUMBER_TYPE.isAssignableFrom(type);
  }
1091052
def is_number(s):
    
    try:
        float(s)
        return True
    except ValueError:
        pass

    try:
        import unicodedata
        unicodedata.numeric(s)
        return True
    except (TypeError, ValueError):
        pass

    return False
1188573
static boolean isPrimitiveNumberClass(Class pClass) {
        return
                pClass == Byte.class ||
                        pClass == Byte.TYPE ||
                        pClass == Short.class ||
                        pClass == Short.TYPE ||
                        pClass == Integer.class ||
                        pClass == Integer.TYPE ||
                        pClass == Long.class ||
                        pClass == Long.TYPE ||
                        pClass == Float.class ||
                        pClass == Float.TYPE ||
                        pClass == Double.class ||
                        pClass == Double.TYPE;
    }
1327749
def value_is_int(self):
        """"""
        try:
            a = float(self.value)
            b = int(a)
        except ValueError:
            return False
        else:
            return a == b
758878
private boolean isSupportedPrimitive(PrimitiveTypeInfo type) {
        switch (type.getPrimitiveCategory()) {
            case VOID:
            case STRING:
            case BOOLEAN:
            case BYTE:
            case SHORT:
            case INT:
            case LONG:
            case FLOAT:
            case DOUBLE:
            case DATE:
            case TIMESTAMP:
                return true;
            default:
                return false;
        }
    }
691599
public static boolean isPrimitive(String type) {
        boolean isPrimitive = false;
        if ( "byte".equals( type ) || "char".equals( type ) || "double".equals( type ) || "float".equals( type ) || "int".equals( type ) || "long".equals( type ) || "short".equals( type ) || "boolean".equals( type ) || "void".equals( type ) ) {
            isPrimitive = true;
        }
        return isPrimitive;
    }
824481
def isnumeric(obj):
    '''
    
    '''
    from decimal import Decimal
    if type(obj) == Decimal:
        return True
    else:
        try:
            float(obj)
        except:
            return False
        return True
1133907
function primitive(str) {
	if (typeof str !== 'string')
		return str
	if (str === 'null')
		return null
	if (str === 'undefined')
		return undefined
	if (str === 'true')
		return true
	if (str === 'false')
		return false
	if (str === 'true')
		return true
	if (str === 'NaN')
		return NaN
	//if (str === 'Infinity')
	//	return Number.POSITIVE_INFINITY
	let ret
	if (str.indexOf('.') >= 0)
		ret = Number.parseFloat(str)
	else
		ret = Number.parseInt(str)
	if (!Number.isNaN(ret))
		return ret
	return str
}
1078596
def _protobuf_value_type(value):
  
  if value.HasField("number_value"):
    return api_pb2.DATA_TYPE_FLOAT64
  if value.HasField("string_value"):
    return api_pb2.DATA_TYPE_STRING
  if value.HasField("bool_value"):
    return api_pb2.DATA_TYPE_BOOL
  return None
672002
private boolean isAllNumeric(TokenStream stream) {
    List<Token> tokens = ((NattyTokenSource) stream.getTokenSource()).getTokens();
    for(Token token:tokens) {
      try {
        Integer.parseInt(token.getText());
      } catch(NumberFormatException e) {
        return false;
      }
    }
    return true;
  }
368896
def _is_valid_type(self, inpt):
        """"""
        from dlkit.abstract_osid.type.primitives import Type as abc_type
        if isinstance(inpt, abc_type):
            return True
        else:
            return False
446086
public static boolean isNumberObj(Object type) {
        try {
            Double.valueOf(type + "");
        } catch (NumberFormatException e) {
            return false;
        }
        return true;
    }
529888
def _is_numeric_data(ll):
    
    for l in ll:
        try:
            if any(math.isnan(float(i)) or isinstance(i, str) for i in l):
                return False
            # if not all(isinstance(i, (int, float)) or math.isnan(float(i)) for i in l):
            #     # There is an entry that is a non-numeric entry in this list
            #     return False
        except ValueError:
            # Trying to case a str as a float didnt work, and we got an error
            return False
    # All arrays are 100% numeric or "nan" entries.
    return True
307796
function isPrimitive( value ) {
	var type = typeof value;
	return type === 'string' || type === 'number' || type === 'boolean' || value === null || value === undefined;
}
851802
private static boolean isNumeric(String value) {
    for (char c : value.toCharArray()) {
      if (!Character.isDigit(c)) {
        return false;
      }
    }
    return true;
  }
138573
public static boolean isNumber( Object obj ) {
      if( (obj != null && obj.getClass() == Byte.TYPE)
            || (obj != null && obj.getClass() == Short.TYPE)
            || (obj != null && obj.getClass() == Integer.TYPE)
            || (obj != null && obj.getClass() == Long.TYPE)
            || (obj != null && obj.getClass() == Float.TYPE)
            || (obj != null && obj.getClass() == Double.TYPE) ){
         return true;
      }

      return obj instanceof Number;
   }
675429
def is_integer(value: Any) -> bool:
    """"""
    return (isinstance(value, int) and not isinstance(value, bool)) or (
        isinstance(value, float) and isfinite(value) and int(value) == value
    )