prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Bug: ` chars are not escaped when parsing !source
  ![Screenshot](https://arse.ee/zi7A9lec.png)
  
  When responding to faulty `!source` commands, the backticks aren't escaped and a formatting issue occurs.
  
  This _might_ lead to being able to ping roles/users, should Discord ever decide to change the embed ping behavior.
  
  </issue>
  <code>
  [start of bot/exts/info/source.py]
  1 import inspect
  2 from pathlib import Path
  3 from typing import Optional, Tuple, Union
  4 
  5 from discord import Embed
  6 from discord.ext import commands
  7 
  8 from bot.bot import Bot
  9 from bot.constants import URLs
  10 
  11 SourceType = Union[commands.HelpCommand, commands.Command, commands.Cog, str, commands.ExtensionNotLoaded]
  12 
  13 
  14 class SourceConverter(commands.Converter):
  15     """Convert an argument into a help command, tag, command, or cog."""
  16 
  17     async def convert(self, ctx: commands.Context, argument: str) -> SourceType:
  18         """Convert argument into source object."""
  19         if argument.lower().startswith("help"):
  20             return ctx.bot.help_command
  21 
  22         cog = ctx.bot.get_cog(argument)
  23         if cog:
  24             return cog
  25 
  26         cmd = ctx.bot.get_command(argument)
  27         if cmd:
  28             return cmd
  29 
  30         tags_cog = ctx.bot.get_cog("Tags")
  31         show_tag = True
  32 
  33         if not tags_cog:
  34             show_tag = False
  35         elif argument.lower() in tags_cog._cache:
  36             return argument.lower()
  37 
  38         raise commands.BadArgument(
  39             f"Unable to convert `{argument}` to valid command{', tag,' if show_tag else ''} or Cog."
  40         )
  41 
  42 
  43 class BotSource(commands.Cog):
  44     """Displays information about the bot's source code."""
  45 
  46     def __init__(self, bot: Bot):
  47         self.bot = bot
  48 
  49     @commands.command(name="source", aliases=("src",))
  50     async def source_command(self, ctx: commands.Context, *, source_item: SourceConverter = None) -> None:
  51         """Display information and a GitHub link to the source code of a command, tag, or cog."""
  52         if not source_item:
  53             embed = Embed(title="Bot's GitHub Repository")
  54             embed.add_field(name="Repository", value=f"[Go to GitHub]({URLs.github_bot_repo})")
  55             embed.set_thumbnail(url="https://avatars1.githubusercontent.com/u/9919")
  56             await ctx.send(embed=embed)
  57             return
  58 
  59         embed = await self.build_embed(source_item)
  60         await ctx.send(embed=embed)
  61 
  62     def get_source_link(self, source_item: SourceType) -> Tuple[str, str, Optional[int]]:
  63         """
  64         Build GitHub link of source item, return this link, file location and first line number.
  65 
  66         Raise BadArgument if `source_item` is a dynamically-created object (e.g. via internal eval).
  67         """
  68         if isinstance(source_item, commands.Command):
  69             src = source_item.callback.__code__
  70             filename = src.co_filename
  71         elif isinstance(source_item, str):
  72             tags_cog = self.bot.get_cog("Tags")
  73             filename = tags_cog._cache[source_item]["location"]
  74         else:
  75             src = type(source_item)
  76             try:
  77                 filename = inspect.getsourcefile(src)
  78             except TypeError:
  79                 raise commands.BadArgument("Cannot get source for a dynamically-created object.")
  80 
  81         if not isinstance(source_item, str):
  82             try:
  83                 lines, first_line_no = inspect.getsourcelines(src)
  84             except OSError:
  85                 raise commands.BadArgument("Cannot get source for a dynamically-created object.")
  86 
  87             lines_extension = f"#L{first_line_no}-L{first_line_no+len(lines)-1}"
  88         else:
  89             first_line_no = None
  90             lines_extension = ""
  91 
  92         # Handle tag file location differently than others to avoid errors in some cases
  93         if not first_line_no:
  94             file_location = Path(filename).relative_to("/bot/")
  95         else:
  96             file_location = Path(filename).relative_to(Path.cwd()).as_posix()
  97 
  98         url = f"{URLs.github_bot_repo}/blob/master/{file_location}{lines_extension}"
  99 
  100         return url, file_location, first_line_no or None
  101 
  102     async def build_embed(self, source_object: SourceType) -> Optional[Embed]:
  103         """Build embed based on source object."""
  104         url, location, first_line = self.get_source_link(source_object)
  105 
  106         if isinstance(source_object, commands.HelpCommand):
  107             title = "Help Command"
  108             description = source_object.__doc__.splitlines()[1]
  109         elif isinstance(source_object, commands.Command):
  110             description = source_object.short_doc
  111             title = f"Command: {source_object.qualified_name}"
  112         elif isinstance(source_object, str):
  113             title = f"Tag: {source_object}"
  114             description = ""
  115         else:
  116             title = f"Cog: {source_object.qualified_name}"
  117             description = source_object.description.splitlines()[0]
  118 
  119         embed = Embed(title=title, description=description)
  120         embed.add_field(name="Source Code", value=f"[Go to GitHub]({url})")
  121         line_text = f":{first_line}" if first_line else ""
  122         embed.set_footer(text=f"{location}{line_text}")
  123 
  124         return embed
  125 
  126 
  127 def setup(bot: Bot) -> None:
  128     """Load the BotSource cog."""
  129     bot.add_cog(BotSource(bot))
  130
  [end of bot/exts/info/source.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/bot/exts/info/source.py b/bot/exts/info/source.py
  --- a/bot/exts/info/source.py
  +++ b/bot/exts/info/source.py
  @@ -2,7 +2,7 @@
   from pathlib import Path
   from typing import Optional, Tuple, Union
   
  -from discord import Embed
  +from discord import Embed, utils
   from discord.ext import commands
   
   from bot.bot import Bot
  @@ -35,8 +35,10 @@
           elif argument.lower() in tags_cog._cache:
               return argument.lower()
   
  +        escaped_arg = utils.escape_markdown(argument)
  +
           raise commands.BadArgument(
  -            f"Unable to convert `{argument}` to valid command{', tag,' if show_tag else ''} or Cog."
  +            f"Unable to convert '{escaped_arg}' to valid command{', tag,' if show_tag else ''} or Cog."
           )
  
verification_info: {"golden_diff": "diff --git a/bot/exts/info/source.py b/bot/exts/info/source.py\n--- a/bot/exts/info/source.py\n+++ b/bot/exts/info/source.py\n@@ -2,7 +2,7 @@\n from pathlib import Path\n from typing import Optional, Tuple, Union\n \n-from discord import Embed\n+from discord import Embed, utils\n from discord.ext import commands\n \n from bot.bot import Bot\n@@ -35,8 +35,10 @@\n         elif argument.lower() in tags_cog._cache:\n             return argument.lower()\n \n+        escaped_arg = utils.escape_markdown(argument)\n+\n         raise commands.BadArgument(\n-            f\"Unable to convert `{argument}` to valid command{', tag,' if show_tag else ''} or Cog.\"\n+            f\"Unable to convert '{escaped_arg}' to valid command{', tag,' if show_tag else ''} or Cog.\"\n         )\n", "issue": "Bug: ` chars are not escaped when parsing !source\n![Screenshot](https://arse.ee/zi7A9lec.png)\r\n\r\nWhen responding to faulty `!source` commands, the backticks aren't escaped and a formatting issue occurs.\r\n\r\nThis _might_ lead to being able to ping roles/users, should Discord ever decide to change the embed ping behavior.\n", "before_files": [{"content": "import inspect\nfrom pathlib import Path\nfrom typing import Optional, Tuple, Union\n\nfrom discord import Embed\nfrom discord.ext import commands\n\nfrom bot.bot import Bot\nfrom bot.constants import URLs\n\nSourceType = Union[commands.HelpCommand, commands.Command, commands.Cog, str, commands.ExtensionNotLoaded]\n\n\nclass SourceConverter(commands.Converter):\n    \"\"\"Convert an argument into a help command, tag, command, or cog.\"\"\"\n\n    async def convert(self, ctx: commands.Context, argument: str) -> SourceType:\n        \"\"\"Convert argument into source object.\"\"\"\n        if argument.lower().startswith(\"help\"):\n            return ctx.bot.help_command\n\n        cog = ctx.bot.get_cog(argument)\n        if cog:\n            return cog\n\n        cmd = ctx.bot.get_command(argument)\n        if cmd:\n            return cmd\n\n        tags_cog = ctx.bot.get_cog(\"Tags\")\n        show_tag = True\n\n        if not tags_cog:\n            show_tag = False\n        elif argument.lower() in tags_cog._cache:\n            return argument.lower()\n\n        raise commands.BadArgument(\n            f\"Unable to convert `{argument}` to valid command{', tag,' if show_tag else ''} or Cog.\"\n        )\n\n\nclass BotSource(commands.Cog):\n    \"\"\"Displays information about the bot's source code.\"\"\"\n\n    def __init__(self, bot: Bot):\n        self.bot = bot\n\n    @commands.command(name=\"source\", aliases=(\"src\",))\n    async def source_command(self, ctx: commands.Context, *, source_item: SourceConverter = None) -> None:\n        \"\"\"Display information and a GitHub link to the source code of a command, tag, or cog.\"\"\"\n        if not source_item:\n            embed = Embed(title=\"Bot's GitHub Repository\")\n            embed.add_field(name=\"Repository\", value=f\"[Go to GitHub]({URLs.github_bot_repo})\")\n            embed.set_thumbnail(url=\"https://avatars1.githubusercontent.com/u/9919\")\n            await ctx.send(embed=embed)\n            return\n\n        embed = await self.build_embed(source_item)\n        await ctx.send(embed=embed)\n\n    def get_source_link(self, source_item: SourceType) -> Tuple[str, str, Optional[int]]:\n        \"\"\"\n        Build GitHub link of source item, return this link, file location and first line number.\n\n        Raise BadArgument if `source_item` is a dynamically-created object (e.g. via internal eval).\n        \"\"\"\n        if isinstance(source_item, commands.Command):\n            src = source_item.callback.__code__\n            filename = src.co_filename\n        elif isinstance(source_item, str):\n            tags_cog = self.bot.get_cog(\"Tags\")\n            filename = tags_cog._cache[source_item][\"location\"]\n        else:\n            src = type(source_item)\n            try:\n                filename = inspect.getsourcefile(src)\n            except TypeError:\n                raise commands.BadArgument(\"Cannot get source for a dynamically-created object.\")\n\n        if not isinstance(source_item, str):\n            try:\n                lines, first_line_no = inspect.getsourcelines(src)\n            except OSError:\n                raise commands.BadArgument(\"Cannot get source for a dynamically-created object.\")\n\n            lines_extension = f\"#L{first_line_no}-L{first_line_no+len(lines)-1}\"\n        else:\n            first_line_no = None\n            lines_extension = \"\"\n\n        # Handle tag file location differently than others to avoid errors in some cases\n        if not first_line_no:\n            file_location = Path(filename).relative_to(\"/bot/\")\n        else:\n            file_location = Path(filename).relative_to(Path.cwd()).as_posix()\n\n        url = f\"{URLs.github_bot_repo}/blob/master/{file_location}{lines_extension}\"\n\n        return url, file_location, first_line_no or None\n\n    async def build_embed(self, source_object: SourceType) -> Optional[Embed]:\n        \"\"\"Build embed based on source object.\"\"\"\n        url, location, first_line = self.get_source_link(source_object)\n\n        if isinstance(source_object, commands.HelpCommand):\n            title = \"Help Command\"\n            description = source_object.__doc__.splitlines()[1]\n        elif isinstance(source_object, commands.Command):\n            description = source_object.short_doc\n            title = f\"Command: {source_object.qualified_name}\"\n        elif isinstance(source_object, str):\n            title = f\"Tag: {source_object}\"\n            description = \"\"\n        else:\n            title = f\"Cog: {source_object.qualified_name}\"\n            description = source_object.description.splitlines()[0]\n\n        embed = Embed(title=title, description=description)\n        embed.add_field(name=\"Source Code\", value=f\"[Go to GitHub]({url})\")\n        line_text = f\":{first_line}\" if first_line else \"\"\n        embed.set_footer(text=f\"{location}{line_text}\")\n\n        return embed\n\n\ndef setup(bot: Bot) -> None:\n    \"\"\"Load the BotSource cog.\"\"\"\n    bot.add_cog(BotSource(bot))\n", "path": "bot/exts/info/source.py"}]}