prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  No way to define options that have no defaults
  Currently if you set a value in `cookiecutter.json` to `null` it becomes `None` and is then turned into the _string_ `'None'`.
  
  
  </issue>
  <code>
  [start of cookiecutter/prompt.py]
  1 #!/usr/bin/env python
  2 # -*- coding: utf-8 -*-
  3 
  4 """
  5 cookiecutter.prompt
  6 ---------------------
  7 
  8 Functions for prompting the user for project info.
  9 """
  10 
  11 from collections import OrderedDict
  12 
  13 import click
  14 from past.builtins import basestring
  15 
  16 from future.utils import iteritems
  17 from jinja2.environment import Environment
  18 
  19 
  20 def read_user_variable(var_name, default_value):
  21     """Prompt the user for the given variable and return the entered value
  22     or the given default.
  23 
  24     :param str var_name: Variable of the context to query the user
  25     :param default_value: Value that will be returned if no input happens
  26     """
  27     # Please see http://click.pocoo.org/4/api/#click.prompt
  28     return click.prompt(var_name, default=default_value)
  29 
  30 
  31 def read_user_yes_no(question, default_value):
  32     """Prompt the user to reply with 'yes' or 'no' (or equivalent values).
  33 
  34     Note:
  35       Possible choices are 'true', '1', 'yes', 'y' or 'false', '0', 'no', 'n'
  36 
  37     :param str question: Question to the user
  38     :param default_value: Value that will be returned if no input happens
  39     """
  40     # Please see http://click.pocoo.org/4/api/#click.prompt
  41     return click.prompt(
  42         question,
  43         default=default_value,
  44         type=click.BOOL
  45     )
  46 
  47 
  48 def read_user_choice(var_name, options):
  49     """Prompt the user to choose from several options for the given variable.
  50 
  51     The first item will be returned if no input happens.
  52 
  53     :param str var_name: Variable as specified in the context
  54     :param list options: Sequence of options that are available to select from
  55     :return: Exactly one item of ``options`` that has been chosen by the user
  56     """
  57     # Please see http://click.pocoo.org/4/api/#click.prompt
  58     if not isinstance(options, list):
  59         raise TypeError
  60 
  61     if not options:
  62         raise ValueError
  63 
  64     choice_map = OrderedDict(
  65         (u'{}'.format(i), value) for i, value in enumerate(options, 1)
  66     )
  67     choices = choice_map.keys()
  68     default = u'1'
  69 
  70     choice_lines = [u'{} - {}'.format(*c) for c in choice_map.items()]
  71     prompt = u'\n'.join((
  72         u'Select {}:'.format(var_name),
  73         u'\n'.join(choice_lines),
  74         u'Choose from {}'.format(u', '.join(choices))
  75     ))
  76 
  77     user_choice = click.prompt(
  78         prompt, type=click.Choice(choices), default=default
  79     )
  80     return choice_map[user_choice]
  81 
  82 
  83 def render_variable(env, raw, cookiecutter_dict):
  84     if not isinstance(raw, basestring):
  85         raw = str(raw)
  86     template = env.from_string(raw)
  87     rendered_template = template.render(cookiecutter=cookiecutter_dict)
  88     return rendered_template
  89 
  90 
  91 def prompt_choice_for_config(cookiecutter_dict, env, key, options, no_input):
  92     """Prompt the user which option to choose from the given. Each of the
  93     possible choices is rendered beforehand.
  94     """
  95     rendered_options = [
  96         render_variable(env, raw, cookiecutter_dict) for raw in options
  97     ]
  98 
  99     if no_input:
  100         return rendered_options[0]
  101     return read_user_choice(key, rendered_options)
  102 
  103 
  104 def prompt_for_config(context, no_input=False):
  105     """
  106     Prompts the user to enter new config, using context as a source for the
  107     field names and sample values.
  108 
  109     :param no_input: Prompt the user at command line for manual configuration?
  110     """
  111     cookiecutter_dict = {}
  112     env = Environment()
  113 
  114     for key, raw in iteritems(context[u'cookiecutter']):
  115         if key.startswith(u'_'):
  116             cookiecutter_dict[key] = raw
  117             continue
  118 
  119         if isinstance(raw, list):
  120             # We are dealing with a choice variable
  121             val = prompt_choice_for_config(
  122                 cookiecutter_dict, env, key, raw, no_input
  123             )
  124         else:
  125             # We are dealing with a regular variable
  126             val = render_variable(env, raw, cookiecutter_dict)
  127 
  128             if not no_input:
  129                 val = read_user_variable(key, val)
  130 
  131         cookiecutter_dict[key] = val
  132     return cookiecutter_dict
  133
  [end of cookiecutter/prompt.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/cookiecutter/prompt.py b/cookiecutter/prompt.py
  --- a/cookiecutter/prompt.py
  +++ b/cookiecutter/prompt.py
  @@ -81,6 +81,8 @@
   
   
   def render_variable(env, raw, cookiecutter_dict):
  +    if raw is None:
  +        return None
       if not isinstance(raw, basestring):
           raw = str(raw)
       template = env.from_string(raw)
  
verification_info: {"golden_diff": "diff --git a/cookiecutter/prompt.py b/cookiecutter/prompt.py\n--- a/cookiecutter/prompt.py\n+++ b/cookiecutter/prompt.py\n@@ -81,6 +81,8 @@\n \n \n def render_variable(env, raw, cookiecutter_dict):\n+    if raw is None:\n+        return None\n     if not isinstance(raw, basestring):\n         raw = str(raw)\n     template = env.from_string(raw)\n", "issue": "No way to define options that have no defaults\nCurrently if you set a value in `cookiecutter.json` to `null` it becomes `None` and is then turned into the _string_ `'None'`.\n\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\ncookiecutter.prompt\n---------------------\n\nFunctions for prompting the user for project info.\n\"\"\"\n\nfrom collections import OrderedDict\n\nimport click\nfrom past.builtins import basestring\n\nfrom future.utils import iteritems\nfrom jinja2.environment import Environment\n\n\ndef read_user_variable(var_name, default_value):\n    \"\"\"Prompt the user for the given variable and return the entered value\n    or the given default.\n\n    :param str var_name: Variable of the context to query the user\n    :param default_value: Value that will be returned if no input happens\n    \"\"\"\n    # Please see http://click.pocoo.org/4/api/#click.prompt\n    return click.prompt(var_name, default=default_value)\n\n\ndef read_user_yes_no(question, default_value):\n    \"\"\"Prompt the user to reply with 'yes' or 'no' (or equivalent values).\n\n    Note:\n      Possible choices are 'true', '1', 'yes', 'y' or 'false', '0', 'no', 'n'\n\n    :param str question: Question to the user\n    :param default_value: Value that will be returned if no input happens\n    \"\"\"\n    # Please see http://click.pocoo.org/4/api/#click.prompt\n    return click.prompt(\n        question,\n        default=default_value,\n        type=click.BOOL\n    )\n\n\ndef read_user_choice(var_name, options):\n    \"\"\"Prompt the user to choose from several options for the given variable.\n\n    The first item will be returned if no input happens.\n\n    :param str var_name: Variable as specified in the context\n    :param list options: Sequence of options that are available to select from\n    :return: Exactly one item of ``options`` that has been chosen by the user\n    \"\"\"\n    # Please see http://click.pocoo.org/4/api/#click.prompt\n    if not isinstance(options, list):\n        raise TypeError\n\n    if not options:\n        raise ValueError\n\n    choice_map = OrderedDict(\n        (u'{}'.format(i), value) for i, value in enumerate(options, 1)\n    )\n    choices = choice_map.keys()\n    default = u'1'\n\n    choice_lines = [u'{} - {}'.format(*c) for c in choice_map.items()]\n    prompt = u'\\n'.join((\n        u'Select {}:'.format(var_name),\n        u'\\n'.join(choice_lines),\n        u'Choose from {}'.format(u', '.join(choices))\n    ))\n\n    user_choice = click.prompt(\n        prompt, type=click.Choice(choices), default=default\n    )\n    return choice_map[user_choice]\n\n\ndef render_variable(env, raw, cookiecutter_dict):\n    if not isinstance(raw, basestring):\n        raw = str(raw)\n    template = env.from_string(raw)\n    rendered_template = template.render(cookiecutter=cookiecutter_dict)\n    return rendered_template\n\n\ndef prompt_choice_for_config(cookiecutter_dict, env, key, options, no_input):\n    \"\"\"Prompt the user which option to choose from the given. Each of the\n    possible choices is rendered beforehand.\n    \"\"\"\n    rendered_options = [\n        render_variable(env, raw, cookiecutter_dict) for raw in options\n    ]\n\n    if no_input:\n        return rendered_options[0]\n    return read_user_choice(key, rendered_options)\n\n\ndef prompt_for_config(context, no_input=False):\n    \"\"\"\n    Prompts the user to enter new config, using context as a source for the\n    field names and sample values.\n\n    :param no_input: Prompt the user at command line for manual configuration?\n    \"\"\"\n    cookiecutter_dict = {}\n    env = Environment()\n\n    for key, raw in iteritems(context[u'cookiecutter']):\n        if key.startswith(u'_'):\n            cookiecutter_dict[key] = raw\n            continue\n\n        if isinstance(raw, list):\n            # We are dealing with a choice variable\n            val = prompt_choice_for_config(\n                cookiecutter_dict, env, key, raw, no_input\n            )\n        else:\n            # We are dealing with a regular variable\n            val = render_variable(env, raw, cookiecutter_dict)\n\n            if not no_input:\n                val = read_user_variable(key, val)\n\n        cookiecutter_dict[key] = val\n    return cookiecutter_dict\n", "path": "cookiecutter/prompt.py"}]}