benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 0725e0b5-29a0-5517-b70c-cfb7c6db156f

Problem

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

complete prompt

from flask import Flask, render_template, request
import json
import logging

logging.basicConfig(filename="out.log", level=logging.INFO)

def task_func(template_folder):
    """
    Creates a Flask application with a specified templates folder. It defines a route at the root ('/')
    which handles POST requests, logs the information request data as a JSON, and renders an 'index.html' template using
    the data provided in POST requests.

    Parameters:
    template_folder (str): The folder containing the Flask application's templates.

    Returns:
    flask.app.Flask: A Flask application instance configured with a root route that handles POST requests.
    The route logs incoming request data as JSON and serves the 'index.html' template with the provided data.

    Requirements:
    - flask.Flask
    - flask.render_template
    - flask.request
    - json
    - logging

    Example:
    >>> app = task_func('my_templates')
    >>> isinstance(app, Flask)
    True
    >>> 'POST' in app.url_map.bind('').match('/', method='POST')
    False
    """

instruct prompt

Creates a Flask application with a specified templates folder. It defines a route at the root ('/') which handles POST requests, logs the information request data as a JSON, and renders an 'index.html' template using the data provided in POST requests.
The function should output with:
    flask.app.Flask: A Flask application instance configured with a root route that handles POST requests.
    The route logs incoming request data as JSON and serves the 'index.html' template with the provided data.
You should write self-contained code starting with:

Code

from flask import Flask, render_template, request
import json
import logging
logging.basicConfig(filename="out.log", level=logging.INFO)
def task_func(template_folder):

code prompt

Code

from flask import Flask, render_template, request
import json
import logging
logging.basicConfig(filename="out.log", level=logging.INFO)
def task_func(template_folder):

entry point

task_func

libs

  • logging
  • flask
  • json

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