We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
setup.py depends on external dataclasses package for python >= 3.8
Setup.py has a check
```python
is_py37 = sys.version_info.major == 3 and sys.version_info.minor == 7
```
and adds the PyPI `dataclasses` package to the requirements when `not is_py37`. (`dataclasses` has been incorporated in the stdlib in python 3.7.) With python 3.8 released, this check is inaccurate, as setup.py currently adds the dependency on dataclasses when the python version is 3.8 or later, not just when it's less than 3.7.

--- 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 # pylint: skip-file
5 
6 import os
7 import sys
8 from pathlib import Path
9 
10 from pkg_resources import parse_version
11 from setuptools import find_packages, setup
12 
13 is_py37 = sys.version_info.major == 3 and sys.version_info.minor == 7
14 on_rtd = os.environ.get("READTHEDOCS", None) == "True"  # copied from the docs
15 
16 # Dependencies of GPflow
17 requirements = ["numpy>=1.10.0", "scipy>=0.18.0", "multipledispatch>=0.4.9", "tabulate"]
18 
19 if not is_py37:
20     requirements.append("dataclasses")
21 
22 if not on_rtd:
23     requirements.append("tensorflow-probability>=0.9")
24 
25 min_tf_version = "2.1.0"
26 tf_cpu = "tensorflow"
27 tf_gpu = "tensorflow-gpu"
28 
29 
30 # for latest_version() [see https://github.com/GPflow/GPflow/issues/1348]:
31 def latest_version(package_name):
32     import json
33     from urllib import request
34     import re
35 
36     url = f"https://pypi.python.org/pypi/{package_name}/json"
37     data = json.load(request.urlopen(url))
38     # filter out rc and beta releases and, more generally, any releases that
39     # do not contain exclusively numbers and dots.
40     versions = [parse_version(v) for v in data["releases"].keys() if re.match("^[0-9.]+$", v)]
41     versions.sort()
42     return versions[-1]  # return latest version
43 
44 
45 # Only detect TF if not installed or outdated. If not, do not do not list as
46 # requirement to avoid installing over e.g. tensorflow-gpu
47 # To avoid this, rely on importing rather than the package name (like pip).
48 
49 try:
50     # If tf not installed, import raises ImportError
51     import tensorflow as tf
52 
53     if parse_version(tf.__version__) < parse_version(min_tf_version):
54         # TF pre-installed, but below the minimum required version
55         raise DeprecationWarning("TensorFlow version below minimum requirement")
56 except (ImportError, DeprecationWarning):
57     # Add TensorFlow to dependencies to trigger installation/update
58     if not on_rtd:
59         # Do not add TF if we are installing GPflow on readthedocs
60         requirements.append(tf_cpu)
61         gast_requirement = (
62             "gast>=0.2.2,<0.3"
63             if latest_version("tensorflow") < parse_version("2.2")
64             else "gast>=0.3.3"
65         )
66         requirements.append(gast_requirement)
67 
68 
69 with open(str(Path(".", "VERSION").absolute())) as version_file:
70     version = version_file.read().strip()
71 
72 packages = find_packages(".", exclude=["tests"])
73 
74 setup(
75     name="gpflow",
76     version=version,
77     author="James Hensman, Alex Matthews",
78     author_email="james.hensman@gmail.com",
79     description="Gaussian process methods in TensorFlow",
80     license="Apache License 2.0",
81     keywords="machine-learning gaussian-processes kernels tensorflow",
82     url="http://github.com/GPflow/GPflow",
83     packages=packages,
84     include_package_data=True,
85     install_requires=requirements,
86     extras_require={"Tensorflow with GPU": [tf_gpu]},
87     python_requires=">=3.6",
88     classifiers=[
89         "License :: OSI Approved :: Apache Software License",
90         "Natural Language :: English",
91         "Operating System :: MacOS :: MacOS X",
92         "Operating System :: Microsoft :: Windows",
93         "Operating System :: POSIX :: Linux",
94         "Programming Language :: Python :: 3.6",
95         "Topic :: Scientific/Engineering :: Artificial Intelligence",
96     ],
97 )
98
```
--- 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
@@ -10,13 +10,13 @@
 from pkg_resources import parse_version
 from setuptools import find_packages, setup
 
-is_py37 = sys.version_info.major == 3 and sys.version_info.minor == 7
 on_rtd = os.environ.get("READTHEDOCS", None) == "True"  # copied from the docs
 
 # Dependencies of GPflow
 requirements = ["numpy>=1.10.0", "scipy>=0.18.0", "multipledispatch>=0.4.9", "tabulate"]
 
-if not is_py37:
+if sys.version_info < (3, 7):
+    # became part of stdlib in python 3.7
     requirements.append("dataclasses")
 
 if not on_rtd:

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -10,13 +10,13 @@\n from pkg_resources import parse_version\n from setuptools import find_packages, setup\n \n-is_py37 = sys.version_info.major == 3 and sys.version_info.minor == 7\n on_rtd = os.environ.get(\"READTHEDOCS\", None) == \"True\"  # copied from the docs\n \n # Dependencies of GPflow\n requirements = [\"numpy>=1.10.0\", \"scipy>=0.18.0\", \"multipledispatch>=0.4.9\", \"tabulate\"]\n \n-if not is_py37:\n+if sys.version_info < (3, 7):\n+    # became part of stdlib in python 3.7\n     requirements.append(\"dataclasses\")\n \n if not on_rtd:\n", "issue": "setup.py depends on external dataclasses package for python >= 3.8\nSetup.py has a check\r\n```python\r\nis_py37 = sys.version_info.major == 3 and sys.version_info.minor == 7\r\n```\r\nand adds the PyPI `dataclasses` package to the requirements when `not is_py37`. (`dataclasses` has been incorporated in the stdlib in python 3.7.) With python 3.8 released, this check is inaccurate, as setup.py currently adds the dependency on dataclasses when the python version is 3.8 or later, not just when it's less than 3.7.\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# pylint: skip-file\n\nimport os\nimport sys\nfrom pathlib import Path\n\nfrom pkg_resources import parse_version\nfrom setuptools import find_packages, setup\n\nis_py37 = sys.version_info.major == 3 and sys.version_info.minor == 7\non_rtd = os.environ.get(\"READTHEDOCS\", None) == \"True\"  # copied from the docs\n\n# Dependencies of GPflow\nrequirements = [\"numpy>=1.10.0\", \"scipy>=0.18.0\", \"multipledispatch>=0.4.9\", \"tabulate\"]\n\nif not is_py37:\n    requirements.append(\"dataclasses\")\n\nif not on_rtd:\n    requirements.append(\"tensorflow-probability>=0.9\")\n\nmin_tf_version = \"2.1.0\"\ntf_cpu = \"tensorflow\"\ntf_gpu = \"tensorflow-gpu\"\n\n\n# for latest_version() [see https://github.com/GPflow/GPflow/issues/1348]:\ndef latest_version(package_name):\n    import json\n    from urllib import request\n    import re\n\n    url = f\"https://pypi.python.org/pypi/{package_name}/json\"\n    data = json.load(request.urlopen(url))\n    # filter out rc and beta releases and, more generally, any releases that\n    # do not contain exclusively numbers and dots.\n    versions = [parse_version(v) for v in data[\"releases\"].keys() if re.match(\"^[0-9.]+$\", v)]\n    versions.sort()\n    return versions[-1]  # return latest version\n\n\n# Only detect TF if not installed or outdated. If not, do not do not list as\n# requirement to avoid installing over e.g. tensorflow-gpu\n# To avoid this, rely on importing rather than the package name (like pip).\n\ntry:\n    # If tf not installed, import raises ImportError\n    import tensorflow as tf\n\n    if parse_version(tf.__version__) < parse_version(min_tf_version):\n        # TF pre-installed, but below the minimum required version\n        raise DeprecationWarning(\"TensorFlow version below minimum requirement\")\nexcept (ImportError, DeprecationWarning):\n    # Add TensorFlow to dependencies to trigger installation/update\n    if not on_rtd:\n        # Do not add TF if we are installing GPflow on readthedocs\n        requirements.append(tf_cpu)\n        gast_requirement = (\n            \"gast>=0.2.2,<0.3\"\n            if latest_version(\"tensorflow\") < parse_version(\"2.2\")\n            else \"gast>=0.3.3\"\n        )\n        requirements.append(gast_requirement)\n\n\nwith open(str(Path(\".\", \"VERSION\").absolute())) as version_file:\n    version = version_file.read().strip()\n\npackages = find_packages(\".\", exclude=[\"tests\"])\n\nsetup(\n    name=\"gpflow\",\n    version=version,\n    author=\"James Hensman, Alex Matthews\",\n    author_email=\"james.hensman@gmail.com\",\n    description=\"Gaussian process methods in TensorFlow\",\n    license=\"Apache License 2.0\",\n    keywords=\"machine-learning gaussian-processes kernels tensorflow\",\n    url=\"http://github.com/GPflow/GPflow\",\n    packages=packages,\n    include_package_data=True,\n    install_requires=requirements,\n    extras_require={\"Tensorflow with GPU\": [tf_gpu]},\n    python_requires=\">=3.6\",\n    classifiers=[\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Natural Language :: English\",\n        \"Operating System :: MacOS :: MacOS X\",\n        \"Operating System :: Microsoft :: Windows\",\n        \"Operating System :: POSIX :: Linux\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Topic :: Scientific/Engineering :: Artificial Intelligence\",\n    ],\n)\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# pylint: skip-file\n\nimport os\nimport sys\nfrom pathlib import Path\n\nfrom pkg_resources import parse_version\nfrom setuptools import find_packages, setup\n\non_rtd = os.environ.get(\"READTHEDOCS\", None) == \"True\"  # copied from the docs\n\n# Dependencies of GPflow\nrequirements = [\"numpy>=1.10.0\", \"scipy>=0.18.0\", \"multipledispatch>=0.4.9\", \"tabulate\"]\n\nif sys.version_info < (3, 7):\n    # became part of stdlib in python 3.7\n    requirements.append(\"dataclasses\")\n\nif not on_rtd:\n    requirements.append(\"tensorflow-probability>=0.9\")\n\nmin_tf_version = \"2.1.0\"\ntf_cpu = \"tensorflow\"\ntf_gpu = \"tensorflow-gpu\"\n\n\n# for latest_version() [see https://github.com/GPflow/GPflow/issues/1348]:\ndef latest_version(package_name):\n    import json\n    from urllib import request\n    import re\n\n    url = f\"https://pypi.python.org/pypi/{package_name}/json\"\n    data = json.load(request.urlopen(url))\n    # filter out rc and beta releases and, more generally, any releases that\n    # do not contain exclusively numbers and dots.\n    versions = [parse_version(v) for v in data[\"releases\"].keys() if re.match(\"^[0-9.]+$\", v)]\n    versions.sort()\n    return versions[-1]  # return latest version\n\n\n# Only detect TF if not installed or outdated. If not, do not do not list as\n# requirement to avoid installing over e.g. tensorflow-gpu\n# To avoid this, rely on importing rather than the package name (like pip).\n\ntry:\n    # If tf not installed, import raises ImportError\n    import tensorflow as tf\n\n    if parse_version(tf.__version__) < parse_version(min_tf_version):\n        # TF pre-installed, but below the minimum required version\n        raise DeprecationWarning(\"TensorFlow version below minimum requirement\")\nexcept (ImportError, DeprecationWarning):\n    # Add TensorFlow to dependencies to trigger installation/update\n    if not on_rtd:\n        # Do not add TF if we are installing GPflow on readthedocs\n        requirements.append(tf_cpu)\n        gast_requirement = (\n            \"gast>=0.2.2,<0.3\"\n            if latest_version(\"tensorflow\") < parse_version(\"2.2\")\n            else \"gast>=0.3.3\"\n        )\n        requirements.append(gast_requirement)\n\n\nwith open(str(Path(\".\", \"VERSION\").absolute())) as version_file:\n    version = version_file.read().strip()\n\npackages = find_packages(\".\", exclude=[\"tests\"])\n\nsetup(\n    name=\"gpflow\",\n    version=version,\n    author=\"James Hensman, Alex Matthews\",\n    author_email=\"james.hensman@gmail.com\",\n    description=\"Gaussian process methods in TensorFlow\",\n    license=\"Apache License 2.0\",\n    keywords=\"machine-learning gaussian-processes kernels tensorflow\",\n    url=\"http://github.com/GPflow/GPflow\",\n    packages=packages,\n    include_package_data=True,\n    install_requires=requirements,\n    extras_require={\"Tensorflow with GPU\": [tf_gpu]},\n    python_requires=\">=3.6\",\n    classifiers=[\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Natural Language :: English\",\n        \"Operating System :: MacOS :: MacOS X\",\n        \"Operating System :: Microsoft :: Windows\",\n        \"Operating System :: POSIX :: Linux\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Topic :: Scientific/Engineering :: Artificial Intelligence\",\n    ],\n)\n", "path": "setup.py"}]}