mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-20 10:51:16 +08:00
Ensure that all registered checks take the same parameters (#499)
The Django API requires that registered checks take an "app_configs" argument, which is a list of AppConfig. This is practically also passed by keyword, so all parameters should be specified with a "= ..." to indicate that they are keywords. Django always passed "app_configs" as a list, but checks can accept and use a more general more Sequence. The Django API also requires that registered checks take "**kwargs". This results in the canonical parameters of: "app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any"
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import Any, List, Union, Iterable, Optional
|
||||
from typing import Any, List, Union, Optional, Sequence
|
||||
|
||||
from django.contrib.admin.options import BaseModelAdmin
|
||||
from django.core.checks.messages import CheckMessage, Error
|
||||
@@ -7,7 +7,7 @@ from django.apps.config import AppConfig
|
||||
|
||||
_CheckError = Union[str, Error]
|
||||
|
||||
def check_admin_app(app_configs: Optional[Iterable[AppConfig]], **kwargs: Any) -> List[_CheckError]: ...
|
||||
def check_admin_app(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[_CheckError]: ...
|
||||
def check_dependencies(**kwargs: Any) -> List[_CheckError]: ...
|
||||
|
||||
class BaseModelAdminChecks:
|
||||
|
||||
Reference in New Issue
Block a user