Parameters
    ----------
    category: str
        Choices: 'neutral', 'chuck', 'all', 'twister'
    lang: str
        Choices: 'en', 'de', 'es', 'gl', 'eu', 'it'

    Returns
    -------
    joke: str
434177
def get_joke(language='en', category='neutral'):
    

    jokes = get_jokes(language, category)
    return random.choice(jokes)
414047
def state_category(value):
        """"""
        if value == re.sre_parse.CATEGORY_DIGIT:
            return (yield '0')

        if value == re.sre_parse.CATEGORY_WORD:
            return (yield 'x')
134493
def _netid_category_url(netid, category_codes):
    
    return "{0}/{1}/category/{2}".format(
        url_base(), netid,
        (','.join([str(n) for n in category_codes])
         if isinstance(category_codes, (list, tuple))
         else category_codes))
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))
84220
def category(self, value):
        

        if value is not None:
            assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format(
                "category", value)
        self.__category = value
453086
def _category(self):
        

        if self.fname.split('_')[0] == 'WAC':
            self.grid = 'WAC'
            self.img = os.path.join(self.wacpath, self.fname + '.IMG')
            self.lbl = ''
        elif self.fname.split('_')[0] == 'LDEM':
            self.grid = 'LOLA'
            self.img = os.path.join(self.lolapath, self.fname + '.IMG')
            self.lbl = os.path.join(self.lolapath, self.fname + '.LBL')
        else:
            raise ValueError("%s : This type of image is not recognized. Possible\
                             images are from %s only" % (self.fname, ', '.join(('WAC', 'LOLA'))))
29063
def choice(self, other):
        ''''''
        @Parser
        def choice_parser(text, index):
            res = self(text, index)
            return res if res.status or res.index != index else other(text, index)
        return choice_parser
745844
def category(soup):
    
    category = []

    tags = raw_parser.category(soup)
    for tag in tags:
        category.append(node_text(tag))

    return category
509822
function(category) {
			var settingsMap = this.settingsMap;
			var pids = typeof category === 'string' ? this.categories[category] : Object.keys(settingsMap); //$NON-NLS-0$
			if (!pids) {
				return [];
			}
			return pids.map(function(pid) {
				return settingsMap[pid];
			});
		}
894202
def set_category(self, category: str = None) -> 'PygalleBaseClass':
        
        return self.set_internal(PygalleBaseClass.__KEYS.CATEGORY, category)
337328
def categories(self):
    '''
    
    '''

    if not getattr(self, '_categories', False):
      self._categories = [re.sub(r'^Category:', '', x) for x in
        [link['title']
        for link in self.__continued_query({
          'prop': 'categories',
          'cllimit': 'max'
        })
      ]]

    return self._categories
79208
function (category) {
    return this.get('/getappsincategory', {
      // 'cc': this.options.country,
      // 'l': this.options.language,
      'category': category
    }).then(function (body) {
      console.log('getAppsInCategory - ', body)
      return Promise.resolve(body);
    });
  }
1185869
def ConsultarCategorias(self, sep="||"):
        ""
        ret = self.client.consultarCategorias(
                        auth={
                            'token': self.Token, 'sign': self.Sign,
                            'cuit': self.Cuit, },
                            )['respuesta']
        self.__analizar_errores(ret)
        array = ret.get('categoria', []) + ret.get('categoriaPorcina', [])
        if sep is None:
            return dict([(it['codigo'], it['descripcion']) for it in array])
        else:
            return [("%s %%s %s %%s %s" % (sep, sep, sep)) %
                    (it['codigo'], it['descripcion']) for it in array]
1049379
def choices(self, cl):
        
        #: Just tidy up standard implementation for the sake of DRY principle.
        def _choice_item(is_selected, query_string, title):
            return {
                'selected': is_selected,
                'query_string': query_string,
                'display': force_text(title),
            }

        yield _choice_item(
            self.lookup_val is None,
            cl.get_query_string({}, [self.lookup_kwarg]),
            _('All'))

        container = (self.field.choices
                     if isinstance(self.field, ChoicesField) else
                     self.field.flatchoices)

        for lookup, title in container:
            yield _choice_item(
                smart_text(lookup) == self.lookup_val,
                cl.get_query_string({self.lookup_kwarg: lookup}),
                title)
346358
def add_category(self, category):
        '''
        
        '''
        if category == sre.CATEGORY_DIGIT:
            self._categories |= UNICODE_DIGIT_CATEGORIES
        elif category == sre.CATEGORY_NOT_DIGIT:
            self._categories |= UNICODE_CATEGORIES - UNICODE_DIGIT_CATEGORIES
        elif category == sre.CATEGORY_SPACE:
            self._categories |= UNICODE_SPACE_CATEGORIES
            for c in (UNICODE_SPACE_CHARS if self._unicode else SPACE_CHARS):
                self._whitelist_chars.add(c)
        elif category == sre.CATEGORY_NOT_SPACE:
            self._categories |= UNICODE_CATEGORIES - UNICODE_SPACE_CATEGORIES
            for c in (UNICODE_SPACE_CHARS if self._unicode else SPACE_CHARS):
                self._blacklist_chars.add(c)
        elif category == sre.CATEGORY_WORD:
            self._categories |= UNICODE_WORD_CATEGORIES
            self._whitelist_chars.add(u'_')
            if HAS_WEIRD_WORD_CHARS and self._unicode:
                for c in UNICODE_WEIRD_NONWORD_CHARS:
                    self._blacklist_chars.add(c)
        elif category == sre.CATEGORY_NOT_WORD:
            self._categories |= UNICODE_CATEGORIES - UNICODE_WORD_CATEGORIES
            self._blacklist_chars.add(u'_')
            if HAS_WEIRD_WORD_CHARS and self._unicode:
                for c in UNICODE_WEIRD_NONWORD_CHARS:
                    self._whitelist_chars.add(c)
161995
def make_category(self, string, parent=None, order=1):
        
        cat = Category(
            name=string.strip(),
            slug=slugify(SLUG_TRANSLITERATOR(string.strip()))[:49],
            # arent=parent,
            order=order
        )
        cat._tree_manager.insert_node(cat, parent, 'last-child', True)
        cat.save()
        if parent:
            parent.rght = cat.rght + 1
            parent.save()
        return cat
322516
def _parse_category(fname, categories):
        """"""
        version, date, values = None, None, []
        print("parsing {} ..".format(fname))
        for line in open(fname, 'rb'):
            uline = line.decode('utf-8')
            if version is None:
                version = uline.split(None, 1)[1].rstrip()
                continue
            elif date is None:
                date = uline.split(':', 1)[1].rstrip()
                continue
            if uline.startswith('#') or not uline.lstrip():
                continue
            addrs, details = uline.split(';', 1)
            addrs, details = addrs.rstrip(), details.lstrip()
            if any(details.startswith('{} #'.format(value))
                   for value in categories):
                start, stop = addrs, addrs
                if '..' in addrs:
                    start, stop = addrs.split('..')
                values.extend(range(int(start, 16), int(stop, 16) + 1))
        return version, date, sorted(values)