Add a new category group at once
761505
protected function submitAddCategoryGroup()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->validateComponent('category_group');
        $this->addCategoryGroup();
    }
645877
private void addGroup(List<Token> group, List<List<Token>> groups) {

    if(group.isEmpty()) return;

    // remove trailing tokens that should be ignored
    while(!group.isEmpty() && IGNORED_TRAILING_TOKENS.contains(
        group.get(group.size() - 1).getType())) {
      group.remove(group.size() - 1);
    }

    // if the group still has some tokens left, we'll add it to our list of groups
    if(!group.isEmpty()) {
      groups.add(group);
    }
  }
533053
protected function setTitleEditCategoryGroup()
    {
        if (isset($this->data_category_group['category_group_id'])) {
            $title = $this->text('Edit %name', array('%name' => $this->data_category_group['title']));
        } else {
            $title = $this->text('Add category group');
        }

        $this->setTitle($title);
    }
235528
def set_categories(self):
        """"""
        self.categories = []
        temp_categories = self.soup.findAll('category')
        for category in temp_categories:
            category_text = category.string
            self.categories.append(category_text)
369395
def add_group(self, name: str, **kwargs) -> None:
        
        group = {
            name: deserializer.inventory.InventoryElement.deserialize_group(
                name=name, defaults=self.defaults, **kwargs
            )
        }
        self.groups.update(group)
1079323
def create_group(cls, prefix: str, name: str) -> ErrorGroup:
        """"""
        group = cls.ErrorGroup(prefix, name)
        cls.groups.append(group)
        return group
179714
def init_group_category_regex(category_groups, category_regex_args):
    
    category_regex = []
    authorized_empty_regex = 1
    if len(category_regex_args) and len(category_groups) != len(category_regex_args):
        printError('Error: you must provide as many regex as category groups.')
        return None
    for regex in category_regex_args:
        if len(regex) < 1:
            if authorized_empty_regex > 0:
                category_regex.append(None)
                authorized_empty_regex -= 1
            else:
                printError('Error: you cannot have more than one empty regex to automatically assign groups to users.')
                return None
        else:
            category_regex.append(re.compile(regex))
    return category_regex
1199481
def addCategory(self, categoryUri, weight):
        
        assert isinstance(weight, (float, int)), "weight value has to be a positive or negative integer"
        self.topicPage["categories"].append({"uri": categoryUri, "wgt": weight})
176182
public function addCategory(CategoryInterface $category)
    {
        if (!$this
            ->categories
            ->contains($category)
        ) {
            $this
                ->categories
                ->add($category);
        }

        return $this;
    }
116021
def _to_add_with_category(self, catid):
        '''
        
        '''

        catinfo = MCategory.get_by_uid(catid)
        kwd = {
            'uid': self._gen_uid(),
            'userid': self.userinfo.user_name if self.userinfo else '',
            'gcat0': catid,
            'parentname': MCategory.get_by_uid(catinfo.pid).name,
            'catname': MCategory.get_by_uid(catid).name,
        }

        self.render('autogen/add/add_{0}.html'.format(catid),
                    userinfo=self.userinfo,
                    kwd=kwd)
1201598
def add(name, **kwargs):
    '''
    
    '''
    if not info(name):
        comp_obj = _get_computer_object()
        try:
            new_group = comp_obj.Create('group', name)
            new_group.SetInfo()
            log.info('Successfully created group %s', name)
        except pywintypes.com_error as exc:
            msg = 'Failed to create group {0}. {1}'.format(
                name, win32api.FormatMessage(exc.excepinfo[5]))
            log.error(msg)
            return False
    else:
        log.warning('The group %s already exists.', name)
        return False
    return True
1281836
def add_sub_category(self, label):
        
        category = Category(label, self)
        self._sub_categories.append(category)
        return category
779394
public function addGroupToSet()
    {
        $aChosenCat = $this->_getActionIds('oxgroups.oxid');
        $soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');

        // adding
        if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
            $sGroupTable = $this->_getViewName('oxgroups');
            $aChosenCat = $this->_getAll($this->_addFilter("select $sGroupTable.oxid " . $this->_getQuery()));
        }
        if ($soxId && $soxId != "-1" && is_array($aChosenCat)) {
            foreach ($aChosenCat as $sChosenCat) {
                $oObject2Delivery = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
                $oObject2Delivery->init('oxobject2delivery');
                $oObject2Delivery->oxobject2delivery__oxdeliveryid = new \OxidEsales\Eshop\Core\Field($soxId);
                $oObject2Delivery->oxobject2delivery__oxobjectid = new \OxidEsales\Eshop\Core\Field($sChosenCat);
                $oObject2Delivery->oxobject2delivery__oxtype = new \OxidEsales\Eshop\Core\Field("oxdelsetg");
                $oObject2Delivery->save();
            }
        }
    }
310874
function addGroupToList(group, list) {
    if (!group) {
      return list;
    }

    if (group.length > 1) {
      list.push(group);
    } else {
      list = list.concat(group);
    }

    return list;
  }
694183
public function addCategories(array $categories)
	{
		$this->categories = array();
		foreach ($categories as $category)
		{
			$this->addCategory($category);
		}

		return $this;
	}
330894
def add_new_header_groups(self, groups):
        
        already_present = []
        for group in groups:
            col_names = self.dm[self.dm['group'] == group].index
            for col in col_names:
                if col not in self.grid.col_labels:
                    col_number = self.grid.add_col(col)
                    # add to appropriate headers list
                    # add drop down menus for user-added column
                    if col in self.contribution.vocab.vocabularies:
                        self.drop_down_menu.add_drop_down(col_number, col)
                    elif col in self.contribution.vocab.suggested:
                        self.drop_down_menu.add_drop_down(col_number, col)
                    elif col in ['specimen', 'sample', 'site', 'location',
                                 'specimens', 'samples', 'sites']:
                        self.drop_down_menu.add_drop_down(col_number, col)
                    elif col == 'experiments':
                        self.drop_down_menu.add_drop_down(col_number, col)
                    if col == "method_codes":
                        self.drop_down_menu.add_method_drop_down(col_number, col)
                else:
                    already_present.append(col)
        return already_present
861574
def add_category(self, name):
        
        category = BayesCategory(name)
        self.categories[name] = category
        return category