@@ -375,7 +375,7 @@ def step_function(
375375 if fn_kwargs is None :
376376 fn_kwargs = {}
377377 if score and not self .op .returns_loss :
378- raise NotImplementedError ("%s does not have loss" % self . op )
378+ raise NotImplementedError (f" { self . op } does not have loss" )
379379 updates = self .updates (
380380 obj_n_mc = obj_n_mc ,
381381 tf_n_mc = tf_n_mc ,
@@ -416,7 +416,7 @@ def score_function(
416416 if fn_kwargs is None :
417417 fn_kwargs = {}
418418 if not self .op .returns_loss :
419- raise NotImplementedError ("%s does not have loss" % self . op )
419+ raise NotImplementedError (f" { self . op } does not have loss" )
420420 if more_replacements is None :
421421 more_replacements = {}
422422 loss = self (sc_n_mc , more_replacements = more_replacements )
@@ -496,13 +496,13 @@ def apply(self, f): # pragma: no cover
496496 def __call__ (self , f = None ):
497497 if self .has_test_function :
498498 if f is None :
499- raise ParametrizationError ("Operator %s requires TestFunction" % self )
499+ raise ParametrizationError (f "Operator { self } requires TestFunction" )
500500 else :
501501 if not isinstance (f , TestFunction ):
502502 f = TestFunction .from_function (f )
503503 else :
504504 if f is not None :
505- warnings .warn ("TestFunction for %s is redundant and removed" % self , stacklevel = 3 )
505+ warnings .warn (f "TestFunction for { self } is redundant and removed" , stacklevel = 3 )
506506 else :
507507 pass
508508 f = TestFunction ()
@@ -555,7 +555,7 @@ def setup(self, approx):
555555 @classmethod
556556 def from_function (cls , f ):
557557 if not callable (f ):
558- raise ParametrizationError ("Need callable, got %r" % f )
558+ raise ParametrizationError (f "Need callable, got { f !r } " )
559559 obj = TestFunction ()
560560 obj .__call__ = f
561561 return obj
@@ -1512,7 +1512,7 @@ def vars_names(vs):
15121512 found .name = name + "_vi_random_slice"
15131513 break
15141514 else :
1515- raise KeyError ("%r not found" % name )
1515+ raise KeyError (f" { name !r } not found" )
15161516 return found
15171517
15181518 @node_property
0 commit comments