install_requires=[
"anyio>=3.4.0,<5",
"typing_extensions>=3.10.0; python_version < '3.10'",
+ "async_generator; python < '3.10'",
],
extras_require={
"full": [
import hashlib
+__all__ = [
+ "md5_hexdigest",
+ "aclosing",
+]
+
# Compat wrapper to always include the `usedforsecurity=...` parameter,
# which is only added from Python 3.9 onwards.
# We use this flag to indicate that we use `md5` hashes only for non-security
data, usedforsecurity=usedforsecurity
).hexdigest()
+
except TypeError: # pragma: no cover
def md5_hexdigest(data: bytes, *, usedforsecurity: bool = True) -> str:
return hashlib.md5(data).hexdigest()
+
+
+try:
+ from contextlib import aclosing
+except ImportError: # Python < 3.10
+ from async_generator import aclosing # type: ignore
-from contextlib import aclosing
from functools import partial
from typing import AsyncGenerator, Callable, Optional
+from .._compat import aclosing
from ..datastructures import MutableHeaders
from ..responses import Response
from ..types import ASGIApp, Message, Receive, Scope, Send