Returns the total parsed responses, given the return value from parse().
490169
def total_results(
    data: Union[List[JSONRPCResponse], JSONRPCResponse, None], *, ok: bool = True
) -> int:
    
    if isinstance(data, list):
        return sum([1 for d in data if d.ok == ok])
    elif isinstance(data, JSONRPCResponse):
        return int(data.ok == ok)
    return 0
910028
def post_parse(self, uri, params={}, data={}):
        '''
        '''
        return self._request_parse(self.post, uri, params, data)
592918
function parseArray (parser) {
  const length = parseLength(parser)
  if (length === undefined) {
    return
  }
  if (length < 0) {
    return null
  }
  const responses = new Array(length)
  return parseArrayElements(parser, responses, 0)
}
1286570
function parseArrayElements (parser, responses, i) {
  const bufferLength = parser.buffer.length
  while (i < responses.length) {
    const offset = parser.offset
    if (parser.offset >= bufferLength) {
      pushArrayCache(parser, responses, i)
      return
    }
    const response = parseType(parser, parser.buffer[parser.offset++])
    if (response === undefined) {
      if (!(parser.arrayCache.length || parser.bufferCache.length)) {
        parser.offset = offset
      }
      pushArrayCache(parser, responses, i)
      return
    }
    responses[i] = response
    i++
  }

  return responses
}
415469
def from_response_data(cls, response_data):
        

        response_json = response_data.json()

        return cls(
            response_data.url,
            response_json["number_of_page_results"],
            response_json["number_of_total_results"],
            response_json["results"],
        )
1279456
def parse_rest_response(self, records, rowcount, row_type=list):
        """"""
        if self.is_plain_count:
            # result of "SELECT COUNT() FROM ... WHERE ..."
            assert list(records) == []
            yield rowcount  # originally [resp.json()['totalSize']]
        else:
            while True:
                for row_deep in records:
                    assert self.is_aggregation == (row_deep['attributes']['type'] == 'AggregateResult')
                    row_flat = self._make_flat(row_deep, path=(), subroots=self.subroots)
                    # TODO Will be the expression "or x['done']" really correct also for long subrequests?
                    assert all(not isinstance(x, dict) or x['done'] for x in row_flat)
                    if issubclass(row_type, dict):
                        yield {k: fix_data_type(row_flat[k.lower()]) for k in self.aliases}
                    else:
                        yield [fix_data_type(row_flat[k.lower()]) for k in self.aliases]
                # if not resp['done']:
                #     if not cursor:
                #         raise ProgrammingError("Must get a cursor")
                #     resp = cursor.query_more(resp['nextRecordsUrl']).json()
                # else:
                #     break
                break
823291
def get_paginated_response(self, data):
        
        metadata = {
            'next': self.get_next_link(),
            'previous': self.get_previous_link(),
            'count': self.get_result_count(),
            'num_pages': self.get_num_pages(),
        }
        if isinstance(data, dict):
            if 'results' not in data:
                raise TypeError(u'Malformed result dict')
            data['pagination'] = metadata
        else:
            data = {
                'results': data,
                'pagination': metadata,
            }
        return Response(data)
489699
def parse(self):
        
        status = Status()
        self.expect_line(Status.client_list.label)

        status.updated_at = self.expect_tuple(Status.updated_at.label)
        status.client_list.update({
            text_type(c.real_address): c
            for c in self._parse_fields(Client, Status.routing_table.label)})
        status.routing_table.update({
            text_type(r.virtual_address): r
            for r in self._parse_fields(Routing, Status.global_stats.label)})
        status.global_stats = GlobalStats()
        status.global_stats.max_bcast_mcast_queue_len = self.expect_tuple(
            GlobalStats.max_bcast_mcast_queue_len.label)

        self.expect_line(self.terminator)
        return status
515312
def get_response(self, results):
        
        if results is None:
            return None
        for result in itertools.chain.from_iterable(results):
            if isinstance(result, BaseResponse):
                return result
117526
def get_parse(self, uri, params={}):
        '''
        '''
        return self._request_parse(self.get, uri, params)
1176090
def response(self, url):
        """"""
        
        resp = requests.get(url).content
        return self.parseresponse(resp)
1112226
def __parseResponseServer(self):
        """"""
        
        self.__logger.debug(Sitools2Abstract.getBaseUrl(self) + SITools2Instance.PROJECTS_URI)        
        result = Util.retrieveJsonResponseFromServer(Sitools2Abstract.getBaseUrl(self) + SITools2Instance.PROJECTS_URI)
        isSuccess = result['success']
        if isSuccess:            
            data = result['data']
            self.__logger.debug(data)
            for i, dataItem in enumerate(data):
                project = Project(Sitools2Abstract.getBaseUrl(self), dataItem)
                self.__projects.append(project)
        else:
            raise Sitools2Exception("Error when loading the server response")
1324007
def parse_info(response):
    ""
    info = {}
    response = nativestr(response)

    def get_value(value):
        if ',' not in value or '=' not in value:
            try:
                if '.' in value:
                    return float(value)
                else:
                    return int(value)
            except ValueError:
                return value
        else:
            sub_dict = {}
            for item in value.split(','):
                k, v = item.rsplit('=', 1)
                sub_dict[k] = get_value(v)
            return sub_dict

    for line in response.splitlines():
        if line and not line.startswith('#'):
            if line.find(':') != -1:
                key, value = line.split(':', 1)
                info[key] = get_value(value)
            else:
                # if the line isn't splittable, append it to the "__raw__" key
                info.setdefault('__raw__', []).append(line)

    return info
94300
def parse_response(self, resp):
        
        p, u = self.getparser()
        p.feed(resp.content)
        p.close()
        return u.close()
1118590
def _iterator(self, response):
        '''
        
        '''

        while True:
            result = deque(self._parse_data(response))
            del response
            if result:
                doc_count = len(result)
                last = result.pop()
                while result:
                    yield result.popleft()

                # We expect doc_count = self._page_size + 1 results, if
                # we have self._page_size or less it means we are on the
                # last page and need to return the last result.
                if doc_count < self._real_page_size:
                    yield last
                    break
                del result

                # if we are in a view, keys could be duplicate so we
                # need to start from the right docid
                if last['id']:
                    response = self._call(startkey=last['key'],
                                          startkey_docid=last['id'])
                # reduce result keys are unique by definition
                else:
                    response = self._call(startkey=last['key'])

            else:
                break
83144
def post_parse_response(self, response, **kwargs):
        

        if "scope" not in response:
            try:
                _key = kwargs['state']
            except KeyError:
                pass
            else:
                if _key:
                    item = self.get_item(oauth2.AuthorizationRequest,
                                         'auth_request', _key)
                    try:
                        response["scope"] = item["scope"]
                    except KeyError:
                        pass
        return response
727902
def parse_authority_response
      threaded_responses = []
      #end_response = Array.new(20)
      end_response = []
      position_counter = 0
      @raw_response.select {|response| response[0] == "atom:entry"}.map do |response|
        threaded_responses << Thread.new(position_counter) { |local_pos|
          end_response[local_pos] = loc_response_to_qa(response_to_struct(response), position_counter)
        }
        position_counter+=1
        #sleep(0.05)

        #loc_response_to_qa(response_to_struct(response))
      end
      threaded_responses.each { |thr|  thr.join }
      end_response
    end