prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  `typing._ClassVar` cannot be accessed in the iPython shell – dataclasses package seems to mess up on Python 3.7
  ### Problem you have encountered:
  
  I just installed flax and tried to import it from the iPython shell. But it raises an `AttributeError`.
  
  ```
  In [1]: import flax
  
  *snip*
  
  ~/.virtualenvs/flax2/lib/python3.7/site-packages/dataclasses.py in _is_classvar(a_type, typing)
      548     # This test uses a typing internal class, but it's the best way to
      549     # test if this is a ClassVar.
  --> 550     return type(a_type) is typing._ClassVar
      551
      552
  
  AttributeError: module 'typing' has no attribute '_ClassVar'
  ```
  This does not happen in the normal interpreter, where everything goes fine. 
  
  ### What you expected to happen:
  
  I expected the import to work the same in iPython and the normal python shell.
  
  ### Logs, error messages, etc:
  
  Full traceback in this gist: https://gist.github.com/bayerj/96f096c7fb09a7c9b758dabdbca32671
  
  ### Steps to reproduce:
  
  On Mac OS X with Python 3.7.6, not anaconda, virtuelenvwrapper installed.
  
  ```
  ❯❯❯ mkvirtualenv flax2
  ❯❯❯ pip install jaxlib
  *snip*
  ❯❯❯ pip install flax
  *snip*
  ❯❯❯ ipython
  
  *snip*
  
  In [1]: import flax
  ```
  
  ### Workaround
  
  The problem seems to be in the `dataclasses` package–not python's own one–from PyPI. If I uninstall it...
  
  ```
  ❯❯❯ pip uninstall dataclasses
  Found existing installation: dataclasses 0.6
  Uninstalling dataclasses-0.6:
    Would remove:
      /Users/bayerj/.virtualenvs/debug2/lib/python3.7/site-packages/dataclasses-0.6.dist-info/*
      /Users/bayerj/.virtualenvs/debug2/lib/python3.7/site-packages/dataclasses.py
  Proceed (y/n)? y
    Successfully uninstalled dataclasses-0.6
  ❯❯❯ ipython
  /usr/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py:931: UserWarning: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.
    warn("Attempting to work in a virtualenv. If you encounter problems, please "
  Python 3.7.6 (default, Dec 30 2019, 19:38:28)
  Type 'copyright', 'credits' or 'license' for more information
  IPython 7.9.0 -- An enhanced Interactive Python. Type '?' for help.
  
  In [1]: import flax
  ```
  ... this goes fine.
  
  
  
  
  
  </issue>
  <code>
  [start of setup.py]
  1 # Copyright 2020 The Flax Authors.
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #     http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 """setup.py for Flax."""
  16 
  17 import os
  18 from setuptools import find_packages
  19 from setuptools import setup
  20 
  21 version = "0.1.0"
  22 
  23 here = os.path.abspath(os.path.dirname(__file__))
  24 try:
  25   README = open(os.path.join(here, "README.md"), encoding='utf-8').read()
  26 except IOError:
  27   README = ""
  28 
  29 install_requires = [
  30     "numpy>=1.12",
  31     "jax>=0.1.59",
  32     "matplotlib",  # only needed for tensorboard export
  33     "dataclasses",  # will only install on py3.6
  34     "msgpack",
  35 ]
  36 
  37 tests_require = [
  38     "jaxlib",
  39     "pytest",
  40     "pytest-cov",
  41     "pytest-xdist",
  42     "tensorflow",
  43     "tensorflow_datasets",
  44 ]
  45 
  46 setup(
  47     name="flax",
  48     version=version,
  49     description="Flax: A neural network library for JAX designed for flexibility",
  50     long_description="\n\n".join([README]),
  51     long_description_content_type='text/markdown',
  52     classifiers=[
  53         "Development Status :: 3 - Alpha",
  54         "Intended Audience :: Developers",
  55         "Intended Audience :: Science/Research",
  56         "License :: OSI Approved :: MIT License",
  57         "Programming Language :: Python :: 3.7",
  58         "Topic :: Scientific/Engineering :: Artificial Intelligence",
  59         ],
  60     keywords="",
  61     author="Flax team",
  62     author_email="flax-dev@google.com",
  63     url="https://github.com/google/flax",
  64     license="Apache",
  65     packages=find_packages(),
  66     include_package_data=False,
  67     zip_safe=False,
  68     install_requires=install_requires,
  69     extras_require={
  70         "testing": tests_require,
  71         },
  72     )
  73
  [end of setup.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/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -30,7 +30,7 @@
       "numpy>=1.12",
       "jax>=0.1.59",
       "matplotlib",  # only needed for tensorboard export
  -    "dataclasses",  # will only install on py3.6
  +    "dataclasses;python_version<'3.7'", # will only install on py3.6
       "msgpack",
   ]
  
