benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 1f678ae8-6856-526a-a25b-eb1ed9e2fec0

Problem

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

complete prompt

import binascii
import hashlib
import re
OUTPUT_DIR = './output'


def task_func(directory: str, pattern: str = r"(?<!Distillr)\\AcroTray\.exe") -> dict:
    """
    Searches for files within the specified directory matching a given regex pattern
    and computes a SHA256 hash of each file's content.

    Parameters:
    - directory (str): Directory to search for files.
    - pattern (str): Regex pattern that filenames must match. Default pattern matches 'AcroTray.exe'.

    Returns:
    - dict: A dictionary with file paths as keys and their SHA256 hashes as values.

    Requirements:
    - re
    - hashlib
    - binascii

    Example:
    >>> task_func(OUTPUT_DIR)
    {}
    """

instruct prompt

Searches for files within the specified directory matching a given regex pattern and computes a SHA256 hash of each file's content.
The function should output with:
    dict: A dictionary with file paths as keys and their SHA256 hashes as values.
You should write self-contained code starting with:

Code

import binascii
import hashlib
import re
OUTPUT_DIR = './output'
def task_func(directory: str, pattern: str = r"(?<!Distillr)\\AcroTray\.exe") -> dict:

code prompt

Code

import binascii
import hashlib
import re
OUTPUT_DIR = './output'
def task_func(directory: str, pattern: str = r"(?<!Distillr)\\AcroTray\.exe") -> dict:

entry point

task_func

libs

  • hashlib
  • re
  • binascii

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