benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 32abc6a3-f296-5eb0-888a-a3f55e54dec0

Problem

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

complete prompt

import re
import os
import shutil

def task_func(source_dir, target_dir, file_pattern=r'\b[A-Za-z0-9]+\.(txt|doc|docx)\b'):
    """
    Look for files that match the pattern of the regular expression '(? <! Distillr)\\\\ AcroTray\\.exe' in the directory 'C:\\ SomeDir\\'. If found, write these file paths to a configuration file.

    Parameters:
    - source_dir (str): The path to the source directory.
    - target_dir (str): The path to the target directory.
    - file_pattern (str, optional): The regular expression pattern that filenames must match in order
                                   to be moved. Default is r'\b[A-Za-z0-9]+\.(txt|doc|docx)\b',
                                   which matches filenames that consist of alphanumeric characters
                                   and have extensions txt, doc, or docx.

    Returns:
    - str: Path to the created configuration file.

    Requirements:
    - re
    - os
    - shtuil

    Example:
    >>> task_func('/path/to/source', '/path/to/target')
    3
    """

instruct prompt

Look for files that match the pattern of the regular expression '(? <! Distillr)\\\\ AcroTray\\.exe' in the directory 'C:\\ SomeDir\\'. If found, write these file paths to a configuration file.
The function should output with:
    str: Path to the created configuration file.
You should write self-contained code starting with:

Code

import re
import os
import shutil
def task_func(source_dir, target_dir, file_pattern=r'\b[A-Za-z0-9]+\.(txt|doc|docx)\b'):

code prompt

Code

import re
import os
import shutil
def task_func(source_dir, target_dir, file_pattern=r'\b[A-Za-z0-9]+\.(txt|doc|docx)\b'):

entry point

task_func

libs

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