benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 6d322a02-62e7-5979-9c88-d0a4da43cce4

Problem

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

complete prompt

import re
from pathlib import Path
import tarfile

# Constants
PATTERN = r"(?<!Distillr)\\\\AcroTray\.exe"
DIRECTORY = r"C:\\SomeDir\\"

def task_func(directory=DIRECTORY, file_pattern=PATTERN):
    """
    Look for files that match the pattern of the regular expression '(? <! Distillr)\\\\ AcroTray\\.exe' in the directory 'C:\\ SomeDir\\'. If found, archive these files in a tar file.

    Parameters:
    - directory: The directory to search for files matching a specified pattern. The function will iterate over all files within this directory, including subdirectories.
    - file_pattern: A regular expression pattern used to match filenames. Files whose names match this pattern will be added to an archive (tar file).

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

    Requirements:
    - re
    - pathlib
    - tarfile

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

instruct prompt

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

Code

import re
from pathlib import Path
import tarfile
# Constants
PATTERN = r"(?<!Distillr)\\\\AcroTray\.exe"
DIRECTORY = r"C:\\SomeDir\\"
def task_func(directory=DIRECTORY, file_pattern=PATTERN):

code prompt

Code

import re
from pathlib import Path
import tarfile
# Constants
PATTERN = r"(?<!Distillr)\\\\AcroTray\.exe"
DIRECTORY = r"C:\\SomeDir\\"
def task_func(directory=DIRECTORY, file_pattern=PATTERN):

entry point

task_func

libs

  • tarfile
  • pathlib
  • re

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