# Path: brew/constants.py
# FC_DIFF_TWO_ROW = 0.017
# 
# Path: brew/constants.py
# LITERS_OF_WORT_AT_SG = 386.0
# 
# Path: brew/constants.py
# MOISTURE_CORRECTION = 0.0
# 
# Path: brew/constants.py
# MOISTURE_FINISHED_MALT = 0.04
# 
# Path: brew/constants.py
# PPG_TO_HWE_CONVERSION = LITER_PER_GAL * POUND_PER_KG
# 
# Path: brew/constants.py
# SUCROSE_PLATO = 11.486
# 
# Path: brew/constants.py
# SUCROSE_PPG = 46.214
# 
# Path: brew/validators.py
# 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")
# 
# Path: brew/utilities/sugar.py
# def gu_to_sg(gu):
#     """
#     Gravity Units to Specific Gravity
# 
#     :param float gu: Gravity Units
#     :return: Specific Gravity
#     :rtype: float
#     """
#     return 1 + (gu / 1000.0)


from ..constants import FC_DIFF_TWO_ROW
from ..constants import LITERS_OF_WORT_AT_SG
from ..constants import MOISTURE_CORRECTION
from ..constants import MOISTURE_FINISHED_MALT
from ..constants import PPG_TO_HWE_CONVERSION
from ..constants import SUCROSE_PLATO
from ..constants import SUCROSE_PPG
from ..validators import validate_percentage
from .sugar import gu_to_sg
    :param float brew_house_efficiency: The efficiency in decimal form
    :return: Specific Gravity available from Malt
    :rtype: float
    """  # noqa
    validate_percentage(dbcg)
    validate_percentage(moisture_content)
    validate_percentage(moisture_correction)
    validate_percentage(brew_house_efficiency)
    return (
        (dbcg - moisture_content - moisture_correction)
        * brew_house_efficiency
        * SUCROSE_PLATO
    )


def basis_to_hwe(basis_percentage):
    """
    Basis Percentage to Hot Water Extract

    :param float basis_percentage: Basis as percentage
    :return: Hot Water Extract as Ldeg/kg, dry basis
    :rtype: float

    Ldeg/kg means how many litres of wort with a specific gravity of 1.001 you
    could produce from a kilogram of the fermentable

    For example, if you had a kilogram of sucrose, you could make up 386 litres
    of wort with a specific gravity of 1.001.
    """
    validate_percentage(basis_percentage)

# Path: brew/constants.py
# FC_DIFF_TWO_ROW = 0.017
# 
# Path: brew/constants.py
# LITERS_OF_WORT_AT_SG = 386.0
# 
# Path: brew/constants.py
# MOISTURE_CORRECTION = 0.0
# 
# Path: brew/constants.py
# MOISTURE_FINISHED_MALT = 0.04
# 
# Path: brew/constants.py
# PPG_TO_HWE_CONVERSION = LITER_PER_GAL * POUND_PER_KG
# 
# Path: brew/constants.py
# SUCROSE_PLATO = 11.486
# 
# Path: brew/constants.py
# SUCROSE_PPG = 46.214
# 
# Path: brew/validators.py
# 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")
# 
# Path: brew/utilities/sugar.py
# def gu_to_sg(gu):
#     """
#     Gravity Units to Specific Gravity
# 
#     :param float gu: Gravity Units
#     :return: Specific Gravity
#     :rtype: float
#     """
#     return 1 + (gu / 1000.0)


# Path: brew/utilities/malt.py
from ..constants import FC_DIFF_TWO_ROW
from ..constants import LITERS_OF_WORT_AT_SG
from ..constants import MOISTURE_CORRECTION
from ..constants import MOISTURE_FINISHED_MALT
from ..constants import PPG_TO_HWE_CONVERSION
from ..constants import SUCROSE_PLATO
from ..constants import SUCROSE_PPG
from ..validators import validate_percentage
from .sugar import gu_to_sg

    :param float brew_house_efficiency: The efficiency in decimal form
    :return: Specific Gravity available from Malt
    :rtype: float
    """  # noqa
    validate_percentage(dbcg)
    validate_percentage(moisture_content)
    validate_percentage(moisture_correction)
    validate_percentage(brew_house_efficiency)
    return (
        (dbcg - moisture_content - moisture_correction)
        * brew_house_efficiency
        * SUCROSE_PLATO
    )


def basis_to_hwe(basis_percentage):
    """
    Basis Percentage to Hot Water Extract

    :param float basis_percentage: Basis as percentage
    :return: Hot Water Extract as Ldeg/kg, dry basis
    :rtype: float

    Ldeg/kg means how many litres of wort with a specific gravity of 1.001 you
    could produce from a kilogram of the fermentable

    For example, if you had a kilogram of sucrose, you could make up 386 litres
    of wort with a specific gravity of 1.001.
    """
    validate_percentage(basis_percentage)

    return basis_percentage * LITERS_OF_WORT_AT_SG