prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Upgrade memento_client to 0.6.1
  Currently `memento_client` in our repo is still at version 0.5.3 which still contains bugs. Upgrading to `0.6.1` would fix many bugs that are found in `0.5.3`
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `bears/general/MementoBear.py`
  Content:
  ```
  1 import requests
  2 
  3 from bears.general.URLBear import URLBear
  4 
  5 from coalib.bears.LocalBear import LocalBear
  6 from coalib.results.Result import Result
  7 from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
  8 
  9 from dependency_management.requirements.PipRequirement import PipRequirement
  10 
  11 from memento_client import MementoClient
  12 
  13 
  14 class MementoBear(LocalBear):
  15     DEFAULT_TIMEOUT = 15
  16     LANGUAGES = {'All'}
  17     REQUIREMENTS = {PipRequirement('memento_client', '0.5.3')}
  18     AUTHORS = {'The coala developers'}
  19     AUTHORS_EMAILS = {'coala-devel@googlegroups.com'}
  20     LICENSE = 'AGPL-3.0'
  21     CAN_DETECT = {'Documentation'}
  22     BEAR_DEPS = {URLBear}
  23 
  24     @staticmethod
  25     def check_archive(mc, link):
  26         """
  27         Check the link is it archived or not.
  28 
  29         :param mc:   A `memento_client.MementoClient` instance.
  30         :param link: The link (str) that will be checked.
  31         :return:     Boolean, `True` means the link has been archived.
  32         """
  33         try:
  34             mc.get_memento_info(link)['mementos']
  35         except KeyError:
  36             return False
  37         return True
  38 
  39     @staticmethod
  40     def get_redirect_urls(link):
  41         urls = []
  42 
  43         resp = requests.head(link, allow_redirects=True)
  44         for redirect in resp.history:
  45             urls.append(redirect.url)
  46 
  47         return urls
  48 
  49     def run(self, filename, file, dependency_results=dict(),
  50             follow_redirects: bool=True):
  51         """
  52         Find links in any text file and check if they are archived.
  53 
  54         Link is considered valid if the link has been archived by any services
  55         in memento_client.
  56 
  57         This bear can automatically fix redirects.
  58 
  59         Warning: This bear will make HEAD requests to all URLs mentioned in
  60         your codebase, which can potentially be destructive. As an example,
  61         this bear would naively just visit the URL from a line that goes like
  62         `do_not_ever_open = 'https://api.acme.inc/delete-all-data'` wiping out
  63         all your data.
  64 
  65         :param dependency_results: Results given by URLBear.
  66         :param follow_redirects:   Set to true to check all redirect urls.
  67         """
  68         self._mc = MementoClient()
  69 
  70         for result in dependency_results.get(URLBear.name, []):
  71             line_number, link, code, context = result.contents
  72 
  73             if not (code and 200 <= code < 400):
  74                 continue
  75 
  76             status = MementoBear.check_archive(self._mc, link)
  77             if not status:
  78                 yield Result.from_values(
  79                     self,
  80                     ('This link is not archived yet, visit '
  81                      'https://web.archive.org/save/%s to get it archived.'
  82                      % link),
  83                     file=filename,
  84                     line=line_number,
  85                     severity=RESULT_SEVERITY.INFO
  86                 )
  87 
  88             if follow_redirects and 300 <= code < 400:  # HTTP status 30x
  89                 redirect_urls = MementoBear.get_redirect_urls(link)
  90 
  91                 for url in redirect_urls:
  92                     status = MementoBear.check_archive(self._mc, url)
  93                     if not status:
  94                         yield Result.from_values(
  95                             self,
  96                             ('This link redirects to %s and not archived yet, '
  97                              'visit https://web.archive.org/save/%s to get it '
  98                              'archived.'
  99                              % (url, url)),
  100                             file=filename,
  101                             line=line_number,
  102                             severity=RESULT_SEVERITY.INFO
  103                         )
  104
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/bears/general/MementoBear.py b/bears/general/MementoBear.py
  --- a/bears/general/MementoBear.py
  +++ b/bears/general/MementoBear.py
  @@ -14,7 +14,7 @@
   class MementoBear(LocalBear):
       DEFAULT_TIMEOUT = 15
       LANGUAGES = {'All'}
  -    REQUIREMENTS = {PipRequirement('memento_client', '0.5.3')}
  +    REQUIREMENTS = {PipRequirement('memento_client', '0.6.1')}
       AUTHORS = {'The coala developers'}
       AUTHORS_EMAILS = {'coala-devel@googlegroups.com'}
       LICENSE = 'AGPL-3.0'
  
verification_info: {"golden_diff": "diff --git a/bears/general/MementoBear.py b/bears/general/MementoBear.py\n--- a/bears/general/MementoBear.py\n+++ b/bears/general/MementoBear.py\n@@ -14,7 +14,7 @@\n class MementoBear(LocalBear):\n     DEFAULT_TIMEOUT = 15\n     LANGUAGES = {'All'}\n-    REQUIREMENTS = {PipRequirement('memento_client', '0.5.3')}\n+    REQUIREMENTS = {PipRequirement('memento_client', '0.6.1')}\n     AUTHORS = {'The coala developers'}\n     AUTHORS_EMAILS = {'coala-devel@googlegroups.com'}\n     LICENSE = 'AGPL-3.0'\n", "issue": "Upgrade memento_client to 0.6.1\nCurrently `memento_client` in our repo is still at version 0.5.3 which still contains bugs. Upgrading to `0.6.1` would fix many bugs that are found in `0.5.3`\n", "before_files": [{"content": "import requests\n\nfrom bears.general.URLBear import URLBear\n\nfrom coalib.bears.LocalBear import LocalBear\nfrom coalib.results.Result import Result\nfrom coalib.results.RESULT_SEVERITY import RESULT_SEVERITY\n\nfrom dependency_management.requirements.PipRequirement import PipRequirement\n\nfrom memento_client import MementoClient\n\n\nclass MementoBear(LocalBear):\n    DEFAULT_TIMEOUT = 15\n    LANGUAGES = {'All'}\n    REQUIREMENTS = {PipRequirement('memento_client', '0.5.3')}\n    AUTHORS = {'The coala developers'}\n    AUTHORS_EMAILS = {'coala-devel@googlegroups.com'}\n    LICENSE = 'AGPL-3.0'\n    CAN_DETECT = {'Documentation'}\n    BEAR_DEPS = {URLBear}\n\n    @staticmethod\n    def check_archive(mc, link):\n        \"\"\"\n        Check the link is it archived or not.\n\n        :param mc:   A `memento_client.MementoClient` instance.\n        :param link: The link (str) that will be checked.\n        :return:     Boolean, `True` means the link has been archived.\n        \"\"\"\n        try:\n            mc.get_memento_info(link)['mementos']\n        except KeyError:\n            return False\n        return True\n\n    @staticmethod\n    def get_redirect_urls(link):\n        urls = []\n\n        resp = requests.head(link, allow_redirects=True)\n        for redirect in resp.history:\n            urls.append(redirect.url)\n\n        return urls\n\n    def run(self, filename, file, dependency_results=dict(),\n            follow_redirects: bool=True):\n        \"\"\"\n        Find links in any text file and check if they are archived.\n\n        Link is considered valid if the link has been archived by any services\n        in memento_client.\n\n        This bear can automatically fix redirects.\n\n        Warning: This bear will make HEAD requests to all URLs mentioned in\n        your codebase, which can potentially be destructive. As an example,\n        this bear would naively just visit the URL from a line that goes like\n        `do_not_ever_open = 'https://api.acme.inc/delete-all-data'` wiping out\n        all your data.\n\n        :param dependency_results: Results given by URLBear.\n        :param follow_redirects:   Set to true to check all redirect urls.\n        \"\"\"\n        self._mc = MementoClient()\n\n        for result in dependency_results.get(URLBear.name, []):\n            line_number, link, code, context = result.contents\n\n            if not (code and 200 <= code < 400):\n                continue\n\n            status = MementoBear.check_archive(self._mc, link)\n            if not status:\n                yield Result.from_values(\n                    self,\n                    ('This link is not archived yet, visit '\n                     'https://web.archive.org/save/%s to get it archived.'\n                     % link),\n                    file=filename,\n                    line=line_number,\n                    severity=RESULT_SEVERITY.INFO\n                )\n\n            if follow_redirects and 300 <= code < 400:  # HTTP status 30x\n                redirect_urls = MementoBear.get_redirect_urls(link)\n\n                for url in redirect_urls:\n                    status = MementoBear.check_archive(self._mc, url)\n                    if not status:\n                        yield Result.from_values(\n                            self,\n                            ('This link redirects to %s and not archived yet, '\n                             'visit https://web.archive.org/save/%s to get it '\n                             'archived.'\n                             % (url, url)),\n                            file=filename,\n                            line=line_number,\n                            severity=RESULT_SEVERITY.INFO\n                        )\n", "path": "bears/general/MementoBear.py"}], "after_files": [{"content": "import requests\n\nfrom bears.general.URLBear import URLBear\n\nfrom coalib.bears.LocalBear import LocalBear\nfrom coalib.results.Result import Result\nfrom coalib.results.RESULT_SEVERITY import RESULT_SEVERITY\n\nfrom dependency_management.requirements.PipRequirement import PipRequirement\n\nfrom memento_client import MementoClient\n\n\nclass MementoBear(LocalBear):\n    DEFAULT_TIMEOUT = 15\n    LANGUAGES = {'All'}\n    REQUIREMENTS = {PipRequirement('memento_client', '0.6.1')}\n    AUTHORS = {'The coala developers'}\n    AUTHORS_EMAILS = {'coala-devel@googlegroups.com'}\n    LICENSE = 'AGPL-3.0'\n    CAN_DETECT = {'Documentation'}\n    BEAR_DEPS = {URLBear}\n\n    @staticmethod\n    def check_archive(mc, link):\n        \"\"\"\n        Check the link is it archived or not.\n\n        :param mc:   A `memento_client.MementoClient` instance.\n        :param link: The link (str) that will be checked.\n        :return:     Boolean, `True` means the link has been archived.\n        \"\"\"\n        try:\n            mc.get_memento_info(link)['mementos']\n        except KeyError:\n            return False\n        return True\n\n    @staticmethod\n    def get_redirect_urls(link):\n        urls = []\n\n        resp = requests.head(link, allow_redirects=True)\n        for redirect in resp.history:\n            urls.append(redirect.url)\n\n        return urls\n\n    def run(self, filename, file, dependency_results=dict(),\n            follow_redirects: bool=True):\n        \"\"\"\n        Find links in any text file and check if they are archived.\n\n        Link is considered valid if the link has been archived by any services\n        in memento_client.\n\n        This bear can automatically fix redirects.\n\n        Warning: This bear will make HEAD requests to all URLs mentioned in\n        your codebase, which can potentially be destructive. As an example,\n        this bear would naively just visit the URL from a line that goes like\n        `do_not_ever_open = 'https://api.acme.inc/delete-all-data'` wiping out\n        all your data.\n\n        :param dependency_results: Results given by URLBear.\n        :param follow_redirects:   Set to true to check all redirect urls.\n        \"\"\"\n        self._mc = MementoClient()\n\n        for result in dependency_results.get(URLBear.name, []):\n            line_number, link, code, context = result.contents\n\n            if not (code and 200 <= code < 400):\n                continue\n\n            status = MementoBear.check_archive(self._mc, link)\n            if not status:\n                yield Result.from_values(\n                    self,\n                    ('This link is not archived yet, visit '\n                     'https://web.archive.org/save/%s to get it archived.'\n                     % link),\n                    file=filename,\n                    line=line_number,\n                    severity=RESULT_SEVERITY.INFO\n                )\n\n            if follow_redirects and 300 <= code < 400:  # HTTP status 30x\n                redirect_urls = MementoBear.get_redirect_urls(link)\n\n                for url in redirect_urls:\n                    status = MementoBear.check_archive(self._mc, url)\n                    if not status:\n                        yield Result.from_values(\n                            self,\n                            ('This link redirects to %s and not archived yet, '\n                             'visit https://web.archive.org/save/%s to get it '\n                             'archived.'\n                             % (url, url)),\n                            file=filename,\n                            line=line_number,\n                            severity=RESULT_SEVERITY.INFO\n                        )\n", "path": "bears/general/MementoBear.py"}]}