Copied from django.contrib.syndication.views.Feed (v1.7.1)
163412
def _get_dynamic_attr(self, attname, obj, default=None):
        
        try:
            attr = getattr(self, attname)
        except AttributeError:
            return default
        if callable(attr):
            # Check co_argcount rather than try/excepting the function and
            # catching the TypeError, because something inside the function
            # may raise the TypeError. This technique is more accurate.
            try:
                code = six.get_function_code(attr)
            except AttributeError:
                code = six.get_function_code(attr.__call__)
            if code.co_argcount == 2:       # one argument is 'self'
                return attr(obj)
            else:
                return attr()
        return attr
156702
def urlnext(parser, token):
    
    bits = token.split_contents()
    if len(bits) < 2:
        raise template.TemplateSyntaxError(
            "'%s' takes at least one argument"
            " (path to a view)" % bits[0]
        )
    viewname = parser.compile_filter(bits[1])
    args = []
    kwargs = {}
    asvar = None
    bits = bits[2:]
    if len(bits) >= 2 and bits[-2] == "as":
        asvar = bits[-1]
        bits = bits[:-2]

    if len(bits):
        for bit in bits:
            match = kwarg_re.match(bit)
            if not match:
                raise template.TemplateSyntaxError("Malformed arguments to url tag")
            name, value = match.groups()
            if name:
                kwargs[name] = parser.compile_filter(value)
            else:
                args.append(parser.compile_filter(value))

    return URLNextNode(viewname, args, kwargs, asvar)
1080067
public function MasterView() {
      // Define some default master views unless one was explicitly defined
      if ($this->MasterView == '') {
         // If this is a syndication request, use the appropriate master view
         if ($this->SyndicationMethod == SYNDICATION_ATOM)
            $this->MasterView = 'atom';
         else if ($this->SyndicationMethod == SYNDICATION_RSS)
            $this->MasterView = 'rss';
         else
            $this->MasterView = 'default'; // Otherwise go with the default
      }
      return $this->MasterView;
   }
