benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 1b1bb5f3-2cd3-5c4f-9487-9fa378ee1dee

Problem

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

complete prompt

import os
import logging

def task_func(directory):
    """
    Removes all jQuery files (JavaScript files containing 'jquery' in their name) from a specified directory.

    Parameters:
    directory (str): The directory path.

    Returns:
    tuple: A tuple containing two elements:
        - int: The number of files removed.
        - list: The names of the removed files.

    Raises:
    - If the specified directory does not exist the code would raise FileNotFoundError.
    
    Note:
    - Removed files are logged in 'jquery_removal.log' file.

    Requirements:
    - os
    - logging


    Example:
    >>> task_func("/path/to/directory")
    (3, ['jquery-1.js', 'jquery-2.js', 'jquery-ui.js'])  # Assuming 3 jQuery files were removed
    """

instruct prompt

Removes all jQuery files (JavaScript files containing 'jquery' in their name) from a specified directory.
Note that: Removed files are logged in 'jquery_removal.log' file.
The function should raise the exception for: If the specified directory does not exist the code would raise FileNotFoundError.
The function should output with:
    tuple: A tuple containing two elements:
    int: The number of files removed.
    list: The names of the removed files.
You should write self-contained code starting with:

Code

import os
import logging
def task_func(directory):

code prompt

Code

import os
import logging
def task_func(directory):

entry point

task_func

libs

  • logging
  • 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