mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-19 07:53:00 +00:00
Remove 3.6 compatibility shims
- asyncio.all_tasks/current_task - pytest-asyncio 0.17 - contextmanager.nullcontext
This commit is contained in:
@@ -27,14 +27,26 @@ from tornado import gen, ioloop, web
|
||||
from tornado.httpclient import AsyncHTTPClient, HTTPError
|
||||
from tornado.log import app_log
|
||||
|
||||
# For compatibility with python versions 3.6 or earlier.
|
||||
# asyncio.Task.all_tasks() is fully moved to asyncio.all_tasks() starting with 3.9. Also applies to current_task.
|
||||
try:
|
||||
asyncio_all_tasks = asyncio.all_tasks
|
||||
asyncio_current_task = asyncio.current_task
|
||||
except AttributeError as e:
|
||||
asyncio_all_tasks = asyncio.Task.all_tasks
|
||||
asyncio_current_task = asyncio.Task.current_task
|
||||
|
||||
# Deprecated aliases: no longer needed now that we require 3.7
|
||||
def asyncio_all_tasks(loop=None):
|
||||
warnings.warn(
|
||||
"jupyterhub.utils.asyncio_all_tasks is deprecated in JupyterHub 2.4."
|
||||
" Use asyncio.all_tasks().",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return asyncio.all_tasks(loop=loop)
|
||||
|
||||
|
||||
def asyncio_current_task(loop=None):
|
||||
warnings.warn(
|
||||
"jupyterhub.utils.asyncio_current_task is deprecated in JupyterHub 2.4."
|
||||
" Use asyncio.current_task().",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return asyncio.current_task(loop=loop)
|
||||
|
||||
|
||||
def random_port():
|
||||
|
Reference in New Issue
Block a user