@@ -714,22 +714,16 @@ class PydanticCustomError(ValueError):
714714 raise PydanticCustomError('custom_value_error', 'Value must be greater than {value}', {'value': 10, 'extra_context': 'extra_data'})
715715 return v
716716 ```
717+
718+ Arguments:
719+ error_type: The error type.
720+ message_template: The message template.
721+ context: The data to inject into the message template.
717722 """
718723
719724 def __init__ (
720- self , error_type : LiteralString , message_template : LiteralString , context : dict [str , Any ] | None = None
721- ) -> None :
722- """Initializes the `PydanticCustomError`.
723-
724- Arguments:
725- error_type: The error type.
726- message_template: The message template.
727- context: The data to inject into the message template.
728- """
729-
730- def __new__ (
731- cls , error_type : LiteralString , message_template : LiteralString , context : dict [str , Any ] | None = None
732- ) -> Self : ...
725+ self , error_type : LiteralString , message_template : LiteralString , context : dict [str , Any ] | None = None , /
726+ ) -> None : ...
733727 @property
734728 def context (self ) -> dict [str , Any ] | None :
735729 """Values which are required to render the error message, and could hence be useful in passing error data forward."""
@@ -757,20 +751,16 @@ class PydanticKnownError(ValueError):
757751
758752 def custom_validator(v) -> None:
759753 if v <= 10:
760- raise PydanticKnownError(error_type= 'greater_than', context= {'gt': 10})
754+ raise PydanticKnownError('greater_than', {'gt': 10})
761755 return v
762756 ```
763- """
764-
765- def __init__ (self , error_type : ErrorType , context : dict [str , Any ] | None = None ) -> None :
766- """Initializes the `PydanticKnownError`.
767757
768- Arguments:
769- error_type: The error type.
770- context: The data to inject into the message template.
771- """
758+ Arguments:
759+ error_type: The error type.
760+ context: The data to inject into the message template.
761+ """
772762
773- def __new__ ( cls , error_type : ErrorType , context : dict [str , Any ] | None = None ) -> Self : ...
763+ def __init__ ( self , error_type : ErrorType , context : dict [str , Any ] | None = None , / ) -> None : ...
774764 @property
775765 def context (self ) -> dict [str , Any ] | None :
776766 """Values which are required to render the error message, and could hence be useful in passing error data forward."""
@@ -870,16 +860,12 @@ class PydanticSerializationError(ValueError):
870860 """An error raised when an issue occurs during serialization.
871861
872862 In custom serializers, this error can be used to indicate that serialization has failed.
873- """
874-
875- def __init__ (self , message : str ) -> None :
876- """Initializes the `PydanticSerializationError`.
877863
878- Arguments:
879- message: The message associated with the error.
880- """
864+ Arguments:
865+ message: The message associated with the error.
866+ """
881867
882- def __new__ ( cls , message : str ) -> Self : ...
868+ def __init__ ( self , message : str , / ) -> None : ...
883869
884870@final
885871class PydanticSerializationUnexpectedValue (ValueError ):
@@ -918,16 +904,12 @@ class PydanticSerializationUnexpectedValue(ValueError):
918904
919905 This is often used internally in `pydantic-core` when unexpected types are encountered during serialization,
920906 but it can also be used by users in custom serializers, as seen above.
921- """
922-
923- def __init__ (self , message : str ) -> None :
924- """Initializes the `PydanticSerializationUnexpectedValue`.
925907
926- Arguments:
927- message: The message associated with the unexpected value.
928- """
908+ Arguments:
909+ message: The message associated with the unexpected value.
910+ """
929911
930- def __new__ ( cls , message : str | None = None ) -> Self : ...
912+ def __init__ ( self , message : str , / ) -> None : ...
931913
932914@final
933915class ArgsKwargs :
0 commit comments