Closed
Description
BigCodeBench version
v0_1_0_hf
Output of running ls ~/.cache/bigcodebench
4d5763508127102b6e158f7e678eafb2.pkl 76104768c76d90a5016e14486517977c.pkl 7eec4137569dc2cd75b89bed448ef8d3.pkl bd357671b112b365ba5b068649b30cae.pkl BigCodeBench-v0.1.0_hf.jsonl f5bee38760ab29aa6a54147e668e839f.pkl
Task ID of the programming task
BigCodeBench/16
The original complete prompt
import os
import glob
import subprocess
def task_func(directory, backup_dir='/path/to/backup'):
"""
Backup all '.log' files in a specified directory to a tar.gz file and delete the original files after backup.
The backup file is named 'logs_backup.tar.gz' and placed in the specified backup directory.
Parameters:
- directory (str): The directory that contains the log files to be backed up.
- backup_dir (str, optional): The directory where the backup file will be saved.
Default is '/path/to/backup'.
Returns:
- str: The path to the backup file if logs are found, otherwise returns a message 'No logs found to backup'.
Raises:
- FileNotFoundError: If the specified directory does not exist.
Requirements:
- subprocess
- glob
- os
Example:
>>> task_func('/path/to/logs')
'/path/to/backup/logs_backup.tar.gz'
>>> task_func('/path/to/logs', '/alternative/backup/dir')
'/alternative/backup/dir/logs_backup.tar.gz'
"""
Your proposed new complete prompt
import os
import glob
import subprocess
def task_func(directory, backup_dir='/path/to/backup'):
"""
Backup all '.log' files in a specified directory to a tar.gz file and delete the original files after backup.
The backup file is named 'logs_backup.tar.gz' and placed in the specified backup directory.
Parameters:
- directory (str): The directory that contains the log files to be backed up.
- backup_dir (str, optional): The directory where the backup file will be saved.
Default is '/path/to/backup'.
Returns:
- str: The path to the backup file if logs are found, otherwise returns a message 'No logs found to backup.'.
Raises:
- FileNotFoundError: If the specified directory does not exist.
Requirements:
- subprocess
- glob
- os
Example:
>>> task_func('/path/to/logs')
'/path/to/backup/logs_backup.tar.gz'
>>> task_func('/path/to/logs', '/alternative/backup/dir')
'/alternative/backup/dir/logs_backup.tar.gz'
"""
Other context
Alternatively (preferred) fix the tests and ground truth so that the period isn't required for "No logs found to backup.
"