forked from orbit-oss/flask
drop support for python 3.7
This commit is contained in:
parent
9659b11a45
commit
2e8fe7b2f2
14 changed files with 19 additions and 40 deletions
|
|
@ -1,7 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import functools
|
||||
import inspect
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
|
@ -9,6 +7,7 @@ import typing as t
|
|||
import weakref
|
||||
from collections.abc import Iterator as _abc_Iterator
|
||||
from datetime import timedelta
|
||||
from inspect import iscoroutinefunction
|
||||
from itertools import chain
|
||||
from types import TracebackType
|
||||
from urllib.parse import quote as _url_quote
|
||||
|
|
@ -70,7 +69,6 @@ from .wrappers import Request
|
|||
from .wrappers import Response
|
||||
|
||||
if t.TYPE_CHECKING: # pragma: no cover
|
||||
import typing_extensions as te
|
||||
from .blueprints import Blueprint
|
||||
from .testing import FlaskClient
|
||||
from .testing import FlaskCliRunner
|
||||
|
|
@ -83,19 +81,6 @@ T_template_filter = t.TypeVar("T_template_filter", bound=ft.TemplateFilterCallab
|
|||
T_template_global = t.TypeVar("T_template_global", bound=ft.TemplateGlobalCallable)
|
||||
T_template_test = t.TypeVar("T_template_test", bound=ft.TemplateTestCallable)
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
iscoroutinefunction = inspect.iscoroutinefunction
|
||||
else:
|
||||
|
||||
def iscoroutinefunction(func: t.Any) -> bool:
|
||||
while inspect.ismethod(func):
|
||||
func = func.__func__
|
||||
|
||||
while isinstance(func, functools.partial):
|
||||
func = func.func
|
||||
|
||||
return inspect.iscoroutinefunction(func)
|
||||
|
||||
|
||||
def _make_timedelta(value: timedelta | int | None) -> timedelta | None:
|
||||
if value is None or isinstance(value, timedelta):
|
||||
|
|
@ -1430,7 +1415,7 @@ class Flask(Scaffold):
|
|||
f"Exception on {request.path} [{request.method}]", exc_info=exc_info
|
||||
)
|
||||
|
||||
def raise_routing_exception(self, request: Request) -> te.NoReturn:
|
||||
def raise_routing_exception(self, request: Request) -> t.NoReturn:
|
||||
"""Intercept routing exceptions and possibly do something else.
|
||||
|
||||
In debug mode, intercept a routing redirect and replace it with
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ from .signals import message_flashed
|
|||
if t.TYPE_CHECKING: # pragma: no cover
|
||||
from werkzeug.wrappers import Response as BaseResponse
|
||||
from .wrappers import Response
|
||||
import typing_extensions as te
|
||||
|
||||
|
||||
def get_debug_flag() -> bool:
|
||||
|
|
@ -257,7 +256,7 @@ def redirect(
|
|||
return _wz_redirect(location, code=code, Response=Response)
|
||||
|
||||
|
||||
def abort(code: int | BaseResponse, *args: t.Any, **kwargs: t.Any) -> te.NoReturn:
|
||||
def abort(code: int | BaseResponse, *args: t.Any, **kwargs: t.Any) -> t.NoReturn:
|
||||
"""Raise an :exc:`~werkzeug.exceptions.HTTPException` for the given
|
||||
status code.
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ from werkzeug.datastructures import CallbackDict
|
|||
from .json.tag import TaggedJSONSerializer
|
||||
|
||||
if t.TYPE_CHECKING: # pragma: no cover
|
||||
import typing_extensions as te
|
||||
from .app import Flask
|
||||
from .wrappers import Request, Response
|
||||
|
||||
|
|
@ -94,7 +93,7 @@ class NullSession(SecureCookieSession):
|
|||
but fail on setting.
|
||||
"""
|
||||
|
||||
def _fail(self, *args: t.Any, **kwargs: t.Any) -> te.NoReturn:
|
||||
def _fail(self, *args: t.Any, **kwargs: t.Any) -> t.NoReturn:
|
||||
raise RuntimeError(
|
||||
"The session is unavailable because no secret "
|
||||
"key was set. Set the secret_key on the "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue