benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf ffc64f00-4f78-581f-b0d0-d8142ea5611e

Problem

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

complete prompt

import requests
import os
import json
import time

# Redefining the function in the current context

HEADERS = {
    'accept': 'text/json',
    'Content-Type': 'application/json'
}

def task_func(url, directory, metadata):
    """
    Upload all files from a specific directory to the specified server URL, along with the associated metadata. 
    In addition, the speed limit function pauses for one second after each upload.

    Parameters:
    url (str): The server URL.
    directory (str): The directory containing the files to be uploaded.
    metadata (dict): The metadata to be associated with the files.

    Returns:
    list: A list of status codes for the upload responses.

    Requirements:
    - requests
    - os
    - json
    - time

    Raises:
    - The function will raise FileNotFoundError if the directory does not exist.
    - The function will raise TypeError if the url is invalid.

    Example:
    >>> task_func('https://www.example.com', './uploads', {'userId': 'abc'})
    """

instruct prompt

Upload all files from a specific directory to the specified server URL, along with the associated metadata. In addition, the speed limit function pauses for one second after each upload.
The function should raise the exception for: The function will raise FileNotFoundError if the directory does not exist. The function will raise TypeError if the url is invalid.
The function should output with:
    list: A list of status codes for the upload responses.
You should write self-contained code starting with:

Code

import requests
import os
import json
import time
# Redefining the function in the current context
HEADERS = {
    'accept': 'text/json',
    'Content-Type': 'application/json'
}
def task_func(url, directory, metadata):

code prompt

Code

import requests
import os
import json
import time
# Redefining the function in the current context
HEADERS = {
    'accept': 'text/json',
    'Content-Type': 'application/json'
}
def task_func(url, directory, metadata):

entry point

task_func

libs

  • time
  • json
  • requests
  • os

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