Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/connexion/context.py: 100%
15 statements
« prev ^ index » next coverage.py v7.2.2, created at 2023-03-26 06:12 +0000
« prev ^ index » next coverage.py v7.2.2, created at 2023-03-26 06:12 +0000
1from contextvars import ContextVar
3from starlette.types import Receive, Scope
4from werkzeug.local import LocalProxy
6from connexion.lifecycle import ASGIRequest
7from connexion.operations import AbstractOperation
9UNBOUND_MESSAGE = (
10 "Working outside of operation context. Make sure your app is wrapped in a "
11 "ContextMiddleware and you're processing a request while accessing the context."
12)
15_context: ContextVar[dict] = ContextVar("CONTEXT")
16context = LocalProxy(_context, unbound_message=UNBOUND_MESSAGE)
18_operation: ContextVar[AbstractOperation] = ContextVar("OPERATION")
19operation = LocalProxy(_operation, unbound_message=UNBOUND_MESSAGE)
21_receive: ContextVar[Receive] = ContextVar("RECEIVE")
22receive = LocalProxy(_receive, unbound_message=UNBOUND_MESSAGE)
24_scope: ContextVar[Scope] = ContextVar("SCOPE")
25scope = LocalProxy(_scope, unbound_message=UNBOUND_MESSAGE)
27request = LocalProxy(
28 lambda: ASGIRequest(scope, receive), unbound_message=UNBOUND_MESSAGE
29)