# Path: ipuz/exceptions.py
# class IPUZException(Exception):
#     pass
# 
# Path: ipuz/validators.py
# def validate_string(field_name, field_data):
#     if not isinstance(field_data, str):
#         raise IPUZException("Invalid {} value found".format(field_name))


import string
from ipuz.exceptions import IPUZException
from ipuz.validators import validate_string


def validate_stylespec_shapebg(field_data):
    return field_data in ["circle"]


def validate_stylespec_highlight(field_data):
    return isinstance(field_data, bool)


def validate_stylespec_named(field_data):
    return field_data is False or isinstance(field_data, str)


def validate_stylespec_border(field_data):
    return type(field_data) is int and field_data >= 0


def validate_stylespec_divided(field_data):
    return field_data in ["-", "|", "/", "\\", "+", "x"]


def validate_stylespec_mark(field_data):
    return (isinstance(field_data, dict) and
            all(key in ["TL", "TR", "BL", "BR"] for key in field_data.keys()))


def validate_stylespec_slice(field_data):
    return (isinstance(field_data, list) and
            len(field_data) == 4 and

# Path: ipuz/exceptions.py
# class IPUZException(Exception):
#     pass
# 
# Path: ipuz/validators.py
# def validate_string(field_name, field_data):
#     if not isinstance(field_data, str):
#         raise IPUZException("Invalid {} value found".format(field_name))


# Path: ipuz/structures/stylespec.py
import string
from ipuz.exceptions import IPUZException
from ipuz.validators import validate_string



def validate_stylespec_shapebg(field_data):
    return field_data in ["circle"]


def validate_stylespec_highlight(field_data):
    return isinstance(field_data, bool)


def validate_stylespec_named(field_data):
    return field_data is False or isinstance(field_data, str)


def validate_stylespec_border(field_data):
    return type(field_data) is int and field_data >= 0


def validate_stylespec_divided(field_data):
    return field_data in ["-", "|", "/", "\\", "+", "x"]


def validate_stylespec_mark(field_data):
    return (isinstance(field_data, dict) and
            all(key in ["TL", "TR", "BL", "BR"] for key in field_data.keys()))


def validate_stylespec_slice(field_data):
    return (isinstance(field_data, list) and
            len(field_data) == 4 and

            all(type(c) is int for c in field_data))