benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf acb799d2-3c1d-5c38-8782-1b2287ca3f9d

Problem

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

complete prompt

import os
import shutil

# Constants
BACKUP_DIR = '/tmp/backup'

def get_unique_backup_dir():
    return "/fake/backup/path"

def task_func(directory):
    """
    Create a backup of a directory and clean the directory afterwards.
    
    Parameters:
    - directory (str): The directory path to be backed up and cleaned.
    
    Returns:
    tuple: A tuple containing:
        - str: The backup directory path.
        - list: A list of any errors encountered during the operation (empty list if no errors).
    
    Requirements:
    - os
    - shutil
    - time
    
    Example:
    >>> task_func('/tmp/my_data')
    ('/tmp/backup/backup_20230827010101', [])
    
    Note: The function will return the backup directory path and a list of errors (if any).
    """

instruct prompt

Create a backup of a directory and clean the directory afterwards.
Note that: The function will return the backup directory path and a list of errors (if any).
The function should output with:
    tuple: A tuple containing:
    str: The backup directory path.
    list: A list of any errors encountered during the operation (empty list if no errors).
You should write self-contained code starting with:

Code

import os
import shutil
# Constants
BACKUP_DIR = '/tmp/backup'
def get_unique_backup_dir():
    return "/fake/backup/path"
def task_func(directory):

code prompt

Code

import os
import shutil
# Constants
BACKUP_DIR = '/tmp/backup'
def get_unique_backup_dir():
    return "/fake/backup/path"
def task_func(directory):

entry point

task_func

libs

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