According to mypy None of the subclasses of BaseRouter correctly implement the abstractmethod add_route.
class BaseRouter(ABC):
@abstractmethod
def add_route(*args) -> Union[Callable, CoroutineType, WebSocket]: ...
vs
class Router(BaseRouter):
...
def add_route(
self,
route_type: HttpMethod,
endpoint: str,
handler: Callable,
is_const: bool,
exception_handler: Optional[Callable],
injected_dependencies: dict,
) -> Union[Callable, CoroutineType]:
vs
class MiddlewareRouter(BaseRouter):
...
def add_route(
self,
middleware_type: MiddlewareType,
endpoint: str,
handler: Callable,
injected_dependencies: dict,
) -> Callable:
vs
class WebSocketRouter(BaseRouter):
...
def add_route(self, endpoint: str, web_socket: WebSocket) -> None:
self.routes[endpoint] = web_socket
The mypy errors are:
Signature of "add_route" incompatible with supertype "BaseRouter"
...
Superclass:
def add_route(*args: BaseRouter) -> Callable[..., Any] | CoroutineType[Any, Any, Any] | WebSocket
Subclass:
def add_route(self, route_type: HttpMethod, endpoint: str, handler: Callable[..., Any], is_const: bool, exception_handler: Callable[..., Any] | None, injected_dependencies: dict[Any, Any]) -> Callable[..., Any] | CoroutineType[Any, Any, Any]
...
Superclass:
def add_route(*args: BaseRouter) -> Callable[..., Any] | CoroutineType[Any, Any, Any] | WebSocket
Subclass:
def add_route(self, middleware_type: MiddlewareType, endpoint: str, handler: Callable[..., Any], injected_dependencies: dict[Any, Any]) -> Callable[..., Any]
...
Superclass:
def add_route(*args: BaseRouter) -> Callable[..., Any] | CoroutineType[Any, Any, Any] | WebSocket
Subclass:
def add_route(self, endpoint: str, web_socket: WebSocket) -> None
I can't find any use of BaseRouter in the codebase.
Options:
Linux
python --version
)3.12
main branch
No response
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too