benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf a0a1526c-2510-5cab-bbfa-b8a25f4dc9f1

Problem

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

complete prompt

import subprocess
import shutil
import os

def task_func(script_path: str, temp_dir: str) -> str:
    """
    Execute a given Python code in a temporary directory.
    
    Parameters:
    - script_path (str): The path to the Python code that needs to be executed.
    - temp_dir (str): The path for the code to copy the Python code
    
    Returns:
    - str: String indicating the success or failure of the script execution.
    
    Requirements:
    - subprocess
    - shutil
    - os
    
    Example:
    >>> task_func('/path/to/example_script.py')
    'Script executed successfully!'
    
    Note: 
    - If the Python code can be run successfully return "Script executed successfully!", otherwise "Script execution failed!"
    """

instruct prompt

Execute a given Python code in a temporary directory.
Note that: If the Python code can be run successfully return "Script executed successfully!", otherwise "Script execution failed!"
The function should output with:
    str: String indicating the success or failure of the script execution.
You should write self-contained code starting with:

Code

import subprocess
import shutil
import os
def task_func(script_path: str, temp_dir: str) -> str:

code prompt

Code

import subprocess
import shutil
import os
def task_func(script_path: str, temp_dir: str) -> str:

entry point

task_func

libs

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