# Path: will/utils.py
# class Bunch(dict):
#     def __init__(self, **kw):
#         dict.__init__(self, kw)
#         self.__dict__ = self
# 
#     def __getstate__(self):
#         return self
# 
#     def __setstate__(self, state):
#         self.update(state)
#         self.__dict__ = self


import datetime
import hashlib
import logging
from pytz import timezone as pytz_timezone
from will.utils import Bunch
    ]

    def __init__(self, *args, **kwargs):
        super(Person, self).__init__(*args, **kwargs)

        for f in kwargs:
            self.__dict__[f] = kwargs[f]

        # Provide first_name
        if "first_name" not in kwargs:
            self.first_name = self.name.split(" ")[0]

        for f in self.REQUIRED_FIELDS:
            if not hasattr(self, f):
                raise Exception("Missing %s in Person construction." % f)

        # Set TZ offset.
        if hasattr(self, "timezone") and self.timezone:
            self.timezone = pytz_timezone(self.timezone)
            self.utc_offset = self.timezone._utcoffset
        else:
            self.timezone = False
            self.utc_offset = False

    @property
    def nick(self):
        logging.warn("sender.nick is deprecated and will be removed eventually. Please use sender.handle instead!")
        return self.handle



# Path: will/utils.py
# class Bunch(dict):
#     def __init__(self, **kw):
#         dict.__init__(self, kw)
#         self.__dict__ = self
# 
#     def __getstate__(self):
#         return self
# 
#     def __setstate__(self, state):
#         self.update(state)
#         self.__dict__ = self


# Path: will/abstractions.py
import datetime
import hashlib
import logging
from pytz import timezone as pytz_timezone
from will.utils import Bunch

    ]

    def __init__(self, *args, **kwargs):
        super(Person, self).__init__(*args, **kwargs)

        for f in kwargs:
            self.__dict__[f] = kwargs[f]

        # Provide first_name
        if "first_name" not in kwargs:
            self.first_name = self.name.split(" ")[0]

        for f in self.REQUIRED_FIELDS:
            if not hasattr(self, f):
                raise Exception("Missing %s in Person construction." % f)

        # Set TZ offset.
        if hasattr(self, "timezone") and self.timezone:
            self.timezone = pytz_timezone(self.timezone)
            self.utc_offset = self.timezone._utcoffset
        else:
            self.timezone = False
            self.utc_offset = False

    @property
    def nick(self):
        logging.warn("sender.nick is deprecated and will be removed eventually. Please use sender.handle instead!")
        return self.handle



class Channel(Bunch):