prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  [2.0] Type annotations break mypy
  I tried porting an existing project to aioredis 2.0. I've got it almost working, but the type annotations that have been added are too strict (and in some cases just wrong) and break mypy. The main problem is that all the functions that take keys annotate them as `str`, when `bytes` (and I think several other types) are perfectly acceptable and are used in my code. The same applies to `register_script`.
  
  The `min` and `max` arguments of `zrangebylex` and `zrevrangebylex` are annotated as int, but they're used for lexicographical sorting so are string-like.
  
  Getting the type annotations right is a fair large undertaking. If there is a desire to release 2.0 soon I'd suggest deleting `py.typed` so that mypy doesn't see this package as annotated. There are annotations for redis-py in typeshed; perhaps that would be a good place to start, although I've occasionally also had issues there.
  
  --- 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 import os.path
  2 import re
  3 
  4 from setuptools import find_packages, setup
  5 
  6 
  7 def read(*parts):
  8     with open(os.path.join(*parts)) as f:
  9         return f.read().strip()
  10 
  11 
  12 def read_version():
  13     regexp = re.compile(r"^__version__\W*=\W*\"([\d.abrc]+)\"")
  14     init_py = os.path.join(os.path.dirname(__file__), "aioredis", "__init__.py")
  15     with open(init_py) as f:
  16         for line in f:
  17             match = regexp.match(line)
  18             if match is not None:
  19                 return match.group(1)
  20         raise RuntimeError(f"Cannot find version in {init_py}")
  21 
  22 
  23 classifiers = [
  24     "License :: OSI Approved :: MIT License",
  25     "Development Status :: 4 - Beta",
  26     "Programming Language :: Python",
  27     "Programming Language :: Python :: 3",
  28     "Programming Language :: Python :: 3.6",
  29     "Programming Language :: Python :: 3.7",
  30     "Programming Language :: Python :: 3 :: Only",
  31     "Operating System :: POSIX",
  32     "Environment :: Web Environment",
  33     "Intended Audience :: Developers",
  34     "Topic :: Software Development",
  35     "Topic :: Software Development :: Libraries",
  36     "Framework :: AsyncIO",
  37 ]
  38 
  39 setup(
  40     name="aioredis",
  41     version=read_version(),
  42     description="asyncio (PEP 3156) Redis support",
  43     long_description="\n\n".join((read("README.md"), read("CHANGELOG.md"))),
  44     long_description_content_type="text/markdown",
  45     classifiers=classifiers,
  46     platforms=["POSIX"],
  47     url="https://github.com/aio-libs/aioredis",
  48     license="MIT",
  49     packages=find_packages(exclude=["tests"]),
  50     install_requires=[
  51         "async-timeout",
  52         "typing-extensions",
  53     ],
  54     extras_require={
  55         "hiredis": 'hiredis>=1.0; implementation_name=="cpython"',
  56     },
  57     python_requires=">=3.6",
  58     include_package_data=True,
  59 )
  60
  ```
  --- 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/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -54,6 +54,7 @@
       extras_require={
           "hiredis": 'hiredis>=1.0; implementation_name=="cpython"',
       },
  +    package_data={"aioredis": ["py.typed"]},
       python_requires=">=3.6",
       include_package_data=True,
   )
  
verification_info: {"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -54,6 +54,7 @@\n     extras_require={\n         \"hiredis\": 'hiredis>=1.0; implementation_name==\"cpython\"',\n     },\n+    package_data={\"aioredis\": [\"py.typed\"]},\n     python_requires=\">=3.6\",\n     include_package_data=True,\n )\n", "issue": "[2.0] Type annotations break mypy\nI tried porting an existing project to aioredis 2.0. I've got it almost working, but the type annotations that have been added are too strict (and in some cases just wrong) and break mypy. The main problem is that all the functions that take keys annotate them as `str`, when `bytes` (and I think several other types) are perfectly acceptable and are used in my code. The same applies to `register_script`.\r\n\r\nThe `min` and `max` arguments of `zrangebylex` and `zrevrangebylex` are annotated as int, but they're used for lexicographical sorting so are string-like.\r\n\r\nGetting the type annotations right is a fair large undertaking. If there is a desire to release 2.0 soon I'd suggest deleting `py.typed` so that mypy doesn't see this package as annotated. There are annotations for redis-py in typeshed; perhaps that would be a good place to start, although I've occasionally also had issues there.\n", "before_files": [{"content": "import os.path\nimport re\n\nfrom setuptools import find_packages, setup\n\n\ndef read(*parts):\n    with open(os.path.join(*parts)) as f:\n        return f.read().strip()\n\n\ndef read_version():\n    regexp = re.compile(r\"^__version__\\W*=\\W*\\\"([\\d.abrc]+)\\\"\")\n    init_py = os.path.join(os.path.dirname(__file__), \"aioredis\", \"__init__.py\")\n    with open(init_py) as f:\n        for line in f:\n            match = regexp.match(line)\n            if match is not None:\n                return match.group(1)\n        raise RuntimeError(f\"Cannot find version in {init_py}\")\n\n\nclassifiers = [\n    \"License :: OSI Approved :: MIT License\",\n    \"Development Status :: 4 - Beta\",\n    \"Programming Language :: Python\",\n    \"Programming Language :: Python :: 3\",\n    \"Programming Language :: Python :: 3.6\",\n    \"Programming Language :: Python :: 3.7\",\n    \"Programming Language :: Python :: 3 :: Only\",\n    \"Operating System :: POSIX\",\n    \"Environment :: Web Environment\",\n    \"Intended Audience :: Developers\",\n    \"Topic :: Software Development\",\n    \"Topic :: Software Development :: Libraries\",\n    \"Framework :: AsyncIO\",\n]\n\nsetup(\n    name=\"aioredis\",\n    version=read_version(),\n    description=\"asyncio (PEP 3156) Redis support\",\n    long_description=\"\\n\\n\".join((read(\"README.md\"), read(\"CHANGELOG.md\"))),\n    long_description_content_type=\"text/markdown\",\n    classifiers=classifiers,\n    platforms=[\"POSIX\"],\n    url=\"https://github.com/aio-libs/aioredis\",\n    license=\"MIT\",\n    packages=find_packages(exclude=[\"tests\"]),\n    install_requires=[\n        \"async-timeout\",\n        \"typing-extensions\",\n    ],\n    extras_require={\n        \"hiredis\": 'hiredis>=1.0; implementation_name==\"cpython\"',\n    },\n    python_requires=\">=3.6\",\n    include_package_data=True,\n)\n", "path": "setup.py"}], "after_files": [{"content": "import os.path\nimport re\n\nfrom setuptools import find_packages, setup\n\n\ndef read(*parts):\n    with open(os.path.join(*parts)) as f:\n        return f.read().strip()\n\n\ndef read_version():\n    regexp = re.compile(r\"^__version__\\W*=\\W*\\\"([\\d.abrc]+)\\\"\")\n    init_py = os.path.join(os.path.dirname(__file__), \"aioredis\", \"__init__.py\")\n    with open(init_py) as f:\n        for line in f:\n            match = regexp.match(line)\n            if match is not None:\n                return match.group(1)\n        raise RuntimeError(f\"Cannot find version in {init_py}\")\n\n\nclassifiers = [\n    \"License :: OSI Approved :: MIT License\",\n    \"Development Status :: 4 - Beta\",\n    \"Programming Language :: Python\",\n    \"Programming Language :: Python :: 3\",\n    \"Programming Language :: Python :: 3.6\",\n    \"Programming Language :: Python :: 3.7\",\n    \"Programming Language :: Python :: 3 :: Only\",\n    \"Operating System :: POSIX\",\n    \"Environment :: Web Environment\",\n    \"Intended Audience :: Developers\",\n    \"Topic :: Software Development\",\n    \"Topic :: Software Development :: Libraries\",\n    \"Framework :: AsyncIO\",\n]\n\nsetup(\n    name=\"aioredis\",\n    version=read_version(),\n    description=\"asyncio (PEP 3156) Redis support\",\n    long_description=\"\\n\\n\".join((read(\"README.md\"), read(\"CHANGELOG.md\"))),\n    long_description_content_type=\"text/markdown\",\n    classifiers=classifiers,\n    platforms=[\"POSIX\"],\n    url=\"https://github.com/aio-libs/aioredis\",\n    license=\"MIT\",\n    packages=find_packages(exclude=[\"tests\"]),\n    install_requires=[\n        \"async-timeout\",\n        \"typing-extensions\",\n    ],\n    extras_require={\n        \"hiredis\": 'hiredis>=1.0; implementation_name==\"cpython\"',\n    },\n    package_data={\"aioredis\": [\"py.typed\"]},\n    python_requires=\">=3.6\",\n    include_package_data=True,\n)\n", "path": "setup.py"}]}