Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
globals.py52 linesDownload Raw Back to flask
1from __future__ import annotations2 3import typing as t4from contextvars import ContextVar5 6from werkzeug.local import LocalProxy7 8if t.TYPE_CHECKING:  # pragma: no cover9    from .app import Flask10    from .ctx import _AppCtxGlobals11    from .ctx import AppContext12    from .ctx import RequestContext13    from .sessions import SessionMixin14    from .wrappers import Request15 16 17_no_app_msg = """\18Working outside of application context.19 20This typically means that you attempted to use functionality that needed21the current application. To solve this, set up an application context22with app.app_context(). See the documentation for more information.\23"""24_cv_app: ContextVar[AppContext] = ContextVar("flask.app_ctx")25app_ctx: AppContext = LocalProxy(  # type: ignore[assignment]26    _cv_app, unbound_message=_no_app_msg27)28current_app: Flask = LocalProxy(  # type: ignore[assignment]29    _cv_app, "app", unbound_message=_no_app_msg30)31g: _AppCtxGlobals = LocalProxy(  # type: ignore[assignment]32    _cv_app, "g", unbound_message=_no_app_msg33)34 35_no_req_msg = """\36Working outside of request context.37 38This typically means that you attempted to use functionality that needed39an active HTTP request. Consult the documentation on testing for40information about how to avoid this problem.\41"""42_cv_request: ContextVar[RequestContext] = ContextVar("flask.request_ctx")43request_ctx: RequestContext = LocalProxy(  # type: ignore[assignment]44    _cv_request, unbound_message=_no_req_msg45)46request: Request = LocalProxy(  # type: ignore[assignment]47    _cv_request, "request", unbound_message=_no_req_msg48)49session: SessionMixin = LocalProxy(  # type: ignore[assignment]50    _cv_request, "session", unbound_message=_no_req_msg51)52 
codekingpro/portable-devtools · Team Ai