An int, float, long, bool, string, or None literal with the given
    value.
198473
def ex_literal(val):
    
    if val is None:
        return ast.Name('None', ast.Load())
    elif isinstance(val, int):
        return ast.Num(val)
    elif isinstance(val, bool):
        return ast.Name(bytes(val), ast.Load())
    elif isinstance(val, str):
        return ast.Str(val)
    raise TypeError(u'no literal for {0}'.format(type(val)))
49504
def yoffset(self, value):
        """"""
        if self._yoffset != value and \
           isinstance(value, (int, float, long)):
            self._yoffset = value
512507
def safe_int(val, default=None):
    

    try:
        val = int(val)
    except (ValueError, TypeError):
        val = default

    return val
1152241
def get_kind(self, value):
        """"""
        if isinstance(value, float):
            return 'f'
        elif isinstance(value, int):
            return 'i'
        else:
            raise ValueError("Only integer or floating point values can be stored.")
717926
def make_value(self, value):
        
        # ensure any escape sequences are converted to unicode
        value = self.unicode_escape_sequence_fix(value)

        if value and value[0] in ['"', "'"]:
            return self.remove_quotes(value)

        try:
            return int(value)
        except ValueError:
            pass
        try:
            return float(value)
        except ValueError:
            pass
        if value.lower() == "true":
            return True
        if value.lower() == "false":
            return False
        if value.lower() == "none":
            return None
        return value
1244641
def safe_int(string, default=None):
    
    value = safe_float(string, default)
    if value is not None:
        value = int(value)
    return value
293346
def p_optional_value(t):
    """"""
    # return value or None.
    t[0] = t[1]
    # Note this must be unsigned
    value = t[0]
    if value is None or value[0].isdigit():
        return
    msg = ''
    if value[0] == '-':
        msg = "Can't use negative index %s" % value
    elif value not in name_dict:
        msg = "Can't derefence index %s" % value
    else:
        data = name_dict[value]
        if data.type != 'const':
            msg = "Can't use non-constant %s %s as index" % (data.type, value)
        elif not data.positive:
            msg = "Can't use negative index %s" % value
    if msg:
        global error_occurred
        error_occurred = True
        print(u"ERROR - {0:s} near line {1:d}".format(msg, t.lineno(1)))
1158721
def positive_int(val):
    """"""
    if isinstance(val, float):
        raise ValueError('"{}" must not be a float'.format(val))
    val = int(val)
    if val >= 0:
        return val
    raise ValueError('"{}" must be positive'.format(val))
930236
def convert_int(value, parameter):
    '''
    
    '''
    value = _check_default(value, parameter, ( '', '-', None ))
    if value is None or isinstance(value, int):
        return value
    try:
        return int(value)
    except Exception as e:
        raise ValueError(str(e))
20959
def Z(self, value):
        
        if isinstance(value, (int, float,
                              long, types.NoneType)):
            self._z = value
1082645
def _ConvertFloat(value):
  """"""
  if value == 'nan':
    raise ParseError('Couldn\'t parse float "nan", use "NaN" instead.')
  try:
    # Assume Python compatible syntax.
    return float(value)
  except ValueError:
    # Check alternative spellings.
    if value == _NEG_INFINITY:
      return float('-inf')
    elif value == _INFINITY:
      return float('inf')
    elif value == _NAN:
      return float('nan')
    else:
      raise ParseError('Couldn\'t parse float: {0}.'.format(value))
67072
def to_int(value: Any) -> int:
        

        if isinstance(value, (bool, int)):
            return int(value)
        return int(str(value))
1086717
function float(value) {
  var parsedFloat = Number.parseFloat(value);

  // couldn't parse it
  if (typeOf(parsedFloat) != 'number') {
    return throwModifierError('float', value, {message: 'Invalid Float'});
  }

  return parsedFloat;
}
158337
def set_value(self, value):
        """"""

        if self.data_type == self.BOOLEAN_TYPE:
            self.value_boolean = bool(value)
        elif self.data_type == self.NUMBER_TYPE:
            self.value_number = float(value)
        else:
            self.value = value
651314
function parseValue(value) {
    if (['true', 'false'].includes(value)) {
        return value === 'true';
    }
    // is it float parsable?
    const parsed = parseFloat(value);
    if (!isNaN(parsed)) {
        return parsed;
    }
    return value;
}
232402
def boolean(value):
    '''
    
    '''
    if value is None or isinstance(value, bool):
        return value

    try:
        return bool(int(value))
    except ValueError:
        lower_value = value.strip().lower()
        if not lower_value:
            return None
        if lower_value in ('f', 'false', 'n', 'no', 'off'):
            return False
        if lower_value in ('on', 't', 'true', 'y', 'yes'):
            return True
        raise Invalid('Unable to parse boolean {0}'.format(value))
176437
def _cast(self, value):
        
        if value.isdigit():
            value = int(value)
        elif re.compile("^\d+\.\d+").match(value):
            value = float(value)
        return value