@@ -172,7 +172,7 @@ def __default(o: Any) -> Any:
172172 if isinstance (o , Set ):
173173 return list (o )
174174
175- raise TypeError (f"Cant' get default value for { type (o )} with value { repr ( o ) } " )
175+ raise TypeError (f"Cant' get default value for { type (o )} with value { o !r } " )
176176
177177
178178def as_json (obj : Any , indent : Optional [bool ] = None , compact : Optional [bool ] = None ) -> str :
@@ -298,7 +298,7 @@ def from_dict(
298298 match_type_hints = type_hints
299299 elif match_same_keys is not None and len (match_same_keys ) == len (same_keys ):
300300 raise TypeError (
301- f"Value { repr ( value ) } matches to more then one types of "
301+ f"Value { value !r } matches to more then one types of "
302302 f"{ repr (types [0 ].__name__ ) if len (types )== 1 else ' | ' .join (repr (e .__name__ ) for e in types )} ."
303303 )
304304
@@ -317,7 +317,7 @@ def from_dict(
317317 try :
318318 return match_ (** params )
319319 except TypeError as ex :
320- raise TypeError (f"Can't initialize class { repr ( match_ ) } with parameters { repr ( params ) } ." ) from ex
320+ raise TypeError (f"Can't initialize class { match_ !r } with parameters { params !r } ." ) from ex
321321
322322 for t in types :
323323 args = get_args (t )
@@ -332,7 +332,7 @@ def from_dict(
332332 return cast (_T , v )
333333
334334 raise TypeError (
335- f"Cant convert value { repr ( value ) } of type { type (value ).__name__ } to type(s) "
335+ f"Cant convert value { value !r } of type { type (value ).__name__ } to type(s) "
336336 + (
337337 repr (types [0 ])
338338 if len (types ) == 1
@@ -415,13 +415,13 @@ def __repr__(self) -> str:
415415 cls = self .class_
416416 cls_name = f"{ cls .__module__ } .{ cls .__name__ } " if cls .__module__ != "__main__" else cls .__name__
417417 attrs = ", " .join ([repr (v ) for v in self .args ])
418- return f"{ cls_name } ({ attrs } , errors={ repr ( self .errors ) } )"
418+ return f"{ cls_name } ({ attrs } , errors={ self .errors !r } )"
419419
420420 def __str__ (self ) -> str :
421421 cls = self .class_
422422 cls_name = f"{ cls .__module__ } .{ cls .__name__ } " if cls .__module__ != "__main__" else cls .__name__
423423 s = cls_name
424- return f"{ s } (errors = { repr ( self .errors ) } )"
424+ return f"{ s } (errors = { self .errors !r } )"
425425
426426
427427def validate_types (expected_types : Union [type , Tuple [type , ...], None ], value : Any ) -> List [str ]:
0 commit comments