From f3f80164a80f578fcd78760283531ce02d384189 Mon Sep 17 00:00:00 2001 From: PIG208 <39874143+PIG208@users.noreply.github.com> Date: Sat, 23 Jul 2022 09:55:58 -0400 Subject: [PATCH] Fix type annotation of message_dict. (#1073) When message_dict is accessed, it either raises an `AttributeError` or returns a `dict`. There is no way for it to be `Optional`. https://github.com/django/django/blob/caad462feaa84ba78ed658a9595a4a4363dad2db/django/core/exceptions.py#L170-L176 Signed-off-by: Zixuan James Li --- django-stubs/core/exceptions.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django-stubs/core/exceptions.pyi b/django-stubs/core/exceptions.pyi index e8f72e066..3ccd1399f 100644 --- a/django-stubs/core/exceptions.pyi +++ b/django-stubs/core/exceptions.pyi @@ -44,7 +44,7 @@ class ValidationError(Exception): params: Optional[Dict[str, Any]] = ..., ) -> None: ... @property - def message_dict(self) -> Optional[Dict[str, List[str]]]: ... + def message_dict(self) -> Dict[str, List[str]]: ... @property def messages(self) -> List[str]: ... def update_error_dict(self, error_dict: Dict[str, List[ValidationError]]) -> Dict[str, List[ValidationError]]: ...