From 0d74792dcab0dbdce997481b92ef43cb31560569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janek=20Nouvertn=C3=A9?= <25355197+provinzkraut@users.noreply.github.com> Date: Sun, 22 Dec 2024 16:52:16 +0100 Subject: [PATCH] remove unused parameter --- litestar/handlers/asgi_handlers.py | 6 +++--- litestar/handlers/base.py | 4 ++-- litestar/handlers/http_handlers/base.py | 4 ++-- litestar/handlers/websocket_handlers/listener.py | 2 +- litestar/handlers/websocket_handlers/route_handler.py | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/litestar/handlers/asgi_handlers.py b/litestar/handlers/asgi_handlers.py index 2316a88400..0c1d194c5e 100644 --- a/litestar/handlers/asgi_handlers.py +++ b/litestar/handlers/asgi_handlers.py @@ -11,7 +11,7 @@ if TYPE_CHECKING: - from litestar import Litestar, Router + from litestar import Router from litestar.connection import ASGIConnection from litestar.types import ( AsyncAnyCallable, @@ -79,9 +79,9 @@ def _get_merge_opts(self, others: tuple[Router, ...]) -> dict[str, Any]: merge_opts["is_mount"] = self.is_mount return merge_opts - def _validate_handler_function(self, app: Litestar | None = None) -> None: + def _validate_handler_function(self) -> None: """Validate the route handler function once it's set by inspecting its return annotations.""" - super()._validate_handler_function(app=app) + super()._validate_handler_function() if not self.parsed_fn_signature.return_type.is_subclass_of(NoneType): raise ImproperlyConfiguredException("ASGI handler functions should return 'None'") diff --git a/litestar/handlers/base.py b/litestar/handlers/base.py index e79b325330..0667d05c46 100644 --- a/litestar/handlers/base.py +++ b/litestar/handlers/base.py @@ -509,10 +509,10 @@ def on_registration(self, route: BaseRoute, app: Litestar) -> None: self._dto = self._resolve_data_dto(app=app) self._return_dto = self._resolve_return_dto(app=app, data_dto=self._dto) - self._validate_handler_function(app=app) + self._validate_handler_function() self._finalize_dependencies(app=app) - def _validate_handler_function(self, app: Litestar | None = None) -> None: + def _validate_handler_function(self) -> None: """Validate the route handler function once set by inspecting its return annotations.""" if self.parsed_data_field is not None and self.parsed_data_field.is_subclass_of(DTOData) and not self.data_dto: raise ImproperlyConfiguredException( diff --git a/litestar/handlers/http_handlers/base.py b/litestar/handlers/http_handlers/base.py index 658635124b..7e9ca26d0d 100644 --- a/litestar/handlers/http_handlers/base.py +++ b/litestar/handlers/http_handlers/base.py @@ -550,9 +550,9 @@ def _get_kwargs_model_for_route(self, path_parameters: Iterable[str]) -> KwargsM model = self._kwargs_models[key] = self._create_kwargs_model(path_parameters) return model - def _validate_handler_function(self, app: Litestar | None = None) -> None: + def _validate_handler_function(self) -> None: """Validate the route handler function once it is set by inspecting its return annotations.""" - super()._validate_handler_function(app=app) + super()._validate_handler_function() return_type = self.parsed_fn_signature.return_type diff --git a/litestar/handlers/websocket_handlers/listener.py b/litestar/handlers/websocket_handlers/listener.py index 28f4087cf5..b21f8d3151 100644 --- a/litestar/handlers/websocket_handlers/listener.py +++ b/litestar/handlers/websocket_handlers/listener.py @@ -273,7 +273,7 @@ def _prepare_fn(self) -> ListenerHandler: listener=self, fn=self.fn, parsed_signature=parsed_signature, namespace=self.signature_namespace ) - def _validate_handler_function(self, app: Litestar | None = None) -> None: + def _validate_handler_function(self) -> None: """Validate the route handler function once it's set by inspecting its return annotations.""" # validation occurs in the call method diff --git a/litestar/handlers/websocket_handlers/route_handler.py b/litestar/handlers/websocket_handlers/route_handler.py index ade74acf77..eb3a986125 100644 --- a/litestar/handlers/websocket_handlers/route_handler.py +++ b/litestar/handlers/websocket_handlers/route_handler.py @@ -100,9 +100,9 @@ def resolve_websocket_class(self) -> type[WebSocket]: def websocket_class(self) -> type[WebSocket]: return self._websocket_class or WebSocket - def _validate_handler_function(self, app: Litestar | None = None) -> None: + def _validate_handler_function(self) -> None: """Validate the route handler function once it's set by inspecting its return annotations.""" - super()._validate_handler_function(app=app) + super()._validate_handler_function() if not self.parsed_fn_signature.return_type.is_subclass_of(NoneType): raise ImproperlyConfiguredException(f"{self}: WebSocket handlers must return 'None'")