benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf f79d5048-ebd6-548f-aa36-dff8407de7e8

Problem

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

complete prompt

import sys
from configparser import ConfigParser

# Constants
PATH_TO_APPEND = '/path/to/whatever'
CONFIG_FILE = '/path/to/config.ini'

def task_func(path_to_append=PATH_TO_APPEND, config_file=CONFIG_FILE):
    """
    Add a specific path to sys.path and update a configuration file with this path.

    Parameters:
    - path_to_append (str): The path to append to sys.path. Default is '/path/to/whatever'.
    - config_file (str): The path to the config file to update. Default is '/path/to/config.ini'.

    Returns:
    - config (object): The object contains the updated configuration.
    - config_file (str): The path to the configuration file that was just modified.

    Requirements:
    - sys
    - configparser.ConfigParser

    Example:
    >>> config = task_func('/path/to/new_directory', '/path/to/new_config.ini')
    >>> 'path_to_append' in config['DEFAULT']
    True
    """

instruct prompt

Add a specific path to sys.path and update a configuration file with this path.
The function should output with:
    config (object): The object contains the updated configuration.
    config_file (str): The path to the configuration file that was just modified.
You should write self-contained code starting with:

Code

import sys
from configparser import ConfigParser
# Constants
PATH_TO_APPEND = '/path/to/whatever'
CONFIG_FILE = '/path/to/config.ini'
def task_func(path_to_append=PATH_TO_APPEND, config_file=CONFIG_FILE):

code prompt

Code

import sys
from configparser import ConfigParser
# Constants
PATH_TO_APPEND = '/path/to/whatever'
CONFIG_FILE = '/path/to/config.ini'
def task_func(path_to_append=PATH_TO_APPEND, config_file=CONFIG_FILE):

entry point

task_func

libs

  • configparser
  • sys

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