From bda5dcbb3da75ecf187a3a130ec2fafcbb484701 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 4 Feb 2021 15:02:55 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/structlog/contextvars.py | 8 ++++---- tests/test_contextvars.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/structlog/contextvars.py b/src/structlog/contextvars.py index a9cb037f..3e0daddb 100644 --- a/src/structlog/contextvars.py +++ b/src/structlog/contextvars.py @@ -20,7 +20,7 @@ from .types import EventDict, WrappedLogger -STRUCTLOG_KEY_PREFIX = 'structlog_' +STRUCTLOG_KEY_PREFIX = "structlog_" _CONTEXT_VARS: Dict[str, contextvars.ContextVar] = {} @@ -40,7 +40,7 @@ def merge_contextvars( for k in ctx: if k.name.startswith(STRUCTLOG_KEY_PREFIX) and ctx[k] is not Ellipsis: - event_dict.setdefault(k.name[len(STRUCTLOG_KEY_PREFIX):], ctx[k]) + event_dict.setdefault(k.name[len(STRUCTLOG_KEY_PREFIX) :], ctx[k]) return event_dict @@ -72,7 +72,7 @@ def bind_contextvars(**kw: Any) -> None: .. versionchanged:: 20.2.0 See toplevel note """ for k, v in kw.items(): - structlog_k = f'{STRUCTLOG_KEY_PREFIX}{k}' + structlog_k = f"{STRUCTLOG_KEY_PREFIX}{k}" try: var = _CONTEXT_VARS[structlog_k] except KeyError: @@ -93,6 +93,6 @@ def unbind_contextvars(*keys: str) -> None: .. versionchanged:: 20.2.0 See toplevel note """ for k in keys: - structlog_k = f'{STRUCTLOG_KEY_PREFIX}{k}' + structlog_k = f"{STRUCTLOG_KEY_PREFIX}{k}" if structlog_k in _CONTEXT_VARS: _CONTEXT_VARS[structlog_k].set(Ellipsis) diff --git a/tests/test_contextvars.py b/tests/test_contextvars.py index 792f19fe..892f7056 100644 --- a/tests/test_contextvars.py +++ b/tests/test_contextvars.py @@ -2,9 +2,10 @@ # 2.0, and the MIT License. See the LICENSE file in the root of this # repository for complete details. -import pytest import asyncio +import pytest + from structlog.contextvars import ( bind_contextvars, clear_contextvars,