def connect(self, address):
        """
        Connect the channel to a remote socket.

        The given ``address`` is resolved and used by the channel to
        connect to the remote server. If an error occurs at any stage in
        this process, :meth:`~pants.stream.Stream.on_connect_error` is
        called. When a connection is successfully established,
        :meth:`~pants.stream.Stream.on_connect` is called.

        Addresses can be represented in a number of different ways. A
        single string is treated as a UNIX address. A single integer is
        treated as a port and converted to a 2-tuple of the form
        ``('', port)``. A 2-tuple is treated as an IPv4 address and a
        4-tuple is treated as an IPv6 address. See the :mod:`socket`
        documentation for further information on socket addresses.

        If no socket exists on the channel, one will be created with a
        socket family appropriate for the given address.

        An error will occur during the connection if the given address
        is not of a valid format or of an inappropriate format for the
        socket (e.g. if an IP address is given to a UNIX socket).

        Calling :meth:`connect()` on a closed channel or a channel that
        is already connected will raise a :exc:`RuntimeError`.

        Returns the channel.

        ===============  ===============================================
        Arguments        Description
        ===============  ===============================================
        address          The remote address to connect to.
        ===============  ===============================================
        """
        if self.connected or self.connecting:
            raise RuntimeError("connect() called on active %r." % self)

        if self._closed or self._closing:
            raise RuntimeError(self % "connect() called on closed %r.")

        self.connecting = True

        address, family, resolved = self._format_address(address)

        if resolved:
            self._do_connect(address, family)
        else:
            try:
                result = socket.getaddrinfo(address[0], address[1], family)
            except socket.error as err:
                self.close(flush=False)
                e = StreamConnectError(err.errno, err.strerror)
                self._safely_call(self.on_connect_error, e)
                return self

            # We only care about the first result.
            result = result[0]
            self._do_connect(result[-1], result[0])

        return self
dataset/ETHPy150Open ecdavis/pants/pants/stream.py/Stream.connect/swapped operands of `%`