prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Change "Contents" to "Table of Contents" ? (Or delete it?)
  Currently PEPs have a "mysterious" triangle pointing to the word "Contents". I don't know why, but somehow every time I see this I do a double take before I realize "oh, that's the ToC". Maybe spell "Table of Contents" in full? There should be plenty of horizontal space for that. (Not in the side bar though -- there mightn't be room for it, and there it's always expanded which provides enough context for the single word to be understood.)
  
  Alternatively, why have this in the main body of the PEP at all when it's already in the sidebar?
  
  (If there was a "nit" label I'd check it. :-)
  
  </issue>
  <code>
  [start of pep_sphinx_extensions/pep_processor/html/pep_html_translator.py]
  1 from __future__ import annotations
  2 
  3 from typing import TYPE_CHECKING
  4 
  5 from docutils import nodes
  6 import sphinx.writers.html5 as html5
  7 
  8 if TYPE_CHECKING:
  9     from sphinx.builders import html
  10 
  11 
  12 class PEPTranslator(html5.HTML5Translator):
  13     """Custom RST -> HTML translation rules for PEPs."""
  14 
  15     def __init__(self, document: nodes.document, builder: html.StandaloneHTMLBuilder):
  16         super().__init__(document, builder)
  17         self.compact_simple: bool = False
  18 
  19     @staticmethod
  20     def should_be_compact_paragraph(node: nodes.paragraph) -> bool:
  21         """Check if paragraph should be compact.
  22 
  23         Omitting <p/> tags around paragraph nodes gives visually compact lists.
  24 
  25         """
  26         # Never compact paragraphs that are children of document or compound.
  27         if isinstance(node.parent, (nodes.document, nodes.compound)):
  28             return False
  29 
  30         # Check for custom attributes in paragraph.
  31         for key, value in node.non_default_attributes().items():
  32             # if key equals "classes", carry on
  33             # if value is empty, or contains only "first", only "last", or both
  34             # "first" and "last", carry on
  35             # else return False
  36             if any((key != "classes", not set(value) <= {"first", "last"})):
  37                 return False
  38 
  39         # Only first paragraph can be compact (ignoring initial label & invisible nodes)
  40         first = isinstance(node.parent[0], nodes.label)
  41         visible_siblings = [child for child in node.parent.children[first:] if not isinstance(child, nodes.Invisible)]
  42         if visible_siblings[0] is not node:
  43             return False
  44 
  45         # otherwise, the paragraph should be compact
  46         return True
  47 
  48     def visit_paragraph(self, node: nodes.paragraph) -> None:
  49         """Remove <p> tags if possible."""
  50         if self.should_be_compact_paragraph(node):
  51             self.context.append("")
  52         else:
  53             self.body.append(self.starttag(node, "p", ""))
  54             self.context.append("</p>\n")
  55 
  56     def depart_paragraph(self, _: nodes.paragraph) -> None:
  57         """Add corresponding end tag from `visit_paragraph`."""
  58         self.body.append(self.context.pop())
  59 
  60     def visit_footnote_reference(self, node):
  61         self.body.append(self.starttag(node, "a", suffix="[",
  62             CLASS=f"footnote-reference {self.settings.footnote_references}",
  63             href=f"#{node['refid']}"
  64         ))
  65 
  66     def depart_footnote_reference(self, node):
  67         self.body.append(']</a>')
  68 
  69     def visit_label(self, node):
  70         # pass parent node to get id into starttag:
  71         self.body.append(self.starttag(node.parent, "dt", suffix="[", CLASS="label"))
  72 
  73         # footnote/citation backrefs:
  74         back_refs = node.parent["backrefs"]
  75         if self.settings.footnote_backlinks and len(back_refs) == 1:
  76             self.body.append(f'<a href="#{back_refs[0]}">')
  77             self.context.append(f"</a>]")
  78         else:
  79             self.context.append("]")
  80 
  81     def depart_label(self, node) -> None:
  82         """PEP link/citation block cleanup with italicised backlinks."""
  83         self.body.append(self.context.pop())
  84         back_refs = node.parent["backrefs"]
  85         if self.settings.footnote_backlinks and len(back_refs) > 1:
  86             back_links = ", ".join(f"<a href='#{ref}'>{i}</a>" for i, ref in enumerate(back_refs, start=1))
  87             self.body.append(f"<em> ({back_links}) </em>")
  88 
  89         # Close the def tags
  90         self.body.append("</dt>\n<dd>")
  91 
  92     def visit_bullet_list(self, node):
  93         if isinstance(node.parent, nodes.section) and "contents" in node.parent["names"]:
  94             self.body.append("<details><summary>Contents</summary>")
  95             self.context.append("</details>")
  96         super().visit_bullet_list(node)
  97 
  98     def depart_bullet_list(self, node):
  99         super().depart_bullet_list(node)
  100         if isinstance(node.parent, nodes.section) and "contents" in node.parent["names"]:
  101             self.body.append(self.context.pop())
  102 
  103     def unknown_visit(self, node: nodes.Node) -> None:
  104         """No processing for unknown node types."""
  105         pass
  106
  [end of pep_sphinx_extensions/pep_processor/html/pep_html_translator.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/pep_sphinx_extensions/pep_processor/html/pep_html_translator.py b/pep_sphinx_extensions/pep_processor/html/pep_html_translator.py
  --- a/pep_sphinx_extensions/pep_processor/html/pep_html_translator.py
  +++ b/pep_sphinx_extensions/pep_processor/html/pep_html_translator.py
  @@ -91,7 +91,7 @@
   
       def visit_bullet_list(self, node):
           if isinstance(node.parent, nodes.section) and "contents" in node.parent["names"]:
  -            self.body.append("<details><summary>Contents</summary>")
  +            self.body.append("<details><summary>Table of Contents</summary>")
               self.context.append("</details>")
           super().visit_bullet_list(node)
  
verification_info: {"golden_diff": "diff --git a/pep_sphinx_extensions/pep_processor/html/pep_html_translator.py b/pep_sphinx_extensions/pep_processor/html/pep_html_translator.py\n--- a/pep_sphinx_extensions/pep_processor/html/pep_html_translator.py\n+++ b/pep_sphinx_extensions/pep_processor/html/pep_html_translator.py\n@@ -91,7 +91,7 @@\n \n     def visit_bullet_list(self, node):\n         if isinstance(node.parent, nodes.section) and \"contents\" in node.parent[\"names\"]:\n-            self.body.append(\"<details><summary>Contents</summary>\")\n+            self.body.append(\"<details><summary>Table of Contents</summary>\")\n             self.context.append(\"</details>\")\n         super().visit_bullet_list(node)\n", "issue": "Change \"Contents\" to \"Table of Contents\" ? (Or delete it?)\nCurrently PEPs have a \"mysterious\" triangle pointing to the word \"Contents\". I don't know why, but somehow every time I see this I do a double take before I realize \"oh, that's the ToC\". Maybe spell \"Table of Contents\" in full? There should be plenty of horizontal space for that. (Not in the side bar though -- there mightn't be room for it, and there it's always expanded which provides enough context for the single word to be understood.)\r\n\r\nAlternatively, why have this in the main body of the PEP at all when it's already in the sidebar?\r\n\r\n(If there was a \"nit\" label I'd check it. :-)\n", "before_files": [{"content": "from __future__ import annotations\n\nfrom typing import TYPE_CHECKING\n\nfrom docutils import nodes\nimport sphinx.writers.html5 as html5\n\nif TYPE_CHECKING:\n    from sphinx.builders import html\n\n\nclass PEPTranslator(html5.HTML5Translator):\n    \"\"\"Custom RST -> HTML translation rules for PEPs.\"\"\"\n\n    def __init__(self, document: nodes.document, builder: html.StandaloneHTMLBuilder):\n        super().__init__(document, builder)\n        self.compact_simple: bool = False\n\n    @staticmethod\n    def should_be_compact_paragraph(node: nodes.paragraph) -> bool:\n        \"\"\"Check if paragraph should be compact.\n\n        Omitting <p/> tags around paragraph nodes gives visually compact lists.\n\n        \"\"\"\n        # Never compact paragraphs that are children of document or compound.\n        if isinstance(node.parent, (nodes.document, nodes.compound)):\n            return False\n\n        # Check for custom attributes in paragraph.\n        for key, value in node.non_default_attributes().items():\n            # if key equals \"classes\", carry on\n            # if value is empty, or contains only \"first\", only \"last\", or both\n            # \"first\" and \"last\", carry on\n            # else return False\n            if any((key != \"classes\", not set(value) <= {\"first\", \"last\"})):\n                return False\n\n        # Only first paragraph can be compact (ignoring initial label & invisible nodes)\n        first = isinstance(node.parent[0], nodes.label)\n        visible_siblings = [child for child in node.parent.children[first:] if not isinstance(child, nodes.Invisible)]\n        if visible_siblings[0] is not node:\n            return False\n\n        # otherwise, the paragraph should be compact\n        return True\n\n    def visit_paragraph(self, node: nodes.paragraph) -> None:\n        \"\"\"Remove <p> tags if possible.\"\"\"\n        if self.should_be_compact_paragraph(node):\n            self.context.append(\"\")\n        else:\n            self.body.append(self.starttag(node, \"p\", \"\"))\n            self.context.append(\"</p>\\n\")\n\n    def depart_paragraph(self, _: nodes.paragraph) -> None:\n        \"\"\"Add corresponding end tag from `visit_paragraph`.\"\"\"\n        self.body.append(self.context.pop())\n\n    def visit_footnote_reference(self, node):\n        self.body.append(self.starttag(node, \"a\", suffix=\"[\",\n            CLASS=f\"footnote-reference {self.settings.footnote_references}\",\n            href=f\"#{node['refid']}\"\n        ))\n\n    def depart_footnote_reference(self, node):\n        self.body.append(']</a>')\n\n    def visit_label(self, node):\n        # pass parent node to get id into starttag:\n        self.body.append(self.starttag(node.parent, \"dt\", suffix=\"[\", CLASS=\"label\"))\n\n        # footnote/citation backrefs:\n        back_refs = node.parent[\"backrefs\"]\n        if self.settings.footnote_backlinks and len(back_refs) == 1:\n            self.body.append(f'<a href=\"#{back_refs[0]}\">')\n            self.context.append(f\"</a>]\")\n        else:\n            self.context.append(\"]\")\n\n    def depart_label(self, node) -> None:\n        \"\"\"PEP link/citation block cleanup with italicised backlinks.\"\"\"\n        self.body.append(self.context.pop())\n        back_refs = node.parent[\"backrefs\"]\n        if self.settings.footnote_backlinks and len(back_refs) > 1:\n            back_links = \", \".join(f\"<a href='#{ref}'>{i}</a>\" for i, ref in enumerate(back_refs, start=1))\n            self.body.append(f\"<em> ({back_links}) </em>\")\n\n        # Close the def tags\n        self.body.append(\"</dt>\\n<dd>\")\n\n    def visit_bullet_list(self, node):\n        if isinstance(node.parent, nodes.section) and \"contents\" in node.parent[\"names\"]:\n            self.body.append(\"<details><summary>Contents</summary>\")\n            self.context.append(\"</details>\")\n        super().visit_bullet_list(node)\n\n    def depart_bullet_list(self, node):\n        super().depart_bullet_list(node)\n        if isinstance(node.parent, nodes.section) and \"contents\" in node.parent[\"names\"]:\n            self.body.append(self.context.pop())\n\n    def unknown_visit(self, node: nodes.Node) -> None:\n        \"\"\"No processing for unknown node types.\"\"\"\n        pass\n", "path": "pep_sphinx_extensions/pep_processor/html/pep_html_translator.py"}]}