From 8a13137e819d6bf1316e91266e63e452bfa187c4 Mon Sep 17 00:00:00 2001 From: Heisenberg Date: Sun, 9 Jun 2024 19:12:51 -0400 Subject: [PATCH] Some extra return type added. --- examples/tutorial/tests/conftest.py | 2 +- src/flask/app.py | 2 +- src/flask/sansio/blueprints.py | 2 +- src/flask/sansio/scaffold.py | 2 +- tests/conftest.py | 2 +- tests/test_appctx.py | 2 +- tests/test_basic.py | 4 ++-- tests/test_helpers.py | 6 +++--- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/tutorial/tests/conftest.py b/examples/tutorial/tests/conftest.py index 6bf62f0a..30381a01 100644 --- a/examples/tutorial/tests/conftest.py +++ b/examples/tutorial/tests/conftest.py @@ -45,7 +45,7 @@ def runner(app): class AuthActions: - def __init__(self, client): + def __init__(self, client) -> None: self._client = client def login(self, username="test", password="test"): diff --git a/src/flask/app.py b/src/flask/app.py index 7622b5e8..8ab5f2d9 100644 --- a/src/flask/app.py +++ b/src/flask/app.py @@ -227,7 +227,7 @@ class Flask(App): instance_path: str | None = None, instance_relative_config: bool = False, root_path: str | None = None, - ): + ) -> None: super().__init__( import_name=import_name, static_url_path=static_url_path, diff --git a/src/flask/sansio/blueprints.py b/src/flask/sansio/blueprints.py index 4f912cca..d3b453e3 100644 --- a/src/flask/sansio/blueprints.py +++ b/src/flask/sansio/blueprints.py @@ -183,7 +183,7 @@ class Blueprint(Scaffold): url_defaults: dict[str, t.Any] | None = None, root_path: str | None = None, cli_group: str | None = _sentinel, # type: ignore[assignment] - ): + ) -> None: super().__init__( import_name=import_name, static_folder=static_folder, diff --git a/src/flask/sansio/scaffold.py b/src/flask/sansio/scaffold.py index 69e33a09..78871475 100644 --- a/src/flask/sansio/scaffold.py +++ b/src/flask/sansio/scaffold.py @@ -79,7 +79,7 @@ class Scaffold: static_url_path: str | None = None, template_folder: str | os.PathLike[str] | None = None, root_path: str | None = None, - ): + ) -> None: #: The name of the package or module that this object belongs #: to. Do not change this once it is set by the constructor. self.import_name = import_name diff --git a/tests/conftest.py b/tests/conftest.py index 58cf85d8..790793fa 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -111,7 +111,7 @@ def limit_loader(request, monkeypatch): return class LimitedLoader: - def __init__(self, loader): + def __init__(self, loader) -> None: self.loader = loader def __getattr__(self, name): diff --git a/tests/test_appctx.py b/tests/test_appctx.py index ca9e079e..4092826d 100644 --- a/tests/test_appctx.py +++ b/tests/test_appctx.py @@ -156,7 +156,7 @@ def test_app_ctx_globals_methods(app, app_ctx): def test_custom_app_ctx_globals_class(app): class CustomRequestGlobals: - def __init__(self): + def __init__(self) -> None: self.spam = "eggs" app.app_ctx_globals_class = CustomRequestGlobals diff --git a/tests/test_basic.py b/tests/test_basic.py index 214cfee0..71b2a66b 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -266,7 +266,7 @@ def test_session_path(app, client): def test_session_using_application_root(app, client): class PrefixPathMiddleware: - def __init__(self, app, prefix): + def __init__(self, app, prefix) -> None: self.app = app self.prefix = prefix @@ -1781,7 +1781,7 @@ def test_multi_route_rules(app, client): def test_multi_route_class_views(app, client): class View: - def __init__(self, app): + def __init__(self, app) -> None: app.add_url_rule("/", "index", self.index) app.add_url_rule("//", "index", self.index) diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 3566385c..759bb641 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -15,7 +15,7 @@ class FakePath: See: https://www.python.org/dev/peps/pep-0519/ """ - def __init__(self, path): + def __init__(self, path) -> None: self.path = path def __fspath__(self): @@ -23,7 +23,7 @@ class FakePath: class PyBytesIO: - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: self._io = io.BytesIO(*args, **kwargs) def __getattr__(self, name): @@ -265,7 +265,7 @@ class TestStreaming: called = [] class Wrapper: - def __init__(self, gen): + def __init__(self, gen) -> None: self._gen = gen def __iter__(self):