Skip to content

Commit d6c486d

Browse files
author
Aaron Ramshaw
committed
Linting/code style fixes
1 parent 6d9a7ff commit d6c486d

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

elasticapm/context/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def init_execution_context():
3434
# we should assume it's use as this will be the most "green-thread safe"
3535
if threading_local_monkey_patched():
3636
from elasticapm.context.threadlocal import execution_context
37+
3738
return execution_context
3839

3940
try:
@@ -51,15 +52,15 @@ def threading_local_monkey_patched():
5152
except ImportError:
5253
pass
5354
else:
54-
if is_object_patched('_threading', 'local'):
55+
if is_object_patched("_threading", "local"):
5556
return True
5657

5758
try:
5859
from eventlet.patcher import is_monkey_patched
5960
except ImportError:
6061
pass
6162
else:
62-
if is_monkey_patched('thread'):
63+
if is_monkey_patched("thread"):
6364
return True
6465

6566
return False

tests/context/test_context.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,15 @@ def test_execution_context_backing():
99

1010
if sys.version_info[0] == 3 and sys.version_info[1] >= 7:
1111
from elasticapm.context.contextvars import ContextVarsContext
12+
1213
assert isinstance(execution_context, ContextVarsContext)
1314
else:
1415
assert isinstance(execution_context, ThreadLocalContext)
1516

1617

1718
def test_execution_context_monkeypatched(monkeypatch):
1819
with monkeypatch.context() as m:
19-
m.setattr(
20-
elasticapm.context,
21-
'threading_local_monkey_patched',
22-
lambda: True
23-
)
20+
m.setattr(elasticapm.context, "threading_local_monkey_patched", lambda: True)
2421
execution_context = elasticapm.context.init_execution_context()
2522

2623
# Should always use ThreadLocalContext when thread local is monkey patched

0 commit comments

Comments
 (0)