get what dates we can for pins from the board RSS feeds
11294
function(seriesCallback) {
                if(!obtainDates) {
                    seriesCallback();
                    return;
                }

                var pinDateMaps = [];
                async.eachLimit(boards, 5, function(board, eachCallback) {
                    getDatesForBoardPinsFromRss(board.user, board.board, function(result) {
                        pinDateMaps.push(result);
                        eachCallback();
                    });
                }, function (err) {
                    if(err) {
                        throw err;
                    }

                    var pinDateMap = mergeMaps(pinDateMaps);

                    for (var i = 0; i < allPinsData.length; i++) {
                        allPinsData[i].created_at = null;
                        allPinsData[i].created_at_source = null;
                        if (pinDateMap[allPinsData[i].id]) {
                            allPinsData[i].created_at = pinDateMap[allPinsData[i].id];
                            allPinsData[i].created_at_source = 'rss';
                        } else {
                            pinsThatNeedScrapedDates.push(allPinsData[i].id);
                        }
                    }

                    seriesCallback();
                    return;
                });
            }
729626
def dateof(tag_name, tags):
    """"""
    for tag in tags:
        if tag['name'] == tag_name:
            commit = read_url(tag['commit']['url'])
            return parse_timestamp(commit['commit']['committer']['date'])
    return None
883611
function getBoards(paginate, callback) {
        var boardsResponse;

        // Check for cache existence
        getCache('boards_' + username, true, function (cacheData) {
            if (cacheData === null) {
                // Create get request and put it in the cache
                get('http://pinterestapi.co.uk/' + username + '/boards', true, function (response) {
                    putCache('boards_' + username, JSON.stringify(response));

                    if (paginate) {
                        boardsResponse = buildResponse(response.body ? response.body : []);
                    } else {
                        boardsResponse = response.body ? response.body : [];
                    }
                    callback(boardsResponse);
                    return;
                });
            } else {
                if (paginate) {
                    boardsResponse = buildResponse(cacheData.body ? cacheData.body : []);
                } else {
                    boardsResponse = cacheData.body ? cacheData.body : [];
                }
                callback(boardsResponse);
                return;
            }
        });
    }
29934
def parseFeed(filename, yesterday):
    """"""
    dom = xml.dom.minidom.parse(filename)

    getText = lambda node, tag: node.getElementsByTagName(tag)[0].childNodes[0].data
    getNode = lambda tag: dom.getElementsByTagName(tag)

    content = getNode('channel')[0] # Only one channel node

    feedTitle = getText(content, 'title')
    feedLink = getText(content, 'link')
    feedDesc = getText(content, 'description')

    feed = Feed(feedTitle, feedLink, feedDesc)

    for item in getNode('item'):
        itemDate = time.strptime(getText(item, 'pubDate'), '%a, %d %b %Y %H:%M:%S GMT')
        if (itemDate > yesterday): # If newer than yesterday
            feed.addItem(getText(item, 'title'),
                         getText(item, 'link'),
                         getText(item, 'description'),
                         getText(item, 'pubDate'))
    return feed
498524
function getMonthDays(timestamp = Date.now()) {
  const cursorDay = new Date(new Date(timestamp).setDate(1));
  const currentMonth = cursorDay.getMonth();
  const days = [];
  while (cursorDay.getMonth() === currentMonth) {
    days.push(cursorDay.getTime());
    cursorDay.setDate(cursorDay.getDate() + 1);
  }
  return days;
}
1330600
function getPins(callback) {
        var allPins = [];
        getBoards(false, function (boards) {
            async.each(boards, function(board, asyncCallback) {
                var splitHref = board.href.split('/');
                if (splitHref[1] === username) { // it's possible to have boards listed from other users
                    var boardHref = board.href.split('/')[2];
                    getPinsFromBoard(boardHref, false, function (pins) {
                        allPins = allPins.concat(pins);
                        asyncCallback();
                    });
                } else {
                    asyncCallback();
                }
            },
            function (err) {
                if (err) {
                    console.error('Error iterating through each board to get pins');
                    throw err;
                }
                callback(buildResponse(allPins));
                return;
            });
        });
    }
1086903
def show(feed):
    
    ecode = 0
    try:
        feedmeta = anchore_feeds.load_anchore_feedmeta()
        if feed in feedmeta:
            result = {}
            groups = feedmeta[feed].get('groups',{}).values()
            result['name'] = feed
            result['access_tier'] = int(feedmeta[feed].get('access_tier'))
            result['description'] = feedmeta[feed].get('description')
            result['groups'] = {}
            if 'subscribed' not in feedmeta[feed]:
                result['subscribed'] = False
            else:
                result['subscribed'] = feedmeta[feed]['subscribed']

            for g in groups:
                result['groups'][g['name']] = {
                    'access_tier': int(g.get('access_tier')),
                    'description': g.get('description'),
                    'last_sync': datetime.datetime.fromtimestamp(g.get('last_update')).isoformat() if 'last_update' in g else 'None'
                }

            anchore_print(result, do_formatting=True)
        else:
            anchore_print_err('Unknown feed name. Valid feeds can be seen withe the "list" command')
            ecode = 1
    except Exception as err:
        anchore_print_err('operation failed')
        ecode = 1

    sys.exit(ecode)
