Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/connexion/context.py: 100%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from contextvars import ContextVar
3from starlette.types import Receive, Scope
4from werkzeug.local import LocalProxy
6from connexion.lifecycle import ConnexionRequest
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: ConnexionRequest(scope, receive), unbound_message=UNBOUND_MESSAGE
29)