We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Clean up dependencies
Spring cleaning! We currently declare some dependencies which are either unused or can easily be substituted:

 - h11 - not used at all?
 - requests - tests + examples only.

We should IMHO also eventually consider removing the following dependencies, although that involves a bit of work and shouldn't be in scope for this issue:

 - pyasn1 - replace with asn1crypto, which is used by cryptography/pyOpenSSL
 - ldap3 - only used for ldap proxy auth, which should probably live outside of the core once we have a healthy addon system.

--- 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
2 from codecs import open
3 
4 import re
5 from setuptools import setup, find_packages
6 
7 # Based on https://github.com/pypa/sampleproject/blob/master/setup.py
8 # and https://python-packaging-user-guide.readthedocs.org/
9 
10 here = os.path.abspath(os.path.dirname(__file__))
11 
12 with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
13     long_description = f.read()
14 
15 with open(os.path.join(here, "mitmproxy", "version.py")) as f:
16     VERSION = re.search(r'VERSION = "(.+?)(?:-0x|")', f.read()).group(1)
17 
18 setup(
19     name="mitmproxy",
20     version=VERSION,
21     description="An interactive, SSL-capable, man-in-the-middle HTTP proxy for penetration testers and software developers.",
22     long_description=long_description,
23     url="http://mitmproxy.org",
24     author="Aldo Cortesi",
25     author_email="aldo@corte.si",
26     license="MIT",
27     classifiers=[
28         "License :: OSI Approved :: MIT License",
29         "Development Status :: 5 - Production/Stable",
30         "Environment :: Console",
31         "Environment :: Console :: Curses",
32         "Operating System :: MacOS :: MacOS X",
33         "Operating System :: POSIX",
34         "Operating System :: Microsoft :: Windows",
35         "Programming Language :: Python",
36         "Programming Language :: Python :: 3",
37         "Programming Language :: Python :: 3 :: Only",
38         "Programming Language :: Python :: 3.5",
39         "Programming Language :: Python :: 3.6",
40         "Programming Language :: Python :: Implementation :: CPython",
41         "Topic :: Security",
42         "Topic :: Internet",
43         "Topic :: Internet :: WWW/HTTP",
44         "Topic :: Internet :: Proxy Servers",
45         "Topic :: Software Development :: Testing"
46     ],
47     packages=find_packages(include=[
48         "mitmproxy", "mitmproxy.*",
49         "pathod", "pathod.*",
50     ]),
51     include_package_data=True,
52     entry_points={
53         'console_scripts': [
54             "mitmproxy = mitmproxy.tools.main:mitmproxy",
55             "mitmdump = mitmproxy.tools.main:mitmdump",
56             "mitmweb = mitmproxy.tools.main:mitmweb",
57             "pathod = pathod.pathod_cmdline:go_pathod",
58             "pathoc = pathod.pathoc_cmdline:go_pathoc"
59         ]
60     },
61     # https://packaging.python.org/en/latest/requirements/#install-requires
62     # It is not considered best practice to use install_requires to pin dependencies to specific versions.
63     install_requires=[
64         "blinker>=1.4, <1.5",
65         "brotlipy>=0.7.0,<0.8",
66         "certifi>=2015.11.20.1",  # no semver here - this should always be on the last release!
67         "click>=6.2, <7",
68         "cryptography>=2.1.4,<2.2",
69         'h11>=0.7.0,<0.8',
70         "h2>=3.0.1,<4",
71         "hyperframe>=5.1.0,<6",
72         "kaitaistruct>=0.7,<0.9",
73         "ldap3>=2.4,<2.5",
74         "passlib>=1.6.5, <1.8",
75         "pyasn1>=0.3.1,<0.5",
76         "pyOpenSSL>=17.5,<17.6",
77         "pyparsing>=2.1.3, <2.3",
78         "pyperclip>=1.6.0, <1.7",
79         "requests>=2.9.1, <3",
80         "ruamel.yaml>=0.13.2, <0.16",
81         "sortedcontainers>=1.5.4, <1.6",
82         "tornado>=4.3, <4.6",
83         "urwid>=2.0.1,<2.1",
84         "wsproto>=0.11.0,<0.12.0",
85     ],
86     extras_require={
87         ':sys_platform == "win32"': [
88             "pydivert>=2.0.3,<2.2",
89         ],
90         'dev': [
91             "flake8>=3.5, <3.6",
92             "Flask>=0.10.1, <0.13",
93             "mypy>=0.560,<0.561",
94             "pytest-cov>=2.5.1,<3",
95             "pytest-faulthandler>=1.3.1,<2",
96             "pytest-timeout>=1.2.1,<2",
97             "pytest-xdist>=1.22,<2",
98             "pytest>=3.3,<4",
99             "tox>=2.3, <3",
100             "rstcheck>=2.2, <4.0",
101         ],
102         'examples': [
103             "beautifulsoup4>=4.4.1, <4.7",
104             "Pillow>=4.3,<5.1",
105         ]
106     }
107 )
108
```
--- 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
@@ -66,7 +66,6 @@
         "certifi>=2015.11.20.1",  # no semver here - this should always be on the last release!
         "click>=6.2, <7",
         "cryptography>=2.1.4,<2.2",
-        'h11>=0.7.0,<0.8',
         "h2>=3.0.1,<4",
         "hyperframe>=5.1.0,<6",
         "kaitaistruct>=0.7,<0.9",
@@ -76,7 +75,6 @@
         "pyOpenSSL>=17.5,<17.6",
         "pyparsing>=2.1.3, <2.3",
         "pyperclip>=1.6.0, <1.7",
-        "requests>=2.9.1, <3",
         "ruamel.yaml>=0.13.2, <0.16",
         "sortedcontainers>=1.5.4, <1.6",
         "tornado>=4.3, <4.6",
@@ -96,6 +94,7 @@
             "pytest-timeout>=1.2.1,<2",
             "pytest-xdist>=1.22,<2",
             "pytest>=3.3,<4",
+            "requests>=2.9.1, <3",
             "tox>=2.3, <3",
             "rstcheck>=2.2, <4.0",
         ],

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -66,7 +66,6 @@\n         \"certifi>=2015.11.20.1\",  # no semver here - this should always be on the last release!\n         \"click>=6.2, <7\",\n         \"cryptography>=2.1.4,<2.2\",\n-        'h11>=0.7.0,<0.8',\n         \"h2>=3.0.1,<4\",\n         \"hyperframe>=5.1.0,<6\",\n         \"kaitaistruct>=0.7,<0.9\",\n@@ -76,7 +75,6 @@\n         \"pyOpenSSL>=17.5,<17.6\",\n         \"pyparsing>=2.1.3, <2.3\",\n         \"pyperclip>=1.6.0, <1.7\",\n-        \"requests>=2.9.1, <3\",\n         \"ruamel.yaml>=0.13.2, <0.16\",\n         \"sortedcontainers>=1.5.4, <1.6\",\n         \"tornado>=4.3, <4.6\",\n@@ -96,6 +94,7 @@\n             \"pytest-timeout>=1.2.1,<2\",\n             \"pytest-xdist>=1.22,<2\",\n             \"pytest>=3.3,<4\",\n+            \"requests>=2.9.1, <3\",\n             \"tox>=2.3, <3\",\n             \"rstcheck>=2.2, <4.0\",\n         ],\n", "issue": "Clean up dependencies\nSpring cleaning! We currently declare some dependencies which are either unused or can easily be substituted:\r\n\r\n - h11 - not used at all?\r\n - requests - tests + examples only.\r\n\r\nWe should IMHO also eventually consider removing the following dependencies, although that involves a bit of work and shouldn't be in scope for this issue:\r\n\r\n - pyasn1 - replace with asn1crypto, which is used by cryptography/pyOpenSSL\r\n - ldap3 - only used for ldap proxy auth, which should probably live outside of the core once we have a healthy addon system.\n", "before_files": [{"content": "import os\nfrom codecs import open\n\nimport re\nfrom setuptools import setup, find_packages\n\n# Based on https://github.com/pypa/sampleproject/blob/master/setup.py\n# and https://python-packaging-user-guide.readthedocs.org/\n\nhere = os.path.abspath(os.path.dirname(__file__))\n\nwith open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:\n    long_description = f.read()\n\nwith open(os.path.join(here, \"mitmproxy\", \"version.py\")) as f:\n    VERSION = re.search(r'VERSION = \"(.+?)(?:-0x|\")', f.read()).group(1)\n\nsetup(\n    name=\"mitmproxy\",\n    version=VERSION,\n    description=\"An interactive, SSL-capable, man-in-the-middle HTTP proxy for penetration testers and software developers.\",\n    long_description=long_description,\n    url=\"http://mitmproxy.org\",\n    author=\"Aldo Cortesi\",\n    author_email=\"aldo@corte.si\",\n    license=\"MIT\",\n    classifiers=[\n        \"License :: OSI Approved :: MIT License\",\n        \"Development Status :: 5 - Production/Stable\",\n        \"Environment :: Console\",\n        \"Environment :: Console :: Curses\",\n        \"Operating System :: MacOS :: MacOS X\",\n        \"Operating System :: POSIX\",\n        \"Operating System :: Microsoft :: Windows\",\n        \"Programming Language :: Python\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3 :: Only\",\n        \"Programming Language :: Python :: 3.5\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: Implementation :: CPython\",\n        \"Topic :: Security\",\n        \"Topic :: Internet\",\n        \"Topic :: Internet :: WWW/HTTP\",\n        \"Topic :: Internet :: Proxy Servers\",\n        \"Topic :: Software Development :: Testing\"\n    ],\n    packages=find_packages(include=[\n        \"mitmproxy\", \"mitmproxy.*\",\n        \"pathod\", \"pathod.*\",\n    ]),\n    include_package_data=True,\n    entry_points={\n        'console_scripts': [\n            \"mitmproxy = mitmproxy.tools.main:mitmproxy\",\n            \"mitmdump = mitmproxy.tools.main:mitmdump\",\n            \"mitmweb = mitmproxy.tools.main:mitmweb\",\n            \"pathod = pathod.pathod_cmdline:go_pathod\",\n            \"pathoc = pathod.pathoc_cmdline:go_pathoc\"\n        ]\n    },\n    # https://packaging.python.org/en/latest/requirements/#install-requires\n    # It is not considered best practice to use install_requires to pin dependencies to specific versions.\n    install_requires=[\n        \"blinker>=1.4, <1.5\",\n        \"brotlipy>=0.7.0,<0.8\",\n        \"certifi>=2015.11.20.1\",  # no semver here - this should always be on the last release!\n        \"click>=6.2, <7\",\n        \"cryptography>=2.1.4,<2.2\",\n        'h11>=0.7.0,<0.8',\n        \"h2>=3.0.1,<4\",\n        \"hyperframe>=5.1.0,<6\",\n        \"kaitaistruct>=0.7,<0.9\",\n        \"ldap3>=2.4,<2.5\",\n        \"passlib>=1.6.5, <1.8\",\n        \"pyasn1>=0.3.1,<0.5\",\n        \"pyOpenSSL>=17.5,<17.6\",\n        \"pyparsing>=2.1.3, <2.3\",\n        \"pyperclip>=1.6.0, <1.7\",\n        \"requests>=2.9.1, <3\",\n        \"ruamel.yaml>=0.13.2, <0.16\",\n        \"sortedcontainers>=1.5.4, <1.6\",\n        \"tornado>=4.3, <4.6\",\n        \"urwid>=2.0.1,<2.1\",\n        \"wsproto>=0.11.0,<0.12.0\",\n    ],\n    extras_require={\n        ':sys_platform == \"win32\"': [\n            \"pydivert>=2.0.3,<2.2\",\n        ],\n        'dev': [\n            \"flake8>=3.5, <3.6\",\n            \"Flask>=0.10.1, <0.13\",\n            \"mypy>=0.560,<0.561\",\n            \"pytest-cov>=2.5.1,<3\",\n            \"pytest-faulthandler>=1.3.1,<2\",\n            \"pytest-timeout>=1.2.1,<2\",\n            \"pytest-xdist>=1.22,<2\",\n            \"pytest>=3.3,<4\",\n            \"tox>=2.3, <3\",\n            \"rstcheck>=2.2, <4.0\",\n        ],\n        'examples': [\n            \"beautifulsoup4>=4.4.1, <4.7\",\n            \"Pillow>=4.3,<5.1\",\n        ]\n    }\n)\n", "path": "setup.py"}], "after_files": [{"content": "import os\nfrom codecs import open\n\nimport re\nfrom setuptools import setup, find_packages\n\n# Based on https://github.com/pypa/sampleproject/blob/master/setup.py\n# and https://python-packaging-user-guide.readthedocs.org/\n\nhere = os.path.abspath(os.path.dirname(__file__))\n\nwith open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:\n    long_description = f.read()\n\nwith open(os.path.join(here, \"mitmproxy\", \"version.py\")) as f:\n    VERSION = re.search(r'VERSION = \"(.+?)(?:-0x|\")', f.read()).group(1)\n\nsetup(\n    name=\"mitmproxy\",\n    version=VERSION,\n    description=\"An interactive, SSL-capable, man-in-the-middle HTTP proxy for penetration testers and software developers.\",\n    long_description=long_description,\n    url=\"http://mitmproxy.org\",\n    author=\"Aldo Cortesi\",\n    author_email=\"aldo@corte.si\",\n    license=\"MIT\",\n    classifiers=[\n        \"License :: OSI Approved :: MIT License\",\n        \"Development Status :: 5 - Production/Stable\",\n        \"Environment :: Console\",\n        \"Environment :: Console :: Curses\",\n        \"Operating System :: MacOS :: MacOS X\",\n        \"Operating System :: POSIX\",\n        \"Operating System :: Microsoft :: Windows\",\n        \"Programming Language :: Python\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3 :: Only\",\n        \"Programming Language :: Python :: 3.5\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: Implementation :: CPython\",\n        \"Topic :: Security\",\n        \"Topic :: Internet\",\n        \"Topic :: Internet :: WWW/HTTP\",\n        \"Topic :: Internet :: Proxy Servers\",\n        \"Topic :: Software Development :: Testing\"\n    ],\n    packages=find_packages(include=[\n        \"mitmproxy\", \"mitmproxy.*\",\n        \"pathod\", \"pathod.*\",\n    ]),\n    include_package_data=True,\n    entry_points={\n        'console_scripts': [\n            \"mitmproxy = mitmproxy.tools.main:mitmproxy\",\n            \"mitmdump = mitmproxy.tools.main:mitmdump\",\n            \"mitmweb = mitmproxy.tools.main:mitmweb\",\n            \"pathod = pathod.pathod_cmdline:go_pathod\",\n            \"pathoc = pathod.pathoc_cmdline:go_pathoc\"\n        ]\n    },\n    # https://packaging.python.org/en/latest/requirements/#install-requires\n    # It is not considered best practice to use install_requires to pin dependencies to specific versions.\n    install_requires=[\n        \"blinker>=1.4, <1.5\",\n        \"brotlipy>=0.7.0,<0.8\",\n        \"certifi>=2015.11.20.1\",  # no semver here - this should always be on the last release!\n        \"click>=6.2, <7\",\n        \"cryptography>=2.1.4,<2.2\",\n        \"h2>=3.0.1,<4\",\n        \"hyperframe>=5.1.0,<6\",\n        \"kaitaistruct>=0.7,<0.9\",\n        \"ldap3>=2.4,<2.5\",\n        \"passlib>=1.6.5, <1.8\",\n        \"pyasn1>=0.3.1,<0.5\",\n        \"pyOpenSSL>=17.5,<17.6\",\n        \"pyparsing>=2.1.3, <2.3\",\n        \"pyperclip>=1.6.0, <1.7\",\n        \"ruamel.yaml>=0.13.2, <0.16\",\n        \"sortedcontainers>=1.5.4, <1.6\",\n        \"tornado>=4.3, <4.6\",\n        \"urwid>=2.0.1,<2.1\",\n        \"wsproto>=0.11.0,<0.12.0\",\n    ],\n    extras_require={\n        ':sys_platform == \"win32\"': [\n            \"pydivert>=2.0.3,<2.2\",\n        ],\n        'dev': [\n            \"flake8>=3.5, <3.6\",\n            \"Flask>=0.10.1, <0.13\",\n            \"mypy>=0.560,<0.561\",\n            \"pytest-cov>=2.5.1,<3\",\n            \"pytest-faulthandler>=1.3.1,<2\",\n            \"pytest-timeout>=1.2.1,<2\",\n            \"pytest-xdist>=1.22,<2\",\n            \"pytest>=3.3,<4\",\n            \"requests>=2.9.1, <3\",\n            \"tox>=2.3, <3\",\n            \"rstcheck>=2.2, <4.0\",\n        ],\n        'examples': [\n            \"beautifulsoup4>=4.4.1, <4.7\",\n            \"Pillow>=4.3,<5.1\",\n        ]\n    }\n)\n", "path": "setup.py"}]}