verification_info: {"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -30,7 +30,7 @@\n     \"numpy>=1.12\",\n     \"jax>=0.1.59\",\n     \"matplotlib\",  # only needed for tensorboard export\n-    \"dataclasses\",  # will only install on py3.6\n+    \"dataclasses;python_version<'3.7'\", # will only install on py3.6\n     \"msgpack\",\n ]\n", "issue": "`typing._ClassVar` cannot be accessed in the iPython shell \u2013 dataclasses package seems to mess up on Python 3.7\n### Problem you have encountered:\r\n\r\nI just installed flax and tried to import it from the iPython shell. But it raises an `AttributeError`.\r\n\r\n```\r\nIn [1]: import flax\r\n\r\n*snip*\r\n\r\n~/.virtualenvs/flax2/lib/python3.7/site-packages/dataclasses.py in _is_classvar(a_type, typing)\r\n    548     # This test uses a typing internal class, but it's the best way to\r\n    549     # test if this is a ClassVar.\r\n--> 550     return type(a_type) is typing._ClassVar\r\n    551\r\n    552\r\n\r\nAttributeError: module 'typing' has no attribute '_ClassVar'\r\n```\r\nThis does not happen in the normal interpreter, where everything goes fine. \r\n\r\n### What you expected to happen:\r\n\r\nI expected the import to work the same in iPython and the normal python shell.\r\n\r\n### Logs, error messages, etc:\r\n\r\nFull traceback in this gist: https://gist.github.com/bayerj/96f096c7fb09a7c9b758dabdbca32671\r\n\r\n### Steps to reproduce:\r\n\r\nOn Mac OS X with Python 3.7.6, not anaconda, virtuelenvwrapper installed.\r\n\r\n```\r\n\u276f\u276f\u276f mkvirtualenv flax2\r\n\u276f\u276f\u276f pip install jaxlib\r\n*snip*\r\n\u276f\u276f\u276f pip install flax\r\n*snip*\r\n\u276f\u276f\u276f ipython\r\n\r\n*snip*\r\n\r\nIn [1]: import flax\r\n```\r\n\r\n### Workaround\r\n\r\nThe problem seems to be in the `dataclasses` package\u2013not python's own one\u2013from PyPI. If I uninstall it...\r\n\r\n```\r\n\u276f\u276f\u276f pip uninstall dataclasses\r\nFound existing installation: dataclasses 0.6\r\nUninstalling dataclasses-0.6:\r\n  Would remove:\r\n    /Users/bayerj/.virtualenvs/debug2/lib/python3.7/site-packages/dataclasses-0.6.dist-info/*\r\n    /Users/bayerj/.virtualenvs/debug2/lib/python3.7/site-packages/dataclasses.py\r\nProceed (y/n)? y\r\n  Successfully uninstalled dataclasses-0.6\r\n\u276f\u276f\u276f ipython\r\n/usr/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py:931: UserWarning: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.\r\n  warn(\"Attempting to work in a virtualenv. If you encounter problems, please \"\r\nPython 3.7.6 (default, Dec 30 2019, 19:38:28)\r\nType 'copyright', 'credits' or 'license' for more information\r\nIPython 7.9.0 -- An enhanced Interactive Python. Type '?' for help.\r\n\r\nIn [1]: import flax\r\n```\r\n... this goes fine.\r\n\r\n\r\n\r\n\n", "before_files": [{"content": "# Copyright 2020 The Flax Authors.\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\n\"\"\"setup.py for Flax.\"\"\"\n\nimport os\nfrom setuptools import find_packages\nfrom setuptools import setup\n\nversion = \"0.1.0\"\n\nhere = os.path.abspath(os.path.dirname(__file__))\ntry:\n  README = open(os.path.join(here, \"README.md\"), encoding='utf-8').read()\nexcept IOError:\n  README = \"\"\n\ninstall_requires = [\n    \"numpy>=1.12\",\n    \"jax>=0.1.59\",\n    \"matplotlib\",  # only needed for tensorboard export\n    \"dataclasses\",  # will only install on py3.6\n    \"msgpack\",\n]\n\ntests_require = [\n    \"jaxlib\",\n    \"pytest\",\n    \"pytest-cov\",\n    \"pytest-xdist\",\n    \"tensorflow\",\n    \"tensorflow_datasets\",\n]\n\nsetup(\n    name=\"flax\",\n    version=version,\n    description=\"Flax: A neural network library for JAX designed for flexibility\",\n    long_description=\"\\n\\n\".join([README]),\n    long_description_content_type='text/markdown',\n    classifiers=[\n        \"Development Status :: 3 - Alpha\",\n        \"Intended Audience :: Developers\",\n        \"Intended Audience :: Science/Research\",\n        \"License :: OSI Approved :: MIT License\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Topic :: Scientific/Engineering :: Artificial Intelligence\",\n        ],\n    keywords=\"\",\n    author=\"Flax team\",\n    author_email=\"flax-dev@google.com\",\n    url=\"https://github.com/google/flax\",\n    license=\"Apache\",\n    packages=find_packages(),\n    include_package_data=False,\n    zip_safe=False,\n    install_requires=install_requires,\n    extras_require={\n        \"testing\": tests_require,\n        },\n    )\n", "path": "setup.py"}]}