prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  mymemory_translated engine: unexpected crash 'str' object has no attribute 'decode' 
  mymemory engine does not work.
  You can see it in the search engine statistics: https://searx.space/#.
  
  Either: "unexpected crash 'str' object has no attribute 'decode'"
  Or: "no result"
  
  My instance is https://searx.hlfh.space (I use antibot-proxy) and I have the first issue.
  I am using mymemory with the API key I got from the service.
  
  </issue>
  <code>
  [start of searx/engines/translated.py]
  1 """
  2  MyMemory Translated
  3 
  4  @website     https://mymemory.translated.net/
  5  @provide-api yes (https://mymemory.translated.net/doc/spec.php)
  6  @using-api   yes
  7  @results     JSON
  8  @stable      yes
  9  @parse       url, title, content
  10 """
  11 import re
  12 from sys import version_info
  13 from searx.utils import is_valid_lang
  14 
  15 if version_info[0] == 3:
  16     unicode = str
  17 
  18 categories = ['general']
  19 url = u'http://api.mymemory.translated.net/get?q={query}&langpair={from_lang}|{to_lang}{key}'
  20 web_url = u'http://mymemory.translated.net/en/{from_lang}/{to_lang}/{query}'
  21 weight = 100
  22 
  23 parser_re = re.compile(u'.*?([a-z]+)-([a-z]+) (.{2,})$', re.I)
  24 api_key = ''
  25 
  26 
  27 def request(query, params):
  28     m = parser_re.match(unicode(query, 'utf8'))
  29     if not m:
  30         return params
  31 
  32     from_lang, to_lang, query = m.groups()
  33 
  34     from_lang = is_valid_lang(from_lang)
  35     to_lang = is_valid_lang(to_lang)
  36 
  37     if not from_lang or not to_lang:
  38         return params
  39 
  40     if api_key:
  41         key_form = '&key=' + api_key
  42     else:
  43         key_form = ''
  44     params['url'] = url.format(from_lang=from_lang[1],
  45                                to_lang=to_lang[1],
  46                                query=query,
  47                                key=key_form)
  48     params['query'] = query
  49     params['from_lang'] = from_lang
  50     params['to_lang'] = to_lang
  51 
  52     return params
  53 
  54 
  55 def response(resp):
  56     results = []
  57     results.append({
  58         'url': web_url.format(
  59             from_lang=resp.search_params['from_lang'][2],
  60             to_lang=resp.search_params['to_lang'][2],
  61             query=resp.search_params['query']),
  62         'title': '[{0}-{1}] {2}'.format(
  63             resp.search_params['from_lang'][1],
  64             resp.search_params['to_lang'][1],
  65             resp.search_params['query']),
  66         'content': resp.json()['responseData']['translatedText']
  67     })
  68     return results
  69
  [end of searx/engines/translated.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/searx/engines/translated.py b/searx/engines/translated.py
  --- a/searx/engines/translated.py
  +++ b/searx/engines/translated.py
  @@ -9,23 +9,19 @@
    @parse       url, title, content
   """
   import re
  -from sys import version_info
   from searx.utils import is_valid_lang
   
  -if version_info[0] == 3:
  -    unicode = str
  -
   categories = ['general']
  -url = u'http://api.mymemory.translated.net/get?q={query}&langpair={from_lang}|{to_lang}{key}'
  -web_url = u'http://mymemory.translated.net/en/{from_lang}/{to_lang}/{query}'
  +url = u'https://api.mymemory.translated.net/get?q={query}&langpair={from_lang}|{to_lang}{key}'
  +web_url = u'https://mymemory.translated.net/en/{from_lang}/{to_lang}/{query}'
   weight = 100
   
  -parser_re = re.compile(u'.*?([a-z]+)-([a-z]+) (.{2,})$', re.I)
  +parser_re = re.compile(b'.*?([a-z]+)-([a-z]+) (.{2,})$', re.I)
   api_key = ''
   
   
   def request(query, params):
  -    m = parser_re.match(unicode(query, 'utf8'))
  +    m = parser_re.match(query)
       if not m:
           return params
   
  @@ -43,9 +39,9 @@
           key_form = ''
       params['url'] = url.format(from_lang=from_lang[1],
                                  to_lang=to_lang[1],
  -                               query=query,
  +                               query=query.decode('utf-8'),
                                  key=key_form)
  -    params['query'] = query
  +    params['query'] = query.decode('utf-8')
       params['from_lang'] = from_lang
       params['to_lang'] = to_lang
  
verification_info: {"golden_diff": "diff --git a/searx/engines/translated.py b/searx/engines/translated.py\n--- a/searx/engines/translated.py\n+++ b/searx/engines/translated.py\n@@ -9,23 +9,19 @@\n  @parse       url, title, content\n \"\"\"\n import re\n-from sys import version_info\n from searx.utils import is_valid_lang\n \n-if version_info[0] == 3:\n-    unicode = str\n-\n categories = ['general']\n-url = u'http://api.mymemory.translated.net/get?q={query}&langpair={from_lang}|{to_lang}{key}'\n-web_url = u'http://mymemory.translated.net/en/{from_lang}/{to_lang}/{query}'\n+url = u'https://api.mymemory.translated.net/get?q={query}&langpair={from_lang}|{to_lang}{key}'\n+web_url = u'https://mymemory.translated.net/en/{from_lang}/{to_lang}/{query}'\n weight = 100\n \n-parser_re = re.compile(u'.*?([a-z]+)-([a-z]+) (.{2,})$', re.I)\n+parser_re = re.compile(b'.*?([a-z]+)-([a-z]+) (.{2,})$', re.I)\n api_key = ''\n \n \n def request(query, params):\n-    m = parser_re.match(unicode(query, 'utf8'))\n+    m = parser_re.match(query)\n     if not m:\n         return params\n \n@@ -43,9 +39,9 @@\n         key_form = ''\n     params['url'] = url.format(from_lang=from_lang[1],\n                                to_lang=to_lang[1],\n-                               query=query,\n+                               query=query.decode('utf-8'),\n                                key=key_form)\n-    params['query'] = query\n+    params['query'] = query.decode('utf-8')\n     params['from_lang'] = from_lang\n     params['to_lang'] = to_lang\n", "issue": "mymemory_translated engine: unexpected crash 'str' object has no attribute 'decode' \nmymemory engine does not work.\r\nYou can see it in the search engine statistics: https://searx.space/#.\r\n\r\nEither: \"unexpected crash 'str' object has no attribute 'decode'\"\r\nOr: \"no result\"\r\n\r\nMy instance is https://searx.hlfh.space (I use antibot-proxy) and I have the first issue.\r\nI am using mymemory with the API key I got from the service.\n", "before_files": [{"content": "\"\"\"\n MyMemory Translated\n\n @website     https://mymemory.translated.net/\n @provide-api yes (https://mymemory.translated.net/doc/spec.php)\n @using-api   yes\n @results     JSON\n @stable      yes\n @parse       url, title, content\n\"\"\"\nimport re\nfrom sys import version_info\nfrom searx.utils import is_valid_lang\n\nif version_info[0] == 3:\n    unicode = str\n\ncategories = ['general']\nurl = u'http://api.mymemory.translated.net/get?q={query}&langpair={from_lang}|{to_lang}{key}'\nweb_url = u'http://mymemory.translated.net/en/{from_lang}/{to_lang}/{query}'\nweight = 100\n\nparser_re = re.compile(u'.*?([a-z]+)-([a-z]+) (.{2,})$', re.I)\napi_key = ''\n\n\ndef request(query, params):\n    m = parser_re.match(unicode(query, 'utf8'))\n    if not m:\n        return params\n\n    from_lang, to_lang, query = m.groups()\n\n    from_lang = is_valid_lang(from_lang)\n    to_lang = is_valid_lang(to_lang)\n\n    if not from_lang or not to_lang:\n        return params\n\n    if api_key:\n        key_form = '&key=' + api_key\n    else:\n        key_form = ''\n    params['url'] = url.format(from_lang=from_lang[1],\n                               to_lang=to_lang[1],\n                               query=query,\n                               key=key_form)\n    params['query'] = query\n    params['from_lang'] = from_lang\n    params['to_lang'] = to_lang\n\n    return params\n\n\ndef response(resp):\n    results = []\n    results.append({\n        'url': web_url.format(\n            from_lang=resp.search_params['from_lang'][2],\n            to_lang=resp.search_params['to_lang'][2],\n            query=resp.search_params['query']),\n        'title': '[{0}-{1}] {2}'.format(\n            resp.search_params['from_lang'][1],\n            resp.search_params['to_lang'][1],\n            resp.search_params['query']),\n        'content': resp.json()['responseData']['translatedText']\n    })\n    return results\n", "path": "searx/engines/translated.py"}]}