172979
def create_external_feed_groups(self, url, group_id, header_match=None, verbosity=None):
        
        path = {}
        data = {}
        params = {}

        # REQUIRED - PATH - group_id
        """ID"""
        path["group_id"] = group_id

        # REQUIRED - url
        """The url to the external rss or atom feed"""
        data["url"] = url

        # OPTIONAL - header_match
        """If given, only feed entries that contain this string in their title will be imported"""
        if header_match is not None:
            data["header_match"] = header_match

        # OPTIONAL - verbosity
        """Defaults to "full""""
        if verbosity is not None:
            self._validate_enum(verbosity, ["full", "truncate", "link_only"])
            data["verbosity"] = verbosity

        self.logger.debug("POST /api/v1/groups/{group_id}/external_feeds with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("POST", "/api/v1/groups/{group_id}/external_feeds".format(**path), data=data, params=params, single_item=True)
58330
private List<String> parseRssFeedForeCast(String feed) {
        String[] result = feed.split("<br />");
        List<String> returnList = new ArrayList<String>();
        String[] result2 = result[2].split("<BR />");

        returnList.add(result2[3] + "\n");
        returnList.add(result[3] + "\n");
        returnList.add(result[4] + "\n");
        returnList.add(result[5] + "\n");
        returnList.add(result[6] + "\n");

        return returnList;
    }
497499
def blogroll(request, btype):
	''
	response, site, cachekey = initview(request)
	if response: return response[0]

	template = loader.get_template('feedjack/{0}.xml'.format(btype))
	ctx = dict()
	fjlib.get_extra_context(site, ctx)
	ctx = Context(ctx)
	response = HttpResponse(
		template.render(ctx), content_type='text/xml; charset=utf-8' )

	patch_vary_headers(response, ['Host'])
	fjcache.cache_set(site, cachekey, (response, ctx_get(ctx, 'last_modified')))
	return response
1328897
async def get_feed(config, url):
    

    LOGGER.debug("++WAIT: cache get feed %s", url)
    previous = config.cache.get(
        'feed', url, schema_version=SCHEMA_VERSION) if config.cache else None
    LOGGER.debug("++DONE: cache get feed %s", url)

    headers = previous.caching if previous else None

    LOGGER.debug("++WAIT: request get %s", url)
    request = await utils.retry_get(config, url, headers=headers)
    LOGGER.debug("++DONE: request get %s", url)
    if not request or not request.success:
        LOGGER.error("Could not get feed %s: %d",
                     url,
                     request.status if request else -1)
        return None, previous, False

    if request.cached:
        LOGGER.debug("%s: Reusing cached version", url)
        return previous, previous, False

    current = Feed(request)

    if config.cache:
        LOGGER.debug("%s: Saving to cache", url)
        LOGGER.debug("++WAIT: cache set feed %s", url)
        config.cache.set('feed', url, current)
        LOGGER.debug("++DONE: cache set feed %s", url)

    LOGGER.debug("%s: Returning new content", url)
    return current, previous, (not previous
                               or current.digest != previous.digest
                               or current.status != previous.status)
1347490
def CreateCustomizerFeed(client, feed_name):
  
  # Get the AdCustomizerFeedService
  ad_customizer_feed_service = client.GetService('AdCustomizerFeedService',
                                                 'v201809')
  customizer_feed = {
      'feedName': feed_name,
      'feedAttributes': [
          {'type': 'STRING', 'name': 'Name'},
          {'type': 'STRING', 'name': 'Price'},
          {'type': 'DATE_TIME', 'name': 'Date'}
      ]
  }

  feed_service_operation = {
      'operator': 'ADD',
      'operand': customizer_feed
  }

  response = ad_customizer_feed_service.mutate([feed_service_operation])

  if response and 'value' in response:
    feed = response['value'][0]
    feed_data = {
        'feedId': feed['feedId'],
        'nameId': feed['feedAttributes'][0]['id'],
        'priceId': feed['feedAttributes'][1]['id'],
        'dateId': feed['feedAttributes'][2]['id']
    }
    print ('Feed with name "%s" and ID %s was added with:\n'
           '\tName attribute ID %s and price attribute ID %s and date attribute'
           'ID %s') % (feed['feedName'], feed['feedId'], feed_data['nameId'],
                       feed_data['priceId'], feed_data['dateId'])
    return feed
  else:
    raise errors.GoogleAdsError('No feeds were added')
1192628
def new(self, user, name, description=None):
        
        uri = self.client.remote + '/users/{0}/feeds'.format(user)

        data = {
            'feed': {
                'name': name,
                'description': description
            }
        }

        resp = self.client.post(uri, data)
        return resp
33057
def subscribe(self, feedUrl):
        
        response = self.httpPost(
            ReaderUrl.SUBSCRIPTION_EDIT_URL,
            {'ac':'subscribe', 's': feedUrl})
        # FIXME - need better return API
        if response and 'OK' in response:
            return True
        else:
            return False
20746
def get_extra_context(site, ctx):
	''
	# XXX: clean this up from obsolete stuff
	ctx['site'] = site
	ctx['feeds'] = feeds = site.active_feeds.order_by('name')

	def get_mod_chk(k):
		mod, chk = (
			(max(vals) if vals else None) for vals in (
				filter(None, it.imap(op.attrgetter(k), feeds))
				for k in ['last_modified', 'last_checked'] ) )
		chk = chk or datetime(1970, 1, 1, 0, 0, 0, 0, timezone.utc)
		ctx['last_modified'], ctx['last_checked'] = mod or chk, chk
		return ctx[k]
	for k in 'last_modified', 'last_checked':
		ctx[k] = lambda: get_mod_chk(k)

	# media_url is set here for historical reasons,
	#  use static_url or STATIC_URL (from django context) in any new templates.
	ctx['media_url'] = ctx['static_url'] =\
		'{}feedjack/{}'.format(settings.STATIC_URL, site.template)
282164
def fix_django_headers(meta):
	
	ret = {}
	for k, v in meta.items():
		if k.startswith("HTTP_"):
			k = k[len("HTTP_") :]
		elif k not in ("CONTENT_LENGTH", "CONTENT_TYPE"):
			# Skip CGI garbage
			continue

		ret[k.lower().replace("_", "-")] = v

	return ret
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)
66581
function feed(cb) {
  return function (args) {
    function resultCb(result) {
      result.forEach(function (article) {
        console.log(article.title);
      });
    }
    function jenkinsCb(jenkins) {
      if (args.job) {
        jenkins.parseJobFeed(args.job, cli.exitCb(null, resultCb));
      } else if (args.view) {
        jenkins.parseViewFeed(args.view, cli.exitCb(null, resultCb));
      } else {
        jenkins.parseFeed(cli.exitCb(null, resultCb));
      }
    }
    cb(args, jenkinsCb);
  };
}
1175055
def clean_route_short_names(feed: "Feed") -> "Feed":
    
    feed = feed.copy()
    r = feed.routes
    if r is None:
        return feed

    # Fill NaNs and strip whitespace
    r["route_short_name"] = r["route_short_name"].fillna("n/a").str.strip()

    # Disambiguate
    def disambiguate(row):
        rsn, rid = row
        return rsn + "-" + rid

    r["dup"] = r["route_short_name"].duplicated(keep=False)
    r.loc[r["dup"], "route_short_name"] = r.loc[
        r["dup"], ["route_short_name", "route_id"]
    ].apply(disambiguate, axis=1)
    del r["dup"]

    feed.routes = r
    return feed
