Add flake8-pie plugin (#419)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Stephen Brown II · committed by Seth Michael Larson · parent 7f76a64 · Browse files · 4 files·+15 added−10 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+15 added−10 removed
- tests:+5 added−5 removed
- other:+10 added−5 removed
Provenance
- Commit
db3e3a0- Tree
481bfb6- Author
Stephen Brown II <Stephen.Brown2@gmail.com>- Committer
Seth Michael Larson <sethmichaellarson@gmail.com>- Parent
7f76a64
4 files changed+15 added−10 removed
modified:httpx/client.py+2 added-4 removed
323 unmodified lines324 url = self.merge_url(url)325 headers = self.merge_headers(headers)326 cookies = self.merge_cookies(cookies)327 params = self.merge_queryparams(params)328- request = AsyncRequest(328+ return AsyncRequest(329 method,330 url,331 data=data,332 files=files,1 unmodified line334 params=params,335 headers=headers,336 cookies=cookies,337 )338- return request338 339 340 class AsyncClient(BaseClient):341 async def get(374 unmodified lines716 params=params,717 headers=headers,718 cookies=cookies,719 )721- response = self.send(720+ return self.send(721 request,722 stream=stream,723 auth=auth,724 allow_redirects=allow_redirects,1 unmodified line726 cert=cert,727 timeout=timeout,728 trust_env=trust_env,729 )731- return response730 731 def send(732 self,733 request: AsyncRequest,335 unmodified linesmodified:tests/dispatch/test_proxy_http.py+5 added-5 removed
24 unmodified lines25 proxy_url="http://127.0.0.1:8000",26 backend=raw_io,27 proxy_mode=httpx.HTTPProxyMode.TUNNEL_ONLY,28 ) as proxy:29- response = await proxy.request("GET", f"http://example.com")29+ response = await proxy.request("GET", "http://example.com")30 31 assert response.status_code == 40432 assert response.headers["Server"] == "origin-server"33 29 unmodified lines63 proxy_url="http://127.0.0.1:8000",64 backend=raw_io,65 proxy_mode=httpx.HTTPProxyMode.TUNNEL_ONLY,66 ) as proxy:67- await proxy.request("GET", f"http://example.com")67+ await proxy.request("GET", "http://example.com")68 69 # ProxyError.request should be the CONNECT request not the original request70 assert e.value.request.method == "CONNECT"71 assert e.value.request.headers["Host"] == "127.0.0.1:8000"43 unmodified lines115 proxy_url="http://127.0.0.1:8000",116 backend=raw_io,117 proxy_mode=httpx.HTTPProxyMode.TUNNEL_ONLY,118 ) as proxy:119- resp = await proxy.request("GET", f"https://example.com")119+ resp = await proxy.request("GET", "https://example.com")120 121 assert resp.status_code == 404122 assert resp.headers["Server"] == "origin-server"123 3 unmodified lines127 128 await resp.read()129 130 # Make another request to see that the tunnel is re-used.131- resp = await proxy.request("GET", f"https://example.com/target")131+ resp = await proxy.request("GET", "https://example.com/target")132 133 assert resp.status_code == 200134 assert resp.headers["Server"] == "origin-server"135 35 unmodified lines171 proxy_mode=proxy_mode,172 proxy_headers={"Proxy-Authorization": "test", "Override": "2"},173 ) as proxy:174 response = await proxy.request(175- "GET", f"http://example.com", headers={"override": "1"}175+ "GET", "http://example.com", headers={"override": "1"}176 )177 178 assert response.status_code == 200179 assert response.headers["Server"] == "origin-server"35 unmodified linesmodified:noxfile.py+7 added-1 removed
18 unmodified lines19 20 @nox.session(reuse_venv=True)21 def check(session):22 session.install(23- "black", "flake8", "flake8-bugbear", "flake8-comprehensions", "isort", "mypy"23+ "black",24+ "flake8",25+ "flake8-bugbear",26+ "flake8-comprehensions",27+ "flake8-pie",28+ "isort",29+ "mypy",30 )31 32 session.run("black", "--check", "--diff", "--target-version=py36", *source_files)33 session.run("flake8", *source_files)17 unmodified linesmodified:test-requirements.txt+1 added
5 unmodified lines6 cryptography7 flake88 flake8-bugbear9 flake8-comprehensions10+flake8-pie11 isort12 mypy13 pytest14 pytest-asyncio8 unmodified lines