Handle literals integers values.
544522
def visit_Num(self, node):
        
        if isinstance(node.n, int):
            return self.add(node, Interval(node.n, node.n))
        return UNKNOWN_RANGE
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))
707540
def from_int(value):
        """"""
        if not isinstance(value, int):
            raise PyVLXException("value_has_to_be_int")
        if not Parameter.is_valid_int(value):
            raise PyVLXException("value_out_of_range")
        return bytes([value >> 8 & 255, value & 255])
49504
def yoffset(self, value):
        """"""
        if self._yoffset != value and \
           isinstance(value, (int, float, long)):
            self._yoffset = value
53237
def safe_int_conv(number):
    """"""
    try:
        return int(np.array(number).astype(int, casting='safe'))
    except TypeError:
        raise ValueError('cannot safely convert {} to integer'.format(number))
479129
def tokenize_number(val, line):
    """"""
    try:
        num = int(val)
        typ = TokenType.int
    except ValueError:
        num = float(val)
        typ = TokenType.float

    return {'type': typ, 'value': num, 'line': line}
628543
def integers(value):
    
    if '.' in value:
        raise ValueError('There are decimal points in %s' % value)
    values = value.replace(',', ' ').split()
    if not values:
        raise ValueError('Not a list of integers: %r' % value)
    try:
        ints = [int(float(v)) for v in values]
    except Exception:
        raise ValueError('Not a list of integers: %r' % value)
    return ints
182974
def _set_types(self):
        """"""
        # If we given something that is not an int or a float we raise
        # a RuntimeError as we do not want to have to guess if the given
        # input should be interpreted as an int or a float, for example the
        # interpretation of the string "1" vs the interpretation of the string
        # "1.0".
        for c in (self.x, self.y):
            if not ( isinstance(c, int) or isinstance(c, float) ):
                raise(RuntimeError('x, y coords should be int or float'))

        if isinstance(self.x, int) and isinstance(self.y, int):
            self._dtype = "int"
        else:
            # At least one value is a float so promote both to float.
            self.x = float(self.x)
            self.y = float(self.y)
            self._dtype = "float"
430011
def _format_num(self, value):
        """"""
        # (value is True or value is False) is ~5x faster than isinstance(value, bool)
        if value is True or value is False:
            raise TypeError('value must be a Number, not a boolean.')
        return self.num_type(value)
1268848
def _compile_literal(self, data):
        """"""
        if data is None:
            return 'nil'
        elif data is True:
            return 'yes'
        elif data is False:
            return 'no'
        else:
            return repr(data)
145517
def validate_positive_integer(option, value):
    
    val = validate_integer(option, value)
    if val <= 0:
        raise ValueError("The value of %s must be "
                         "a positive integer" % (option,))
    return val
1151984
def _to_int(self, val_str):
        """"""
        val = _integerValue_to_int(val_str)
        if val is None:
            raise ValueError(
                _format("The value-mapped {0} has an invalid integer "
                        "representation in a ValueMap entry: {1!A}",
                        self._element_str(), val_str))
        return val
561850
def _operator_handling(self, cursor):
        """"""
        values = self._literal_handling(cursor)
        retval = ''.join([str(val) for val in values])
        return retval
458421
def clean(self, value):
        """"""

        if isinstance(value, numbers.Number):
            return value
        elif isinstance(value, six.string_types):
            try:
                value = float(value)
                return int(value) if value.is_integer() else value
            except ValueError:
                raise ParameterNotValidError

        raise ParameterNotValidError
163676
def __try_parse_number(self, string):
        """"""
        try:
            return int(string)
        except ValueError:
            try:
                return float(string)
            except ValueError:
                return False
1325553
def make_int(value, missing=-1):
    """"""
    if isinstance(value, six.string_types):
        if not value.strip():
            return missing
    elif value is None:
        return missing
    return int(value)
1083724
def translate(cls, val):
        """"""
        if val is None:
            return cls.translate_none(val)
        elif isinstance(val, string_types):
            return cls.translate_str(val)
        # Needs to be before integer checks
        elif isinstance(val, bool):
            return cls.translate_bool(val)
        elif isinstance(val, integer_types):
            return cls.translate_int(val)
        elif isinstance(val, float):
            return cls.translate_float(val)
        elif isinstance(val, dict):
            return cls.translate_dict(val)
        elif isinstance(val, list):
            return cls.translate_list(val)
        # Use this generic translation as a last resort
        return cls.translate_escaped_str(val)