From 74d95cdeecd4e2d722a633c54897621f526a035e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 22:12:36 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/flask/cli.py | 6 ++---- src/flask/config.py | 6 ++---- src/flask/json/tag.py | 1 + tests/test_json.py | 2 +- tests/typing/typing_app_decorators.py | 12 ++++-------- 5 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/flask/cli.py b/src/flask/cli.py index d4df2802..ecb292a0 100644 --- a/src/flask/cli.py +++ b/src/flask/cli.py @@ -229,15 +229,13 @@ def prepare_import(path: str) -> str: @t.overload def locate_app( module_name: str, app_name: str | None, raise_if_not_found: t.Literal[True] = True -) -> Flask: - ... +) -> Flask: ... @t.overload def locate_app( module_name: str, app_name: str | None, raise_if_not_found: t.Literal[False] = ... -) -> Flask | None: - ... +) -> Flask | None: ... def locate_app( diff --git a/src/flask/config.py b/src/flask/config.py index f2f41478..7e3ba179 100644 --- a/src/flask/config.py +++ b/src/flask/config.py @@ -27,12 +27,10 @@ class ConfigAttribute(t.Generic[T]): self.get_converter = get_converter @t.overload - def __get__(self, obj: None, owner: None) -> te.Self: - ... + def __get__(self, obj: None, owner: None) -> te.Self: ... @t.overload - def __get__(self, obj: App, owner: type[App]) -> T: - ... + def __get__(self, obj: App, owner: type[App]) -> T: ... def __get__(self, obj: App | None, owner: type[App] | None = None) -> T | te.Self: if obj is None: diff --git a/src/flask/json/tag.py b/src/flask/json/tag.py index 2bb986bc..8dc3629b 100644 --- a/src/flask/json/tag.py +++ b/src/flask/json/tag.py @@ -40,6 +40,7 @@ be processed before ``dict``. app.session_interface.serializer.register(TagOrderedDict, index=0) """ + from __future__ import annotations import typing as t diff --git a/tests/test_json.py b/tests/test_json.py index 500eb64d..1e2b27dc 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -176,7 +176,7 @@ def test_jsonify_aware_datetimes(tz): def test_jsonify_uuid_types(app, client): """Test jsonify with uuid.UUID types""" - test_uuid = uuid.UUID(bytes=b"\xDE\xAD\xBE\xEF" * 4) + test_uuid = uuid.UUID(bytes=b"\xde\xad\xbe\xef" * 4) url = "/uuid_test" app.add_url_rule(url, url, lambda: flask.jsonify(x=test_uuid)) diff --git a/tests/typing/typing_app_decorators.py b/tests/typing/typing_app_decorators.py index c8d01113..0e25a30c 100644 --- a/tests/typing/typing_app_decorators.py +++ b/tests/typing/typing_app_decorators.py @@ -17,20 +17,16 @@ async def after_async(response: Response) -> Response: @app.before_request -def before_sync() -> None: - ... +def before_sync() -> None: ... @app.before_request -async def before_async() -> None: - ... +async def before_async() -> None: ... @app.teardown_appcontext -def teardown_sync(exc: BaseException | None) -> None: - ... +def teardown_sync(exc: BaseException | None) -> None: ... @app.teardown_appcontext -async def teardown_async(exc: BaseException | None) -> None: - ... +async def teardown_async(exc: BaseException | None) -> None: ...