aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Flask/py3/flask/typing.py
diff options
context:
space:
mode:
authornkozlovskiy <nmk@ydb.tech>2023-09-29 12:24:06 +0300
committernkozlovskiy <nmk@ydb.tech>2023-09-29 12:41:34 +0300
commite0e3e1717e3d33762ce61950504f9637a6e669ed (patch)
treebca3ff6939b10ed60c3d5c12439963a1146b9711 /contrib/python/Flask/py3/flask/typing.py
parent38f2c5852db84c7b4d83adfcb009eb61541d1ccd (diff)
downloadydb-e0e3e1717e3d33762ce61950504f9637a6e669ed.tar.gz
add ydb deps
Diffstat (limited to 'contrib/python/Flask/py3/flask/typing.py')
-rw-r--r--contrib/python/Flask/py3/flask/typing.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/contrib/python/Flask/py3/flask/typing.py b/contrib/python/Flask/py3/flask/typing.py
new file mode 100644
index 0000000000..93896f806c
--- /dev/null
+++ b/contrib/python/Flask/py3/flask/typing.py
@@ -0,0 +1,49 @@
+import typing as t
+
+
+if t.TYPE_CHECKING:
+ from _typeshed.wsgi import WSGIApplication # noqa: F401
+ from werkzeug.datastructures import Headers # noqa: F401
+ from .wrappers import Response # noqa: F401
+
+# The possible types that are directly convertible or are a Response object.
+ResponseValue = t.Union[
+ "Response",
+ t.AnyStr,
+ t.Dict[str, t.Any], # any jsonify-able dict
+ t.Generator[t.AnyStr, None, None],
+]
+StatusCode = int
+
+# the possible types for an individual HTTP header
+HeaderName = str
+HeaderValue = t.Union[str, t.List[str], t.Tuple[str, ...]]
+
+# the possible types for HTTP headers
+HeadersValue = t.Union[
+ "Headers", t.Dict[HeaderName, HeaderValue], t.List[t.Tuple[HeaderName, HeaderValue]]
+]
+
+# The possible types returned by a route function.
+ResponseReturnValue = t.Union[
+ ResponseValue,
+ t.Tuple[ResponseValue, HeadersValue],
+ t.Tuple[ResponseValue, StatusCode],
+ t.Tuple[ResponseValue, StatusCode, HeadersValue],
+ "WSGIApplication",
+]
+
+GenericException = t.TypeVar("GenericException", bound=Exception, contravariant=True)
+
+AppOrBlueprintKey = t.Optional[str] # The App key is None, whereas blueprints are named
+AfterRequestCallable = t.Callable[["Response"], "Response"]
+BeforeFirstRequestCallable = t.Callable[[], None]
+BeforeRequestCallable = t.Callable[[], t.Optional[ResponseReturnValue]]
+TeardownCallable = t.Callable[[t.Optional[BaseException]], None]
+TemplateContextProcessorCallable = t.Callable[[], t.Dict[str, t.Any]]
+TemplateFilterCallable = t.Callable[..., t.Any]
+TemplateGlobalCallable = t.Callable[..., t.Any]
+TemplateTestCallable = t.Callable[..., bool]
+URLDefaultCallable = t.Callable[[str, dict], None]
+URLValuePreprocessorCallable = t.Callable[[t.Optional[str], t.Optional[dict]], None]
+ErrorHandlerCallable = t.Callable[[GenericException], ResponseReturnValue]