prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Monospaced font for text/plain long_description
  Don't you think that would be nice to wrap project descriptions in text/plain with pre tag?
  Close if duplicate. I'm really sorry, looking through over 400 issues of production system is beyond of my capabilities.
  
  </issue>
  <code>
  [start of warehouse/utils/readme.py]
  1 # Licensed under the Apache License, Version 2.0 (the "License");
  2 # you may not use this file except in compliance with the License.
  3 # You may obtain a copy of the License at
  4 #
  5 # http://www.apache.org/licenses/LICENSE-2.0
  6 #
  7 # Unless required by applicable law or agreed to in writing, software
  8 # distributed under the License is distributed on an "AS IS" BASIS,
  9 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10 # See the License for the specific language governing permissions and
  11 # limitations under the License.
  12 
  13 """Utils for rendering and updating package descriptions (READMEs)."""
  14 
  15 import cgi
  16 
  17 import pkg_resources
  18 import readme_renderer.markdown
  19 import readme_renderer.rst
  20 import readme_renderer.txt
  21 
  22 _RENDERERS = {
  23     None: readme_renderer.rst,  # Default if description_content_type is None
  24     "": readme_renderer.rst,  # Default if description_content_type is None
  25     "text/plain": readme_renderer.txt,
  26     "text/x-rst": readme_renderer.rst,
  27     "text/markdown": readme_renderer.markdown,
  28 }
  29 
  30 
  31 def render(value, content_type=None, use_fallback=True):
  32     if value is None:
  33         return value
  34 
  35     content_type, parameters = cgi.parse_header(content_type or "")
  36 
  37     # Get the appropriate renderer
  38     renderer = _RENDERERS.get(content_type, readme_renderer.txt)
  39 
  40     # Actually render the given value, this will not only render the value, but
  41     # also ensure that it's had any disallowed markup removed.
  42     rendered = renderer.render(value, **parameters)
  43 
  44     # If the content was not rendered, we'll render as plaintext instead. The
  45     # reason it's necessary to do this instead of just accepting plaintext is
  46     # that readme_renderer will deal with sanitizing the content.
  47     # Skip the fallback option when validating that rendered output is ok.
  48     if use_fallback and rendered is None:
  49         rendered = readme_renderer.txt.render(value)
  50 
  51     return rendered
  52 
  53 
  54 def renderer_version():
  55     return pkg_resources.get_distribution("readme-renderer").version
  56
  [end of warehouse/utils/readme.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/warehouse/utils/readme.py b/warehouse/utils/readme.py
  --- a/warehouse/utils/readme.py
  +++ b/warehouse/utils/readme.py
  @@ -41,6 +41,10 @@
       # also ensure that it's had any disallowed markup removed.
       rendered = renderer.render(value, **parameters)
   
  +    # Wrap plaintext as preformatted to preserve whitespace.
  +    if content_type == "text/plain":
  +        rendered = f"<pre>{rendered}</pre>"
  +
       # If the content was not rendered, we'll render as plaintext instead. The
       # reason it's necessary to do this instead of just accepting plaintext is
       # that readme_renderer will deal with sanitizing the content.
  
verification_info: {"golden_diff": "diff --git a/warehouse/utils/readme.py b/warehouse/utils/readme.py\n--- a/warehouse/utils/readme.py\n+++ b/warehouse/utils/readme.py\n@@ -41,6 +41,10 @@\n     # also ensure that it's had any disallowed markup removed.\n     rendered = renderer.render(value, **parameters)\n \n+    # Wrap plaintext as preformatted to preserve whitespace.\n+    if content_type == \"text/plain\":\n+        rendered = f\"<pre>{rendered}</pre>\"\n+\n     # If the content was not rendered, we'll render as plaintext instead. The\n     # reason it's necessary to do this instead of just accepting plaintext is\n     # that readme_renderer will deal with sanitizing the content.\n", "issue": "Monospaced font for text/plain long_description\nDon't you think that would be nice to wrap project descriptions in text/plain with pre tag?\r\nClose if duplicate. I'm really sorry, looking through over 400 issues of production system is beyond of my capabilities.\n", "before_files": [{"content": "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"Utils for rendering and updating package descriptions (READMEs).\"\"\"\n\nimport cgi\n\nimport pkg_resources\nimport readme_renderer.markdown\nimport readme_renderer.rst\nimport readme_renderer.txt\n\n_RENDERERS = {\n    None: readme_renderer.rst,  # Default if description_content_type is None\n    \"\": readme_renderer.rst,  # Default if description_content_type is None\n    \"text/plain\": readme_renderer.txt,\n    \"text/x-rst\": readme_renderer.rst,\n    \"text/markdown\": readme_renderer.markdown,\n}\n\n\ndef render(value, content_type=None, use_fallback=True):\n    if value is None:\n        return value\n\n    content_type, parameters = cgi.parse_header(content_type or \"\")\n\n    # Get the appropriate renderer\n    renderer = _RENDERERS.get(content_type, readme_renderer.txt)\n\n    # Actually render the given value, this will not only render the value, but\n    # also ensure that it's had any disallowed markup removed.\n    rendered = renderer.render(value, **parameters)\n\n    # If the content was not rendered, we'll render as plaintext instead. The\n    # reason it's necessary to do this instead of just accepting plaintext is\n    # that readme_renderer will deal with sanitizing the content.\n    # Skip the fallback option when validating that rendered output is ok.\n    if use_fallback and rendered is None:\n        rendered = readme_renderer.txt.render(value)\n\n    return rendered\n\n\ndef renderer_version():\n    return pkg_resources.get_distribution(\"readme-renderer\").version\n", "path": "warehouse/utils/readme.py"}]}