Skip to content

Commit

Permalink
Broaden type annotation for ValidationError to accept lazystr.
Browse files Browse the repository at this point in the history
Signed-off-by: Zixuan James Li <p359101898@gmail.com>
  • Loading branch information
PIG208 committed Aug 29, 2022
1 parent 1250eb9 commit b66572e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion django-stubs/core/exceptions.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union

from django.utils.functional import _StrPromise
from typing_extensions import Literal

class FieldDoesNotExist(Exception): ...
Expand Down Expand Up @@ -35,7 +36,7 @@ class ValidationError(Exception):
def __init__(
self,
# Accepts arbitrarily nested data structure, mypy doesn't allow describing it accurately.
message: Union[str, ValidationError, Dict[str, Any], List[Any]],
message: Union[str, _StrPromise, ValidationError, Dict[str, Any], List[Any]],
code: Optional[str] = ...,
params: Optional[Dict[str, Any]] = ...,
) -> None: ...
Expand Down

0 comments on commit b66572e

Please sign in to comment.