Merge in changes from 3.6 drop

This commit is contained in:
Adam Hopkins
2021-02-22 13:09:33 +02:00
10 changed files with 15 additions and 57 deletions

View File

@@ -159,7 +159,7 @@ class Sanic(BaseSanic):
is delayed until before server start.
`See user guide
<https://sanicframework.org/guide/basics/tasks.html#background-tasks>`_
<https://sanicframework.org/guide/basics/tasks.html#background-tasks>`__
:param task: future, couroutine or awaitable
"""
@@ -357,7 +357,7 @@ class Sanic(BaseSanic):
the output URL's query string.
`See user guide
<https://sanicframework.org/guide/basics/routing.html#generating-a-url>`_
<https://sanicframework.org/guide/basics/routing.html#generating-a-url>`__
:param view_name: string referencing the view name
:param kwargs: keys and values that are used to build request

View File

@@ -1,3 +1,5 @@
from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,

View File

@@ -10,14 +10,13 @@ from typing import (
Dict,
Iterator,
Optional,
Protocol,
Tuple,
Union,
)
from urllib.parse import quote_plus
from warnings import warn
from typing_extensions import Protocol
from sanic.compat import Header, open_async
from sanic.cookies import CookieJar
from sanic.helpers import has_message_body, remove_entity_headers

View File

@@ -24,7 +24,6 @@ import os
import secrets
import socket
import stat
import sys
from asyncio import CancelledError
from asyncio.transports import Transport
@@ -58,7 +57,9 @@ class Signal:
class ConnInfo:
"""Local and remote addresses and SSL status info."""
"""
Local and remote addresses and SSL status info.
"""
__slots__ = (
"sockname",
@@ -146,7 +147,6 @@ class HttpProtocol(asyncio.Protocol):
):
asyncio.set_event_loop(loop)
self.loop = loop
deprecated_loop = self.loop if sys.version_info < (3, 7) else None
self.app: Sanic = app
self.url = None
self.transport: Optional[Transport] = None
@@ -168,8 +168,8 @@ class HttpProtocol(asyncio.Protocol):
self.state = state if state else {}
if "requests_count" not in self.state:
self.state["requests_count"] = 0
self._data_received = asyncio.Event(loop=deprecated_loop)
self._can_write = asyncio.Event(loop=deprecated_loop)
self._data_received = asyncio.Event()
self._can_write = asyncio.Event()
self._can_write.set()
self._exception = None
self._unix = unix