Attempt to join a channel.

        The optional second argument is the channel key, if needed.
490885
def join(self, target, key=None):
        
        chantypes = self.server.features.get("CHANTYPES", "#")
        if not target or target[0] not in chantypes:
            # Among other things, this prevents accidentally sending the
            # "JOIN 0" command which actually removes you from all channels
            _log.warning("Refusing to join channel that does not start "
                         "with one of '%s': %s", chantypes, target)
            return False

        if self.server.in_channel(target):
            _log.warning("Ignoring request to join channel '%s' because we "
                         "are already in that channel.", target)
            return False

        _log.info("Joining channel %s ...", target)
        self.send("JOIN", target, *([key] if key else []))
        return True
299627
def add_channel(channel: EFBChannel):
    
    global master, slaves
    if isinstance(channel, EFBChannel):
        if channel.channel_type == ChannelType.Slave:
            slaves[channel.channel_id] = channel
        else:
            master = channel
    else:
        raise TypeError("Channel instance is expected")
553804
private synchronized Channel channel() throws IOException {
        if (autoReconnect) {
            try {
                connect();
            } catch (GeneralSecurityException e) {
                throw new IOException(e);
            }
        }

        return channel;
    }
197347
def bring_to_front(self, channel):
        
        channel_index = wt_kit.get_index(self.channel_names, channel)
        new = list(self.channel_names)
        new.insert(0, new.pop(channel_index))
        self.channel_names = new
1295919
def open_channel(self):
        
        logger.debug('Creating new channel')
        self._connection.channel(on_open_callback=self.on_channel_open)
836269
def subscribe(self, socket_id, channel):
        """"""
        con = self._get_connection(socket_id)
        self.subscriptions.setdefault(channel, set()).add(socket_id)
        con.subscriptions.add(channel)
828840
def try_open (*args, **kwargs):
    
    try:
        return io.open (*args, **kwargs)
    except IOError as e:
        if e.errno == 2:
            return None
        raise
72609
@Override
    public Channel join(String channelName) {
        if (!connected) {
            throw new NotConnectedException();
        }

        ChannelImpl channel = new ChannelImpl(this, channelName);

        /* Attempt to join */
        if (channel.join()) {
            return channel;
        }

        /* Error while joining */
        return null;
    }
637415
def open_channel(self):
        
        _logger.info('Creating a new channel')
        self._connection.channel(on_open_callback=self.on_channel_open)
1098483
def execute(self, key: str, executable: str, *, capture_stdout: bool=False, capture_stderr: bool=False,
                **acquire_kwargs) -> Tuple[Optional[int], Optional[bytes], Optional[bytes]]:
        
        lock = self.acquire(key, **acquire_kwargs)
        if lock is None:
            return None, None, None
        return self.execute_with_lock(executable, lock, capture_stdout=capture_stdout, capture_stderr=capture_stderr)
6445
def check_channel_shell_request(self, channel):
        ''''''
        try:
            self.channels[channel].start()
        except KeyError:
            log.error('Requested to start a channel (%r) that was not previously set up.', channel)
            return False
        else:
            return True
803370
def join(self, channel_name):
        
        self.params.update({
            'name': channel_name,
            })
        return FromUrl('https://slack.com/api/channels.join', self._requests)(data=self.params).post()
602184
def start(self, channel):
        

        if self._started:
            raise InternalError("The method start() was called twice on VirtualIOTileDevice.")

        self._push_channel = channel
        self.start_workers()
939605
def open_channel(self):
        
        self._logger.debug('Creating a new channel')
        self._connection.channel(on_open_callback=self.on_channel_open)
1164760
def on_connect(self, connection):
        ""
        # NOTE: for python3, we can't pass bytestrings as keyword arguments
        # so we need to decode channel/pattern names back to unicode strings
        # before passing them to [p]subscribe.
        self.pending_unsubscribe_channels.clear()
        self.pending_unsubscribe_patterns.clear()
        if self.channels:
            channels = {}
            for k, v in iteritems(self.channels):
                channels[self.encoder.decode(k, force=True)] = v
            self.subscribe(**channels)
        if self.patterns:
            patterns = {}
            for k, v in iteritems(self.patterns):
                patterns[self.encoder.decode(k, force=True)] = v
            self.psubscribe(**patterns)
661964
async def kick(self, channel, target, reason=None):
        
        if not self.in_channel(channel):
            raise NotInChannel(channel)

        if reason:
            await self.rawmsg('KICK', channel, target, reason)
        else:
            await self.rawmsg('KICK', channel, target)
890632
def construct_channel(self, *args, **kwargs):
        
        channel = self.get_channel(*args, **kwargs)   # creates ChannelNode from data in self.channel_info
        _build_tree(channel, SAMPLE_TREE)
        raise_for_invalid_channel(channel)

        return channel