Get a random answer in current language.

        :return: An answer.

        :Example:
            No
496319
def answer(self) -> str:
        
        answers = self._data['answers']
        return self.random.choice(answers)
1014121
def _get_answer(self, part):
        
        answer_fname = getattr(self, "answer_{}_fname".format(part))
        if os.path.isfile(answer_fname):
            with open(answer_fname) as f:
                return f.read().strip()
        # scrape puzzle page for any previously solved answers
        response = requests.get(self.url, cookies=self._cookies, headers=self._headers)
        response.raise_for_status()
        soup = bs4.BeautifulSoup(response.text, "html.parser")
        if not self._title:
            # may as well save this while we're here
            self._save_title(soup=soup)
        hit = "Your puzzle answer was"
        paras = [p for p in soup.find_all("p") if p.text.startswith(hit)]
        if paras:
            parta_correct_answer = paras[0].code.text
            self._save_correct_answer(value=parta_correct_answer, part="a")
            if len(paras) > 1:
                _p1, p2 = paras
                partb_correct_answer = p2.code.text
                self._save_correct_answer(value=partb_correct_answer, part="b")
        if os.path.isfile(answer_fname):
            with open(answer_fname) as f:
                return f.read().strip()
        msg = "Answer {}-{}{} is not available".format(self.year, self.day, part)
        raise PuzzleUnsolvedError(msg)
556655
def select(self, **kws):
        '''
            
        '''
        lst = [i for i in self.values() if i.select(**kws)]

        random.shuffle(lst)

        return lst
1167116
def get_name(self, language):
        
        return self.gettext(language, self._name) if self._name else ""
1212271
def _choice_from(self, key: str) -> str:
        """"""
        data = self._data[key]
        return self.random.choice(data)
385890
def get_language(query: str) -> str:
    
    query = query.lower()
    for language in LANGUAGES:
        if query.endswith(language):
            return language
    return ''
58652
def gettext(self, singular, plural=None, n=1, locale=None) -> str:
        
        if locale is None:
            locale = self.ctx_locale.get()

        if locale not in self.locales:
            if n is 1:
                return singular
            else:
                return plural

        translator = self.locales[locale]

        if plural is None:
            return translator.gettext(singular)
        else:
            return translator.ngettext(singular, plural, n)
1311091
def get_random_value(length=10, character_sets=[string.ascii_uppercase, string.ascii_lowercase]):
        

        return "".join(random.choice("".join(character_sets)) for i in range(length))
121928
def get(self):
        
        io_loop = IOLoop.current()
        new_get = Future()

        with self._lock:
            get, self._get = self._get, new_get

        answer = Future()

        def _on_node(future):
            if future.exception():  # pragma: no cover (never happens)
                return answer.set_exc_info(future.exc_info())

            node = future.result()
            value = node.value
            new_hole, node.next = node.next, None
            new_get.set_result(new_hole)
            answer.set_result(value)

        def _on_get(future):
            if future.exception():  # pragma: no cover (never happens)
                return answer.set_exc_info(future.exc_info())

            hole = future.result()
            io_loop.add_future(hole, _on_node)

        io_loop.add_future(get, _on_get)
        return answer
844975
def get_translations(self, language=None):
        
        from .models import Translation

        if not self.pk:
            return Translation.objects.none()

        return Translation.objects.get_translations(obj=self, language=language)
1163924
def slug(self, language=None, fallback=True):
        

        slug = self.get_content(language, 'slug', language_fallback=fallback)
        if slug == '':
            return "Page {0}".format(self.pk)

        return slug
32883
def get(args):
    

    html = args.H
    lang = args.l
    nowrap = args.n
    query = args.q
    silent = args.s
    title = args.t
    verbose = args.v
    wiki = args.w

    if query:
        qobj = WPToolsQuery(lang=lang, wiki=wiki)
        if title:
            return qobj.query(title)
        return qobj.random()

    page = wptools.page(title, lang=lang, silent=silent,
                        verbose=verbose, wiki=wiki)

    try:
        page.get_query()
    except (StandardError, ValueError, LookupError):
        return "NOT_FOUND"

    if not page.data.get('extext'):
        out = page.cache['query']['query']

    out = _page_text(page, nowrap)
    if html:
        out = _page_html(page)

    try:
        return out.encode('utf-8')
    except KeyError:
        return out
476449
def get_form_language(self, request, obj=None):
        
        if obj is not None:
            return obj.get_current_language()
        else:
            return self._language(request)
989609
def from_xxx(cls, xxx):
        
        xxx = str(xxx).lower()
        if xxx is 'unknown':
            return UnknownLanguage(xxx)
        try:
            return cls._from_xyz('LanguageID', xxx)
        except NotALanguageException:
            log.warning('Unknown LanguageId: {}'.format(xxx))
            return UnknownLanguage(xxx)
49214
def quote(self) -> str:
        
        quotes = self._data['quotes']
        return self.random.choice(quotes)
1281032
def ask(message, options):
    """"""
    while 1:
        if os.environ.get('PIP_NO_INPUT'):
            raise Exception('No input was expected ($PIP_NO_INPUT set); question: %s' % message)
        response = raw_input(message)
        response = response.strip().lower()
        if response not in options:
            print('Your response (%r) was not one of the expected responses: %s' % (
                response, ', '.join(options)))
        else:
            return response
683468
def random(self):
        
        utc_now = datetime.datetime.utcnow()
        return self.valueFromString(utc_now.strftime(self.defaultFormat()))