From 225cc1aecbdb0d73a5759bae339cd80283acd976 Mon Sep 17 00:00:00 2001 From: cdeler Date: Fri, 11 Sep 2020 19:18:35 +0300 Subject: [PATCH 1/3] Silent PIE786 in project config --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index abf929021e..79f14d123c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [flake8] -ignore = W503, E203, B305 +ignore = W503, E203, B305, PIE786 max-line-length = 88 [mypy] From fb29354a2b4da82f02b76c4ba7ffad801ede99db Mon Sep 17 00:00:00 2001 From: cdeler Date: Fri, 11 Sep 2020 19:48:30 +0300 Subject: [PATCH 2/3] Replaced BaseException by Exception in _client.py --- httpx/_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/httpx/_client.py b/httpx/_client.py index 7a264318df..1aa410e0e6 100644 --- a/httpx/_client.py +++ b/httpx/_client.py @@ -763,7 +763,7 @@ def _send_handling_auth( next_request = auth_flow.send(response) except StopIteration: return response - except BaseException as exc: + except Exception as exc: response.close() raise exc from None else: @@ -1386,7 +1386,7 @@ async def _send_handling_auth( next_request = await auth_flow.asend(response) except StopAsyncIteration: return response - except BaseException as exc: + except Exception as exc: await response.aclose() raise exc from None else: From f8f2dc43aa885b3c3bd90be7610d569caa807838 Mon Sep 17 00:00:00 2001 From: cdeler Date: Sat, 12 Sep 2020 10:24:28 +0300 Subject: [PATCH 3/3] Disabled PIE786 per line --- httpx/_client.py | 4 ++-- httpx/_exceptions.py | 2 +- httpx/_transports/asgi.py | 2 +- setup.cfg | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/httpx/_client.py b/httpx/_client.py index 1aa410e0e6..095ff4baac 100644 --- a/httpx/_client.py +++ b/httpx/_client.py @@ -763,7 +763,7 @@ def _send_handling_auth( next_request = auth_flow.send(response) except StopIteration: return response - except Exception as exc: + except Exception as exc: # noqa: PIE786 response.close() raise exc from None else: @@ -1386,7 +1386,7 @@ async def _send_handling_auth( next_request = await auth_flow.asend(response) except StopAsyncIteration: return response - except Exception as exc: + except Exception as exc: # noqa: PIE786 await response.aclose() raise exc from None else: diff --git a/httpx/_exceptions.py b/httpx/_exceptions.py index 260d14ee5f..21d21c7c3e 100644 --- a/httpx/_exceptions.py +++ b/httpx/_exceptions.py @@ -340,7 +340,7 @@ def map_exceptions( ) -> typing.Iterator[None]: try: yield - except Exception as exc: + except Exception as exc: # noqa: PIE786 mapped_exc = None for from_exc, to_exc in mapping.items(): diff --git a/httpx/_transports/asgi.py b/httpx/_transports/asgi.py index a58e10a6d6..4ab2de3e63 100644 --- a/httpx/_transports/asgi.py +++ b/httpx/_transports/asgi.py @@ -145,7 +145,7 @@ async def send(message: dict) -> None: try: await self.app(scope, receive, send) - except Exception: + except Exception: # noqa: PIE786 if self.raise_app_exceptions or not response_complete.is_set(): raise diff --git a/setup.cfg b/setup.cfg index 79f14d123c..abf929021e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [flake8] -ignore = W503, E203, B305, PIE786 +ignore = W503, E203, B305 max-line-length = 88 [mypy]