@@ -566,6 +566,29 @@ def _pprint_user_string(self, object, stream, indent, allowance, context, level)
566566
567567    _dispatch [_collections .UserString .__repr__ ] =  _pprint_user_string 
568568
569+     def  _pprint_template (self , object , stream , indent , allowance , context , level ):
570+         cls_name  =  object .__class__ .__name__ 
571+         indent  +=  len (cls_name ) +  1 
572+         items  =  (("strings" , object .strings ),
573+                  ("interpolations" , object .interpolations ))
574+         stream .write (cls_name  +  '(' )
575+         self ._format_namespace_items (items , stream , indent , allowance , context , level )
576+         stream .write (')' )
577+ 
578+     def  _pprint_interpolation (self , object , stream , indent , allowance , context , level ):
579+         cls_name  =  object .__class__ .__name__ 
580+         indent  +=  len (cls_name )
581+         items  =  (object .value , object .expression ,
582+                 object .conversion , object .format_spec )
583+         stream .write (cls_name  +  '(' )
584+         self ._format_items (items , stream , indent , allowance , context , level )
585+         stream .write (')' )
586+ 
587+     t  =  t "{0}" 
588+     _dispatch [type (t ).__repr__ ] =  _pprint_template 
589+     _dispatch [type (t .interpolations [0 ]).__repr__ ] =  _pprint_interpolation 
590+     del  t 
591+ 
569592    def  _safe_repr (self , object , context , maxlevels , level ):
570593        # Return triple (repr_string, isreadable, isrecursive). 
571594        typ  =  type (object )
0 commit comments