prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  nyaa changed TLD
  hi peeps. it seems they switched TLD from .eu to .se
  
  i changed my local flexget/plugins/sites/nyaa.py, removed the pyc & reloaded the daemon. its pulling stuff. but i aint got the skills to send a pull request, so i thought i'd do the next best thing and say something
  
  if you don't want to do anything, i guess thats fine too. the old is redirecting to the new
  
  </issue>
  <code>
  [start of flexget/plugins/sites/nyaa.py]
  1 from __future__ import unicode_literals, division, absolute_import
  2 from builtins import *  # noqa pylint: disable=unused-import, redefined-builtin
  3 from future.moves.urllib.parse import quote
  4 
  5 import logging
  6 
  7 import feedparser
  8 
  9 from flexget import plugin
  10 from flexget.entry import Entry
  11 from flexget.event import event
  12 from flexget.utils.search import normalize_unicode
  13 
  14 log = logging.getLogger('nyaa')
  15 
  16 # TODO: Other categories
  17 CATEGORIES = {'all': '0_0',
  18               'anime': '1_0',
  19               'anime eng': '1_37',
  20               'anime non-eng': '1_38',
  21               'anime raw': '1_11'}
  22 FILTERS = ['all', 'filter remakes', 'trusted only', 'a+ only']
  23 
  24 
  25 class UrlRewriteNyaa(object):
  26     """Nyaa urlrewriter and search plugin."""
  27 
  28     schema = {
  29         'oneOf': [
  30             {'type': 'string', 'enum': list(CATEGORIES)},
  31             {
  32                 'type': 'object',
  33                 'properties': {
  34                     'category': {'type': 'string', 'enum': list(CATEGORIES)},
  35                     'filter': {'type': 'string', 'enum': list(FILTERS)}
  36                 },
  37                 'additionalProperties': False
  38             }
  39         ]
  40     }
  41 
  42     def search(self, task, entry, config):
  43         if not isinstance(config, dict):
  44             config = {'category': config}
  45         config.setdefault('category', 'anime eng')
  46         config.setdefault('filter', 'all')
  47         entries = set()
  48         for search_string in entry.get('search_strings', [entry['title']]):
  49             name = normalize_unicode(search_string)
  50             url = 'http://www.nyaa.eu/?page=rss&cats=%s&filter=%s&term=%s' % (
  51                 CATEGORIES[config['category']], FILTERS.index(config['filter']), quote(name.encode('utf-8')))
  52 
  53             log.debug('requesting: %s' % url)
  54             rss = feedparser.parse(url)
  55 
  56             status = rss.get('status', False)
  57             if status != 200:
  58                 log.debug('Search result not 200 (OK), received %s' % status)
  59             if status >= 400:
  60                 continue
  61 
  62             ex = rss.get('bozo_exception', False)
  63             if ex:
  64                 log.error('Got bozo_exception (bad feed) on %s' % url)
  65                 continue
  66 
  67             for item in rss.entries:
  68                 entry = Entry()
  69                 entry['title'] = item.title
  70                 entry['url'] = item.link
  71                 # TODO: parse some shit
  72                 # entry['torrent_seeds'] = int(item.seeds)
  73                 # entry['torrent_leeches'] = int(item.leechs)
  74                 # entry['search_sort'] = torrent_availability(entry['torrent_seeds'], entry['torrent_leeches'])
  75                 # entry['content_size'] = int(item.size) / 1024 / 1024
  76 
  77                 entries.add(entry)
  78 
  79         return entries
  80 
  81     def url_rewritable(self, task, entry):
  82         return entry['url'].startswith('http://www.nyaa.eu/?page=torrentinfo&tid=')
  83 
  84     def url_rewrite(self, task, entry):
  85         entry['url'] = entry['url'].replace('torrentinfo', 'download')
  86 
  87 
  88 @event('plugin.register')
  89 def register_plugin():
  90     plugin.register(UrlRewriteNyaa, 'nyaa', groups=['search', 'urlrewriter'], api_ver=2)
  91
  [end of flexget/plugins/sites/nyaa.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/flexget/plugins/sites/nyaa.py b/flexget/plugins/sites/nyaa.py
  --- a/flexget/plugins/sites/nyaa.py
  +++ b/flexget/plugins/sites/nyaa.py
  @@ -47,7 +47,7 @@
           entries = set()
           for search_string in entry.get('search_strings', [entry['title']]):
               name = normalize_unicode(search_string)
  -            url = 'http://www.nyaa.eu/?page=rss&cats=%s&filter=%s&term=%s' % (
  +            url = 'http://www.nyaa.se/?page=rss&cats=%s&filter=%s&term=%s' % (
                   CATEGORIES[config['category']], FILTERS.index(config['filter']), quote(name.encode('utf-8')))
   
               log.debug('requesting: %s' % url)
  @@ -79,7 +79,7 @@
           return entries
   
       def url_rewritable(self, task, entry):
  -        return entry['url'].startswith('http://www.nyaa.eu/?page=torrentinfo&tid=')
  +        return entry['url'].startswith('http://www.nyaa.se/?page=torrentinfo&tid=')
   
       def url_rewrite(self, task, entry):
           entry['url'] = entry['url'].replace('torrentinfo', 'download')
  
verification_info: {"golden_diff": "diff --git a/flexget/plugins/sites/nyaa.py b/flexget/plugins/sites/nyaa.py\n--- a/flexget/plugins/sites/nyaa.py\n+++ b/flexget/plugins/sites/nyaa.py\n@@ -47,7 +47,7 @@\n         entries = set()\n         for search_string in entry.get('search_strings', [entry['title']]):\n             name = normalize_unicode(search_string)\n-            url = 'http://www.nyaa.eu/?page=rss&cats=%s&filter=%s&term=%s' % (\n+            url = 'http://www.nyaa.se/?page=rss&cats=%s&filter=%s&term=%s' % (\n                 CATEGORIES[config['category']], FILTERS.index(config['filter']), quote(name.encode('utf-8')))\n \n             log.debug('requesting: %s' % url)\n@@ -79,7 +79,7 @@\n         return entries\n \n     def url_rewritable(self, task, entry):\n-        return entry['url'].startswith('http://www.nyaa.eu/?page=torrentinfo&tid=')\n+        return entry['url'].startswith('http://www.nyaa.se/?page=torrentinfo&tid=')\n \n     def url_rewrite(self, task, entry):\n         entry['url'] = entry['url'].replace('torrentinfo', 'download')\n", "issue": "nyaa changed TLD\nhi peeps. it seems they switched TLD from .eu to .se\r\n\r\ni changed my local flexget/plugins/sites/nyaa.py, removed the pyc & reloaded the daemon. its pulling stuff. but i aint got the skills to send a pull request, so i thought i'd do the next best thing and say something\r\n\r\nif you don't want to do anything, i guess thats fine too. the old is redirecting to the new\n", "before_files": [{"content": "from __future__ import unicode_literals, division, absolute_import\nfrom builtins import *  # noqa pylint: disable=unused-import, redefined-builtin\nfrom future.moves.urllib.parse import quote\n\nimport logging\n\nimport feedparser\n\nfrom flexget import plugin\nfrom flexget.entry import Entry\nfrom flexget.event import event\nfrom flexget.utils.search import normalize_unicode\n\nlog = logging.getLogger('nyaa')\n\n# TODO: Other categories\nCATEGORIES = {'all': '0_0',\n              'anime': '1_0',\n              'anime eng': '1_37',\n              'anime non-eng': '1_38',\n              'anime raw': '1_11'}\nFILTERS = ['all', 'filter remakes', 'trusted only', 'a+ only']\n\n\nclass UrlRewriteNyaa(object):\n    \"\"\"Nyaa urlrewriter and search plugin.\"\"\"\n\n    schema = {\n        'oneOf': [\n            {'type': 'string', 'enum': list(CATEGORIES)},\n            {\n                'type': 'object',\n                'properties': {\n                    'category': {'type': 'string', 'enum': list(CATEGORIES)},\n                    'filter': {'type': 'string', 'enum': list(FILTERS)}\n                },\n                'additionalProperties': False\n            }\n        ]\n    }\n\n    def search(self, task, entry, config):\n        if not isinstance(config, dict):\n            config = {'category': config}\n        config.setdefault('category', 'anime eng')\n        config.setdefault('filter', 'all')\n        entries = set()\n        for search_string in entry.get('search_strings', [entry['title']]):\n            name = normalize_unicode(search_string)\n            url = 'http://www.nyaa.eu/?page=rss&cats=%s&filter=%s&term=%s' % (\n                CATEGORIES[config['category']], FILTERS.index(config['filter']), quote(name.encode('utf-8')))\n\n            log.debug('requesting: %s' % url)\n            rss = feedparser.parse(url)\n\n            status = rss.get('status', False)\n            if status != 200:\n                log.debug('Search result not 200 (OK), received %s' % status)\n            if status >= 400:\n                continue\n\n            ex = rss.get('bozo_exception', False)\n            if ex:\n                log.error('Got bozo_exception (bad feed) on %s' % url)\n                continue\n\n            for item in rss.entries:\n                entry = Entry()\n                entry['title'] = item.title\n                entry['url'] = item.link\n                # TODO: parse some shit\n                # entry['torrent_seeds'] = int(item.seeds)\n                # entry['torrent_leeches'] = int(item.leechs)\n                # entry['search_sort'] = torrent_availability(entry['torrent_seeds'], entry['torrent_leeches'])\n                # entry['content_size'] = int(item.size) / 1024 / 1024\n\n                entries.add(entry)\n\n        return entries\n\n    def url_rewritable(self, task, entry):\n        return entry['url'].startswith('http://www.nyaa.eu/?page=torrentinfo&tid=')\n\n    def url_rewrite(self, task, entry):\n        entry['url'] = entry['url'].replace('torrentinfo', 'download')\n\n\n@event('plugin.register')\ndef register_plugin():\n    plugin.register(UrlRewriteNyaa, 'nyaa', groups=['search', 'urlrewriter'], api_ver=2)\n", "path": "flexget/plugins/sites/nyaa.py"}]}