Obtain channel id for channel name, if present in ``self.search_params``.
351106
def __getChannelId(self):

        

        if not self.search_params.get("channelId"):
            return

        api_fixed_url = "https://www.googleapis.com/youtube/v3/channels?part=id&maxResults=1&fields=items%2Fid&"
        url = api_fixed_url + urlencode({"key": self.api_key, "forUsername": self.search_params["channelId"]})
        get = requests.get(url).json()

        try:
            self.search_params["channelId"] = get['items'][0]['id']
            return # got it

        except IndexError:
            pass # try searching now...

        api_fixed_url = "https://www.googleapis.com/youtube/v3/search?part=snippet&type=channel&fields=items%2Fid&"
        url = api_fixed_url + urlencode({"key": self.api_key, "q": self.search_params['channelId']})
        get = requests.get(url).json()

        try:
            self.search_params["channelId"] = get['items'][0]['id']['channelId']

        except IndexError:
            del self.search_params["channelId"]
227097
def get_channel_listing(self):
        
        return {'name': self.name,
                'key': self.channel.key,
                'type': self.channel.typ,
                'read_only': self.read_only,
                'is_online': self.is_online(),
                'actions': self.get_actions(),
                'unread': self.unread_count()}
1122929
def channels(self):
        """"""
        if hasattr(self.mgfile.info, 'channels'):
            return self.mgfile.info.channels
        return 0
296747
def unarchive(self, channel_name):
        
        channel_id = self.get_channel_id(channel_name)
        self.params.update({
            'channel': channel_id,
            })
        return FromUrl('https://slack.com/api/channels.unarchive', self._requests)(data=self.params).post()
1198189
def _next_channel(self):
        """"""
        chanid = self._channel_counter
        while self._channels.get(chanid) is not None:
            self._channel_counter = (self._channel_counter + 1) & 0xffffff
            chanid = self._channel_counter
        self._channel_counter = (self._channel_counter + 1) & 0xffffff
        return chanid
450904
def channel(self, channel_id=None, auto_encode_decode=True):
        """"""
        try:
            return self.channels[channel_id]
        except KeyError:
            return self.Channel(self, channel_id,
                                auto_encode_decode=auto_encode_decode)
1310180
def youtube_id(self):
        """"""
        m = re.search(r'/embed/([A-Za-z0-9\-=_]*)', self.embed)
        if m:
            return m.group(1)
        return ''
1306618
private EventChannelStruct getEventChannelStruct(String channelName) {
        if (channel_map.containsKey(channelName)) {
            return channel_map.get(channelName);
        }
        //  Check with other TangoHosts using possibleTangoHosts as header
        int index = channelName.indexOf("//");
        if (index>0) {
            index = channelName.indexOf('/', index+2); //  "//".length()
            for (String possibleTangoHost : possibleTangoHosts) {
                String key = possibleTangoHost + channelName.substring(index);
                if (channel_map.containsKey(key))
                    return channel_map.get(key);
            }
        }
        return null;
    }
24852
def _get_nds2_name(channel):
    
    if hasattr(channel, 'ndsname'):  # gwpy.detector.Channel
        return channel.ndsname
    if hasattr(channel, 'channel_type'):  # nds2.channel
        return '%s,%s' % (channel.name,
                          channel.channel_type_to_string(channel.channel_type))
    return str(channel)
1090276
def str_id(self):
        ""
        id_or_name = self.id_or_name
        if id_or_name is not None and isinstance(id_or_name, str):
            return id_or_name
        return None
1327848
def _smart_get_initialized_channel_for_service(self, metadata, filter_by, is_try_initailize = True):
        '''
         
        '''
        channels = self._get_initialized_channels_for_service(self.args.org_id, self.args.service_id)
        group_id = metadata.get_group_id(self.args.group_name)
        channels = [c for c in channels if c[filter_by].lower() == self.ident.address.lower() and c["groupId"] == group_id]

        if (len(channels) == 0 and is_try_initailize):
           # this will work only in simple case where signer == sender
           self._initialize_already_opened_channel(metadata, self.ident.address, self.ident.address)
           return self._smart_get_initialized_channel_for_service(metadata, filter_by, is_try_initailize = False)

        if (len(channels) == 0):
            raise Exception("Cannot find initialized channel for service with org_id=%s service_id=%s and signer=%s"%(self.args.org_id, self.args.service_id, self.ident.address))
        if (self.args.channel_id is None):
            if (len(channels) > 1):
                channel_ids = [channel["channelId"] for channel in channels]
                raise Exception("We have several initialized channel: %s. You should use --channel-id to select one"%str(channel_ids))
            return channels[0]
        for channel in channels:
            if (channel["channelId"] == self.args.channel_id):
                return channel
        raise Exception("Channel %i has not been initialized or your are not the sender/signer of it"%self.args.channel_id)
990787
def channel_parameters(parameter_prefix, channel_names, configuration_entry):
    

    if configuration_entry in (True, False):
        return ([], [parameter_prefix])[configuration_entry]

    parameters = []
    if isinstance(configuration_entry, dict):
        for name in set(channel_names).intersection(configuration_entry):
            if configuration_entry[name] is True:
                parameters.append(parameter_prefix + "_" + name)
    else:
        raise TypeError("incorrect type")

    return parameters
1209928
def _get_id(self):
        """"""
        return ''.join(map(str,
                           filter(is_not_None,
                                  [self.Prefix, self.Name])))
382451
def get_channel_info(self):
        """"""
        self.request(EP_GET_CHANNEL_INFO)
        return {} if self.last_response is None else self.last_response.get('payload')
222455
def get_channel_listing(self):
        
        teams = self.get('/teams')
        for team in teams:
            if team['name'].lower() == self.team:
                channel_listing = self.get('/teams/' + team['id'] + '/channels')
                return channel_listing
1025640
def search_channels(self, **kwargs):
        
        params = [(key, kwargs[key]) for key in sorted(kwargs.keys())]
        url = "/notification/v1/channel?{}".format(
            urlencode(params, doseq=True))

        response = NWS_DAO().getURL(url, self._read_headers)

        if response.status != 200:
            raise DataFailureException(url, response.status, response.data)

        data = json.loads(response.data)
        channels = []
        for datum in data.get("Channels", []):
            channels.append(self._channel_from_json(datum))
        return channels
907782
def _get_initialized_channels_for_service(self, org_id, service_id):
        ''''''
        channels_dict = self._get_initialized_channels_dict_for_service(org_id, service_id)
        return list(channels_dict.values())