Skip to content

Commit

Permalink
remove unused parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
provinzkraut committed Dec 22, 2024
1 parent 418ddc2 commit 0d74792
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions litestar/handlers/asgi_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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'")
Expand Down
4 changes: 2 additions & 2 deletions litestar/handlers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions litestar/handlers/http_handlers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion litestar/handlers/websocket_handlers/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions litestar/handlers/websocket_handlers/route_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'")
Expand Down

0 comments on commit 0d74792

Please sign in to comment.