def __init__(self, cardinal, config):
        """Registers a callback for URL detection."""
        # Initialize logger
        self.logger = logging.getLogger(__name__)

        try:
            self._max_description_length = config['max_description_length']
        except KeyError:
            self.logger.warning("No max description length in config -- using"
                " defaults: %d" % DEFAULT_MAX_DESCRIPTION_LENGTH)
            self._max_description_length = DEFAULT_MAX_DESCRIPTION_LENGTH

        try:
            self._language_code = config['language_code']
        except __HOLE__:
            self.logger.warning("No language in config -- using defaults: %s" %
                DEFAULT_LANGUAGE_CODE)
            self._language_code = DEFAULT_LANGUAGE_CODE

        self._callback_id = cardinal.event_manager.register_callback(
            'urls.detection', self.url_callback)
dataset/ETHPy150Open JohnMaguire/Cardinal/plugins/wikipedia/plugin.py/WikipediaPlugin.__init__