Attach the given link to the classification, while checking for duplicates.
187817
public ClassificationModel attachLink(ClassificationModel classificationModel, LinkModel linkModel)
    {
        for (LinkModel existing : classificationModel.getLinks())
        {
            if (StringUtils.equals(existing.getLink(), linkModel.getLink()))
            {
                return classificationModel;
            }
        }
        classificationModel.addLink(linkModel);
        return classificationModel;
    }
1078952
public ClassificationModel attachClassification(GraphRewrite event, EvaluationContext context, FileModel fileModel, String classificationText, String description)
    {
        return attachClassification(event, context, fileModel, IssueCategoryRegistry.DEFAULT, classificationText, description);
    }
1356928
def validate_links(links):
	
	valid_links = []
	for link in links:
		if link[:7] in "http://" or link[:8] in "https://":
			valid_links.append(link)
	
	if not valid_links:
		print("No files found.")
		sys.exit(0)

	# checking valid urls for return code
	urls = {}
	for link in valid_links:
		if 'github.com' and '/blob/' in link:
			link = link.replace('/blob/', '/raw/')
		urls[link] = {'code': get_url_nofollow(link)}
		
	
	# printing valid urls with return code 200
	available_urls = []
	for url in urls:
		print("code: %d\turl: %s" % (urls[url]['code'], url))
		if urls[url]['code'] != 0:
			available_urls.append(url)

	return available_urls
146800
def link_href(self, rel):
        """"""
        link = self.link(rel)
        if (link is not None):
            link = link['href']
        return(link)
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
164520
def add_find_links(self, urls):
        """"""
        for url in urls:
            if (
                self.to_scan is None  # if we have already "gone online"
                or not URL_SCHEME(url)  # or it's a local file/directory
                or url.startswith('file:')
                or list(distros_for_url(url))  # or a direct package link
            ):
                # then go ahead and process it now
                self.scan_url(url)
            else:
                # otherwise, defer retrieval till later
                self.to_scan.append(url)
336503
def __addNode(self, name, cls):
        '''
        
        '''
        if name in self.nodes:
            raise Exception("A node by the name {} already exists.  Can't add a duplicate.".format(name))
        self.__nxgraph.add_node(name)
        self.__nxgraph.node[name]['label'] = name
        self.__nxgraph.node[name]['nodeobj'] = cls()
        self.__nxgraph.node[name]['type'] = cls.__name__
1159177
def duplicates(self):
        
        self._params.update(
            href=self._resource.get('search_duplicate'))
        return self
94577
def view_links(obj):
    ''' '''
    result=format_html('')
    result+=format_html('<a href="%s" style="white-space: nowrap">Show duplicates</a><br/>'%reverse('duplicates', args=(obj.pk,)))
    result+=format_html('<a href="%s" style="white-space: nowrap">Show submissions</a><br/>'%obj.grading_url())
    result+=format_html('<a href="%s" style="white-space: nowrap">Download submissions</a>'%reverse('assarchive', args=(obj.pk,)))
    return result
1193183
def duplicate
      enhance_settings
      p = self.dup
      p.category = 'COPY OF ' + category
      p.created_at = p.updated_at = nil
      p.url = url
      p.attachment = attachment

      # allow site to do some customization
      p.send(:duplicate_extra, self) if p.respond_to?(:duplicate_extra)
      p.save!
      p
    end
23612
def attached_to_model(self):
        """"""
        try:
            if not bool(self.model):
                return False
        except AttributeError:
            return False
        else:
            try:
                return not bool(self.instance)
            except AttributeError:
                return True
1111746
def addInternalLink(self, link):
        '''
        
        '''
        if isinstance(link, InternalLink):
            self.internalLinks.append(link)
        else:
            raise InternalLinkError( 
                'link Type should be InternalLink, not %s' % type(link))
808300
def addRelation(self, link):
        '''
        
        '''
        if isinstance(link, Relation):
            self.internalLinks.append(link)
        else:
            raise TypeError(
                'link Type should be InternalLink, not %s' % type(link))
1235779
private void addLink(final WSubMenu subMenu, final WLink link) {
		subMenu.add(new WMenuItem(new WDecoratedLabel(link)));
	}
844050
def attach_related_file(self, path, mimetype=None):
        """"""
        filename = os.path.basename(path)
        content = open(path, 'rb').read()
        self.attach_related(filename, content, mimetype)
285979
def updateLink(page, lnk):
    
    CheckParent(page)
    annot = getLinkText(page, lnk)
    if annot == "":
        raise ValueError("link kind not supported")

    page.parent._updateObject(lnk["xref"], annot, page = page) 
    return
1360357
def link(self, source, target):
        ''

        return self.operations('link', target.decode(self.encoding),
                                       source.decode(self.encoding))