Create a new internal link
485374
def add_link(self):
        ""
        n=len(self.links)+1
        self.links[n]=(0,0)
        return n
850563
def add_link l
            l.door = @iotas[l.src]
            raise Edoors::Exception.new "Link source #{l.src} does not exist in #{path}" if l.door.nil?
            (@links[l.src] ||= [])<< l
        end
800146
def add_link(network_id, link,**kwargs):
    
    user_id = kwargs.get('user_id')

    #check_perm(user_id, 'edit_topology')
    try:
        net_i = db.DBSession.query(Network).filter(Network.id == network_id).one()
        net_i.check_write_permission(user_id)
    except NoResultFound:
        raise ResourceNotFoundError("Network %s not found"%(network_id))

    try:
        node_1 = db.DBSession.query(Node).filter(Node.id==link.node_1_id).one()
        node_2 = db.DBSession.query(Node).filter(Node.id==link.node_2_id).one()
    except NoResultFound:
        raise ResourceNotFoundError("Nodes for link not found")

    link_i = net_i.add_link(link.name, link.description, link.layout, node_1, node_2)

    hdb.add_resource_attributes(link_i, link.attributes)

    db.DBSession.flush()

    if link.types is not None and len(link.types) > 0:
        res_types = []
        res_attrs = []
        res_scenarios = {}
        for typesummary in link.types:
            ra, rt, rs = template.set_resource_type(link_i,
                                        typesummary.id,
                                         **kwargs)
            res_types.append(rt)
            res_attrs.extend(ra)
            res_scenarios.update(rs)#rs is a dict

        if len(res_types) > 0:
            db.DBSession.bulk_insert_mappings(ResourceType, res_types)
        if len(res_attrs) > 0:
            db.DBSession.bulk_insert_mappings(ResourceAttr, res_attrs)

            new_res_attrs = db.DBSession.query(ResourceAttr).order_by(ResourceAttr.id.desc()).limit(len(res_attrs)).all()
            all_rs = []
            for ra in new_res_attrs:
                ra_id = ra.id
                if ra.attr_id in res_scenarios:
                    rs_list = res_scenarios[ra.attr_id]
                    for rs in rs_list:
                        rs_list[rs]['resource_attr_id'] = ra_id
                        all_rs.append(rs_list[rs])

            if len(all_rs) > 0:
                db.DBSession.bulk_insert_mappings(ResourceScenario, all_rs)

    db.DBSession.refresh(link_i)

    return link_i
296905
async def create_link(project, nodes):
    
    node1 = random.choice(list(nodes.values()))

    for port in range(0, 8):
        node2 = random.choice(list(nodes.values()))

        if node1 == node2:
            continue

        data = {"nodes":
                [
                    {
                        "adapter_number": 0,
                        "node_id": node1["node_id"],
                        "port_number": port
                    },
                    {
                        "adapter_number": 0,
                        "node_id": node2["node_id"],
                        "port_number": port
                    }
                ]
                }
        try:
            await post("/projects/{}/links".format(project["project_id"]), body=data)
        except (HTTPConflict, HTTPNotFound):
            pass
82352
def create_link(id_link, post_data):
        '''
        
        '''
        if MLink.get_by_uid(id_link):
            return False
        try:
            the_order = int(post_data['order'])
        except:
            the_order = 999
        TabLink.create(name=post_data['name'],
                       link=post_data['link'],
                       order=the_order,
                       logo=post_data['logo'] if 'logo' in post_data else '',
                       uid=id_link)
        return id_link
724289
public function createSelfLink()
    {
        // if no apiPath is not set generate it from basepath
        if (is_null($this->getApiPath())) {
            $class = explode('\\', get_class($this));
            $plural = Inflector::pluralize(strtolower(end($class)));
            $this->apiPath = $this->apiBasePath . '/' . $plural;
        }

        // add id to path
        $idPath = '';
        if ($this->getId()) {
            $idPath = '/' . $this->getId();
        }
        $this->_links = [
            'self' => $this->getApiPath() . $idPath,
        ];
    }
891960
def create(self, project, title, href, **attrs):
        
        attrs.update({'project': project, 'title': title, 'href': href})
        return self._new_resource(payload=attrs)
1122762
def _update_self_link(self, link, headers):
        ''''''
        self.self.props.update(link)
        # Set the self.type to the content_type of the returned document
        self.self.props['type'] = headers.get(
            'Content-Type', self.DEFAULT_CONTENT_TYPE)
        self.self.props
