codekingpro/portable-devtools
114k
1# Copyright 2021 by J. Christopher Wagner (jwag). All rights reserved.2 3import typing as t4 5from flask import current_app6from werkzeug.local import LocalProxy7 8if t.TYPE_CHECKING: # pragma: no cover9 from passlib.context import CryptContext10 from .core import Security11 from .datastore import CanonicalUserDatastore12 13# Convenient references14_security: "Security" = LocalProxy( # type: ignore15 lambda: current_app.extensions["security"]16)17 18_datastore: "CanonicalUserDatastore" = LocalProxy( # type:ignore19 lambda: _security.datastore20)21 22_pwd_context: "CryptContext" = LocalProxy(lambda: _security.pwd_context) # type: ignore23 24_hashing_context: "CryptContext" = LocalProxy( # type: ignore25 lambda: _security.hashing_context26)27 28DecoratedView = t.Callable[..., t.Any]29 