def integer(str_value: str, line: str) ->int:
    """casts the value as an integer"""
    try:
        value = int(str_value)
    except ValueError:
        raise ValueError('%r is not an integer; line:\n%r' % (str_value, line))
    return value
