# Path: mfr/settings.py
# class SettingsDict(dict):
#     def __init__(self, *args, parent=None, **kwargs):
#     def get(self, key, default=None):
#     def get_bool(self, key, default=None):
#     def get_nullable(self, key, default=None):
#     def get_object(self, key, default=None):
#     def full_key(self, key):
#     def child(self, key):
# def child(key):
# PROJECT_NAME = 'mfr'
# PROJECT_CONFIG_PATH = '~/.cos'
# UNSUPPORTED_EXPORTER_MSG = 'Exporting of this file type is not currently supported.'
# UNSUPPORTED_RENDER_MSG = 'Viewing of this file type is not currently supported. Please download the file to view.'
# MAX_FILE_SIZE_TO_RENDER = {'.csv': 100000000,
#                            '.xlsx': 1000000000,
#                            '.tsv': 1000000000,
#                            '.sav': 1000000000,
#                            '.xls': 1000000000,
#                            '.zip': 1000000000}
#     DEFAULT_FORMATTER = {
#         '()': 'colorlog.ColoredFormatter',
#         'format': '%(cyan)s[%(asctime)s]%(log_color)s[%(levelname)s][%(name)s]: %(reset)s%(message)s'
#     }
#     DEFAULT_FORMATTER = {
#         '()': 'waterbutler.core.logging.MaskFormatter',
#         'format': '[%(asctime)s][%(levelname)s][%(name)s]: %(message)s',
#         'pattern': '(?<=cookie=)(.*?)(?=&|$)',
#         'mask': '***'
#     }
# DEFAULT_LOGGING_CONFIG = {
#     'version': 1,
#     'disable_existing_loggers': False,
#     'formatters': {
#         'console': DEFAULT_FORMATTER,
#     },
#     'handlers': {
#         'console': {
#             'class': 'logging.StreamHandler',
#             'level': 'INFO',
#             'formatter': 'console'
#         },
#         'syslog': {
#             'class': 'logging.handlers.SysLogHandler',
#             'level': 'INFO'
#         }
#     },
#     'loggers': {
#         '': {
#             'handlers': ['console'],
#             'level': 'INFO',
#             'propagate': False
#         }
#     },
#     'root': {
#         'level': 'INFO',
#         'handlers': ['console']
#     }
# }
# SENTRY_DSN = config.get_nullable('SENTRY_DSN', None)
# GOOGLE_ANALYTICS_TRACKING_ID = config.get_nullable('GOOGLE_ANALYTICS_TRACKING_ID', None)


import waterbutler.core.exceptions
from mfr import settings
class MakeProviderError(DriverManagerError):
    """Thrown when MFR can't find an applicable provider class.  This indicates programmer error,
    so ``code`` defaults to ``500``."""

    def __init__(self, message, *args, code: int=500, **kwargs):
        super().__init__(message, *args, code=code, **kwargs)


class UnsupportedExtensionError(DriverManagerError):
    """When make_renderer and make_exporter fail, it's usually because MFR doesn't support that
    extension yet.  This error inherits from DriverManagerError (since it's the DriverManager that
    trips this) and includes a handler_type argsument
    """

    __TYPE = 'unsupported_extension'

    def __init__(self, *args, code: int=400, handler_type: str='', **kwargs):
        super().__init__(*args, code=code, **kwargs)

        self.handler_type = handler_type

        self.attr_stack.append([self.__TYPE, {'handler_type': self.handler_type}])


class MakeRendererError(UnsupportedExtensionError):
    """The MFR related errors raised from a ``mfr.core.utils.make_renderer`` should inherit from
    MakeRendererError
    """

    def __init__(self, *args, **kwargs):

# Path: mfr/settings.py
# class SettingsDict(dict):
#     def __init__(self, *args, parent=None, **kwargs):
#     def get(self, key, default=None):
#     def get_bool(self, key, default=None):
#     def get_nullable(self, key, default=None):
#     def get_object(self, key, default=None):
#     def full_key(self, key):
#     def child(self, key):
# def child(key):
# PROJECT_NAME = 'mfr'
# PROJECT_CONFIG_PATH = '~/.cos'
# UNSUPPORTED_EXPORTER_MSG = 'Exporting of this file type is not currently supported.'
# UNSUPPORTED_RENDER_MSG = 'Viewing of this file type is not currently supported. Please download the file to view.'
# MAX_FILE_SIZE_TO_RENDER = {'.csv': 100000000,
#                            '.xlsx': 1000000000,
#                            '.tsv': 1000000000,
#                            '.sav': 1000000000,
#                            '.xls': 1000000000,
#                            '.zip': 1000000000}
#     DEFAULT_FORMATTER = {
#         '()': 'colorlog.ColoredFormatter',
#         'format': '%(cyan)s[%(asctime)s]%(log_color)s[%(levelname)s][%(name)s]: %(reset)s%(message)s'
#     }
#     DEFAULT_FORMATTER = {
#         '()': 'waterbutler.core.logging.MaskFormatter',
#         'format': '[%(asctime)s][%(levelname)s][%(name)s]: %(message)s',
#         'pattern': '(?<=cookie=)(.*?)(?=&|$)',
#         'mask': '***'
#     }
# DEFAULT_LOGGING_CONFIG = {
#     'version': 1,
#     'disable_existing_loggers': False,
#     'formatters': {
#         'console': DEFAULT_FORMATTER,
#     },
#     'handlers': {
#         'console': {
#             'class': 'logging.StreamHandler',
#             'level': 'INFO',
#             'formatter': 'console'
#         },
#         'syslog': {
#             'class': 'logging.handlers.SysLogHandler',
#             'level': 'INFO'
#         }
#     },
#     'loggers': {
#         '': {
#             'handlers': ['console'],
#             'level': 'INFO',
#             'propagate': False
#         }
#     },
#     'root': {
#         'level': 'INFO',
#         'handlers': ['console']
#     }
# }
# SENTRY_DSN = config.get_nullable('SENTRY_DSN', None)
# GOOGLE_ANALYTICS_TRACKING_ID = config.get_nullable('GOOGLE_ANALYTICS_TRACKING_ID', None)


# Path: mfr/core/exceptions.py
import waterbutler.core.exceptions
from mfr import settings

class MakeProviderError(DriverManagerError):
    """Thrown when MFR can't find an applicable provider class.  This indicates programmer error,
    so ``code`` defaults to ``500``."""

    def __init__(self, message, *args, code: int=500, **kwargs):
        super().__init__(message, *args, code=code, **kwargs)


class UnsupportedExtensionError(DriverManagerError):
    """When make_renderer and make_exporter fail, it's usually because MFR doesn't support that
    extension yet.  This error inherits from DriverManagerError (since it's the DriverManager that
    trips this) and includes a handler_type argsument
    """

    __TYPE = 'unsupported_extension'

    def __init__(self, *args, code: int=400, handler_type: str='', **kwargs):
        super().__init__(*args, code=code, **kwargs)

        self.handler_type = handler_type

        self.attr_stack.append([self.__TYPE, {'handler_type': self.handler_type}])


class MakeRendererError(UnsupportedExtensionError):
    """The MFR related errors raised from a ``mfr.core.utils.make_renderer`` should inherit from
    MakeRendererError
    """

    def __init__(self, *args, **kwargs):

        super().__init__(settings.UNSUPPORTED_RENDER_MSG, *args, handler_type='renderer',