benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 5e8be57b-a658-50e6-93d7-97109570e48a

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

from django.http import HttpResponse
from django.conf import settings
import random
import time

def task_func(data, min_delay, max_delay):
    """
    After a random delay, generate a Django HttpResponse with JSON data to simulate the latency of the network.
    
    Parameters:
    data (str): The data to be included in the response body.
    min_delay (int): The minimum delay in seconds.
    max_delay (int): The maximum delay in seconds.
    
    Returns:
    HttpResponse: A Django HttpResponse with JSON data.
    
    Requirements:
    - django
    - random
    - time

    Example:
    >>> import json
    >>> random.seed(0)
    >>> response = task_func(json.dumps({"Sample-Key": "Sample-Value"}), 1, 5)
    >>> response.status_code
    200
    >>> json.loads(response.content)
    {"Sample-Key": "Sample-Value"}
    """

instruct prompt

After a random delay, generate a Django HttpResponse with JSON data to simulate the latency of the network.
The function should output with:
    HttpResponse: A Django HttpResponse with JSON data.
You should write self-contained code starting with:

Code

from django.http import HttpResponse
from django.conf import settings
import random
import time
def task_func(data, min_delay, max_delay):

code prompt

Code

from django.http import HttpResponse
from django.conf import settings
import random
import time
def task_func(data, min_delay, max_delay):

entry point

task_func

libs

  • django
  • random
  • time

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import