1206010
function callbackParser(err, out) {
	if (err) {
		error += err + '\n\n';
	} else {
		results[counter] = out;
	}

	counter++;
	if (counter === urlLength) {
		let result = {sources: [], feeds: []};
		let i = 0;
		_.each(results, feed => {
			feed.metadata.lastBuildDate = moment(feed.metadata.lastBuildDate).format('x');
			feed.metadata.update = moment(feed.metadata.update).format('x');
			result.sources.push({type: feed.type, metadata: feed.metadata});
			_.each(feed.items, function (item) {
				item.source = i;
				result.feeds.push(item);
			});
			i++;
		});

		// Sort value
		switch (allowSortValue[sortByDate]) {
			case allowSortValue.asc:
				result.feeds.sort((a, b) => (a.date > b.date) ? 1 : ((b.date > a.date) ? -1 : 0));
				break;
			case allowSortValue.desc:
				result.feeds.sort((a, b) => (a.date < b.date) ? 1 : ((b.date < a.date) ? -1 : 0));
				break;
			default:
				break;
		}

		if (error !== '') {
			finishCallback(error);
		} else {
			finishCallback(null, {feedRSSAtom: result});
		}
	}
}
1106846
def get_rss_feed_content(url, offset=0, limit=None, exclude_items_in=None):
    

    end = limit + offset if limit is not None else None

    response = _get(url)

    try:
        feed_data = feedparser.parse(response.text)
        if not feed_data.feed:
            logger.warning('No valid feed data found at {}'.format(url))
            return False
        content = feed_data.entries
    except Exception as parse_error:
        logger.warning(
            'Failed to parse feed from {}: {}'.format(url, str(parse_error))
        )
        return False

    if exclude_items_in:
        exclude_ids = [item['guid'] for item in exclude_items_in]
        content = [item for item in content if item['guid'] not in exclude_ids]

    content = content[offset:end]

    for item in content:
        updated_time = time.mktime(item['updated_parsed'])
        item['updated_datetime'] = datetime.fromtimestamp(updated_time)

    return content
368769
def read_service_ids_by_date(path: str) -> Dict[datetime.date, FrozenSet[str]]:
    """"""
    feed = load_raw_feed(path)
    return _service_ids_by_date(feed)
819375
def get_dated_items(self):
        
        now = timezone.now()
        if timezone.is_aware(now):
            now = timezone.localtime(now)
        today = now.date()
        self.year, self.month, self.day = today.isoformat().split('-')
        return self._get_dated_items(today)
1297435
def feed(self, data_len, feed_time=None):
        '''
        '''
        self._bytes_transferred += data_len
        self._collected_bytes_transferred += data_len

        time_now = feed_time or time.time()
        time_diff = time_now - self._last_feed_time

        if time_diff < self._sample_min_time:
            return

        self._last_feed_time = time.time()

        if data_len == 0 and time_diff >= self._stall_time:
            self._stalled = True
            return

        self._samples.append((time_diff, self._collected_bytes_transferred))
        self._collected_bytes_transferred = 0
6551
private function setup_feeds() {
		if ( false === ( $items_normalized = get_transient( 'themeisle_sdk_feed_items' ) ) ) {
			// Load SimplePie Instance.
			$feed = fetch_feed( $this->feeds );
			// TODO report error when is an error loading the feed.
			if ( is_wp_error( $feed ) ) {
				return;
			}

			$items = $feed->get_items( 0, 5 );
			foreach ( (array) $items as $item ) {
				$items_normalized[] = array(
					'title' => $item->get_title(),
					'date'  => $item->get_date( 'U' ),
					'link'  => $item->get_permalink(),
				);
			}
			set_transient( 'themeisle_sdk_feed_items', $items_normalized, 48 * HOUR_IN_SECONDS );
		}
		$this->items = $items_normalized;
	}
1349263
public function getPageFeeds()
    {
        if (!$this->parser) {
            return;
        }

        $nodes = $this->parser->find('link');

        $feeds = array();

        $types = array(
            'application/rss+xml',
            'application/atom+xml',
            'text/xml',
        );

        foreach ($nodes as $node) {
            $type = strtolower($node->getAttribute('type'));

            if (in_array($type, $types)) {
                $feeds[] = $node->getAttribute('href');
            }
        }

        return $feeds;
    }
1172077
function createPinDateMapFromRssXmlObject(xmlObject) {
    var pinDateMap;

    try {
        pinDateMap = {};
        var pins = xmlObject.rss.channel[0].item;
        for (var i = 0; i < pins.length; i++) {
            var publishDate = new Date(pins[i].pubDate[0]);
            var pinId = getPinIdFromUrl(pins[i].guid[0]);
            pinDateMap[pinId] = publishDate;
        }
    } catch (e) {
        pinDateMap = {};
    }

    return pinDateMap;
}
704636
def fetch_submissions(self, submissions_callback, *args):
        """"""
        logger.debug('Fetching submissions')

        submissions_callback(*args)

        logger.info('Found {} submissions'.format(len(self.submissions)))
        if not self.submissions:
            return

        self.min_date = min(x.created_utc for x in self.submissions.values())
        self.max_date = max(x.created_utc for x in self.submissions.values())

        self.process_submitters()
        self.process_commenters()
1079833
def get_upcoming_events(self):
        
        mask = "mask[id, subject, startDate, endDate, statusCode, acknowledgedFlag, impactedResourceCount, updateCount]"
        _filter = {
            'endDate': {
                'operation': '> sysdate'
            },
            'startDate': {
                'operation': 'orderBy',
                'options': [{
                    'name': 'sort',
                    'value': ['ASC']
                }]
            }
        }
        return self.client.call('Notification_Occurrence_Event', 'getAllObjects', filter=_filter, mask=mask, iter=True)