We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add six as dependency
Just a quick tracking issue to remember to add six as dependency. It is currently used, but it's just an indirect dependency of many other packages. For clarity, it would be good to add it to the dependencies. I'm not sure how to do it myself, the file is non-standard.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `synapse/python_dependencies.py`
Content:
```
1 # Copyright 2015, 2016 OpenMarket Ltd
2 # Copyright 2017 Vector Creations Ltd
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 import logging
17 from distutils.version import LooseVersion
18 
19 logger = logging.getLogger(__name__)
20 
21 REQUIREMENTS = {
22     "jsonschema>=2.5.1": ["jsonschema>=2.5.1"],
23     "frozendict>=0.4": ["frozendict"],
24     "unpaddedbase64>=1.1.0": ["unpaddedbase64>=1.1.0"],
25     "canonicaljson>=1.1.3": ["canonicaljson>=1.1.3"],
26     "signedjson>=1.0.0": ["signedjson>=1.0.0"],
27     "pynacl>=1.2.1": ["nacl>=1.2.1", "nacl.bindings"],
28     "service_identity>=1.0.0": ["service_identity>=1.0.0"],
29     "Twisted>=16.0.0": ["twisted>=16.0.0"],
30     "pyopenssl>=0.14": ["OpenSSL>=0.14"],
31     "pyyaml": ["yaml"],
32     "pyasn1": ["pyasn1"],
33     "daemonize": ["daemonize"],
34     "bcrypt": ["bcrypt>=3.1.0"],
35     "pillow": ["PIL"],
36     "pydenticon": ["pydenticon"],
37     "blist": ["blist"],
38     "pysaml2>=3.0.0": ["saml2>=3.0.0"],
39     "pymacaroons-pynacl": ["pymacaroons"],
40     "msgpack-python>=0.3.0": ["msgpack"],
41     "phonenumbers>=8.2.0": ["phonenumbers"],
42 }
43 CONDITIONAL_REQUIREMENTS = {
44     "web_client": {
45         "matrix_angular_sdk>=0.6.8": ["syweb>=0.6.8"],
46     },
47     "preview_url": {
48         "netaddr>=0.7.18": ["netaddr"],
49     },
50     "email.enable_notifs": {
51         "Jinja2>=2.8": ["Jinja2>=2.8"],
52         "bleach>=1.4.2": ["bleach>=1.4.2"],
53     },
54     "matrix-synapse-ldap3": {
55         "matrix-synapse-ldap3>=0.1": ["ldap_auth_provider"],
56     },
57     "psutil": {
58         "psutil>=2.0.0": ["psutil>=2.0.0"],
59     },
60     "affinity": {
61         "affinity": ["affinity"],
62     },
63 }
64 
65 
66 def requirements(config=None, include_conditional=False):
67     reqs = REQUIREMENTS.copy()
68     if include_conditional:
69         for _, req in CONDITIONAL_REQUIREMENTS.items():
70             reqs.update(req)
71     return reqs
72 
73 
74 def github_link(project, version, egg):
75     return "https://github.com/%s/tarball/%s/#egg=%s" % (project, version, egg)
76 
77 
78 DEPENDENCY_LINKS = {
79 }
80 
81 
82 class MissingRequirementError(Exception):
83     def __init__(self, message, module_name, dependency):
84         super(MissingRequirementError, self).__init__(message)
85         self.module_name = module_name
86         self.dependency = dependency
87 
88 
89 def check_requirements(config=None):
90     """Checks that all the modules needed by synapse have been correctly
91     installed and are at the correct version"""
92     for dependency, module_requirements in (
93             requirements(config, include_conditional=False).items()):
94         for module_requirement in module_requirements:
95             if ">=" in module_requirement:
96                 module_name, required_version = module_requirement.split(">=")
97                 version_test = ">="
98             elif "==" in module_requirement:
99                 module_name, required_version = module_requirement.split("==")
100                 version_test = "=="
101             else:
102                 module_name = module_requirement
103                 version_test = None
104 
105             try:
106                 module = __import__(module_name)
107             except ImportError:
108                 logging.exception(
109                     "Can't import %r which is part of %r",
110                     module_name, dependency
111                 )
112                 raise MissingRequirementError(
113                     "Can't import %r which is part of %r"
114                     % (module_name, dependency), module_name, dependency
115                 )
116             version = getattr(module, "__version__", None)
117             file_path = getattr(module, "__file__", None)
118             logger.info(
119                 "Using %r version %r from %r to satisfy %r",
120                 module_name, version, file_path, dependency
121             )
122 
123             if version_test == ">=":
124                 if version is None:
125                     raise MissingRequirementError(
126                         "Version of %r isn't set as __version__ of module %r"
127                         % (dependency, module_name), module_name, dependency
128                     )
129                 if LooseVersion(version) < LooseVersion(required_version):
130                     raise MissingRequirementError(
131                         "Version of %r in %r is too old. %r < %r"
132                         % (dependency, file_path, version, required_version),
133                         module_name, dependency
134                     )
135             elif version_test == "==":
136                 if version is None:
137                     raise MissingRequirementError(
138                         "Version of %r isn't set as __version__ of module %r"
139                         % (dependency, module_name), module_name, dependency
140                     )
141                 if LooseVersion(version) != LooseVersion(required_version):
142                     raise MissingRequirementError(
143                         "Unexpected version of %r in %r. %r != %r"
144                         % (dependency, file_path, version, required_version),
145                         module_name, dependency
146                     )
147 
148 
149 def list_requirements():
150     result = []
151     linked = []
152     for link in DEPENDENCY_LINKS.values():
153         egg = link.split("#egg=")[1]
154         linked.append(egg.split('-')[0])
155         result.append(link)
156     for requirement in requirements(include_conditional=True):
157         is_linked = False
158         for link in linked:
159             if requirement.replace('-', '_').startswith(link):
160                 is_linked = True
161         if not is_linked:
162             result.append(requirement)
163     return result
164 
165 
166 if __name__ == "__main__":
167     import sys
168     sys.stdout.writelines(req + "\n" for req in list_requirements())
169
```
--- 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/synapse/python_dependencies.py b/synapse/python_dependencies.py
--- a/synapse/python_dependencies.py
+++ b/synapse/python_dependencies.py
@@ -1,5 +1,6 @@
 # Copyright 2015, 2016 OpenMarket Ltd
 # Copyright 2017 Vector Creations Ltd
