# Path: will/settings.py
# def auto_key():
# def import_settings(quiet=True):
#         DEPRECATED_BUT_MAPPED_SETTINGS = {
#             "USERNAME": "HIPCHAT_USERNAME",
#             "PASSWORD": "HIPCHAT_PASSWORD",
#             "V1_TOKEN": "HIPCHAT_V1_TOKEN",
#             "V2_TOKEN": "HIPCHAT_V2_TOKEN",
#             "TOKEN": "HIPCHAT_V1_TOKEN",
#             "ROOMS": "HIPCHAT_ROOMS",
#             "NAME": "HIPCHAT_NAME",
#             "HANDLE": "HIPCHAT_HANDLE",
#             "DEFAULT_ROOM": "HIPCHAT_DEFAULT_ROOM",
#             "SLACK_DEFAULT_ROOM": "SLACK_DEFAULT_CHANNEL",
#         }
#             IO_BACKENDS = []


import importlib
import logging
import dill as pickle
import functools
from will import settings


class EncryptionMixin(object):
    @property
    def encryption_backend(self):
        if not hasattr(self, "_encryption"):
            if hasattr(self, "bot") and hasattr(self.bot, "_encryption"):
                self._encryption = self.bot._encryption
            else:
                # The ENCRYPTION_BACKEND setting points to a specific module namespace
                # aes => will.encryption.aes
                module_name = ''.join([
                    'will.backends.encryption.',
                    getattr(settings, 'ENCRYPTION_BACKEND', 'aes'),
                ])
                encryption_module = importlib.import_module(module_name)

# Path: will/settings.py
# def auto_key():
# def import_settings(quiet=True):
#         DEPRECATED_BUT_MAPPED_SETTINGS = {
#             "USERNAME": "HIPCHAT_USERNAME",
#             "PASSWORD": "HIPCHAT_PASSWORD",
#             "V1_TOKEN": "HIPCHAT_V1_TOKEN",
#             "V2_TOKEN": "HIPCHAT_V2_TOKEN",
#             "TOKEN": "HIPCHAT_V1_TOKEN",
#             "ROOMS": "HIPCHAT_ROOMS",
#             "NAME": "HIPCHAT_NAME",
#             "HANDLE": "HIPCHAT_HANDLE",
#             "DEFAULT_ROOM": "HIPCHAT_DEFAULT_ROOM",
#             "SLACK_DEFAULT_ROOM": "SLACK_DEFAULT_CHANNEL",
#         }
#             IO_BACKENDS = []


# Path: will/mixins/encryption.py
import importlib
import logging
import dill as pickle
import functools
from will import settings



class EncryptionMixin(object):
    @property
    def encryption_backend(self):
        if not hasattr(self, "_encryption"):
            if hasattr(self, "bot") and hasattr(self.bot, "_encryption"):
                self._encryption = self.bot._encryption
            else:
                # The ENCRYPTION_BACKEND setting points to a specific module namespace
                # aes => will.encryption.aes
                module_name = ''.join([
                    'will.backends.encryption.',
                    getattr(settings, 'ENCRYPTION_BACKEND', 'aes'),
                ])
                encryption_module = importlib.import_module(module_name)

                self._encryption = encryption_module.bootstrap(settings)