Fetch a Channel object identified by the numeric channel_id, or
        create that object if it doesn't already exist.
504546
def channel(self, channel_id=None):
        
        if channel_id in self.channels:
            return self.channels[channel_id]

        return Channel(self, channel_id)
1309878
def fetch(self):
        
        params = values.of({})

        payload = self._version.fetch(
            'GET',
            self._uri,
            params=params,
        )

        return NumberInstance(self._version, payload, number=self._solution['number'], )
1295938
def set_channel_created(self, channel_link, channel_id):
        
        self.channel_link = channel_link
        self.channel_id = channel_id
        self.__record_progress(Status.PUBLISH_CHANNEL if config.PUBLISH else Status.DONE)
1307210
def fetch(channels, start, end, type=None, dtype=None, allow_tape=None,
          connection=None, host=None, port=None, pad=None, scaled=True,
          verbose=False, series_class=TimeSeries):
    # host and port keywords are used by the decorator only
    # pylint: disable=unused-argument
    
    # set ALLOW_DATA_ON_TAPE
    if allow_tape is not None:
        set_parameter(connection, 'ALLOW_DATA_ON_TAPE', str(allow_tape),
                      verbose=verbose)

    type = _parse_nds_enum_dict_param(channels, 'type', type)
    dtype = _parse_nds_enum_dict_param(channels, 'dtype', dtype)

    # verify channels exist
    print_verbose("Checking channels list against NDS2 database...", end=' ',
                  verbose=verbose)
    utype = reduce(operator.or_, type.values())  # logical OR of types
    udtype = reduce(operator.or_, dtype.values())
    epoch = (start, end) if connection.get_protocol() > 1 else None
    ndschannels = io_nds2.find_channels(channels, connection=connection,
                                        epoch=epoch, type=utype, dtype=udtype,
                                        unique=True)

    names = [Channel.from_nds2(c).ndsname for c in ndschannels]
    print_verbose('done', verbose=verbose)

    # handle minute trend timing
    if (any(c.endswith('m-trend') for c in names) and
            (start % 60 or end % 60)):
        warnings.warn("Requested at least one minute trend, but "
                      "start and stop GPS times are not multiples of "
                      "60. Times will be expanded outwards to compensate")
        start, end = io_nds2.minute_trend_times(start, end)

    # get data availability
    span = SegmentList([Segment(start, end)])
    if pad is None:
        qsegs = span
        gap = 'raise'
    elif connection.get_protocol() == 1:
        qsegs = span
        gap = 'pad'
    else:
        print_verbose("Querying for data availability...", end=' ',
                      verbose=verbose)
        pad = float(pad)
        gap = 'pad'
        qsegs = _get_data_segments(ndschannels, start, end, connection) & span
        print_verbose('done\nFound {0} viable segments of data with {1:.2f}% '
                      'coverage'.format(len(qsegs),
                                        abs(qsegs) / abs(span) * 100),
                      verbose=verbose)
        if span - qsegs:
            warnings.warn("Gaps were found in data available from {0}, "
                          "but will be padded with {1}".format(
                              connection.get_host(), pad))

    # query for each segment
    out = series_class.DictClass()
    desc = verbose if isinstance(verbose, str) else 'Downloading data'
    with progress_bar(total=float(abs(qsegs)), desc=desc,
                      unit='s', disable=not bool(verbose)) as bar:
        for seg in qsegs:
            total = 0.
            for buffers in connection.iterate(int(seg[0]), int(seg[1]), names):
                for buffer_, chan in zip(buffers, channels):
                    series = series_class.from_nds2_buffer(
                        buffer_,
                        scaled=scaled,
                        copy=chan not in out,  # only copy if first buffer
                    )
                    out.append({chan: series}, pad=pad, gap=gap)
                new = buffer_.length / buffer_.channel.sample_rate
                total += new
                bar.update(new)
            # sometimes NDS2 returns no data at all
            if not total and gap != 'pad':
                raise RuntimeError("no data received from {0} for {1}".format(
                    connection.get_host(), seg))

    # finalise timeseries to make sure each channel has the correct limits
    # only if user asked to pad gaps
    if pad is not None:
        for chan, ndschan in zip(channels, ndschannels):
            try:
                ts = out[chan]
            except KeyError:
                out[chan] = _create_series(ndschan, pad, start, end,
                                           series_class=series_class)
            else:
                out[chan] = _pad_series(ts, pad, start, end)

    return out
500952
def get_object(self, request, object_id):
        
        queryset = self.queryset(request)
        model = queryset.model
        try:
            object_id = model._meta.pk.to_python(object_id)
            return queryset.get(pk=object_id)
        except (model.DoesNotExist, ValidationError):
            return None
1097304
def push(self, channel_id, data):
        

        channel_path = self.channel_path(channel_id)
        response = requests.post(channel_path, data)

        return response.json()
954135
def get(cls, id, api=None):
        
        id = Transform.to_resource(id)
        api = api if api else cls._API
        if 'get' in cls._URL:
            extra = {'resource': cls.__name__, 'query': {'id': id}}
            logger.info('Fetching {} resource'.format(cls), extra=extra)
            resource = api.get(url=cls._URL['get'].format(id=id)).json()
            return cls(api=api, **resource)
        else:
            raise SbgError('Unable to fetch resource!')
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())
753377
def _ensure_object_id(cls, id):
        """"""
        if isinstance(id, ObjectId):
            return id

        if isinstance(id, basestring) and OBJECTIDEXPR.match(id):
            return ObjectId(id)

        return id
595223
def get(cls, id):
        '''
        
        '''
        client = cls._new_api_client()
        return client.make_request(cls, 'get', url_params={'id': id})
437114
public synchronized Channel findOrCreateChannel(ChannelData channelData) throws ChannelException {
        String channelName = channelData.getName();
        Channel rc = this.existingChannels.get(channelName);
        if (null == rc) {
            rc = createChannel(channelData);
            this.existingChannels.put(channelName, rc);
        }
        return rc;
    }
549029
public static channel_interface_binding[] get(nitro_service service, String id) throws Exception{
		channel_interface_binding obj = new channel_interface_binding();
		obj.set_id(id);
		channel_interface_binding response[] = (channel_interface_binding[]) obj.get_resources(service);
		return response;
	}
1354072
def update_channel(self, channel):
        

        data = {'channels': channel}
        return super(ApiInterfaceRequest, self).put('api/v3/channel/', data)
921541
public Channel findById(Long channelId) {
        Assert.assertNotNull(channelId);
        List<Channel> channels = listByIds(channelId);
        if (channels.size() != 1) {
            String exceptionCause = "query channelId:" + channelId + " return null.";
            logger.error("ERROR ## " + exceptionCause);
            throw new ManagerException(exceptionCause);
        }
        return channels.get(0);
    }
1312052
def update_channel(data)
      channel = Channel.new(data, self)
      old_channel = @channels[channel.id]
      return unless old_channel

      old_channel.update_from(channel)
    end
805012
def push_object(self, channel_id, obj):
        

        return self.push(channel_id, json.dumps(obj).replace('"', '\\"'))
207499
def _fetch_channels(self):
        """"""
        json = requests.get(self._channels_url).json()
        self._channels = {c['channel']['code']: c['channel']['name']
                          for c in json['channels']}