Add a new group to a network.
542993
def add_group(self, name, desc, status):
        

        existing_group = get_session().query(ResourceGroup).filter(ResourceGroup.name==name, ResourceGroup.network_id==self.id).first()
        if existing_group is not None:
            raise HydraError("A resource group with name %s is already in network %s"%(name, self.id))

        group_i             = ResourceGroup()
        group_i.name        = name
        group_i.description = desc
        group_i.status      = status

        get_session().add(group_i)

        self.resourcegroups.append(group_i)


        return group_i
331599
def add_node(self, node):
        """"""
        nodes = [n for n in self.nodes() if not isinstance(n, Source)]
        num_agents = len(nodes)
        curr_generation = int((num_agents - 1) / float(self.generation_size))
        node.generation = curr_generation

        if curr_generation == 0:
            if self.initial_source:
                source = min(
                    self.nodes(type=Source),
                    key=attrgetter('creation_time'))
                source.connect(whom=node)
                source.transmit(to_whom=node)
        else:
            prev_agents = Node.query\
                .filter_by(failed=False,
                           network_id=self.id,
                           generation=(curr_generation - 1))\
                .all()
            prev_fits = [p.fitness for p in prev_agents]
            prev_probs = [(f / (1.0 * sum(prev_fits))) for f in prev_fits]

            rnd = random.random()
            temp = 0.0
            for i, probability in enumerate(prev_probs):
                temp += probability
                if temp > rnd:
                    parent = prev_agents[i]
                    break

            parent.connect(whom=node)
            parent.transmit(to_whom=node)
981215
def create_usuario_grupo(self):
        """"""
        return UsuarioGrupo(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
603606
def add_to_group(connection, group_id)
      params = to_json_for_add
      url    = "/api/2.0/asset_groups/#{group_id}/tags"
      uri    = AJAX.post(connection, url, params, AJAX::CONTENT_TYPE::JSON)
      @id    = uri.split('/').last.to_i
    end
23526
public void add(Group group, AccessLevel accessLevel) {
        getAccessList().add(new Access(group, accessLevel));
    }
1195019
def add_ip_to_net(networks, host):
    
    for network in networks:
        if host['ipaddr'] in network['network']:
            network['hosts'].append(host)
            return
982422
def add_member_to_group(self, group_id, user_id):
        
        url = self.TEAM_MEMBERS_URL % (group_id, user_id)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.post_request()
621976
def add_user(self, user, group):
        
        if self.is_user_in(user, group):
            raise UserAlreadyInAGroup
        self.new_groups.add(group, user)
1287593
def add_group(data_api, data_setters, group_index):
    """"""
    group_type_ind = data_api.group_type_list[group_index]
    atom_count = len(data_api.group_list[group_type_ind]["atomNameList"])
    insertion_code = data_api.ins_code_list[group_index]
    data_setters.set_group_info(data_api.group_list[group_type_ind]["groupName"],
                                data_api.group_id_list[group_index], insertion_code,
                                data_api.group_list[group_type_ind]["chemCompType"],
                                atom_count, data_api.num_bonds,
                                data_api.group_list[group_type_ind]["singleLetterCode"],
                                data_api.sequence_index_list[group_index],
                                data_api.sec_struct_list[group_index])
    for group_atom_ind in range(atom_count):
        add_atom_data(data_api, data_setters,
                      data_api.group_list[group_type_ind]["atomNameList"],
                      data_api.group_list[group_type_ind]["elementList"],
                      data_api.group_list[group_type_ind]["formalChargeList"],
                      group_atom_ind)
        data_api.atom_counter +=1
    add_group_bonds(data_setters,
                    data_api.group_list[group_type_ind]["bondAtomList"],
                    data_api.group_list[group_type_ind]["bondOrderList"])
    return atom_count
1103504
def add_group(self, group_attribs=None, parent=None):
        """"""
        if parent is None:
            parent = self.tree.getroot()
        elif not self.contains_group(parent):
            warnings.warn('The requested group {0} does not belong to '
                          'this Document'.format(parent))

        if group_attribs is None:
            group_attribs = {}
        else:
            group_attribs = group_attribs.copy()

        return SubElement(parent, '{{{0}}}g'.format(
            SVG_NAMESPACE['svg']), group_attribs)
137793
def create_network(self):
        """"""
        return Network(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
860362
def add_node(self, node):
        
        if _debug: Network._debug("add_node %r", node)

        self.nodes.append(node)
        node.lan = self

        # update the node name
        if not node.name:
            node.name = '%s:%s' % (self.name, node.address)
126077
def AddGroupMemberships(self):
    """"""
    self.groups = {g.name: self._Members(g) for g in itervalues(self.groups)}
    # Map the groups a user is a member of, irrespective of primary/extra gid.
    for g in itervalues(self.groups):
      for user in g.members:
        membership = self.memberships.setdefault(user, set())
        membership.add(g.gid)
    # Now add the completed membership to the user account.
    for user in itervalues(self.entry):
      user.gids = self.memberships.get(user.username)
557181
def add_peer_to_group(self, group_jid, peer_jid):
        
        log.info("[+] Requesting to add user {} into the group {}".format(peer_jid, group_jid))
        return self._send_xmpp_element(group_adminship.AddToGroupRequest(group_jid, peer_jid))
912765
def add_user_to_group(self, group_name, user_name):
        
        params = {'GroupName' : group_name,
                  'UserName' : user_name}
        return self.get_response('AddUserToGroup', params)
68881
def _add(self, hostport):
        """"""
        peer = self.peer_class(
            tchannel=self.tchannel,
            hostport=hostport,
            on_conn_change=self._update_heap,
        )
        peer.rank = self.rank_calculator.get_rank(peer)
        self._peers[peer.hostport] = peer

        self.peer_heap.add_and_shuffle(peer)
1313454
def add_nic(self, instance_id, net_id):
        """"""
        #TODO: upgrade with port_id and fixed_ip in future
        self.client.servers.interface_attach(
            instance_id, None, net_id, None)
        return True