# 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
        u"Unkown hop type '{}', must use {}".format(hop_type, u", ".join(HOP_TYPE_LIST))
    )


def validate_percentage(percent):
    """
    Validate decimal percentage

    :param float percent: Percentage between 0.0 and 1.0
    :return: percentage
    :rtype: float
    :raises ValidatorException: If decimal percentage not between 0.0 and 1.0
    """
    if 0.0 <= percent <= 1.0:
        return percent
    raise ValidatorException(u"Percentage values should be in decimal format")


def validate_units(units):
    """
    Validate units

    :param str units: Unit type
    :return: units
    :rtype: str
    :raises ValidatorException: If units is unknown
    """
    if units in [IMPERIAL_UNITS, SI_UNITS]:
        return units
    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

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


def validate_percentage(percent):
    """
    Validate decimal percentage

    :param float percent: Percentage between 0.0 and 1.0
    :return: percentage
    :rtype: float
    :raises ValidatorException: If decimal percentage not between 0.0 and 1.0
    """
    if 0.0 <= percent <= 1.0:
        return percent
    raise ValidatorException(u"Percentage values should be in decimal format")


def validate_units(units):
    """
    Validate units

    :param str units: Unit type
    :return: units
    :rtype: str
    :raises ValidatorException: If units is unknown
    """
    if units in [IMPERIAL_UNITS, SI_UNITS]:
        return units
    raise ValidatorException(

        u"Unkown units '{}', must use {} or {}".format(units, IMPERIAL_UNITS, SI_UNITS)