benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 400cfe78-f988-53d2-89b2-a819d966412c

Problem

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

complete prompt

import os
import re

def task_func(directory):
    """
    Finds all files in the specified directory whose names contain any type of 
    bracket (round, curly, or square).

    Uses an internal constant BRACKET_PATTERN = '[(){}\\[\\]]', which specifies
    the brackets that are looked for.

    
    Parameters:
    directory (str): The directory path to search in.
    
    Returns:
    list[str]: A list of file paths that contain brackets in their names.
    
    Requirements:
    - re
    - os
    
    Example:
    >>> task_func('./some_directory/')
    ['./some_directory/file(1).txt', './some_directory/folder/file[2].jpg']
    
    >>> task_func('./another_directory/')
    ['./another_directory/file{3}.png']
    """

instruct prompt

Finds all files in the specified directory whose names contain any type of bracket (round, curly, or square). Uses an internal constant BRACKET_PATTERN = '[(){}\\[\\]]', which specifies the brackets that are looked for. >>> task_func('./another_directory/') ['./another_directory/file{3}.png']
The function should output with:
    list[str]: A list of file paths that contain brackets in their names.
You should write self-contained code starting with:

Code

import os
import re
def task_func(directory):

code prompt

Code

import os
import re
def task_func(directory):

entry point

task_func

libs

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