1001149
def open(self, new=1):
        
        import webbrowser
        webbrowser.open(self.url, new=new)
988063
def _update_new_linked_model(self, internal, linked_mdl_ins, link):
        

        # If there is a link between two sides (A and B), if a link from A to B,
        # link should be saved at B but it is not necessary to control again data in A.
        # If internal field is True, data control is not done and passes.
        if not internal:

            for lnk in linked_mdl_ins.get_links():
                mdl = lnk['mdl']
                if not isinstance(self, mdl) or lnk['reverse'] != link['field']:
                    continue
                local_field_name = lnk['field']
                # remote_name = lnk['reverse']
                remote_field_name = un_camel(mdl.__name__)
                if not link['o2o']:
                    if '.' in local_field_name:
                        local_field_name, remote_field_name = local_field_name.split('.')
                    remote_set = getattr(linked_mdl_ins, local_field_name)

                    if remote_set._TYPE == 'ListNode' and self not in remote_set:
                        remote_set(**{remote_field_name: self._root_node})
                        if linked_mdl_ins._exists is False:
                            raise ObjectDoesNotExist('Linked %s on field %s with key %s doesn\'t exist' % (
                                linked_mdl_ins.__class__.__name__,
                                remote_field_name,
                                linked_mdl_ins.key,
                            ))
                        linked_mdl_ins.save(internal=True)
                else:
                    linked_mdl_ins.setattr(remote_field_name, self._root_node)
                    if linked_mdl_ins._exists is False:
                        raise ObjectDoesNotExist('Linked object %s on field %s with key %s doesn\'t exist' % (
                            linked_mdl_ins.__class__.__name__,
                            remote_field_name,
                            linked_mdl_ins.key,
                        ))
                    linked_mdl_ins.save(internal=True)
324585
def build_default_link(self):
        ''''''
        attrs = {}
        attrs["rel"] = "stylesheet"
        attrs["href"] ="{}?{:x}".format(
            os.path.join(settings.STATIC_URL, self.filepath).replace(os.path.sep, '/'),
            self.version_id,
        )
        attrs.update(self.options['link_attrs'])
        attrs["data-context"] = self.provider_run.uid       # can't be overridden
        return '<link{} />'.format(flatatt(attrs))
367544
def create_nv_link(self):
        """"""
        from os.path import abspath, islink
        from os import unlink, symlink

        nv_name = self.doc.as_version(None)

        from_path =  abspath(self._last_write_path or self.package_path.path)

        to_path = join(dirname(from_path), nv_name + self.type_suffix)

        if islink(to_path):
            unlink(to_path)

        symlink(from_path, to_path)
858385
def link(self, href, **kwargs):
        """"""
        return link.Link(dict(href=href, **kwargs), self.base_uri)
691069
function linkto(parentState, longname, name) {

    if (!!longname && longname !== '') {
        return '<a ui-sref="jsdoc.' + parentState + "({anchor:'" + longname.replace('module:', '') + "'})" + '">' + name + '</a>';
    }
    return '<a ui-sref="jsdoc.' + parentState + '">' + name + '</a>';
    
}
690635
function (links) {
            var i, len;
            for (i = 0, len = links.length; i < len; ++i) {
                createLink(links[i]);
            }
        }
60069
def edit_link(link = nil, options = {}, &block)
      if link && link.is_a?(Instamojo::Link)
        yield(link) if block_given?
      else
        options = set_options(options, &block)
        link = Instamojo::Link.new(options, self)
      end
      patch("links/#{link.slug}", link.to_h)
      @response.success? ? Instamojo::Link.new(@response.body[:link], self) : @response
    end
510601
function createLink (data) {
    var item = document.createElement('li')
    var a = document.createElement('a')
    if (options.listItemClass) {
      item.setAttribute('class', options.listItemClass)
    }

    if (options.onClick) {
      a.onclick = options.onClick
    }

    if (options.includeHtml && data.childNodes.length) {
      forEach.call(data.childNodes, function (node) {
        a.appendChild(node.cloneNode(true))
      })
    } else {
      // Default behavior.
      a.textContent = data.textContent
    }
    a.setAttribute('href', '#' + data.id)
    a.setAttribute('class', options.linkClass +
      SPACE_CHAR + 'node-name--' + data.nodeName +
      SPACE_CHAR + options.extraLinkClasses)
    item.appendChild(a)
    return item
  }