benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 189c217a-1a49-5acc-a765-5658bc0f56c8

Problem

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

complete prompt

import pickle
import os

# Constants
FILE_NAME = 'save.pkl'

def task_func(dt):
    """
    Save the date time object "dt" in the pickle file "save.pkl" and then read it back for validation.

    Parameters:
    - dt (datetime): The datetime object to be saved.

    Returns:
    - loaded_dt (datetime): The loaded datetime object from 'save.pkl'.

    Requirements:
    - pickle
    - os

    Example:
    >>> dt = datetime.now(pytz.UTC)
    >>> loaded_dt = task_func(dt)
    >>> assert dt == loaded_dt
    """

instruct prompt

Save the date time object "dt" in the pickle file "save.pkl" and then read it back for validation.
The function should output with:
    loaded_dt (datetime): The loaded datetime object from 'save.pkl'.
You should write self-contained code starting with:

Code

import pickle
import os
# Constants
FILE_NAME = 'save.pkl'
def task_func(dt):

code prompt

Code

import pickle
import os
# Constants
FILE_NAME = 'save.pkl'
def task_func(dt):

entry point

task_func

libs

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