does the same this as `pageviews`, except it includes content ids and then optionally filters
    the response by a list of content ids passed as query params - note, this load can be a little
    heavy and could take a minute
4573
def content_ids(params):
    
    # set up default values
    default_from, default_to, yesterday, _ = make_default_times()

    # get params
    try:
        series = params.get("site", [DEFAULT_SERIES])[0]
        from_date = params.get("from", [default_from])[0]
        to_date = params.get("to", [default_to])[0]
        group_by = params.get("group_by", [DEFAULT_GROUP_BY])[0]
        ids = params.get("content_id", [])
    except Exception as e:
        LOGGER.exception(e)
        return json.dumps({"error": e.message}), "500 Internal Error"

    # check the cache
    cache_key = "{}:{}:{}:{}:{}:{}:{}".format(
        memcached_prefix, "contentids.json", series, from_date, to_date, group_by, ids)
    try:
        data = MEMCACHED_CLIENT.get(cache_key)
        if data:
            return data, "200 OK"
    except Exception as e:
        LOGGER.exception(e)

    # enforce content ids
    if not len(ids):
        return json.dumps({"error": "you must pass at least one content id'"}), "400 Bad Request"

    # parse from date
    from_date = parse_datetime(from_date)
    if from_date is None:
        LOGGER.error("could not parse 'from'")
        return json.dumps({"error": "could not parse 'from'"}), "400 Bad Request"

    # parse to date
    to_date = parse_datetime(to_date)
    if to_date is None:
        LOGGER.error("could not parse 'to'")
        return json.dumps({"error": "could not parse 'to'"}), "400 Bad Request"

    # influx will only keep non-aggregated data for a day, so if the from param is beyond that point
    # we need to update the series name to use the rolled up values
    if from_date < yesterday:
        series = update_series(series, "pageviews", "content_id")

    # format times
    from_date = format_datetime(from_date)
    to_date = format_datetime(to_date)

    # start building the query
    query = "SELECT content_id, sum(value) as value " \
            "FROM {series} " \
            "WHERE time > '{from_date}' AND time < '{to_date}' " \
            "GROUP BY content_id, time({group_by}) " \
            "fill(0);"
    args = {"series": series, "from_date": from_date, "to_date": to_date, "group_by": group_by}

    # send the request
    try:
        res = INFLUXDB_CLIENT.query(query.format(**args))

    # capture errors and send them back along with the query (for inspection/debugging)
    except Exception as e:
        LOGGER.exception(e)
        return json.dumps({"error": e.message, "query": query.format(**args)}), "500 Internal Error"

    # build the response object
    response = flatten_response(res)

    # filter by content ids
    if len(ids):
        for site, points in response.items():
            filtered = filter(lambda p: p["content_id"] in ids, points)
            response[site] = filtered
    res = json.dumps(response)

    # cache the response
    try:
        MEMCACHED_CLIENT.set(cache_key, res, time=MEMCACHED_EXPIRATION)
    except Exception as e:
        LOGGER.exception(e)

    return res, "200 OK"
346832
def all_resource_urls(query):
    '''  '''
    urls = []
    next = True
    while next:
        response = requests.get(query)
        json_data = json.loads(response.content)
        for resource in json_data['results']:
            urls.append(resource['url'])
        if bool(json_data['next']):
            query = json_data['next']
        else:
            next = False
    return urls
811762
def list_subscriptions(self, target_id=None, ids=None, query_flags=None):
        
        query_parameters = {}
        if target_id is not None:
            query_parameters['targetId'] = self._serialize.query('target_id', target_id, 'str')
        if ids is not None:
            ids = ",".join(ids)
            query_parameters['ids'] = self._serialize.query('ids', ids, 'str')
        if query_flags is not None:
            query_parameters['queryFlags'] = self._serialize.query('query_flags', query_flags, 'str')
        response = self._send(http_method='GET',
                              location_id='70f911d6-abac-488c-85b3-a206bf57e165',
                              version='5.0-preview.1',
                              query_parameters=query_parameters)
        return self._deserialize('[NotificationSubscription]', self._unwrap_collection(response))
