# Path: brew/exceptions.py
# class YeastException(BrewdayException):
#     pass
# 
# Path: brew/validators.py
# def validate_optional_fields(data, optional_fields, data_field=u"data"):
#     """
#     Validate fields which are optional as part of the data.
# 
#     :param dict data: A python dictionary to check for required fields
#     :param list(tuple) optional_fields: Values and types to check for in data
#     :param str data_field: The key in the data dictionary containing the optional fields
#     :raises ValidatorException: Optional field is of the wrong type
# 
#     The format is a list of tuples where the first element is a string with
#     a value that should be a key found in the data dict and
#     where the second element is a python type or list/tuple of
#     python types to check the field against.
#     """  # noqa
#     # If no optional data field present then return
#     if data_field not in data:
#         return
#     for field, field_type in optional_fields:
#         if field in data[data_field]:
#             if field_type == str:
#                 try:
#                     field_type = unicode
#                 except NameError:
#                     field_type = str
#             # With optional fields only check the type as they are overrides
#             # and not all overrides need to be present
#             if not isinstance(data[data_field][field], field_type):
#                 raise ValidatorException(
#                     u"Optional field '{}' in '{}' is not of type '{}'".format(  # noqa
#                         field, data_field, field_type
#                     )
#                 )
# 
# 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/validators.py
# def validate_required_fields(data, required_fields):
#     """
#     Validate fields which are required as part of the data.
# 
#     :param dict data: A python dictionary to check for required fields
#     :param list(tuple) required_fields: Values and types to check for in data
#     :raises ValidatorException: Required field is missing from data
#     :raises ValidatorException: Required field is of the wrong type
# 
#     The format is a list of tuples where the first element is a string with
#     a value that should be a key found in the data dict and
#     where the second element is a python type or list/tuple of
#     python types to check the field against.
#     """
#     for field, field_type in required_fields:
#         if field not in data:
#             raise ValidatorException(
#                 u"Required field '{}' missing from data".format(field)  # noqa
#             )
#         if field_type == str:
#             try:
#                 field_type = unicode
#             except NameError:
#                 field_type = str
#         if not isinstance(data[field], field_type):
#             raise ValidatorException(
#                 u"Required field '{}' is not of type '{}'".format(  # noqa
#                     field, field_type
#                 )
#             )


import json
import sys
import textwrap
from .exceptions import YeastException
from .validators import validate_optional_fields
from .validators import validate_percentage
from .validators import validate_required_fields
# -*- coding: utf-8 -*-


__all__ = [u"Yeast"]


class Yeast(object):
    """
    A representation of a type of Yeast as added to a Recipe.
    """

    def __init__(self, name, percent_attenuation=0.75):
        """
        :param float percent_attenuation: The percentage the yeast is expected to attenuate the sugar in the yeast to create alcohol
        :raises YeastException: If percent_attenuation is not provided
        """  # noqa
        self.name = name
        if percent_attenuation is None:

# Path: brew/exceptions.py
# class YeastException(BrewdayException):
#     pass
# 
# Path: brew/validators.py
# def validate_optional_fields(data, optional_fields, data_field=u"data"):
#     """
#     Validate fields which are optional as part of the data.
# 
#     :param dict data: A python dictionary to check for required fields
#     :param list(tuple) optional_fields: Values and types to check for in data
#     :param str data_field: The key in the data dictionary containing the optional fields
#     :raises ValidatorException: Optional field is of the wrong type
# 
#     The format is a list of tuples where the first element is a string with
#     a value that should be a key found in the data dict and
#     where the second element is a python type or list/tuple of
#     python types to check the field against.
#     """  # noqa
#     # If no optional data field present then return
#     if data_field not in data:
#         return
#     for field, field_type in optional_fields:
#         if field in data[data_field]:
#             if field_type == str:
#                 try:
#                     field_type = unicode
#                 except NameError:
#                     field_type = str
#             # With optional fields only check the type as they are overrides
#             # and not all overrides need to be present
#             if not isinstance(data[data_field][field], field_type):
#                 raise ValidatorException(
#                     u"Optional field '{}' in '{}' is not of type '{}'".format(  # noqa
#                         field, data_field, field_type
#                     )
#                 )
# 
# 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/validators.py
# def validate_required_fields(data, required_fields):
#     """
#     Validate fields which are required as part of the data.
# 
#     :param dict data: A python dictionary to check for required fields
#     :param list(tuple) required_fields: Values and types to check for in data
#     :raises ValidatorException: Required field is missing from data
#     :raises ValidatorException: Required field is of the wrong type
# 
#     The format is a list of tuples where the first element is a string with
#     a value that should be a key found in the data dict and
#     where the second element is a python type or list/tuple of
#     python types to check the field against.
#     """
#     for field, field_type in required_fields:
#         if field not in data:
#             raise ValidatorException(
#                 u"Required field '{}' missing from data".format(field)  # noqa
#             )
#         if field_type == str:
#             try:
#                 field_type = unicode
#             except NameError:
#                 field_type = str
#         if not isinstance(data[field], field_type):
#             raise ValidatorException(
#                 u"Required field '{}' is not of type '{}'".format(  # noqa
#                     field, field_type
#                 )
#             )


# Path: brew/yeasts.py
import json
import sys
import textwrap
from .exceptions import YeastException
from .validators import validate_optional_fields
from .validators import validate_percentage
from .validators import validate_required_fields

# -*- coding: utf-8 -*-


__all__ = [u"Yeast"]


class Yeast(object):
    """
    A representation of a type of Yeast as added to a Recipe.
    """

    def __init__(self, name, percent_attenuation=0.75):
        """
        :param float percent_attenuation: The percentage the yeast is expected to attenuate the sugar in the yeast to create alcohol
        :raises YeastException: If percent_attenuation is not provided
        """  # noqa
        self.name = name
        if percent_attenuation is None:

            raise YeastException(