+# Copyright 2018 New Vector Ltd
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -18,6 +19,18 @@
 
 logger = logging.getLogger(__name__)
 
+# this dict maps from python package name to a list of modules we expect it to
+# provide.
+#
+# the key is a "requirement specifier", as used as a parameter to `pip
+# install`[1], or an `install_requires` argument to `setuptools.setup` [2].
+#
+# the value is a sequence of strings; each entry should be the name of the
+# python module, optionally followed by a version assertion which can be either
+# ">=<ver>" or "==<ver>".
+#
+# [1] https://pip.pypa.io/en/stable/reference/pip_install/#requirement-specifiers.
+# [2] https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-dependencies
 REQUIREMENTS = {
     "jsonschema>=2.5.1": ["jsonschema>=2.5.1"],
     "frozendict>=0.4": ["frozendict"],
@@ -26,7 +39,11 @@
     "signedjson>=1.0.0": ["signedjson>=1.0.0"],
     "pynacl>=1.2.1": ["nacl>=1.2.1", "nacl.bindings"],
     "service_identity>=1.0.0": ["service_identity>=1.0.0"],
-    "Twisted>=16.0.0": ["twisted>=16.0.0"],
+
+    # we break under Twisted 18.4
+    # (https://github.com/matrix-org/synapse/issues/3135)
+    "Twisted>=16.0.0,<18.4": ["twisted>=16.0.0"],
+
     "pyopenssl>=0.14": ["OpenSSL>=0.14"],
     "pyyaml": ["yaml"],
     "pyasn1": ["pyasn1"],
@@ -39,6 +56,7 @@
     "pymacaroons-pynacl": ["pymacaroons"],
     "msgpack-python>=0.3.0": ["msgpack"],
     "phonenumbers>=8.2.0": ["phonenumbers"],
+    "six": ["six"],
 }
 CONDITIONAL_REQUIREMENTS = {
     "web_client": {

{"golden_diff": "diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py\n--- a/synapse/python_dependencies.py\n+++ b/synapse/python_dependencies.py\n@@ -1,5 +1,6 @@\n # Copyright 2015, 2016 OpenMarket Ltd\n # Copyright 2017 Vector Creations Ltd\n+# Copyright 2018 New Vector Ltd\n #\n # Licensed under the Apache License, Version 2.0 (the \"License\");\n # you may not use this file except in compliance with the License.\n@@ -18,6 +19,18 @@\n \n logger = logging.getLogger(__name__)\n \n+# this dict maps from python package name to a list of modules we expect it to\n+# provide.\n+#\n+# the key is a \"requirement specifier\", as used as a parameter to `pip\n+# install`[1], or an `install_requires` argument to `setuptools.setup` [2].\n+#\n+# the value is a sequence of strings; each entry should be the name of the\n+# python module, optionally followed by a version assertion which can be either\n+# \">=<ver>\" or \"==<ver>\".\n+#\n+# [1] https://pip.pypa.io/en/stable/reference/pip_install/#requirement-specifiers.\n+# [2] https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-dependencies\n REQUIREMENTS = {\n     \"jsonschema>=2.5.1\": [\"jsonschema>=2.5.1\"],\n     \"frozendict>=0.4\": [\"frozendict\"],\n@@ -26,7 +39,11 @@\n     \"signedjson>=1.0.0\": [\"signedjson>=1.0.0\"],\n     \"pynacl>=1.2.1\": [\"nacl>=1.2.1\", \"nacl.bindings\"],\n     \"service_identity>=1.0.0\": [\"service_identity>=1.0.0\"],\n-    \"Twisted>=16.0.0\": [\"twisted>=16.0.0\"],\n+\n+    # we break under Twisted 18.4\n+    # (https://github.com/matrix-org/synapse/issues/3135)\n+    \"Twisted>=16.0.0,<18.4\": [\"twisted>=16.0.0\"],\n+\n     \"pyopenssl>=0.14\": [\"OpenSSL>=0.14\"],\n     \"pyyaml\": [\"yaml\"],\n     \"pyasn1\": [\"pyasn1\"],\n@@ -39,6 +56,7 @@\n     \"pymacaroons-pynacl\": [\"pymacaroons\"],\n     \"msgpack-python>=0.3.0\": [\"msgpack\"],\n     \"phonenumbers>=8.2.0\": [\"phonenumbers\"],\n+    \"six\": [\"six\"],\n }\n CONDITIONAL_REQUIREMENTS = {\n     \"web_client\": {\n", "issue": "Add six as dependency\nJust a quick tracking issue to remember to add six as dependency. It is currently used, but it's just an indirect dependency of many other packages. For clarity, it would be good to add it to the dependencies. I'm not sure how to do it myself, the file is non-standard.\n", "before_files": [{"content": "# Copyright 2015, 2016 OpenMarket Ltd\n# Copyright 2017 Vector Creations Ltd\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport logging\nfrom distutils.version import LooseVersion\n\nlogger = logging.getLogger(__name__)\n\nREQUIREMENTS = {\n    \"jsonschema>=2.5.1\": [\"jsonschema>=2.5.1\"],\n    \"frozendict>=0.4\": [\"frozendict\"],\n    \"unpaddedbase64>=1.1.0\": [\"unpaddedbase64>=1.1.0\"],\n    \"canonicaljson>=1.1.3\": [\"canonicaljson>=1.1.3\"],\n    \"signedjson>=1.0.0\": [\"signedjson>=1.0.0\"],\n    \"pynacl>=1.2.1\": [\"nacl>=1.2.1\", \"nacl.bindings\"],\n    \"service_identity>=1.0.0\": [\"service_identity>=1.0.0\"],\n    \"Twisted>=16.0.0\": [\"twisted>=16.0.0\"],\n    \"pyopenssl>=0.14\": [\"OpenSSL>=0.14\"],\n    \"pyyaml\": [\"yaml\"],\n    \"pyasn1\": [\"pyasn1\"],\n    \"daemonize\": [\"daemonize\"],\n    \"bcrypt\": [\"bcrypt>=3.1.0\"],\n    \"pillow\": [\"PIL\"],\n    \"pydenticon\": [\"pydenticon\"],\n    \"blist\": [\"blist\"],\n    \"pysaml2>=3.0.0\": [\"saml2>=3.0.0\"],\n    \"pymacaroons-pynacl\": [\"pymacaroons\"],\n    \"msgpack-python>=0.3.0\": [\"msgpack\"],\n    \"phonenumbers>=8.2.0\": [\"phonenumbers\"],\n}\nCONDITIONAL_REQUIREMENTS = {\n    \"web_client\": {\n        \"matrix_angular_sdk>=0.6.8\": [\"syweb>=0.6.8\"],\n    },\n    \"preview_url\": {\n        \"netaddr>=0.7.18\": [\"netaddr\"],\n    },\n    \"email.enable_notifs\": {\n        \"Jinja2>=2.8\": [\"Jinja2>=2.8\"],\n        \"bleach>=1.4.2\": [\"bleach>=1.4.2\"],\n    },\n    \"matrix-synapse-ldap3\": {\n        \"matrix-synapse-ldap3>=0.1\": [\"ldap_auth_provider\"],\n    },\n    \"psutil\": {\n        \"psutil>=2.0.0\": [\"psutil>=2.0.0\"],\n    },\n    \"affinity\": {\n        \"affinity\": [\"affinity\"],\n    },\n}\n\n\ndef requirements(config=None, include_conditional=False):\n    reqs = REQUIREMENTS.copy()\n    if include_conditional:\n        for _, req in CONDITIONAL_REQUIREMENTS.items():\n            reqs.update(req)\n    return reqs\n\n\ndef github_link(project, version, egg):\n    return \"https://github.com/%s/tarball/%s/#egg=%s\" % (project, version, egg)\n\n\nDEPENDENCY_LINKS = {\n}\n\n\nclass MissingRequirementError(Exception):\n    def __init__(self, message, module_name, dependency):\n        super(MissingRequirementError, self).__init__(message)\n        self.module_name = module_name\n        self.dependency = dependency\n\n\ndef check_requirements(config=None):\n    \"\"\"Checks that all the modules needed by synapse have been correctly\n    installed and are at the correct version\"\"\"\n    for dependency, module_requirements in (\n            requirements(config, include_conditional=False).items()):\n        for module_requirement in module_requirements:\n            if \">=\" in module_requirement:\n                module_name, required_version = module_requirement.split(\">=\")\n                version_test = \">=\"\n            elif \"==\" in module_requirement:\n                module_name, required_version = module_requirement.split(\"==\")\n                version_test = \"==\"\n            else:\n                module_name = module_requirement\n                version_test = None\n\n            try:\n                module = __import__(module_name)\n            except ImportError:\n                logging.exception(\n                    \"Can't import %r which is part of %r\",\n                    module_name, dependency\n                )\n                raise MissingRequirementError(\n                    \"Can't import %r which is part of %r\"\n                    % (module_name, dependency), module_name, dependency\n                )\n            version = getattr(module, \"__version__\", None)\n            file_path = getattr(module, \"__file__\", None)\n            logger.info(\n                \"Using %r version %r from %r to satisfy %r\",\n                module_name, version, file_path, dependency\n            )\n\n            if version_test == \">=\":\n                if version is None:\n                    raise MissingRequirementError(\n                        \"Version of %r isn't set as __version__ of module %r\"\n                        % (dependency, module_name), module_name, dependency\n                    )\n                if LooseVersion(version) < LooseVersion(required_version):\n                    raise MissingRequirementError(\n                        \"Version of %r in %r is too old. %r < %r\"\n                        % (dependency, file_path, version, required_version),\n                        module_name, dependency\n                    )\n            elif version_test == \"==\":\n                if version is None:\n                    raise MissingRequirementError(\n                        \"Version of %r isn't set as __version__ of module %r\"\n                        % (dependency, module_name), module_name, dependency\n                    )\n                if LooseVersion(version) != LooseVersion(required_version):\n                    raise MissingRequirementError(\n                        \"Unexpected version of %r in %r. %r != %r\"\n                        % (dependency, file_path, version, required_version),\n                        module_name, dependency\n                    )\n\n\ndef list_requirements():\n    result = []\n    linked = []\n    for link in DEPENDENCY_LINKS.values():\n        egg = link.split(\"#egg=\")[1]\n        linked.append(egg.split('-')[0])\n        result.append(link)\n    for requirement in requirements(include_conditional=True):\n        is_linked = False\n        for link in linked:\n            if requirement.replace('-', '_').startswith(link):\n                is_linked = True\n        if not is_linked:\n            result.append(requirement)\n    return result\n\n\nif __name__ == \"__main__\":\n    import sys\n    sys.stdout.writelines(req + \"\\n\" for req in list_requirements())\n", "path": "synapse/python_dependencies.py"}], "after_files": [{"content": "# Copyright 2015, 2016 OpenMarket Ltd\n# Copyright 2017 Vector Creations Ltd\n# Copyright 2018 New Vector Ltd\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport logging\nfrom distutils.version import LooseVersion\n\nlogger = logging.getLogger(__name__)\n\n# this dict maps from python package name to a list of modules we expect it to\n# provide.\n#\n# the key is a \"requirement specifier\", as used as a parameter to `pip\n# install`[1], or an `install_requires` argument to `setuptools.setup` [2].\n#\n# the value is a sequence of strings; each entry should be the name of the\n# python module, optionally followed by a version assertion which can be either\n# \">=<ver>\" or \"==<ver>\".\n#\n# [1] https://pip.pypa.io/en/stable/reference/pip_install/#requirement-specifiers.\n# [2] https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-dependencies\nREQUIREMENTS = {\n    \"jsonschema>=2.5.1\": [\"jsonschema>=2.5.1\"],\n    \"frozendict>=0.4\": [\"frozendict\"],\n    \"unpaddedbase64>=1.1.0\": [\"unpaddedbase64>=1.1.0\"],\n    \"canonicaljson>=1.1.3\": [\"canonicaljson>=1.1.3\"],\n    \"signedjson>=1.0.0\": [\"signedjson>=1.0.0\"],\n    \"pynacl>=1.2.1\": [\"nacl>=1.2.1\", \"nacl.bindings\"],\n    \"service_identity>=1.0.0\": [\"service_identity>=1.0.0\"],\n\n    # we break under Twisted 18.4\n    # (https://github.com/matrix-org/synapse/issues/3135)\n    \"Twisted>=16.0.0,<18.4\": [\"twisted>=16.0.0\"],\n\n    \"pyopenssl>=0.14\": [\"OpenSSL>=0.14\"],\n    \"pyyaml\": [\"yaml\"],\n    \"pyasn1\": [\"pyasn1\"],\n    \"daemonize\": [\"daemonize\"],\n    \"bcrypt\": [\"bcrypt>=3.1.0\"],\n    \"pillow\": [\"PIL\"],\n    \"pydenticon\": [\"pydenticon\"],\n    \"blist\": [\"blist\"],\n    \"pysaml2>=3.0.0\": [\"saml2>=3.0.0\"],\n    \"pymacaroons-pynacl\": [\"pymacaroons\"],\n    \"msgpack-python>=0.3.0\": [\"msgpack\"],\n    \"phonenumbers>=8.2.0\": [\"phonenumbers\"],\n    \"six\": [\"six\"],\n}\nCONDITIONAL_REQUIREMENTS = {\n    \"web_client\": {\n        \"matrix_angular_sdk>=0.6.8\": [\"syweb>=0.6.8\"],\n    },\n    \"preview_url\": {\n        \"netaddr>=0.7.18\": [\"netaddr\"],\n    },\n    \"email.enable_notifs\": {\n        \"Jinja2>=2.8\": [\"Jinja2>=2.8\"],\n        \"bleach>=1.4.2\": [\"bleach>=1.4.2\"],\n    },\n    \"matrix-synapse-ldap3\": {\n        \"matrix-synapse-ldap3>=0.1\": [\"ldap_auth_provider\"],\n    },\n    \"psutil\": {\n        \"psutil>=2.0.0\": [\"psutil>=2.0.0\"],\n    },\n    \"affinity\": {\n        \"affinity\": [\"affinity\"],\n    },\n}\n\n\ndef requirements(config=None, include_conditional=False):\n    reqs = REQUIREMENTS.copy()\n    if include_conditional:\n        for _, req in CONDITIONAL_REQUIREMENTS.items():\n            reqs.update(req)\n    return reqs\n\n\ndef github_link(project, version, egg):\n    return \"https://github.com/%s/tarball/%s/#egg=%s\" % (project, version, egg)\n\n\nDEPENDENCY_LINKS = {\n}\n\n\nclass MissingRequirementError(Exception):\n    def __init__(self, message, module_name, dependency):\n        super(MissingRequirementError, self).__init__(message)\n        self.module_name = module_name\n        self.dependency = dependency\n\n\ndef check_requirements(config=None):\n    \"\"\"Checks that all the modules needed by synapse have been correctly\n    installed and are at the correct version\"\"\"\n    for dependency, module_requirements in (\n            requirements(config, include_conditional=False).items()):\n        for module_requirement in module_requirements:\n            if \">=\" in module_requirement:\n                module_name, required_version = module_requirement.split(\">=\")\n                version_test = \">=\"\n            elif \"==\" in module_requirement:\n                module_name, required_version = module_requirement.split(\"==\")\n                version_test = \"==\"\n            else:\n                module_name = module_requirement\n                version_test = None\n\n            try:\n                module = __import__(module_name)\n            except ImportError:\n                logging.exception(\n                    \"Can't import %r which is part of %r\",\n                    module_name, dependency\n                )\n                raise MissingRequirementError(\n                    \"Can't import %r which is part of %r\"\n                    % (module_name, dependency), module_name, dependency\n                )\n            version = getattr(module, \"__version__\", None)\n            file_path = getattr(module, \"__file__\", None)\n            logger.info(\n                \"Using %r version %r from %r to satisfy %r\",\n                module_name, version, file_path, dependency\n            )\n\n            if version_test == \">=\":\n                if version is None:\n                    raise MissingRequirementError(\n                        \"Version of %r isn't set as __version__ of module %r\"\n                        % (dependency, module_name), module_name, dependency\n                    )\n                if LooseVersion(version) < LooseVersion(required_version):\n                    raise MissingRequirementError(\n                        \"Version of %r in %r is too old. %r < %r\"\n                        % (dependency, file_path, version, required_version),\n                        module_name, dependency\n                    )\n            elif version_test == \"==\":\n                if version is None:\n                    raise MissingRequirementError(\n                        \"Version of %r isn't set as __version__ of module %r\"\n                        % (dependency, module_name), module_name, dependency\n                    )\n                if LooseVersion(version) != LooseVersion(required_version):\n                    raise MissingRequirementError(\n                        \"Unexpected version of %r in %r. %r != %r\"\n                        % (dependency, file_path, version, required_version),\n                        module_name, dependency\n                    )\n\n\ndef list_requirements():\n    result = []\n    linked = []\n    for link in DEPENDENCY_LINKS.values():\n        egg = link.split(\"#egg=\")[1]\n        linked.append(egg.split('-')[0])\n        result.append(link)\n    for requirement in requirements(include_conditional=True):\n        is_linked = False\n        for link in linked:\n            if requirement.replace('-', '_').startswith(link):\n                is_linked = True\n        if not is_linked:\n            result.append(requirement)\n    return result\n\n\nif __name__ == \"__main__\":\n    import sys\n    sys.stdout.writelines(req + \"\\n\" for req in list_requirements())\n", "path": "synapse/python_dependencies.py"}]}