returns links that have changed cost
19382
def _find_changed(old, new, both):
    
    # create two list of sets of old and new edges including cost
    old_edges = []
    for edge in old.edges(data=True):
        # skip links that are not in both
        if set((edge[0], edge[1])) not in both:
            continue
        # wrap cost in tuple so it will be recognizable
        cost = (edge[2]['weight'],)
        old_edges.append(set((edge[0], edge[1], cost)))
    new_edges = []
    for edge in new.edges(data=True):
        # skip links that are not in both
        if set((edge[0], edge[1])) not in both:
            continue
        # wrap cost in tuple so it will be recognizable
        cost = (edge[2]['weight'],)
        new_edges.append(set((edge[0], edge[1], cost)))
    # find out which edge changed
    changed = []
    for new_edge in new_edges:
        if new_edge not in old_edges:
            # new_edge is a set, convert it to list
            new_edge = list(new_edge)
            for item in new_edge:
                if isinstance(item, tuple):
                    # unwrap cost from tuple and put it in a dict
                    cost = {'weight': item[0]}
                    new_edge.remove(item)
            changed.append((new_edge[0], new_edge[1], cost))
    return changed
42758
def get_a(html, find=''):
    """"""
    links = []
    for a in html.find_all('a'):
        if a.get('href').find(find) != -1:
            links.append(a)
    return links
140188
def hook_get_queryset(self, changelist, request):
        """"""
        changelist.check_field_exists(self.left_field)
        changelist.check_field_exists(self.right_field)
        self.pid = self.get_pid_from_request(changelist, request)

        # Get parent item first.
        qs = changelist.root_queryset

        if self.pid:
            self.parent = qs.get(pk=self.pid)
            changelist.params.update(self.get_immediate_children_filter(self.parent))

        else:
            changelist.params[self.level_field] = self.root_level
            self.parent = qs.get(**{key: val for key, val in changelist.params.items() if not key.startswith('_')})
578946
public function pagesAffectedByChanges()
    {
        $pages = $this->Pages();
        $urls = [];
        foreach ($pages as $page) {
            $urls[] = $page->Link();
        }

        return $urls;
    }
1019287
def update_link(self):
        
        name = repr(self)
        if not name:
            return self
        l = self.__class__._get_links()
        to_be_changed = list()
        if name in l:

            for wal in l[name]:
                if wal.ref_obj and self is not wal():
                    to_be_changed.append((wal.ref_obj, wal.attr))

        for o, a in to_be_changed:
            setattr(o, a, self)

        self.clean_up_link_dict()
        return self
1053990
def ensure(self, status, cost):
        
        changed = False
        status_id = LINK_STATUS[status]
        if self.status != status_id:
            self.status = status_id
            changed = True
        if self.metric_value != cost:
            self.metric_value = cost
            changed = True
        if changed:
            self.save()
865829
def _link_for_value(self, value):
    ''''''
    try:
      key = Key(value)
      if key.name == self.sentinel:
        return key.parent
    except:
      pass
    return None
1118996
def _link(self, *args, **kwargs):
        
        if self._record.redirect_url:
            return links.resolve(self._record.redirect_url,
                                 self.search_path, kwargs.get('absolute'))

        return self._permalink(*args, **kwargs)
62944
def is_cached(self, link):
        '''
        '''
        if link is None:
            return False
        elif hasattr(link, 'uri'):
            return link.uri in self.id_map
        else:
            return link in self.id_map
597375
function normalizeLinks(base, input) {
  if (!input) return;
  if (!Array.isArray(input)) input = [ input ];

  return flatten(input).filter(Boolean).map(function (link) {
    return normalizeLink(base, link);
  });
}
596806
def price_change(self):
        
        try:
            if self._data_from_search:
                return self._data_from_search.find('div', {'class': 'price-changes-sr'}).text
            else:
                return self._ad_page_content.find('div', {'class': 'price-changes-sr'}).text
        except Exception as e:
            if self._debug:
                logging.error(
                    "Error getting price_change. Error message: " + e.args[0])
            return
1212721
def get_recent_linkbacks(number=5,
                         template='zinnia/tags/linkbacks_recent.html'):
    
    entry_published_pks = map(smart_text,
                              Entry.published.values_list('id', flat=True))
    content_type = ContentType.objects.get_for_model(Entry)

    linkbacks = get_comment_model().objects.filter(
        content_type=content_type,
        object_pk__in=entry_published_pks,
        flags__flag__in=[PINGBACK, TRACKBACK],
        is_public=True).order_by('-pk')[:number]

    linkbacks = linkbacks.prefetch_related('content_object')

    return {'template': template,
            'linkbacks': linkbacks}
647470
String prevLink() {
    if (currentOffset == 0 || currentLimit == 0) {
      return null;
    }

    return urlWithUpdatedPagination(Math.max(0, currentOffset - currentLimit), currentLimit);
  }
408816
def get_link(self, rel):
        
        if rel in self.links:
            return self.links[rel]
        raise ResourceNotFound('Resource requested: %r is not available '
            'on this element.' % rel)
438017
def filter_spent_outputs(self, outputs):
        
        links = [o.to_dict() for o in outputs]
        txs = list(query.get_spending_transactions(self.connection, links))
        spends = {TransactionLink.from_dict(input_['fulfills'])
                  for tx in txs
                  for input_ in tx['inputs']}
        return [ff for ff in outputs if ff not in spends]
507612
def link_to_like_or_unlike
      return unless helpers.current_user

      options = current_user_likes? ? like_options : unlike_options

      like_or_unlike_link(options: options)
    end
900368
def link(self, thing1, thing2):
		
		thing1 = thing1.strip().lower()
		thing2 = thing2.strip().lower()
		if thing1 == thing2:
			raise SameName("Attempted to link two of the same name")
		self.change(thing1, 0)
		self.change(thing2, 0)
		return self._link(thing1, thing2)