1066291
function(section, pageFields, submittedFields) {
  var thisSection = section;
  var fieldsInSection = sectionUtils.getFieldsInSection(section._id, pageFields);

  var renderData = [];
  var addedSectionBreaks = false;
  var idsOfFieldsInTheSection = [];

  _.each(fieldsInSection, function(field) {
    idsOfFieldsInTheSection.push(field._id);

    var thisFieldInSection = _.filter(submittedFields, function(subField) {
      return subField.fieldId._id === field._id;
    });

    if (!addedSectionBreaks) {
      _.each(thisFieldInSection, function(field, index) {
        var sectionForIndex = _.clone(thisSection);
        sectionForIndex.idx = index + 1;
        field.sectionIndex = field.sectionIndex || 0;
        renderData[field.sectionIndex] = [sectionForIndex];
      });
      addedSectionBreaks = true;
    }

    _.each(thisFieldInSection, function(field) {
      field.sectionIndex = field.sectionIndex || 0;
      renderData[field.sectionIndex].push(convertFieldToFormFormat(field));
    });
  });
  renderData = _.flatten(renderData);

  return {renderData: renderData, fieldsInSection: idsOfFieldsInTheSection};
}
1212744
function arrayify(urls) {
  var tmp = Array.isArray(urls) ? urls : [urls];
  return tmp.filter(Boolean);
}
49548
function renderNavItems({ pages, ...params }) {
  return (
    <List>
      {pages.reduce(
        // eslint-disable-next-line no-use-before-define
        (items, page) => reduceChildRoutes({ items, page, ...params }),
        [],
      )}
    </List>
  );
}
1133710
def query(self, titles, pageids=None, cparams=None):
        
        query = self.QUERY.substitute(
            WIKI=self.uri,
            ENDPOINT=self.endpoint,
            TITLES=safequote(titles) or pageids)
        status = titles or pageids

        if pageids and not titles:
            query = query.replace('&titles=', '&pageids=')

        if cparams:
            query += cparams
            status += " (%s)" % cparams

        if self.variant:
            query += '&variant=' + self.variant

        self.set_status('query', status)

        return query
258988
def page_strip(page, versioned):
    
    # page strip filtering should be conditional
    page.pop('ResponseMetadata', None)
    contents_key = versioned and 'Versions' or 'Contents'
    contents = page.get(contents_key, ())

    # aggressive size
    if versioned:
        keys = []
        for k in contents:
            if k['IsLatest']:
                keys.append((k['Key'], k['VersionId'], True))
            else:
                keys.append((k['Key'], k['VersionId']))
        return keys
    else:
        return [k['Key'] for k in contents]

    if not contents:
        return page

    # Depending on use case we may want these
    for k in contents:
        k.pop('Owner', None)
        k.pop('LastModified', None)
        k.pop('ETag', None)
        k.pop('StorageClass', None)
        k.pop('Size', None)

    return page
451840
def get_page_ids_by_slug(self, slug):
        
        ids = self.filter(type='slug', body=slug).values('page_id').annotate(
            max_creation_date=Max('creation_date')
        )
        return [content['page_id'] for content in ids]
760062
protected void getPage(final JSONObject params) {
		
		if (this.client == null)
			client = BandwidthClient.getInstance();
    	
        try {
	        final RestResponse response = client.get(resourceUri, params);
	        
	        final JSONArray array = Utils.response2JSONArray(response);
	        
	        for (final Object obj : array) {	
        		final E elem = clazz.getConstructor(BandwidthClient.class, JSONObject.class).newInstance(client, (JSONObject) obj);
        		add(elem);
	        }
	        
	        // if anything comes back, reset the index
	        if (array.size() > 0)
	        	this.index = 0;
	        
	        // set the next links
	        this.setNextLink(response.getNextLink());	        
	        this.setFirstLink(response.getFirstLink());
	        this.setPreviousLink(response.getPreviousLink());
        }
        catch(final Exception e) {
        	e.printStackTrace();
        }
	}
1028209
def _get_content_type_queryset(models_list):
    
    content_type_ids = {c.id for c in ContentType.objects.get_for_models(*models_list).values()}
    return ContentType.objects.filter(id__in=content_type_ids)
