benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 509c143f-7f20-5e98-9332-cf566960008d

Problem

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

complete prompt

import json
import urllib.request
import urllib.parse
import gzip

def task_func(url_str, file_path):
    """
    Fetches JSON data from a given URL, decodes the json-formatted data, and compresses it into a gzip file.

    Parameters:
        url_str (str): The URL string pointing to the JSON data.
        file_path (str): The path where the compressed gzip file should be saved.

    Returns:
        str: The path to the compressed gzip file containing the JSON data.

    Requirements:
    - json
    - urllib.request
    - urllib.parse
    - gzip

    Examples:
    >>> isinstance(task_func('http://example.com/data.json', '/path/to/file.json.gz'), str)
    True
    >>> task_func('http://example.com/data.json', '/path/to/file.json.gz').endswith('.gz')
    True
    """

instruct prompt

Fetches JSON data from a given URL, decodes the json-formatted data, and compresses it into a gzip file.
The function should output with:
    str: The path to the compressed gzip file containing the JSON data.
You should write self-contained code starting with:

Code

import json
import urllib.request
import urllib.parse
import gzip
def task_func(url_str, file_path):

code prompt

Code

import json
import urllib.request
import urllib.parse
import gzip
def task_func(url_str, file_path):

entry point

task_func

libs

  • urllib
  • gzip
  • json

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