@@ -382,11 +382,7 @@ def check_similar_hists(
382382 return True
383383 for hist in hist_list :
384384 if not isinstance (hist , assert_type ):
385- raise TypeError (
386- "Input histogram type {htype} not of {htypes}." .format (
387- htype = type (hist ), htypes = assert_type
388- )
389- )
385+ raise TypeError (f"Input histogram type { type (hist )} not of { assert_type } ." )
390386 # perform similarity checks on:
391387 # - number of dimensions
392388 # - histogram type
@@ -411,37 +407,27 @@ def check_similar_hists(
411407 # Make this consistent first.
412408 types = [get_contentType (hist ) for hist in hist_list ]
413409 if types .count (types [0 ]) != len (types ):
414- warnings .warn (
415- "Input histograms have inconsistent class types: {types}" .format (
416- types = types
417- )
418- )
410+ warnings .warn (f"Input histograms have inconsistent class types: { types } " )
419411 return False
420412
421413 # Check Bin attributes
422414 if isinstance (hist_list [0 ], histogrammar .Bin ):
423415 nums = [hist .num for hist in hist_list ]
424416 if nums .count (nums [0 ]) != len (nums ):
425417 warnings .warn (
426- "Input Bin histograms have inconsistent num attributes: {types}" .format (
427- types = nums
428- )
418+ f"Input Bin histograms have inconsistent num attributes: { nums } "
429419 )
430420 return False
431421 lows = [hist .low for hist in hist_list ]
432422 if lows .count (lows [0 ]) != len (lows ):
433423 warnings .warn (
434- "Input Bin histograms have inconsistent low attributes: {types}" .format (
435- types = lows
436- )
424+ f"Input Bin histograms have inconsistent low attributes: { lows } "
437425 )
438426 return False
439427 highs = [hist .high for hist in hist_list ]
440428 if highs .count (highs [0 ]) != len (highs ):
441429 warnings .warn (
442- "Input histograms have inconsistent high attributes: {types}" .format (
443- types = highs
444- )
430+ f"Input histograms have inconsistent high attributes: { highs } "
445431 )
446432 return False
447433
@@ -450,17 +436,13 @@ def check_similar_hists(
450436 origins = [hist .origin for hist in hist_list ]
451437 if origins .count (origins [0 ]) != len (origins ):
452438 warnings .warn (
453- "Input SparselyBin histograms have inconsistent origin attributes: {types}" .format (
454- types = origins
455- )
439+ f"Input SparselyBin histograms have inconsistent origin attributes: { origins } "
456440 )
457441 return False
458442 bws = [hist .binWidth for hist in hist_list ]
459443 if bws .count (bws [0 ]) != len (bws ):
460444 warnings .warn (
461- "Input SparselyBin histograms have inconsistent binWidth attributes: {types}" .format (
462- types = bws
463- )
445+ f"Input SparselyBin histograms have inconsistent binWidth attributes: { bws } "
464446 )
465447 return False
466448
0 commit comments