benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf f9c0cbdc-b555-5df0-90f1-e07d9f46a398

Problem

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

complete prompt

from flask import Flask
from flask_mail import Mail, Message

def task_func(smtp_server, smtp_port, smtp_user, smtp_password, template_folder):
    """
    Creates a Flask application configured to send emails using Flask-Mail.
    It sets up the necessary SMTP configuration dynamically based on provided parameters
    and defines a route to send a test email.

    Parameters:
        smtp_server (str): The SMTP server address.
        smtp_port (int): The SMTP server port.
        smtp_user (str): The SMTP username.
        smtp_password (str): The SMTP password.
        template_folder (str): The folder path for email templates.

    Requirements:
    - flask.Flask
    - flask_mail.Mail
    - flask_mail.Message

    Returns:
        Flask: A Flask application instance configured for sending emails.

    Examples:
    >>> app = task_func('smtp.example.com', 587, 'user@example.com', 'password', 'templates')
    >>> type(app).__name__
    'Flask'
    >>> app.config['MAIL_USERNAME'] == 'user@example.com'
    True
    """

instruct prompt

Creates a Flask application configured to send emails using Flask-Mail. It sets up the necessary SMTP configuration dynamically based on provided parameters and defines a route to send a test email.
The function should output with:
    Flask: A Flask application instance configured for sending emails.
You should write self-contained code starting with:

Code

from flask import Flask
from flask_mail import Mail, Message
def task_func(smtp_server, smtp_port, smtp_user, smtp_password, template_folder):

code prompt

Code

from flask import Flask
from flask_mail import Mail, Message
def task_func(smtp_server, smtp_port, smtp_user, smtp_password, template_folder):

entry point

task_func

libs

  • flask_mail
  • flask

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