@@ -191,22 +191,23 @@ def _process_parameter_replacements(sequencer_program: str, replacements: dict[s
191191
192192 # At this point, the replacement value should be a string.
193193 if not isinstance (replacement , str ):
194- raise ValueError ("Cannot handle replacement value of type {!r}" . format ( type (replacement )) )
194+ raise ValueError (f "Cannot handle replacement value of type { type (replacement )!r } " )
195195
196196 # Perform the replacement.
197197 if SEQC_PAR_PATTERN .fullmatch (parameter ):
198198 # Replace parameter, respecting word boundaries only (note: '$' is already a word boundary)
199199 parameter_pattern = f"\\ { parameter } \\ b" # escape the '$' and add word boundary match
200200 sequencer_program = re .sub (parameter_pattern , replacement , sequencer_program )
201201 else :
202- raise NameError ("Replacement parameter has an invalid name: {}" . format ( parameter ) )
202+ raise NameError (f "Replacement parameter has an invalid name: { parameter } " )
203203
204204 # Check if there are any unreplaced parameters left in the source code; this will not compile.
205205 leftover_parameters = SEQC_PAR_PATTERN .findall (sequencer_program )
206206 if leftover_parameters :
207- raise KeyError ("Variables left in sequencer program that were not in replacement dictionary: {}" .format (
208- ', ' .join (leftover_parameters )
209- ))
207+ raise KeyError (
208+ "Variables left in sequencer program that were not in replacement dictionary: " +
209+ f"{ ', ' .join (leftover_parameters )} ."
210+ )
210211
211212 return sequencer_program
212213
@@ -246,7 +247,7 @@ def _check_program_not_empty(sequencer_program: str):
246247
247248 # Check if there are any lines left (we do not check if that is executable code; the compiler will do that).
248249 if len (seqc_statements ) == 0 :
249- raise QMI_ApplicationException ("Source string does not contain executable statements" )
250+ raise QMI_ApplicationException ("Source string does not contain executable statements. " )
250251
251252 @staticmethod
252253 def _control_waveform_inputs (
@@ -434,7 +435,7 @@ def _interpret_compilation_result_is_ok(self, compilation_result: CompilerStatus
434435 _logger .warning ("Compilation finished with warnings: %s" , warning_message )
435436 ok_to_proceed = True
436437 else :
437- raise ValueError ("Unknown compiler status: {}" . format ( compilation_result ) )
438+ raise ValueError (f "Unknown compiler status: { compilation_result } " )
438439
439440 return ok_to_proceed
440441
@@ -753,7 +754,7 @@ def set_awg_core_enabled(self, awg_core: int, value: int) -> None:
753754
754755 value = int (value ) # Conversion just in case input is e.g. bool. ZhInst checks the type.
755756 if value not in (0 , 1 ):
756- raise ValueError ("Invalid enable value" )
757+ raise ValueError ("Invalid enable value. " )
757758
758759 self ._check_is_open ()
759760 self .device .awgs [awg_core ].enable (value )
0 commit comments