mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-20 02:41:16 +08:00
Ensure that all registered checks return a list of CheckMessage (#508)
* Ensure that all registered checks return a list of CheckMessage This changes missing and Any return types on registered checks to always return "List[CheckMessage]". In many cases, check functions were already annotated to return in a more specific type than CheckMessage (e.g. Error). In these cases, it's assumed that the existing annotation is correct, and the more specific type is kept. * Update model_checks.pyi Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
from typing import Any, List, Union, Optional, Sequence
|
||||
from typing import Any, List, Optional, Sequence
|
||||
|
||||
from django.contrib.admin.options import BaseModelAdmin
|
||||
from django.core.checks.messages import CheckMessage, Error
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
|
||||
_CheckError = Union[str, Error]
|
||||
|
||||
def check_admin_app(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[_CheckError]: ...
|
||||
def check_dependencies(**kwargs: Any) -> List[_CheckError]: ...
|
||||
def check_admin_app(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Error]: ...
|
||||
def check_dependencies(app_configs: Optional[Sequence[AppConfig]] = ..., **kwargs: Any) -> List[Error]: ...
|
||||
|
||||
class BaseModelAdminChecks:
|
||||
def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> List[CheckMessage]: ...
|
||||
|
||||
Reference in New Issue
Block a user