# Path: brew/constants.py
# GRAIN_TYPE_LIST = [
#     GRAIN_TYPE_CEREAL,
#     GRAIN_TYPE_SPECIALTY,
#     GRAIN_TYPE_DME,
#     GRAIN_TYPE_LME,
# ]
# 
# Path: brew/constants.py
# HOP_TYPE_LIST = [HOP_TYPE_PELLET, HOP_TYPE_WHOLE, HOP_TYPE_WHOLE_WET, HOP_TYPE_PLUG]
# 
# Path: brew/constants.py
# IMPERIAL_UNITS = u"imperial"
# 
# Path: brew/constants.py
# SI_UNITS = u"metric"
# 
# Path: brew/exceptions.py
# class ValidatorException(BrewdayException):
#     pass


from .constants import GRAIN_TYPE_LIST
from .constants import HOP_TYPE_LIST
from .constants import IMPERIAL_UNITS
from .constants import SI_UNITS
from .exceptions import ValidatorException
def validate_grain_type(grain_type):
    """
    Validate a grain type

    :param str grain_type: Type of Grain
    :return: grain type
    :rtype: str
    :raises ValidatorException: If grain type is unknown
    """
    if grain_type in GRAIN_TYPE_LIST:
        return grain_type
    raise ValidatorException(
        u"Unkown grain type '{}', must use {}".format(
            grain_type, u", ".join(GRAIN_TYPE_LIST)
        )
    )


def validate_hop_type(hop_type):
    """
    Validate a hop type

    :param str hop_type: Type of Grain
    :return: hop type
    :rtype: str
    :raises ValidatorException: If hop type is unknown
    """
    if hop_type in HOP_TYPE_LIST:
        return hop_type
    raise ValidatorException(

# Path: brew/constants.py
# GRAIN_TYPE_LIST = [
#     GRAIN_TYPE_CEREAL,
#     GRAIN_TYPE_SPECIALTY,
#     GRAIN_TYPE_DME,
#     GRAIN_TYPE_LME,
# ]
# 
# Path: brew/constants.py
# HOP_TYPE_LIST = [HOP_TYPE_PELLET, HOP_TYPE_WHOLE, HOP_TYPE_WHOLE_WET, HOP_TYPE_PLUG]
# 
# Path: brew/constants.py
# IMPERIAL_UNITS = u"imperial"
# 
# Path: brew/constants.py
# SI_UNITS = u"metric"
# 
# Path: brew/exceptions.py
# class ValidatorException(BrewdayException):
#     pass


# Path: brew/validators.py
from .constants import GRAIN_TYPE_LIST
from .constants import HOP_TYPE_LIST
from .constants import IMPERIAL_UNITS
from .constants import SI_UNITS
from .exceptions import ValidatorException

def validate_grain_type(grain_type):
    """
    Validate a grain type

    :param str grain_type: Type of Grain
    :return: grain type
    :rtype: str
    :raises ValidatorException: If grain type is unknown
    """
    if grain_type in GRAIN_TYPE_LIST:
        return grain_type
    raise ValidatorException(
        u"Unkown grain type '{}', must use {}".format(
            grain_type, u", ".join(GRAIN_TYPE_LIST)
        )
    )


def validate_hop_type(hop_type):
    """
    Validate a hop type

    :param str hop_type: Type of Grain
    :return: hop type
    :rtype: str
    :raises ValidatorException: If hop type is unknown
    """
    if hop_type in HOP_TYPE_LIST:
        return hop_type
    raise ValidatorException(

        u"Unkown hop type '{}', must use {}".format(hop_type, u", ".join(HOP_TYPE_LIST))