benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 04a2c911-e2ba-5ff7-8180-87f1bb640398

Problem

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

complete prompt

import re
import os
import glob

def task_func(dir_path: str) -> list:
    """
    Rename all files in the specified directory by removing all special characters,
    punctuation marks, and spaces, using regular expressions. The function keeps
    alphanumeric characters and removes the rest.

    Requirements:
    - re
    - os
    - glob

    Parameters:
    dir_path (str): The path to the directory containing the files to be renamed.

    Returns:
    list[str]: A list containing the new names of all files after renaming.

    Example:
    >>> task_func('path/to/directory')
    ['file1', 'file2', 'file3']
    >>> task_func('another/directory/path')
    ['anotherFile1', 'anotherFile2']
    """

instruct prompt

Rename all files in the specified directory by removing all special characters, punctuation marks, and spaces, using regular expressions. The function keeps alphanumeric characters and removes the rest.
The function should output with:
    list[str]: A list containing the new names of all files after renaming.
You should write self-contained code starting with:

Code

import re
import os
import glob
def task_func(dir_path: str) -> list:

code prompt

Code

import re
import os
import glob
def task_func(dir_path: str) -> list:

entry point

task_func

libs

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