def _count(self, method, limit, keywords):
        """ Do a scan or query and aggregate the results into a Count """
        # The limit will be mutated, so copy it and leave the original intact
        limit = limit.copy()
        has_more = True
        count = None
        while has_more:
            limit.set_request_args(keywords)
            response = self.call(method, **keywords)
            limit.post_fetch(response)
            count += Count.from_response(response)
            last_evaluated_key = response.get('LastEvaluatedKey')
            has_more = last_evaluated_key is not None and not limit.complete
            if has_more:
                keywords['ExclusiveStartKey'] = last_evaluated_key
        return count
def _count ( self , method , limit , keywords ) : limit = limit . copy ( ) has_more = True count = None while has_more : limit . set_request_args ( keywords ) response = self . call ( method , ** keywords ) limit . post_fetch ( response ) count += Count . from_response ( response ) last_evaluated_key = response . get ( 'LastEvaluatedKey' ) has_more = last_evaluated_key is not None and not limit . complete if has_more : keywords [ 'ExclusiveStartKey' ] = last_evaluated_key return count
Do a scan or query and aggregate the results into a Count