prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Strip leading . on .tld queries
  `.tld .py` should be the same as `.tld py`
  
  
  </issue>
  <code>
  [start of willie/modules/tld.py]
  1 # coding=utf8
  2 """
  3 tld.py - Willie TLD Module
  4 Copyright 2009-10, Michael Yanovich, yanovich.net
  5 Licensed under the Eiffel Forum License 2.
  6 
  7 http://willie.dftba.net
  8 """
  9 from __future__ import unicode_literals
  10 
  11 from willie import web
  12 from willie.module import commands, example
  13 import re
  14 import sys
  15 if sys.version_info.major >= 3:
  16     unicode = str
  17 
  18 uri = 'https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains'
  19 r_tag = re.compile(r'<(?!!)[^>]+>')
  20 
  21 
  22 @commands('tld')
  23 @example('.tld ru')
  24 def gettld(bot, trigger):
  25     """Show information about the given Top Level Domain."""
  26     page = web.get(uri)
  27     search = r'(?i)<td><a href="\S+" title="\S+">\.{0}</a></td>\n(<td><a href=".*</a></td>\n)?<td>([A-Za-z0-9].*?)</td>\n<td>(.*)</td>\n<td[^>]*>(.*?)</td>\n<td[^>]*>(.*?)</td>\n'
  28     search = search.format(trigger.group(2))
  29     re_country = re.compile(search)
  30     matches = re_country.findall(page)
  31     if not matches:
  32         search = r'(?i)<td><a href="\S+" title="(\S+)">\.{0}</a></td>\n<td><a href=".*">(.*)</a></td>\n<td>([A-Za-z0-9].*?)</td>\n<td[^>]*>(.*?)</td>\n<td[^>]*>(.*?)</td>\n'
  33         search = search.format(trigger.group(2))
  34         re_country = re.compile(search)
  35         matches = re_country.findall(page)
  36     if matches:
  37         matches = list(matches[0])
  38         i = 0
  39         while i < len(matches):
  40             matches[i] = r_tag.sub("", matches[i])
  41             i += 1
  42         desc = matches[2]
  43         if len(desc) > 400:
  44             desc = desc[:400] + "..."
  45         reply = "%s -- %s. IDN: %s, DNSSEC: %s" % (matches[1], desc,
  46                 matches[3], matches[4])
  47         bot.reply(reply)
  48     else:
  49         search = r'<td><a href="\S+" title="\S+">.{0}</a></td>\n<td><span class="flagicon"><img.*?\">(.*?)</a></td>\n<td[^>]*>(.*?)</td>\n<td[^>]*>(.*?)</td>\n<td[^>]*>(.*?)</td>\n<td[^>]*>(.*?)</td>\n<td[^>]*>(.*?)</td>\n'
  50         search = search.format(unicode(trigger.group(2)))
  51         re_country = re.compile(search)
  52         matches = re_country.findall(page)
  53         if matches:
  54             matches = matches[0]
  55             dict_val = dict()
  56             dict_val["country"], dict_val["expl"], dict_val["notes"], dict_val["idn"], dict_val["dnssec"], dict_val["sld"] = matches
  57             for key in dict_val:
  58                 if dict_val[key] == "&#160;":
  59                     dict_val[key] = "N/A"
  60                 dict_val[key] = r_tag.sub('', dict_val[key])
  61             if len(dict_val["notes"]) > 400:
  62                 dict_val["notes"] = dict_val["notes"][:400] + "..."
  63             reply = "%s (%s, %s). IDN: %s, DNSSEC: %s, SLD: %s" % (dict_val["country"], dict_val["expl"], dict_val["notes"], dict_val["idn"], dict_val["dnssec"], dict_val["sld"])
  64         else:
  65             reply = "No matches found for TLD: {0}".format(unicode(trigger.group(2)))
  66         bot.reply(reply)
  67
  [end of willie/modules/tld.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/willie/modules/tld.py b/willie/modules/tld.py
  --- a/willie/modules/tld.py
  +++ b/willie/modules/tld.py
  @@ -24,13 +24,16 @@
   def gettld(bot, trigger):
       """Show information about the given Top Level Domain."""
       page = web.get(uri)
  +    tld = trigger.group(2)
  +    if tld[0] == '.':
  +        tld = tld[1:]
       search = r'(?i)<td><a href="\S+" title="\S+">\.{0}</a></td>\n(<td><a href=".*</a></td>\n)?<td>([A-Za-z0-9].*?)</td>\n<td>(.*)</td>\n<td[^>]*>(.*?)</td>\n<td[^>]*>(.*?)</td>\n'
  -    search = search.format(trigger.group(2))
  +    search = search.format(tld)
       re_country = re.compile(search)
       matches = re_country.findall(page)
       if not matches:
           search = r'(?i)<td><a href="\S+" title="(\S+)">\.{0}</a></td>\n<td><a href=".*">(.*)</a></td>\n<td>([A-Za-z0-9].*?)</td>\n<td[^>]*>(.*?)</td>\n<td[^>]*>(.*?)</td>\n'
  -        search = search.format(trigger.group(2))
  +        search = search.format(tld)
           re_country = re.compile(search)
           matches = re_country.findall(page)
       if matches:
  @@ -47,7 +50,7 @@
           bot.reply(reply)
       else:
           search = r'<td><a href="\S+" title="\S+">.{0}</a></td>\n<td><span class="flagicon"><img.*?\">(.*?)</a></td>\n<td[^>]*>(.*?)</td>\n<td[^>]*>(.*?)</td>\n<td[^>]*>(.*?)</td>\n<td[^>]*>(.*?)</td>\n<td[^>]*>(.*?)</td>\n'
  -        search = search.format(unicode(trigger.group(2)))
  +        search = search.format(unicode(tld))
           re_country = re.compile(search)
           matches = re_country.findall(page)
           if matches:
  @@ -62,5 +65,5 @@
                   dict_val["notes"] = dict_val["notes"][:400] + "..."
               reply = "%s (%s, %s). IDN: %s, DNSSEC: %s, SLD: %s" % (dict_val["country"], dict_val["expl"], dict_val["notes"], dict_val["idn"], dict_val["dnssec"], dict_val["sld"])
           else:
  -            reply = "No matches found for TLD: {0}".format(unicode(trigger.group(2)))
  +            reply = "No matches found for TLD: {0}".format(unicode(tld))
           bot.reply(reply)
  
verification_info: {"golden_diff": "diff --git a/willie/modules/tld.py b/willie/modules/tld.py\n--- a/willie/modules/tld.py\n+++ b/willie/modules/tld.py\n@@ -24,13 +24,16 @@\n def gettld(bot, trigger):\n     \"\"\"Show information about the given Top Level Domain.\"\"\"\n     page = web.get(uri)\n+    tld = trigger.group(2)\n+    if tld[0] == '.':\n+        tld = tld[1:]\n     search = r'(?i)<td><a href=\"\\S+\" title=\"\\S+\">\\.{0}</a></td>\\n(<td><a href=\".*</a></td>\\n)?<td>([A-Za-z0-9].*?)</td>\\n<td>(.*)</td>\\n<td[^>]*>(.*?)</td>\\n<td[^>]*>(.*?)</td>\\n'\n-    search = search.format(trigger.group(2))\n+    search = search.format(tld)\n     re_country = re.compile(search)\n     matches = re_country.findall(page)\n     if not matches:\n         search = r'(?i)<td><a href=\"\\S+\" title=\"(\\S+)\">\\.{0}</a></td>\\n<td><a href=\".*\">(.*)</a></td>\\n<td>([A-Za-z0-9].*?)</td>\\n<td[^>]*>(.*?)</td>\\n<td[^>]*>(.*?)</td>\\n'\n-        search = search.format(trigger.group(2))\n+        search = search.format(tld)\n         re_country = re.compile(search)\n         matches = re_country.findall(page)\n     if matches:\n@@ -47,7 +50,7 @@\n         bot.reply(reply)\n     else:\n         search = r'<td><a href=\"\\S+\" title=\"\\S+\">.{0}</a></td>\\n<td><span class=\"flagicon\"><img.*?\\\">(.*?)</a></td>\\n<td[^>]*>(.*?)</td>\\n<td[^>]*>(.*?)</td>\\n<td[^>]*>(.*?)</td>\\n<td[^>]*>(.*?)</td>\\n<td[^>]*>(.*?)</td>\\n'\n-        search = search.format(unicode(trigger.group(2)))\n+        search = search.format(unicode(tld))\n         re_country = re.compile(search)\n         matches = re_country.findall(page)\n         if matches:\n@@ -62,5 +65,5 @@\n                 dict_val[\"notes\"] = dict_val[\"notes\"][:400] + \"...\"\n             reply = \"%s (%s, %s). IDN: %s, DNSSEC: %s, SLD: %s\" % (dict_val[\"country\"], dict_val[\"expl\"], dict_val[\"notes\"], dict_val[\"idn\"], dict_val[\"dnssec\"], dict_val[\"sld\"])\n         else:\n-            reply = \"No matches found for TLD: {0}\".format(unicode(trigger.group(2)))\n+            reply = \"No matches found for TLD: {0}\".format(unicode(tld))\n         bot.reply(reply)\n", "issue": "Strip leading . on .tld queries\n`.tld .py` should be the same as `.tld py`\n\n", "before_files": [{"content": "# coding=utf8\n\"\"\"\ntld.py - Willie TLD Module\nCopyright 2009-10, Michael Yanovich, yanovich.net\nLicensed under the Eiffel Forum License 2.\n\nhttp://willie.dftba.net\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom willie import web\nfrom willie.module import commands, example\nimport re\nimport sys\nif sys.version_info.major >= 3:\n    unicode = str\n\nuri = 'https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains'\nr_tag = re.compile(r'<(?!!)[^>]+>')\n\n\n@commands('tld')\n@example('.tld ru')\ndef gettld(bot, trigger):\n    \"\"\"Show information about the given Top Level Domain.\"\"\"\n    page = web.get(uri)\n    search = r'(?i)<td><a href=\"\\S+\" title=\"\\S+\">\\.{0}</a></td>\\n(<td><a href=\".*</a></td>\\n)?<td>([A-Za-z0-9].*?)</td>\\n<td>(.*)</td>\\n<td[^>]*>(.*?)</td>\\n<td[^>]*>(.*?)</td>\\n'\n    search = search.format(trigger.group(2))\n    re_country = re.compile(search)\n    matches = re_country.findall(page)\n    if not matches:\n        search = r'(?i)<td><a href=\"\\S+\" title=\"(\\S+)\">\\.{0}</a></td>\\n<td><a href=\".*\">(.*)</a></td>\\n<td>([A-Za-z0-9].*?)</td>\\n<td[^>]*>(.*?)</td>\\n<td[^>]*>(.*?)</td>\\n'\n        search = search.format(trigger.group(2))\n        re_country = re.compile(search)\n        matches = re_country.findall(page)\n    if matches:\n        matches = list(matches[0])\n        i = 0\n        while i < len(matches):\n            matches[i] = r_tag.sub(\"\", matches[i])\n            i += 1\n        desc = matches[2]\n        if len(desc) > 400:\n            desc = desc[:400] + \"...\"\n        reply = \"%s -- %s. IDN: %s, DNSSEC: %s\" % (matches[1], desc,\n                matches[3], matches[4])\n        bot.reply(reply)\n    else:\n        search = r'<td><a href=\"\\S+\" title=\"\\S+\">.{0}</a></td>\\n<td><span class=\"flagicon\"><img.*?\\\">(.*?)</a></td>\\n<td[^>]*>(.*?)</td>\\n<td[^>]*>(.*?)</td>\\n<td[^>]*>(.*?)</td>\\n<td[^>]*>(.*?)</td>\\n<td[^>]*>(.*?)</td>\\n'\n        search = search.format(unicode(trigger.group(2)))\n        re_country = re.compile(search)\n        matches = re_country.findall(page)\n        if matches:\n            matches = matches[0]\n            dict_val = dict()\n            dict_val[\"country\"], dict_val[\"expl\"], dict_val[\"notes\"], dict_val[\"idn\"], dict_val[\"dnssec\"], dict_val[\"sld\"] = matches\n            for key in dict_val:\n                if dict_val[key] == \"&#160;\":\n                    dict_val[key] = \"N/A\"\n                dict_val[key] = r_tag.sub('', dict_val[key])\n            if len(dict_val[\"notes\"]) > 400:\n                dict_val[\"notes\"] = dict_val[\"notes\"][:400] + \"...\"\n            reply = \"%s (%s, %s). IDN: %s, DNSSEC: %s, SLD: %s\" % (dict_val[\"country\"], dict_val[\"expl\"], dict_val[\"notes\"], dict_val[\"idn\"], dict_val[\"dnssec\"], dict_val[\"sld\"])\n        else:\n            reply = \"No matches found for TLD: {0}\".format(unicode(trigger.group(2)))\n        bot.reply(reply)\n", "path": "willie/modules/tld.py"}]}