Skip to content

Commit 0417869

Browse files
committed
Move concurrent.futures import to module level
1 parent 964d727 commit 0417869

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

vcr/stubs/httpcore_stubs.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import logging
44
from collections import defaultdict
55
from collections.abc import AsyncIterable, Iterable
6+
from concurrent.futures import ThreadPoolExecutor
67

78
from httpcore import Response
89
from httpcore._models import ByteStream
@@ -182,8 +183,6 @@ def _run_async_function(sync_func, *args, **kwargs):
182183
- An event loop is already running.
183184
- No event loop exists yet.
184185
"""
185-
import concurrent.futures
186-
187186
try:
188187
asyncio.get_running_loop()
189188
except RuntimeError:
@@ -195,7 +194,7 @@ def _run_async_function(sync_func, *args, **kwargs):
195194
def run_in_thread():
196195
return asyncio.run(sync_func(*args, **kwargs))
197196

198-
with concurrent.futures.ThreadPoolExecutor() as pool:
197+
with ThreadPoolExecutor() as pool:
199198
future = pool.submit(run_in_thread)
200199
return future.result()
201200

0 commit comments

Comments
 (0)