benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 5e9c01fe-6a81-54b9-a987-7aea2c6a2a4a

Problem

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

complete prompt

import requests
import logging

def task_func(repo_url: str) -> dict:
    """
    Fetches and returns information about a GitHub repository using its API URL. The function makes an HTTP GET
    request to the provided repository URL. It incorporates error handling for various scenarios including API
    rate limits, other HTTP errors, and general request issues. The function also checks for a large number of
    open issues in the repository and prints a warning if they exceed a certain threshold.

    Parameters:
    - repo_url (str): The URL of the GitHub repository API.

    Returns:
    - dict: A dictionary containing information about the GitHub repository.

    Raises:
    - requests.exceptions.HTTPError: If an HTTP error occurs, particularly when the GitHub API rate limit is
            exceeded.
    - requests.exceptions.RequestException: For other general issues encountered during the API request, such
            as network problems, invalid responses, or timeouts.

    Requirements:
    - requests
    - logging

    Example:
    >>> task_func('https://api.github.com/repos/psf/requests')
    { ... }  # dictionary containing repo information
    >>> task_func('https://api.github.com/repos/some/repo')
    { ... }  # dictionary containing repo information with a possible runtime warning about open issues
    """

instruct prompt

Fetches and returns information about a GitHub repository using its API URL. The function makes an HTTP GET request to the provided repository URL. It incorporates error handling for various scenarios including API rate limits, other HTTP errors, and general request issues. The function also checks for a large number of open issues in the repository and prints a warning if they exceed a certain threshold.
The function should raise the exception for: requests.exceptions.HTTPError: If an HTTP error occurs, particularly when the GitHub API rate limit is exceeded. requests.exceptions.RequestException: For other general issues encountered during the API request, such as network problems, invalid responses, or timeouts.
The function should output with:
    dict: A dictionary containing information about the GitHub repository.
You should write self-contained code starting with:

Code

import requests
import logging
def task_func(repo_url: str) -> dict:

code prompt

Code

import requests
import logging
def task_func(repo_url: str) -> dict:

entry point

task_func

libs

  • logging
  • requests

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