Fetches list of :class:`models.PollOption` objects from the poll id

        :param poll_id: Poll ID to fetch from
        :rtype: list
        :raises: FBchatException if request failed
772134
def fetchPollOptions(self, poll_id):
        
        data = {"question_id": poll_id}
        j = self._post(
            self.req_url.GET_POLL_OPTIONS, data, fix_request=True, as_json=True
        )
        return [PollOption._from_graphql(m) for m in j["payload"]]
313966
def run(self):
        
        services = Service.objects.all()
        for service in services:
            poll_service.apply_async(kwargs={"service_id": str(service.id)})
        return "Queued <%s> Service(s) for Polling" % services.count()
306375
def set_stream_class_lists_url(self, session_id):
        
        url = self.api_url + '/v2/project/' + self.api_key + '/session/' + session_id + '/stream'
        return url
629045
def get(cls, object_id):
        
        from highton.models.party import Party
        return fields.ListField(name=Party.ENDPOINT, init_class=Party).decode(
            cls.element_from_string(
                cls._get_request(endpoint=cls.ENDPOINT + '/' + str(object_id)).text
            )
        )
802552
def fetch(self, only_ref=False):
        
        if self.ref:
            reply = self.connector.get_object(
                self.ref, return_fields=self.return_fields)
            if reply:
                self.update_from_dict(reply)
                return True

        search_dict = self.to_dict(search_fields='update')
        return_fields = [] if only_ref else self.return_fields
        reply = self.connector.get_object(self.infoblox_type,
                                          search_dict,
                                          return_fields=return_fields)
        if reply:
            self.update_from_dict(reply[0], only_ref=only_ref)
            return True
        return False
1311811
def list_statements(self, session_id: int) -> List[Statement]:
        
        response = self._client.get(f"/sessions/{session_id}/statements")
        return [
            Statement.from_json(session_id, data)
            for data in response["statements"]
        ]
1140860
def get(self, id):
        
        url = self._url('%s' % (id))
        return self.client.get(url)
835409
def get(self, id):
        
        ctx = self.context.copy()
        ctx['active_test'] = False
        results = self.rpc_model.search_read(
            [('id', '=', id)],
            None, None, None, self.fields,
            context=ctx
        )
        return results and results[0] or None
959025
def getIds(self, query='*:*', fq=None, start=0, rows=1000):
        
        params = {'q': query, 'start': str(start), 'rows': str(rows), 'wt': 'python'}
        if fq is not None:
            params['fq'] = fq
        request = urllib.parse.urlencode(params, doseq=True)
        data = None
        response = {'matches': 0, 'start': start, 'failed': True, 'ids': []}
        try:
            rsp = self.doPost(self.solrBase + '', request, self.formheaders)
            data = eval(rsp.read())
        except Exception:
            pass
        if data is None:
            return response
        response['failed'] = False
        response['matches'] = data['response']['numFound']
        for doc in data['response']['docs']:
            response['ids'].append(doc['id'][0])
        return response
1124587
def _poll_connection(self, fd):
        
        try:
            state = self._connections[fd].poll()
        except (OSError, socket.error) as error:
            self._ioloop.remove_handler(fd)
            if fd in self._futures and not self._futures[fd].done():
                self._futures[fd].set_exception(
                    psycopg2.OperationalError('Connection error (%s)' % error)
                )
        except (psycopg2.Error, psycopg2.Warning) as error:
            if fd in self._futures and not self._futures[fd].done():
                self._futures[fd].set_exception(error)
        else:
            if state == extensions.POLL_OK:
                if fd in self._futures and not self._futures[fd].done():
                    self._futures[fd].set_result(True)
            elif state == extensions.POLL_WRITE:
                self._ioloop.update_handler(fd, ioloop.IOLoop.WRITE)
            elif state == extensions.POLL_READ:
                self._ioloop.update_handler(fd, ioloop.IOLoop.READ)
            elif state == extensions.POLL_ERROR:
                self._ioloop.remove_handler(fd)
                if fd in self._futures and not self._futures[fd].done():
                    self._futures[fd].set_exception(
                        psycopg2.Error('Poll Error'))
434216
def createPoll(self, poll, thread_id=None):
        
        thread_id, thread_type = self._getThread(thread_id, None)

        # We're using ordered dicts, because the Facebook endpoint that parses the POST
        # parameters is badly implemented, and deals with ordering the options wrongly.
        # This also means we had to change `client._payload_default` to an ordered dict,
        # since that's being copied in between this point and the `requests` call
        #
        # If you can find a way to fix this for the endpoint, or if you find another
        # endpoint, please do suggest it ;)
        data = OrderedDict([("question_text", poll.title), ("target_id", thread_id)])

        for i, option in enumerate(poll.options):
            data["option_text_array[{}]".format(i)] = option.text
            data["option_is_selected_array[{}]".format(i)] = str(int(option.vote))

        j = self._post(self.req_url.CREATE_POLL, data, fix_request=True, as_json=True)
359929
def show(request, pollId):
    """"""

    # Get the poll
    curDB.execute('SELECT id, title, description FROM Poll WHERE id = ? ORDER BY title', (pollId,))
    poll = curDB.fetchone()

    if poll is None:
        return {}

    responses = []
    totalVotes = 0
    votedFor = 0

    # Compute the list of responses
    curDB.execute('SELECT id, title FROM Response WHERE pollId = ? ORDER BY title ', (poll[0],))
    resps = curDB.fetchall()

    for rowRep in resps:

        votes = []
        nbVotes = 0

        # List each votes
        for rowVote in curDB.execute('SELECT username FROM Vote WHERE responseId = ?', (rowRep[0],)):

            nbVotes += 1

            # If the user is and administrator, saves each votes
            if request.args.get('ebuio_u_ebuio_admin') == 'True':
                votes.append(rowVote[0])

            # Save the vote of the current suer
            if request.args.get('ebuio_u_username') == rowVote[0]:
                votedFor = rowRep[0]

        totalVotes += nbVotes
        responses.append({'id': rowRep[0], 'title': rowRep[1], 'nbVotes': nbVotes, 'votes': votes})

    return {'id': poll[0], 'name': poll[1], 'description': poll[2], 'responses': responses, 'totalVotes': totalVotes, 'votedFor': votedFor}
1273847
def receive(self, poll_interval):
        
        readable, writeable, errored = select.select(self._readlist, [], [],
                                                     poll_interval)
        for s in readable:
            data, addr = s.recvfrom(self.BUFFER_SIZE)
            if data:
                return data

        return None
1363237
def get_objects(self, ids, **args):
        
        args["ids"] = ",".join(ids)
        return self.request(self.version + "/", args)
994274
def get_poll_option_formset(self, formset_class):
        
        if self.request.forum_permission_handler.can_create_polls(
            self.get_forum(), self.request.user,
        ):
            return formset_class(**self.get_poll_option_formset_kwargs())
1050769
def request(self, id, **kwargs):
        
        data = self.get('requests', id, **kwargs)
        return data
514456
def account_lists(self, id):
        
        id = self.__unpack_id(id)
        params = self.__generate_params(locals(), ['id'])
        url = '/api/v1/accounts/{0}/lists'.format(str(id))
        return self.__api_request('GET', url, params)