# Path: wwb_scanner/core.py
# class JSONMixin(object):
#     @classmethod
#     def from_json(cls, data, **kwargs):
#         if isinstance(data, basestring):
#             data = json.loads(data)
#         kwargs.update(data)
#         kwargs['__from_json__'] = True
#         obj = cls(**kwargs)
#         obj._deserialize(**kwargs)
#         return obj
#     def instance_from_json(self, data, **kwargs):
#         if isinstance(data, basestring):
#             data = json.loads(data)
#         kwargs.update(data)
#         self._deserialize(**kwargs)
#     def to_json(self, **kwargs):
#         d = self._serialize()
#         return json.dumps(d, **kwargs)
#     def _serialize(self):
#         raise NotImplementedError('method must be implemented by subclasses')
#     def _deserialize(self, **kwargs):
#         pass


from wwb_scanner.core import JSONMixin

class Config(JSONMixin):
    def __init__(self, initdict=None, **kwargs):
        data = {}
        if initdict is not None:
            data.update(initdict)
        data.update(kwargs)
        if '__from_json__' in data:
            del data['__from_json__']
        if hasattr(self, 'DEFAULTS'):
            for key, val in self.DEFAULTS.items():
                data.setdefault(key, val)
        self._config_keys = set(data.keys())
        self._child_conf_keys = set(data.get('_child_conf_keys', []))
        self._data = {}
        for key, val in data.items():
            if key == '_child_conf_keys':
                continue
            self[key] = val
    def __setitem__(self, key, item):
        if key in self._child_conf_keys:
            if not isinstance(item, Config):
                item = self._deserialize_child(key, item)
        elif isinstance(item, Config):
            self._child_conf_keys.add(key)
        self._data[key] = item
        self._config_keys.add(key)

# Path: wwb_scanner/core.py
# class JSONMixin(object):
#     @classmethod
#     def from_json(cls, data, **kwargs):
#         if isinstance(data, basestring):
#             data = json.loads(data)
#         kwargs.update(data)
#         kwargs['__from_json__'] = True
#         obj = cls(**kwargs)
#         obj._deserialize(**kwargs)
#         return obj
#     def instance_from_json(self, data, **kwargs):
#         if isinstance(data, basestring):
#             data = json.loads(data)
#         kwargs.update(data)
#         self._deserialize(**kwargs)
#     def to_json(self, **kwargs):
#         d = self._serialize()
#         return json.dumps(d, **kwargs)
#     def _serialize(self):
#         raise NotImplementedError('method must be implemented by subclasses')
#     def _deserialize(self, **kwargs):
#         pass


# Path: wwb_scanner/utils/config.py
from wwb_scanner.core import JSONMixin


class Config(JSONMixin):
    def __init__(self, initdict=None, **kwargs):
        data = {}
        if initdict is not None:
            data.update(initdict)
        data.update(kwargs)
        if '__from_json__' in data:
            del data['__from_json__']
        if hasattr(self, 'DEFAULTS'):
            for key, val in self.DEFAULTS.items():
                data.setdefault(key, val)
        self._config_keys = set(data.keys())
        self._child_conf_keys = set(data.get('_child_conf_keys', []))
        self._data = {}
        for key, val in data.items():
            if key == '_child_conf_keys':
                continue
            self[key] = val
    def __setitem__(self, key, item):
        if key in self._child_conf_keys:
            if not isinstance(item, Config):
                item = self._deserialize_child(key, item)
        elif isinstance(item, Config):
            self._child_conf_keys.add(key)
        self._data[key] = item
        self._config_keys.add(key)

    def __getitem__(self, key):