# Path: brew/constants.py
# ABV_CONST = 131.25  # RATIO_C2H6O_TO_CO2 / ALCOHOL_SPECIFIC_GRAVITY * 100.0
# 
# Path: brew/constants.py
# ALCOHOL_SPECIFIC_GRAVITY = 0.7936
# 
# Path: brew/utilities/sugar.py
# def apparent_extract_to_real_extract(original_extract, apparent_extract):
#     """
#     Apparent Extract to Real Extract in degrees Plato
# 
#     :param float original_extract: Original degrees Plato
#     :param float apparent_extract: Apparent degrees Plato of finished beer
#     :return: Real degrees Plato of finished beer
#     :rtype: float
# 
#     Source:
# 
#     * Formula from Balling: De Clerck, Jean, A Textbook Of Brewing, Chapman & Hall Ltd., 1958
#     """  # noqa
#     attenuation_coeff = 0.22 + 0.001 * original_extract
#     real_extract = (attenuation_coeff * original_extract + apparent_extract) / (
#         1 + attenuation_coeff
#     )  # noqa
#     return real_extract


from ..constants import ABV_CONST
from ..constants import ALCOHOL_SPECIFIC_GRAVITY
from .sugar import apparent_extract_to_real_extract
    Source:

    * Formula from Balling: De Clerck, Jean, A Textbook Of Brewing, Chapman & Hall Ltd., 1958
    * http://beersmith.com/blog/2010/09/07/apparent-and-real-attenuation-for-beer-brewers-part-1/
    * http://beersmith.com/blog/2010/09/14/apparent-and-real-attenuation-for-beer-brewers-part-2/
    """  # noqa
    return (original_extract - apparent_extract) / original_extract


def real_attenuation(original_extract, real_extract):
    """
    Real Attenuation

    :param float original_extract: Original degrees Plato
    :param float real_extract: Real degrees Plato of finished beer
    :return: The percent of real attenuation
    :rtype: float
    """
    return (original_extract - real_extract) / original_extract


def real_attenuation_from_apparent_extract(original_extract, apparent_extract):
    """
    Real Attenuation from Apparent Extract

    :param float original_extract: Original degrees Plato
    :param float apparent_extract: Apparent degrees Plato of finished beer
    :return: The percent of real attenuation
    :rtype: float
    """

# Path: brew/constants.py
# ABV_CONST = 131.25  # RATIO_C2H6O_TO_CO2 / ALCOHOL_SPECIFIC_GRAVITY * 100.0
# 
# Path: brew/constants.py
# ALCOHOL_SPECIFIC_GRAVITY = 0.7936
# 
# Path: brew/utilities/sugar.py
# def apparent_extract_to_real_extract(original_extract, apparent_extract):
#     """
#     Apparent Extract to Real Extract in degrees Plato
# 
#     :param float original_extract: Original degrees Plato
#     :param float apparent_extract: Apparent degrees Plato of finished beer
#     :return: Real degrees Plato of finished beer
#     :rtype: float
# 
#     Source:
# 
#     * Formula from Balling: De Clerck, Jean, A Textbook Of Brewing, Chapman & Hall Ltd., 1958
#     """  # noqa
#     attenuation_coeff = 0.22 + 0.001 * original_extract
#     real_extract = (attenuation_coeff * original_extract + apparent_extract) / (
#         1 + attenuation_coeff
#     )  # noqa
#     return real_extract


# Path: brew/utilities/abv.py
from ..constants import ABV_CONST
from ..constants import ALCOHOL_SPECIFIC_GRAVITY
from .sugar import apparent_extract_to_real_extract

    Source:

    * Formula from Balling: De Clerck, Jean, A Textbook Of Brewing, Chapman & Hall Ltd., 1958
    * http://beersmith.com/blog/2010/09/07/apparent-and-real-attenuation-for-beer-brewers-part-1/
    * http://beersmith.com/blog/2010/09/14/apparent-and-real-attenuation-for-beer-brewers-part-2/
    """  # noqa
    return (original_extract - apparent_extract) / original_extract


def real_attenuation(original_extract, real_extract):
    """
    Real Attenuation

    :param float original_extract: Original degrees Plato
    :param float real_extract: Real degrees Plato of finished beer
    :return: The percent of real attenuation
    :rtype: float
    """
    return (original_extract - real_extract) / original_extract


def real_attenuation_from_apparent_extract(original_extract, apparent_extract):
    """
    Real Attenuation from Apparent Extract

    :param float original_extract: Original degrees Plato
    :param float apparent_extract: Apparent degrees Plato of finished beer
    :return: The percent of real attenuation
    :rtype: float
    """

    real_extract = apparent_extract_to_real_extract(original_extract, apparent_extract)