# Path: brew/exceptions.py
# class ColorException(BrewdayException):
#     pass
# 
# Path: brew/exceptions.py
# class StyleException(BrewdayException):
#     pass
# 
# 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 ColorException
from .exceptions import StyleException
from .validators import validate_required_fields
        return errors

    def to_dict(self):
        style_dict = {
            u"style": self.style,
            u"category": self.category,
            u"subcategory": self.subcategory,
            u"og": self.og,
            u"fg": self.fg,
            u"abv": self.abv,
            u"ibu": self.ibu,
            u"color": self.color,
        }
        return style_dict

    def to_json(self):
        return json.dumps(self.to_dict(), sort_keys=True)

    @classmethod
    def validate(cls, recipe):
        required_fields = [
            (u"style", str),
            (u"category", str),
            (u"subcategory", str),
            (u"og", (list, tuple)),
            (u"fg", (list, tuple)),
            (u"abv", (list, tuple)),
            (u"ibu", (list, tuple)),
            (u"color", (list, tuple)),
        ]

# Path: brew/exceptions.py
# class ColorException(BrewdayException):
#     pass
# 
# Path: brew/exceptions.py
# class StyleException(BrewdayException):
#     pass
# 
# 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/styles.py
import json
import sys
import textwrap
from .exceptions import ColorException
from .exceptions import StyleException
from .validators import validate_required_fields

        return errors

    def to_dict(self):
        style_dict = {
            u"style": self.style,
            u"category": self.category,
            u"subcategory": self.subcategory,
            u"og": self.og,
            u"fg": self.fg,
            u"abv": self.abv,
            u"ibu": self.ibu,
            u"color": self.color,
        }
        return style_dict

    def to_json(self):
        return json.dumps(self.to_dict(), sort_keys=True)

    @classmethod
    def validate(cls, recipe):
        required_fields = [
            (u"style", str),
            (u"category", str),
            (u"subcategory", str),
            (u"og", (list, tuple)),
            (u"fg", (list, tuple)),
            (u"abv", (list, tuple)),
            (u"ibu", (list, tuple)),
            (u"color", (list, tuple)),
        ]

        validate_required_fields(recipe, required_fields)