gets trending content values
484088
def trending(params):
    
    # get params
    try:
        series = params.get("site", [DEFAULT_SERIES])[0]
        offset = params.get("offset", [DEFAULT_GROUP_BY])[0]
        limit = params.get("limit", [20])[0]
    except Exception as e:
        LOGGER.exception(e)
        return json.dumps({"error": e.message}), "500 Internal Error"

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

    # update series name
    series = update_trending_series(series)

    # parse the limit
    try:
        limit = int(limit)
    except ValueError:
        LOGGER.error("limit param must be an integer")
        return json.dumps({"error": "limit param must be an integer"}), "400 Bad Request"

    # build the query
    query = "SELECT content_id, sum(value) as value " \
            "FROM {series} " \
            "WHERE time > now() - {offset} " \
            "GROUP BY content_id;"
    args = {"series": series, "offset": offset}

    # 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)

    # limit the number of content per site
    for site, points in response.items():
        sorted_content = sorted(points, key=lambda p: p["value"], reverse=True)[:limit]
        response[site] = sorted_content

    clean_response = {}
    for site, values in response.items():
        clean_name = site.split("-")[0]
        clean_response[clean_name] = values
    res = json.dumps(clean_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"
148540
async def get_value(self):
        

        cc = self.request.custom_content

        async with self.lock:
            if self.content_key not in cc:
                cc[self.content_key] = await self.call_api()

        return cc[self.content_key]
231857
def get_contents(self, el, no_iframe=False):
        """"""
        if not no_iframe or not self.is_iframe(el):
            for content in el.contents:
                yield content
258741
def get_content(self, uri, disable_proxy=False):
        """"""
        return self.get(uri=uri, disable_proxy=disable_proxy)
898561
def __get_diff_recent():
    '''
    
    '''
    diff_str = ''

    for key in router_post:
        recent_posts = MPost.query_recent_edited(tools.timestamp() - TIME_LIMIT, kind=key)
        for recent_post in recent_posts:
            hist_rec = MPostHist.get_last(recent_post.uid)
            if hist_rec:
                raw_title = hist_rec.title
                new_title = recent_post.title

                infobox = diff_table(raw_title, new_title)

                diff_str = diff_str + '''
                <h2 style="color:red;font-size:larger;font-weight:70;">TITLE: {0}</h2>
                '''.format(recent_post.title) + infobox

                infobox = diff_table(hist_rec.cnt_md, recent_post.cnt_md)

                diff_str = diff_str + '<h3>CONTENT:{0}</h3>'.format(
                    recent_post.title
                ) + infobox + '</hr>'
            else:
                continue
    return diff_str
151809
def value(self):
        
        try:
            res = self.properties.device.properties.network.read(
                "{} {} {} presentValue".format(
                    self.properties.device.properties.address,
                    self.properties.type,
                    str(self.properties.address),
                )
            )
            self._trend(res)

        except Exception:
            raise Exception("Problem reading : {}".format(self.properties.name))

        if res == "inactive":
            self._key = 0
            self._boolKey = False
        else:
            self._key = 1
            self._boolKey = True
        return res
76635
def _get_content(data, which_content):
        
        content = ''
        if data.get(which_content):
            if isinstance(data.get(which_content), feedparser.FeedParserDict):
                content = data.get(which_content)['value']
            elif not isinstance(data.get(which_content), str):
                if 'value' in data.get(which_content)[0]:
                    content = data.get(which_content)[0].value
            else:
                content = data.get(which_content)
        return content
1003501
@Override
	public KriptonContentValues contentValuesForContentProvider(ContentValues values) {
		KriptonContentValues content = contentValues.get();
		content.clear(values);

		return content;
	}
225019
@Override
	public ReadableInstant getLastModified(
		ServletContext servletContext,
		HttpServletRequest request,
		HttpServletResponse response,
		Page page
	) throws ServletException, IOException {
		List<News> news = NewsUtils.findAllNews(servletContext, request, response, page);
		return news.isEmpty() ? null : news.get(0).getPubDate();
	}
1222839
def retrieveVals(self):
        """"""
        lighttpdInfo = LighttpdInfo(self._host, self._port,
                                self._user, self._password, 
                                self._statuspath, self._ssl)
        stats = lighttpdInfo.getServerStats()
        if self.hasGraph('lighttpd_access'):
            self.setGraphVal('lighttpd_access', 'reqs', stats['Total Accesses'])
        if self.hasGraph('lighttpd_bytes'):
            self.setGraphVal('lighttpd_bytes', 'bytes', 
                             stats['Total kBytes'] * 1000)
        if self.hasGraph('lighttpd_servers'):
            self.setGraphVal('lighttpd_servers', 'busy', stats['BusyServers'])
            self.setGraphVal('lighttpd_servers', 'idle', stats['IdleServers'])
            self.setGraphVal('lighttpd_servers', 'max', stats['MaxServers'])
179716
function extractPageValues(outerWindow, currentPage, pageStartAtValue, pageEndAtValue) {
  let pageValues = [];
  pageValues.push(pageStartAtValue);
  pageValues.push(pageEndAtValue);

  let addPageValue = function(page) {
    pageValues.push(page);
  };

  if (outerWindow > 0) {
    let leftOuterWindowStartAtValue = pageStartAtValue + 1;
    let leftOuterWindowEndAtValue = pageStartAtValue + outerWindow;

    let rightOuterWindowStartAtValue = pageEndAtValue - 1 - outerWindow;
    let rightOuterWindowEndAtValue = pageEndAtValue - 1;

    createRange(leftOuterWindowStartAtValue, leftOuterWindowEndAtValue).forEach(addPageValue);
    createRange(rightOuterWindowStartAtValue, rightOuterWindowEndAtValue).forEach(addPageValue);
  }

  // add / subtract 2 for the dots display for the inner window
  // to handle exactly this use case (if 100 is current page): ... 99 100 101 ...
  let innerWindowStartAtValue = currentPage - 2;
  let innerWindowEndAtValue = currentPage + 2;
  createRange(innerWindowStartAtValue, innerWindowEndAtValue).forEach(addPageValue);

  let takeUnique = function(page, idx, array) {
    return array.indexOf(page) === idx;
  };

  return pageValues
          .sort((a, b) => a - b)
          .filter((page) => page >= pageStartAtValue && page <= pageEndAtValue)
          .filter(takeUnique);

}
1084379
def _filter(self, text, context, encoding):
        """"""

        content = []
        self.current_encoding = encoding
        self.line_num = 1
        self.prev_line = -1
        self.leading = ''
        self.block_comments = []
        self.line_comments = []

        self.find_content(text)
        self.extend_src(content, context)

        return content
993874
def _GetContents(self):
        """"""
        try:
            self._RealGetContents()
        except BadZipfile:
            if not self._filePassed:
                self.fp.close()
                self.fp = None
            raise
478782
function getRowContentElements() {
		var i;
		var rowCnt = getRowCnt();
		var rowDivs = [];
		for (i=0; i<rowCnt; i++) {
			rowDivs[i] = allDayRow(i)
				.find('div.fc-day-content > div');
		}
		return rowDivs;
	}
730296
def getPrevUrl(self, url, data):
        """"""
        mo = compile(r"index(\d+)\.html").search(url)
        num = int(mo.group(1)) - 1
        prefix = url.rsplit('/', 1)[0]
        return "%s/index%d.html" % (prefix, num)
315849
def get_trend(self, item, nb=6):
        
        raw_history = self.get_raw_history(item=item, nb=nb)
        if raw_history is None or len(raw_history) < nb:
            return None
        last_nb = [v[1] for v in raw_history]
        return last_nb[-1] - mean(last_nb[:-1])
1051809
function getValuesFromUrl() {
        var url_hash = window.location.hash.slice(1, window.location.hash.length).split('/');
        if (url_hash.length < 3 || parseFloat(url_hash[0]) === 'number') {
            url_hash = false;
        }
        return url_hash;
    }