1038912
def _get_filter_ids(cls, request):
        
        id_query = request.url.query.get('id', None)

        if id_query is None:
            return None

        filter_ids = id_query.split(',')
        for filter_id in filter_ids:
            cls._validate_id(filter_id)

        return filter_ids
916277
def each(&block)
      @ids.each_slice(@page_size) do |page_of_ids|
        resources = @paging_block.call(page_of_ids)
        resources.each(&block)
      end
    end
975054
def __load(self, redirect=True, preload=False):
        
        query_params = {
            "prop": "info|pageprops",
            "inprop": "url",
            "ppprop": "disambiguation",
            "redirects": "",
        }
        query_params.update(self.__title_query_param())

        request = self.mediawiki.wiki_request(query_params)

        query = request["query"]
        pageid = list(query["pages"].keys())[0]
        page = query["pages"][pageid]

        # determine result of the request
        # missing is present if the page is missing
        if "missing" in page:
            self._raise_page_error()
        # redirects is present in query if page is a redirect
        elif "redirects" in query:
            self._handle_redirect(redirect, preload, query, page)
        # if pageprops is returned, it must be a disambiguation error
        elif "pageprops" in page:
            self._raise_disambiguation_error(page, pageid)
        else:
            self.pageid = pageid
            self.title = page["title"]
            self.url = page["fullurl"]
303791
function (id) {
            var description = this._requests[id];
            if (!description) {
                // The request was aborted
                return;
            }
            var request = description.request;
            var callback = description.cb;

            var iFrame = request.iFrame;
            var responseText, contentDocument = iFrame.contentDocument, contentWindow;

            if (contentDocument == null) {
                var contentWindow = iFrame.contentWindow;
                if (contentWindow) {
                    contentDocument = contentWindow.document;
                }
            }
            if (contentDocument) {
                var body = contentDocument.body || contentDocument.documentElement;
                if (body) {
                    // this is for content displayed as text:
                    responseText = body.textContent || body.outerText;
                }
                var xmlDoc = contentDocument.XMLDocument;
                // In IE, contentDocument contains a transformation of the document
                // see: http://www.aspnet-answers.com/microsoft/JScript/29847637/javascript-ie-xml.aspx
                if (xmlDoc) {
                    contentDocument = xmlDoc;
                }
            }

            this._deleteRequest(request);

            var response = {
                status : 200,
                responseText : responseText,
                responseXML : contentDocument
            };

            callback.fn.call(callback.scope, false, callback.args, response);
        }
690326
function ajaxHandleResponses( s, jqXHR, responses ) {

	var contents = s.contents,
		dataTypes = s.dataTypes,
		responseFields = s.responseFields,
		ct,
		type,
		finalDataType,
		firstDataType;

	// Fill responseXXX fields
	for ( type in responseFields ) {
		if ( type in responses ) {
			jqXHR[ responseFields[type] ] = responses[ type ];
		}
	}

	// Remove auto dataType and get content-type in the process
	while( dataTypes[ 0 ] === "*" ) {
		dataTypes.shift();
		if ( ct === undefined ) {
			ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
		}
	}

	// Check if we're dealing with a known content-type
	if ( ct ) {
		for ( type in contents ) {
			if ( contents[ type ] && contents[ type ].test( ct ) ) {
				dataTypes.unshift( type );
				break;
			}
		}
	}

	// Check to see if we have a response for the expected dataType
	if ( dataTypes[ 0 ] in responses ) {
		finalDataType = dataTypes[ 0 ];
	} else {
		// Try convertible dataTypes
		for ( type in responses ) {
			if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
				finalDataType = type;
				break;
			}
			if ( !firstDataType ) {
				firstDataType = type;
			}
		}
		// Or just use first one
		finalDataType = finalDataType || firstDataType;
	}

	// If we found a dataType
	// We add the dataType to the list if needed
	// and return the corresponding response
	if ( finalDataType ) {
		if ( finalDataType !== dataTypes[ 0 ] ) {
			dataTypes.unshift( finalDataType );
		}
		return responses[ finalDataType ];
	}
}
681608
def get_views(video_id)
      params = { :id => video_id, :part => 'statistics' }
      request = Yourub::REST::Videos.list(self,params)
      v = Yourub::Result.format(request).first
      v ? Yourub::CountFilter.get_views_count(v) : nil
    end