benchmarks.wiki / Public workspace
BigCodeBench / BigCodeBench v0.1.0_hf 4d8769a1-03d1-5209-afdc-181dfc307054
Problem
Answer published by the source. Consult the official source to check your work against its answer.
complete prompt
import configparser
import os
import shutil
def task_func(config_file_path, archieve_dir ='/home/user/archive'):
"""
Archive a specified project directory into a ZIP file based on the configuration specified in a config file.
This function reads a configuration file to determine the project directory and archives this directory into a ZIP file.
The ZIP file's name will be the project directory's basename, stored in the specified archive directory.
Configuration File Format:
[Project]
directory=path_to_project_directory
Parameters:
- config_file_path (str): Path to the configuration file. The file must exist and be readable.
- archive_dir (str, optional): Path to the directory where the ZIP archive will be stored. Defaults to '/home/user/archive'.
Returns:
- bool: True if the ZIP archive is successfully created, otherwise an exception is raised.
Requirements:
- configparse
- os
- shutil
Raises:
- FileNotFoundError: If the `config_file_path` does not exist or the specified project directory does not exist.
- Exception: If the ZIP archive cannot be created.
Example:
>>> task_func("/path/to/config.ini")
True
"""
instruct prompt
Archive a specified project directory into a ZIP file based on the configuration specified in a config file. This function reads a configuration file to determine the project directory and archives this directory into a ZIP file. The ZIP file's name will be the project directory's basename, stored in the specified archive directory. Configuration File Format: [Project] directory=path_to_project_directory
The function should raise the exception for: FileNotFoundError: If the `config_file_path` does not exist or the specified project directory does not exist. Exception: If the ZIP archive cannot be created.
The function should output with:
bool: True if the ZIP archive is successfully created, otherwise an exception is raised.
You should write self-contained code starting with:
Code
import configparser
import os
import shutil
def task_func(config_file_path, archieve_dir ='/home/user/archive'):
code prompt
Code
import configparser
import os
import shutil
def task_func(config_file_path, archieve_dir ='/home/user/archive'):
entry point
task_func
libs
- configparser
- shutil
- os
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
initial import