benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 86392cfc-ffb3-5ade-9497-c8976eb4da8e

Problem

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

complete prompt

import sys
import sqlite3

# Constants
PATH_TO_APPEND = "path/to/whatever"
DATABASE = "path/to/database.db"


def task_func(path_to_append=PATH_TO_APPEND, database=DATABASE):
    """
    This function appends a given path to sys.path and updates an SQLite database with the path, 
    creating the table if needed and avoiding duplicates.

    Parameters:
    - path_to_append (str): A file system path to be appended to sys.path and inserted
      into the SQLite database. Defaults to 'path/to/whatever' if not specified.
    - database (str): The file system path to the SQLite database file. Defaults to
      'path/to/database.db' if not provided. The function interacts with this database
      to store the path.

    Returns:
    - str: The path that was appended to sys.path and inserted into the database.

    Requirements:
    - sys
    - sqlite3


    Examples:
    >>> task_func('path/to/new_directory', 'path/to/new_database.db')
    'path/to/new_directory'
    >>> task_func()
    'path/to/whatever'
    """

instruct prompt

This function appends a given path to sys.path and updates an SQLite database with the path, creating the table if needed and avoiding duplicates.
The function should output with:
    str: The path that was appended to sys.path and inserted into the database.
You should write self-contained code starting with:

Code

import sys
import sqlite3
# Constants
PATH_TO_APPEND = "path/to/whatever"
DATABASE = "path/to/database.db"
def task_func(path_to_append=PATH_TO_APPEND, database=DATABASE):

code prompt

Code

import sys
import sqlite3
# Constants
PATH_TO_APPEND = "path/to/whatever"
DATABASE = "path/to/database.db"
def task_func(path_to_append=PATH_TO_APPEND, database=DATABASE):

entry point

task_func

libs

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