From 1bec55e53af276ddbcd130f3d9b86bd8c6a28779 Mon Sep 17 00:00:00 2001 From: Colton Myers Date: Mon, 27 Nov 2023 15:24:12 -0700 Subject: [PATCH] Upgrade flake8 in pre-commit --- .pre-commit-config.yaml | 2 +- elasticapm/contrib/asgi.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f3341b37e..07f59f368 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: language_version: python3 exclude: "(tests/utils/stacks/linenos.py|tests/utils/stacks/linenos2.py|tests/contrib/grpc/grpc_app/.*pb2.*.py)" - repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 + rev: 6.1.0 hooks: - id: flake8 exclude: "(tests/utils/stacks/linenos.py|tests/utils/stacks/linenos2.py|tests/contrib/grpc/grpc_app/.*pb2.*.py)" diff --git a/elasticapm/contrib/asgi.py b/elasticapm/contrib/asgi.py index 701ea3d0e..096fed36a 100644 --- a/elasticapm/contrib/asgi.py +++ b/elasticapm/contrib/asgi.py @@ -92,13 +92,15 @@ async def __call__(self, scope: "Scope", receive: "ASGIReceiveCallable", send: " body = str(body_raw, errors="ignore") # Dispatch to the ASGI callable - async def wrapped_receive(): + async def new_wrapped_receive(): if messages: return messages.pop(0) # Once that's done we can just await any other messages. return await receive() + wrapped_receive = new_wrapped_receive + await set_context(lambda: self.get_data_from_request(scope, constants.TRANSACTION, body), "request") try: