
from flask import render_template
from flask import request


def render_task(func):
    def rendered():
        params = dict(title=func.__module__.split('.')[-1] or '')
        if request.method == 'POST':
            input_data = request.form.get('input')
            params['input_data'] = input_data
            params['solution'] = func(input_data)
        return render_template('task.html', **params)

    return rendered


from flask import render_template
from flask import request


def render_task(func):
    """Decorator for task solving functions. Provides raw form data from the
    request and expects a string formatted return value."""

    def rendered():
        params = dict(title=func.__module__.split('.')[-1] or '')
        if request.method == 'POST':
            input_data = request.form.get('input')
            params['input'] = input_data
            params['solution'] = func(input_data)
        return render_template('task.html', **params)

    return rendered

Add docstring, fix template param name
Add docstring, fix template param name

  
  from flask import render_template
  from flask import request
  
  
  def render_task(func):
+     """Decorator for task solving functions. Provides raw form data from the
+     request and expects a string formatted return value."""
+ 
      def rendered():
          params = dict(title=func.__module__.split('.')[-1] or '')
          if request.method == 'POST':
              input_data = request.form.get('input')
-             params['input_data'] = input_data
+             params['input'] = input_data
              params['solution'] = func(input_data)
          return render_template('task.html', **params)
  
      return rendered
  
Add docstring, fix template param name
## Code Before:

from flask import render_template
from flask import request


def render_task(func):
    def rendered():
        params = dict(title=func.__module__.split('.')[-1] or '')
        if request.method == 'POST':
            input_data = request.form.get('input')
            params['input_data'] = input_data
            params['solution'] = func(input_data)
        return render_template('task.html', **params)

    return rendered

## Instruction:
Add docstring, fix template param name
## Code After:

from flask import render_template
from flask import request


def render_task(func):
    """Decorator for task solving functions. Provides raw form data from the
    request and expects a string formatted return value."""

    def rendered():
        params = dict(title=func.__module__.split('.')[-1] or '')
        if request.method == 'POST':
            input_data = request.form.get('input')
            params['input'] = input_data
            params['solution'] = func(input_data)
        return render_template('task.html', **params)

    return rendered
