Skip to content

Commit 766a29d

Browse files
authored
Improve DefaultRouter constructor and attributes (#610)
* Improve `DefaultRouter` constructor and attributes * Update allowlist
1 parent 641b213 commit 766a29d

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

rest_framework-stubs/routers.pyi

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,16 @@ class DefaultRouter(SimpleRouter):
6060
include_format_suffixes: bool
6161
root_view_name: str
6262
default_schema_renderers: Any
63-
APIRootView = APIRootView
64-
APISchemaView = SchemaView
65-
SchemaGenerator = SchemaGenerator
66-
63+
APIRootView: type[APIRootView]
64+
APISchemaView: type[SchemaView]
65+
SchemaGenerator: type[SchemaGenerator]
6766
root_renderers: list[type[BaseRenderer]]
68-
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
67+
68+
def __init__(
69+
self,
70+
trailing_slash: bool = True,
71+
use_regex_path: bool = True,
72+
*,
73+
root_renderers: list[type[BaseRenderer]] = ...,
74+
) -> None: ...
6975
def get_api_root_view(self, api_urls: Any | None = ...) -> Callable: ...

scripts/stubtest/allowlist_todo.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ rest_framework.request.Request.QUERY_PARAMS
6565
rest_framework.routers.BaseRouter
6666
rest_framework.routers.BaseRouter.register
6767
rest_framework.routers.DefaultRouter
68-
rest_framework.routers.DefaultRouter.APIRootView
69-
rest_framework.routers.DefaultRouter.APISchemaView
70-
rest_framework.routers.DefaultRouter.SchemaGenerator
7168
rest_framework.routers.RenameRouterMethods
7269
rest_framework.routers.SimpleRouter
7370
rest_framework.schemas.SchemaGenerator.__init__

0 commit comments

Comments
 (0)