1217805
def GetSitelinksFromFeed(client, feed):
  
  # Retrieve the feed's attribute mapping.
  feed_mappings = GetFeedMapping(client, feed, PLACEHOLDER_TYPE_SITELINKS)

  feed_items = {}

  for feed_item in GetFeedItems(client, feed):
    site_link_from_feed = {}

    for attribute_value in feed_item['attributeValues']:
      if attribute_value['feedAttributeId'] in feed_mappings:
        for field_id in feed_mappings[attribute_value['feedAttributeId']]:
          if field_id == SITE_LINK_FIELDS['TEXT']:
            site_link_from_feed['text'] = attribute_value['stringValue']
          elif field_id == SITE_LINK_FIELDS['URL']:
            site_link_from_feed['url'] = attribute_value['stringValue']
          elif field_id == SITE_LINK_FIELDS['FINAL_URLS']:
            site_link_from_feed['finalUrls'] = attribute_value['stringValues']
          elif field_id == SITE_LINK_FIELDS['FINAL_MOBILE_URLS']:
            site_link_from_feed['finalMobileUrls'] = attribute_value[
                'stringValues']
          elif field_id == SITE_LINK_FIELDS['TRACKING_URL_TEMPLATE']:
            site_link_from_feed['trackingUrlTemplate'] = attribute_value[
                'stringValue']
          elif field_id == SITE_LINK_FIELDS['LINE2']:
            site_link_from_feed['line2'] = attribute_value['stringValue']
          elif field_id == SITE_LINK_FIELDS['LINE3']:
            site_link_from_feed['line3'] = attribute_value['stringValue']
          else:
            print 'No applicable Site Link Field found for Id: %s' % field_id

    feed_items[feed_item['feedItemId']] = site_link_from_feed

  return feed_items
443351
def _get_feed_data(self, file_paths):
        
        rv = {}
        for i in file_paths:
            # TODO(crow): only support first category
            _ = i.split('/')
            category = _[-2]
            name = _[-1].split('.')[0]
            page_config, md = self._get_config_and_content(i)
            parsed_md = tools.parse_markdown(md, self.site_config)
            rv.setdefault(category, {})
            rv[category].update(
                {
                    i: {
                        'title': page_config.get('title', ''),
                        'name': name.decode('utf-8'),
                        'content': parsed_md,
                        'date': page_config.get('date', '')
                        }
                    }
                )
        return rv