def __init__(self, uri=None, **kwargs):
        """Initialize the socket and initialize pdb."""
        params = DEFAULT_PARAMS.copy()
        params.update(parse_irc_uri(uri))
        params.update(kwargs)

        # Backup stdin and stdout before replacing them by the socket handle
        self.old_stdout = sys.stdout
        self.old_stdin = sys.stdin
        self.read_timeout = 0.1

        if not params.get('limit_access_to'):
            raise NoAllowedNicknamesSelected(
                "You must specify a list of nicknames that are allowed "
                "to interact with the debugger using the "
                "`limit_access_to` keyword argument."
            )
        elif isinstance(params.get('limit_access_to'), six.string_types):
            params['limit_access_to'] = [params.get('limit_access_to')]

        connect_params = {}
        if not params.get('nickname'):
            params['nickname'] = socket.gethostname().split('.')[0]
        if not params.get('channel'):
            raise NoChannelSelected(
                "You must specify a channel to connect to using the "
                "`channel` keyword argument."
            )
        if params.get('ssl'):
            connect_params['connect_factory'] = (
                Factory(wrapper=ssllib.wrap_socket)
            )

        # Writes to stdout are forbidden in mod_wsgi environments
        try:
            logger.info(
                "ircpdb has connected to %s:%s on %s\n",
                params.get('server'),
                params.get('port'),
                params.get('channel')
            )
        except __HOLE__:
            pass

        r_pipe, w_pipe = os.pipe()
        # The A pipe is from the bot to pdb
        self.p_A_pipe = os.fdopen(r_pipe, 'r')
        self.b_A_pipe = os.fdopen(w_pipe, 'w')

        r_pipe, w_pipe = os.pipe()
        # The B pipe is from pdb to the bot
        self.b_B_pipe = os.fdopen(r_pipe, 'r')
        self.p_B_pipe = os.fdopen(w_pipe, 'w')

        pdb.Pdb.__init__(
            self,
            stdin=self.p_A_pipe,
            stdout=self.p_B_pipe,
        )

        self.bot = IrcpdbBot(
            channel=params.get('channel'),
            nickname=params.get('nickname'),
            server=params.get('server'),
            port=params.get('port'),
            password=params.get('password'),
            limit_access_to=params.get('limit_access_to'),
            message_wait_seconds=params.get('message_wait_seconds'),
            dpaste_minimum_response_length=(
                params.get('dpaste_minimum_response_length')
            ),
            activation_timeout=params.get('activation_timeout'),
            **connect_params
        )
dataset/ETHPy150Open coddingtonbear/ircpdb/ircpdb/debugger.py/Ircpdb.__init__