def create_query_results(query_ids):

    # install custom opener
    urllib2.install_opener(urllib2.build_opener(HTTPSHandlerV3()))

    for query_id, num_groups in query_ids.iteritems():
        is_grouped = num_groups > 1
        if is_grouped:
            results = {
                (i+1) % 'group%d': random.uniform(10000, 20000) for i in range(num_groups)
            }
            query_string = "SELECT count(*) FROM the_best_table GROUP BY awesomeness;"
        else:
            results = random.uniform(10000, 20000)
            query_string = "SELECT count(*) FROM the_best_table;"
        data = {
            'querystring': query_string,
            'query_id': query_id,
            'pipeline_id': str(uuid.uuid4()),
            'result_col_name': 'num_rows',
            'grouped': "true" if is_grouped else "false",
            'results': json.dumps(results)
        }
        send_request(data)
dataset/ETHPy150Open amplab/ampcrowd/ampcrowd/results_dashboard/post.py/create_query_results/swapped operands of `%`