Skip to content

Commit

Permalink
Fix type annotation of message_dict. (#1073)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
PIG208 authored Jul 23, 2022
1 parent 3d8d900 commit f3f8016
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion django-stubs/core/exceptions.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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]]: ...
Expand Down

0 comments on commit f3f8016

Please sign in to comment.