We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Core: drop MySQL dependence on MyISAM
Core depends on MyISAM at the moment because of low level features used for changeid tracking.  We need to migrate that to a more general approach that works on InnoDB and other supported DB engines.
- [x] Make resources list work in all DB backends (#3539)
- [x] Switch revision counter to Redis (#3364)
- [x] Ensure tests run on InnoDB (#3777)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 #
4 # Copyright 2008-2013 Zuza Software Foundation
5 # Copyright 2014 Evernote Corporation
6 #
7 # This file is part of Pootle.
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, see <http://www.gnu.org/licenses/>.
21 
22 import glob
23 import os
24 import re
25 import sys
26 
27 from distutils import log
28 from distutils.command.build import build as DistutilsBuild
29 from distutils.errors import DistutilsOptionError
30 
31 from setuptools import find_packages, setup
32 from setuptools.command.test import test as TestCommand
33 
34 from pootle.__version__ import sver as pootle_version
35 
36 
37 def parse_requirements(file_name):
38     """Parses a pip requirements file and returns a list of packages.
39 
40     Use the result of this function in the ``install_requires`` field.
41     Copied from cburgmer/pdfserver.
42     """
43     requirements = []
44     for line in open(file_name, 'r').read().split('\n'):
45         # Ignore comments, blank lines and included requirements files
46         if re.match(r'(\s*#)|(\s*$)|(-r .*$)', line):
47             continue
48 
49         if re.match(r'\s*-e\s+', line):
50             requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1', line))
51         elif re.match(r'\s*-f\s+', line):
52             pass
53         else:
54             requirements.append(line)
55 
56     return requirements
57 
58 
59 class PyTest(TestCommand):
60 
61     def finalize_options(self):
62         TestCommand.finalize_options(self)
63         self.test_args = ['--tb=short', 'tests/']
64         self.test_suite = True
65 
66     def run_tests(self):
67         #import here, cause outside the eggs aren't loaded
68         import pytest
69         errno = pytest.main(self.test_args)
70         sys.exit(errno)
71 
72 
73 class PootleBuildMo(DistutilsBuild):
74 
75     description = "compile Gettext PO files into MO"
76     user_options = [
77         ('all', None,
78          "compile all language (don't use LINGUAS file)"),
79         ('lang=', 'l',
80          "specify a language to compile"),
81     ]
82     boolean_options = ['all']
83 
84     po_path_base = os.path.join('pootle', 'locale')
85     _langs = []
86 
87     def initialize_options(self):
88         self.all = False
89         self.lang = None
90 
91     def finalize_options(self):
92         if self.all and self.lang is not None:
93             raise DistutilsOptionError(
94                 "Can't use --all and --lang together"
95             )
96         if self.lang is not None:
97             self._langs = [self.lang]
98         elif self.all:
99             for lang in os.listdir(self.po_path_base):
100                 if (os.path.isdir(os.path.join(self.po_path_base, lang)) and
101                     lang != "templates"):
102                     self._langs.append(lang)
103         else:
104             for lang in open(os.path.join('pootle', 'locale', 'LINGUAS')):
105                 self._langs.append(lang.rstrip())
106 
107     def build_mo(self):
108         """Compile .mo files from available .po files"""
109         import subprocess
110         import gettext
111         from translate.storage import factory
112 
113         for lang in self._langs:
114             lang = lang.rstrip()
115 
116             po_path = os.path.join('pootle', 'locale', lang)
117             mo_path = os.path.join('pootle', 'locale', lang, 'LC_MESSAGES')
118 
119             if not os.path.exists(mo_path):
120                 os.makedirs(mo_path)
121 
122             for po, mo in (('pootle.po', 'django.mo'),
123                            ('pootle_js.po', 'djangojs.mo')):
124                 po_filename = os.path.join(po_path, po)
125                 mo_filename = os.path.join(mo_path, mo)
126 
127                 if not os.path.exists(po_filename):
128                     log.warn("%s: missing file %s", lang, po_filename)
129                     continue
130 
131                 if not os.path.exists(mo_path):
132                     os.makedirs(mo_path)
133 
134                 log.info("compiling %s", lang)
135                 try:
136                     subprocess.call([
137                         'msgfmt', '--strict', '-o', mo_filename, po_filename],
138                         stderr=subprocess.STDOUT)
139                 except Exception as e:
140                     log.warn("%s: skipping, running msgfmt failed: %s",
141                              lang, e)
142 
143                 try:
144                     store = factory.getobject(po_filename)
145                     gettext.c2py(store.getheaderplural()[1])
146                 except Exception:
147                     log.warn("%s: invalid plural header in %s",
148                              lang, po_filename)
149 
150     def run(self):
151         self.build_mo()
152 
153 
154 setup(
155     name="Pootle",
156     version=pootle_version,
157 
158     description="An online collaborative localization tool.",
159     long_description=open(
160         os.path.join(os.path.dirname(__file__), 'README.rst')
161     ).read(),
162 
163     author="Translate",
164     author_email="dev@translate.org.za",
165     license="GNU General Public License (GPL)",
166     url="http://pootle.translatehouse.org",
167     download_url="http://sourceforge.net/projects/translate/files/Pootle/" + pootle_version,
168 
169     install_requires=parse_requirements('requirements/base.txt'),
170     tests_require=parse_requirements('requirements/tests.txt'),
171 
172     platforms=["any"],
173     classifiers=[
174         "Development Status :: 5 - Production/Stable",
175         "Environment :: Web Environment",
176         "Framework :: Django",
177         "Intended Audience :: Developers",
178         "Intended Audience :: End Users/Desktop",
179         "Intended Audience :: Information Technology",
180         "License :: OSI Approved :: GNU General Public License (GPL)",
181         "Operating System :: OS Independent",
182         "Operating System :: Microsoft :: Windows",
183         "Operating System :: Unix",
184         "Programming Language :: JavaScript",
185         "Programming Language :: Python",
186         "Topic :: Software Development :: Localization",
187         "Topic :: Text Processing :: Linguistic"
188     ],
189     zip_safe=False,
190     packages=find_packages(exclude=['deploy*']),
191     include_package_data=True,
192 
193     entry_points={
194         'console_scripts': [
195             'pootle = pootle.runner:main',
196         ],
197     },
198     cmdclass={
199         'build_mo': PootleBuildMo,
200         'test': PyTest,
201     },
202 )
203
```
--- 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()

```

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -43,7 +43,7 @@
     requirements = []
     for line in open(file_name, 'r').read().split('\n'):
         # Ignore comments, blank lines and included requirements files
-        if re.match(r'(\s*#)|(\s*$)|(-r .*$)', line):
+        if re.match(r'(\s*#)|(\s*$)|((-r|--allow-external|--allow-unverified) .*$)', line):
             continue
 
         if re.match(r'\s*-e\s+', line):

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -43,7 +43,7 @@\n     requirements = []\n     for line in open(file_name, 'r').read().split('\\n'):\n         # Ignore comments, blank lines and included requirements files\n-        if re.match(r'(\\s*#)|(\\s*$)|(-r .*$)', line):\n+        if re.match(r'(\\s*#)|(\\s*$)|((-r|--allow-external|--allow-unverified) .*$)', line):\n             continue\n \n         if re.match(r'\\s*-e\\s+', line):\n", "issue": "Core: drop MySQL dependence on MyISAM\nCore depends on MyISAM at the moment because of low level features used for changeid tracking.  We need to migrate that to a more general approach that works on InnoDB and other supported DB engines.\n- [x] Make resources list work in all DB backends (#3539)\n- [x] Switch revision counter to Redis (#3364)\n- [x] Ensure tests run on InnoDB (#3777)\n\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright 2008-2013 Zuza Software Foundation\n# Copyright 2014 Evernote Corporation\n#\n# This file is part of Pootle.\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, see <http://www.gnu.org/licenses/>.\n\nimport glob\nimport os\nimport re\nimport sys\n\nfrom distutils import log\nfrom distutils.command.build import build as DistutilsBuild\nfrom distutils.errors import DistutilsOptionError\n\nfrom setuptools import find_packages, setup\nfrom setuptools.command.test import test as TestCommand\n\nfrom pootle.__version__ import sver as pootle_version\n\n\ndef parse_requirements(file_name):\n    \"\"\"Parses a pip requirements file and returns a list of packages.\n\n    Use the result of this function in the ``install_requires`` field.\n    Copied from cburgmer/pdfserver.\n    \"\"\"\n    requirements = []\n    for line in open(file_name, 'r').read().split('\\n'):\n        # Ignore comments, blank lines and included requirements files\n        if re.match(r'(\\s*#)|(\\s*$)|(-r .*$)', line):\n            continue\n\n        if re.match(r'\\s*-e\\s+', line):\n            requirements.append(re.sub(r'\\s*-e\\s+.*#egg=(.*)$', r'\\1', line))\n        elif re.match(r'\\s*-f\\s+', line):\n            pass\n        else:\n            requirements.append(line)\n\n    return requirements\n\n\nclass PyTest(TestCommand):\n\n    def finalize_options(self):\n        TestCommand.finalize_options(self)\n        self.test_args = ['--tb=short', 'tests/']\n        self.test_suite = True\n\n    def run_tests(self):\n        #import here, cause outside the eggs aren't loaded\n        import pytest\n        errno = pytest.main(self.test_args)\n        sys.exit(errno)\n\n\nclass PootleBuildMo(DistutilsBuild):\n\n    description = \"compile Gettext PO files into MO\"\n    user_options = [\n        ('all', None,\n         \"compile all language (don't use LINGUAS file)\"),\n        ('lang=', 'l',\n         \"specify a language to compile\"),\n    ]\n    boolean_options = ['all']\n\n    po_path_base = os.path.join('pootle', 'locale')\n    _langs = []\n\n    def initialize_options(self):\n        self.all = False\n        self.lang = None\n\n    def finalize_options(self):\n        if self.all and self.lang is not None:\n            raise DistutilsOptionError(\n                \"Can't use --all and --lang together\"\n            )\n        if self.lang is not None:\n            self._langs = [self.lang]\n        elif self.all:\n            for lang in os.listdir(self.po_path_base):\n                if (os.path.isdir(os.path.join(self.po_path_base, lang)) and\n                    lang != \"templates\"):\n                    self._langs.append(lang)\n        else:\n            for lang in open(os.path.join('pootle', 'locale', 'LINGUAS')):\n                self._langs.append(lang.rstrip())\n\n    def build_mo(self):\n        \"\"\"Compile .mo files from available .po files\"\"\"\n        import subprocess\n        import gettext\n        from translate.storage import factory\n\n        for lang in self._langs:\n            lang = lang.rstrip()\n\n            po_path = os.path.join('pootle', 'locale', lang)\n            mo_path = os.path.join('pootle', 'locale', lang, 'LC_MESSAGES')\n\n            if not os.path.exists(mo_path):\n                os.makedirs(mo_path)\n\n            for po, mo in (('pootle.po', 'django.mo'),\n                           ('pootle_js.po', 'djangojs.mo')):\n                po_filename = os.path.join(po_path, po)\n                mo_filename = os.path.join(mo_path, mo)\n\n                if not os.path.exists(po_filename):\n                    log.warn(\"%s: missing file %s\", lang, po_filename)\n                    continue\n\n                if not os.path.exists(mo_path):\n                    os.makedirs(mo_path)\n\n                log.info(\"compiling %s\", lang)\n                try:\n                    subprocess.call([\n                        'msgfmt', '--strict', '-o', mo_filename, po_filename],\n                        stderr=subprocess.STDOUT)\n                except Exception as e:\n                    log.warn(\"%s: skipping, running msgfmt failed: %s\",\n                             lang, e)\n\n                try:\n                    store = factory.getobject(po_filename)\n                    gettext.c2py(store.getheaderplural()[1])\n                except Exception:\n                    log.warn(\"%s: invalid plural header in %s\",\n                             lang, po_filename)\n\n    def run(self):\n        self.build_mo()\n\n\nsetup(\n    name=\"Pootle\",\n    version=pootle_version,\n\n    description=\"An online collaborative localization tool.\",\n    long_description=open(\n        os.path.join(os.path.dirname(__file__), 'README.rst')\n    ).read(),\n\n    author=\"Translate\",\n    author_email=\"dev@translate.org.za\",\n    license=\"GNU General Public License (GPL)\",\n    url=\"http://pootle.translatehouse.org\",\n    download_url=\"http://sourceforge.net/projects/translate/files/Pootle/\" + pootle_version,\n\n    install_requires=parse_requirements('requirements/base.txt'),\n    tests_require=parse_requirements('requirements/tests.txt'),\n\n    platforms=[\"any\"],\n    classifiers=[\n        \"Development Status :: 5 - Production/Stable\",\n        \"Environment :: Web Environment\",\n        \"Framework :: Django\",\n        \"Intended Audience :: Developers\",\n        \"Intended Audience :: End Users/Desktop\",\n        \"Intended Audience :: Information Technology\",\n        \"License :: OSI Approved :: GNU General Public License (GPL)\",\n        \"Operating System :: OS Independent\",\n        \"Operating System :: Microsoft :: Windows\",\n        \"Operating System :: Unix\",\n        \"Programming Language :: JavaScript\",\n        \"Programming Language :: Python\",\n        \"Topic :: Software Development :: Localization\",\n        \"Topic :: Text Processing :: Linguistic\"\n    ],\n    zip_safe=False,\n    packages=find_packages(exclude=['deploy*']),\n    include_package_data=True,\n\n    entry_points={\n        'console_scripts': [\n            'pootle = pootle.runner:main',\n        ],\n    },\n    cmdclass={\n        'build_mo': PootleBuildMo,\n        'test': PyTest,\n    },\n)\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright 2008-2013 Zuza Software Foundation\n# Copyright 2014 Evernote Corporation\n#\n# This file is part of Pootle.\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, see <http://www.gnu.org/licenses/>.\n\nimport glob\nimport os\nimport re\nimport sys\n\nfrom distutils import log\nfrom distutils.command.build import build as DistutilsBuild\nfrom distutils.errors import DistutilsOptionError\n\nfrom setuptools import find_packages, setup\nfrom setuptools.command.test import test as TestCommand\n\nfrom pootle.__version__ import sver as pootle_version\n\n\ndef parse_requirements(file_name):\n    \"\"\"Parses a pip requirements file and returns a list of packages.\n\n    Use the result of this function in the ``install_requires`` field.\n    Copied from cburgmer/pdfserver.\n    \"\"\"\n    requirements = []\n    for line in open(file_name, 'r').read().split('\\n'):\n        # Ignore comments, blank lines and included requirements files\n        if re.match(r'(\\s*#)|(\\s*$)|((-r|--allow-external|--allow-unverified) .*$)', line):\n            continue\n\n        if re.match(r'\\s*-e\\s+', line):\n            requirements.append(re.sub(r'\\s*-e\\s+.*#egg=(.*)$', r'\\1', line))\n        elif re.match(r'\\s*-f\\s+', line):\n            pass\n        else:\n            requirements.append(line)\n\n    return requirements\n\n\nclass PyTest(TestCommand):\n\n    def finalize_options(self):\n        TestCommand.finalize_options(self)\n        self.test_args = ['--tb=short', 'tests/']\n        self.test_suite = True\n\n    def run_tests(self):\n        #import here, cause outside the eggs aren't loaded\n        import pytest\n        errno = pytest.main(self.test_args)\n        sys.exit(errno)\n\n\nclass PootleBuildMo(DistutilsBuild):\n\n    description = \"compile Gettext PO files into MO\"\n    user_options = [\n        ('all', None,\n         \"compile all language (don't use LINGUAS file)\"),\n        ('lang=', 'l',\n         \"specify a language to compile\"),\n    ]\n    boolean_options = ['all']\n\n    po_path_base = os.path.join('pootle', 'locale')\n    _langs = []\n\n    def initialize_options(self):\n        self.all = False\n        self.lang = None\n\n    def finalize_options(self):\n        if self.all and self.lang is not None:\n            raise DistutilsOptionError(\n                \"Can't use --all and --lang together\"\n            )\n        if self.lang is not None:\n            self._langs = [self.lang]\n        elif self.all:\n            for lang in os.listdir(self.po_path_base):\n                if (os.path.isdir(os.path.join(self.po_path_base, lang)) and\n                    lang != \"templates\"):\n                    self._langs.append(lang)\n        else:\n            for lang in open(os.path.join('pootle', 'locale', 'LINGUAS')):\n                self._langs.append(lang.rstrip())\n\n    def build_mo(self):\n        \"\"\"Compile .mo files from available .po files\"\"\"\n        import subprocess\n        import gettext\n        from translate.storage import factory\n\n        for lang in self._langs:\n            lang = lang.rstrip()\n\n            po_path = os.path.join('pootle', 'locale', lang)\n            mo_path = os.path.join('pootle', 'locale', lang, 'LC_MESSAGES')\n\n            if not os.path.exists(mo_path):\n                os.makedirs(mo_path)\n\n            for po, mo in (('pootle.po', 'django.mo'),\n                           ('pootle_js.po', 'djangojs.mo')):\n                po_filename = os.path.join(po_path, po)\n                mo_filename = os.path.join(mo_path, mo)\n\n                if not os.path.exists(po_filename):\n                    log.warn(\"%s: missing file %s\", lang, po_filename)\n                    continue\n\n                if not os.path.exists(mo_path):\n                    os.makedirs(mo_path)\n\n                log.info(\"compiling %s\", lang)\n                try:\n                    subprocess.call([\n                        'msgfmt', '--strict', '-o', mo_filename, po_filename],\n                        stderr=subprocess.STDOUT)\n                except Exception as e:\n                    log.warn(\"%s: skipping, running msgfmt failed: %s\",\n                             lang, e)\n\n                try:\n                    store = factory.getobject(po_filename)\n                    gettext.c2py(store.getheaderplural()[1])\n                except Exception:\n                    log.warn(\"%s: invalid plural header in %s\",\n                             lang, po_filename)\n\n    def run(self):\n        self.build_mo()\n\n\nsetup(\n    name=\"Pootle\",\n    version=pootle_version,\n\n    description=\"An online collaborative localization tool.\",\n    long_description=open(\n        os.path.join(os.path.dirname(__file__), 'README.rst')\n    ).read(),\n\n    author=\"Translate\",\n    author_email=\"dev@translate.org.za\",\n    license=\"GNU General Public License (GPL)\",\n    url=\"http://pootle.translatehouse.org\",\n    download_url=\"http://sourceforge.net/projects/translate/files/Pootle/\" + pootle_version,\n\n    install_requires=parse_requirements('requirements/base.txt'),\n    tests_require=parse_requirements('requirements/tests.txt'),\n\n    platforms=[\"any\"],\n    classifiers=[\n        \"Development Status :: 5 - Production/Stable\",\n        \"Environment :: Web Environment\",\n        \"Framework :: Django\",\n        \"Intended Audience :: Developers\",\n        \"Intended Audience :: End Users/Desktop\",\n        \"Intended Audience :: Information Technology\",\n        \"License :: OSI Approved :: GNU General Public License (GPL)\",\n        \"Operating System :: OS Independent\",\n        \"Operating System :: Microsoft :: Windows\",\n        \"Operating System :: Unix\",\n        \"Programming Language :: JavaScript\",\n        \"Programming Language :: Python\",\n        \"Topic :: Software Development :: Localization\",\n        \"Topic :: Text Processing :: Linguistic\"\n    ],\n    zip_safe=False,\n    packages=find_packages(exclude=['deploy*']),\n    include_package_data=True,\n\n    entry_points={\n        'console_scripts': [\n            'pootle = pootle.runner:main',\n        ],\n    },\n    cmdclass={\n        'build_mo': PootleBuildMo,\n        'test': PyTest,\n    },\n)\n", "path": "setup.py"}]}