Enable an entire category of commands
        :param category: the category to enable
16522
def enable_category(self, category: str) -> None:
        
        for cmd_name in list(self.disabled_commands):
            func = self.disabled_commands[cmd_name].command_function
            if hasattr(func, HELP_CATEGORY) and getattr(func, HELP_CATEGORY) == category:
                self.enable_command(cmd_name)
556406
public function addCategory($category)
    {
        if ( ! in_array($category, (array)$this->categories)) {
            $this->categories[] = $category;
        }

        return $this;
    }
1097206
def _assert_category(self, category):
        """"""
        category = category.lower()
        valid_categories = ['cable', 'broadcast', 'final', 'tv']
        assert_msg = "%s is not a valid category." % (category)
        assert (category in valid_categories), assert_msg
248354
def do_disable_commands(self, _):
        """"""
        message_to_print = "{} is not available while {} commands are disabled".format(COMMAND_NAME,
                                                                                       self.CMD_CAT_APP_MGMT)
        self.disable_category(self.CMD_CAT_APP_MGMT, message_to_print)
        self.poutput("The Application Management commands have been disabled")
319169
def for_category(self, category, live_only=False):
        
        filters = {'tag': category.tag}

        if live_only:
            filters.update({'entry__live': True})

        return self.filter(**filters)
571361
def run_command(command, args):
    
    for category, commands in iteritems(command_categories):
        for existing_command in commands:
            if existing_command.match(command):
                existing_command.run(args)
1346020
def add_category
      category_name = self.name.to_s.split('.').first
      # if one word then add to general category
      category_name = self.name.to_s.split('.').size == 1 ? 'general' : self.name.to_s.split('.').first
      self.category = TranslationCenter::Category.where(name: category_name).first_or_create
      self.last_accessed = Time.now
    end
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)
1058803
def __show_categories_tree(self):
        
        for cat in self.categories_tree:
            print("%s (%i)" % (self.categories[cat], cat))
            for subcat in self.categories_tree[cat]:
                print("-> %s (%i)" % (self.categories[subcat], subcat))
890215
def cmd(send, _, args):
    
    apikey = args['config']['api']['ebayapikey']
    categories = get_categories(apikey)
    item = None
    while not item:
        item = get_item(choice(categories), apikey)
    send(item)
1212311
def _set_categories_on_workflow(global_workflow_id, categories_to_set):
    
    assert(isinstance(categories_to_set, list))

    existing_categories = dxpy.api.global_workflow_list_categories(global_workflow_id)['categories']
    categories_to_add = set(categories_to_set).difference(set(existing_categories))
    categories_to_remove = set(existing_categories).difference(set(categories_to_set))
    if categories_to_add:
        dxpy.api.global_workflow_add_categories(global_workflow_id,
                                                input_params={'categories': list(categories_to_add)})
    if categories_to_remove:
        dxpy.api.global_workflow_remove_categories(global_workflow_id,
                                                   input_params={'categories': list(categories_to_remove)})
956183
public function cmdGetCategoryGroup()
    {
        $result = $this->getListCategoryGroup();
        $this->outputFormat($result);
        $this->outputFormatTableCategoryGroup($result);
        $this->output();
    }
1152124
def set_category(self, category):
        
        pcategory = self.find("general/category")
        pcategory.clear()
        name = ElementTree.SubElement(pcategory, "name")
        if isinstance(category, Category):
            id_ = ElementTree.SubElement(pcategory, "id")
            id_.text = category.id
            name.text = category.name
        elif isinstance(category, basestring):
            name.text = category
1225932
protected function addCategory()
    {
        $this->controlAccess('category_add');

        if ($this->category->add($this->getSubmitted())) {
            $url = "admin/content/category/{$this->data_category_group['category_group_id']}";
            $this->redirect($url, $this->text('Category has been added'), 'success');
        }

        $this->redirect('', $this->text('Category has not been added'), 'warning');
    }
628568
def create_category(self, category):
        
        content = self._serialize.body(category, 'ExtensionCategory')
        response = self._send(http_method='POST',
                              location_id='476531a3-7024-4516-a76a-ed64d3008ad6',
                              version='5.1-preview.1',
                              content=content)
        return self._deserialize('ExtensionCategory', response)
717733
def add_category(self, category):
        
        self._categories = self._ensure_append(category, self._categories)
1246824
public void setCategories(List<String> categories) {

        if ((categories != null) && !categories.isEmpty()) {
            addFilterQuery(CmsSearchField.FIELD_CATEGORY + CmsSearchField.FIELD_DYNAMIC_EXACT, categories, true, true);
        }
    }