fix typing that wasn't available in Python 3.6.0
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by David Lord · parent 6fe7f45 · Browse files · 4 files·+7 added−3 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+7 added−3 removed
- other:+7 added−3 removed
Provenance
- Commit
25884c4- Tree
8148f56- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
6fe7f45
4 files changed+7 added−3 removed
modified:src/flask/app.py+2 added-1 removed
70 unmodified lines71 from .wrappers import Request72 from .wrappers import Response73 74 if t.TYPE_CHECKING:75+ import typing_extensions as te76 from .blueprints import Blueprint77 from .testing import FlaskClient78 from .testing import FlaskCliRunner79 1361 unmodified lines1441 self.logger.error(1442 f"Exception on {request.path} [{request.method}]", exc_info=exc_info1443 )1444 1444- def raise_routing_exception(self, request: Request) -> t.NoReturn:1445+ def raise_routing_exception(self, request: Request) -> "te.NoReturn":1446 """Exceptions that are recording during routing are reraised with1447 this method. During debug we are not reraising redirect requests1448 for non ``GET``, ``HEAD``, or ``OPTIONS`` requests and we're raising1449 a different error instead to help debug situations.627 unmodified linesmodified:src/flask/sessions.py+2 added-1 removed
10 unmodified lines11 from .helpers import is_ip12 from .json.tag import TaggedJSONSerializer13 14 if t.TYPE_CHECKING:15+ import typing_extensions as te16 from .app import Flask17 from .wrappers import Request, Response18 19 72 unmodified lines92 available. Will still allow read-only access to the empty session93 but fail on setting.94 """95 95- def _fail(self, *args: t.Any, **kwargs: t.Any) -> t.NoReturn:96+ def _fail(self, *args: t.Any, **kwargs: t.Any) -> "te.NoReturn":97 raise RuntimeError(98 "The session is unavailable because no secret "99 "key was set. Set the secret_key on the "100 "application to something unique and secret."304 unmodified linesmodified:src/flask/wrappers.py+2 added-1 removed
6 unmodified lines7 from . import json8 from .globals import current_app9 10 if t.TYPE_CHECKING:11+ import typing_extensions as te12 from werkzeug.routing import Rule13 14 15 class Request(RequestBase):75 unmodified lines91 from .debughelpers import attach_enctype_error_multidict92 93 attach_enctype_error_multidict(self)94 94- def on_json_loading_failed(self, e: Exception) -> t.NoReturn:95+ def on_json_loading_failed(self, e: Exception) -> "te.NoReturn":96 if current_app and current_app.debug:97 raise BadRequest(f"Failed to decode JSON object: {e}")98 99 raise BadRequest()36 unmodified linesmodified:CHANGES.rst+1 added
10 unmodified lines11 - Mark top-level names as exported so type checking understands12 imports in user projects. :issue:`4024`13 - Fix type annotation for ``g`` and inform mypy that it is a namespace14 object that has arbitrary attributes. :issue:`4020`15+- Fix some types that weren't available in Python 3.6.0. :issue:`4040`16 17 18 Version 2.0.019 -------------1096 unmodified lines