From ae7e292e906899b89a3a85fa961162cfa0ee157b Mon Sep 17 00:00:00 2001 From: Alberto Mecca Date: Wed, 27 Nov 2024 17:35:08 +0100 Subject: [PATCH] Restore python2 compatibility Do not use f-strings, import print_function --- src/cmsstyle/cmsstyle.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cmsstyle/cmsstyle.py b/src/cmsstyle/cmsstyle.py index b640e2f..27470c0 100644 --- a/src/cmsstyle/cmsstyle.py +++ b/src/cmsstyle/cmsstyle.py @@ -3,6 +3,7 @@ # Authors: CMS, Andrea Malara # ######################################## +from __future__ import print_function import ROOT as rt from array import array import re @@ -34,8 +35,8 @@ def SetLumi(lumi, unit="fb", round_lumi=False): """ global cms_lumi if lumi != "": - cms_lumi = f"{lumi:.0f}" if round_lumi else f"{lumi}" - cms_lumi += f" {unit}^{{#minus1}}" + cms_lumi = "{:.0f}".format(lumi) if round_lumi else "{}".format(lumi) + cms_lumi += " {unit}^{{#minus1}}".format(unit=unit) else: cms_lumi = lumi @@ -1000,7 +1001,7 @@ def cmsObjectDraw (obj,opt='',**kwargs): elif hasattr(obj,xkey): method = xkey else: - raise AttributeError(f"Indicated argument for configuration is invalid: {xkey} {xval} {type(obj)}") + raise AttributeError("Indicated argument for configuration is invalid: {} {} {}".format(xkey, xval, type(obj))) if xval is None: getattr(obj,method)()