Skip to content

Commit

Permalink
Restore python2 compatibility
Browse files Browse the repository at this point in the history
Do not use f-strings, import print_function
  • Loading branch information
amecca committed Nov 27, 2024
1 parent e86e101 commit ae7e292
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/cmsstyle/cmsstyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Authors: CMS, Andrea Malara #
########################################

from __future__ import print_function
import ROOT as rt
from array import array
import re
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)()
Expand Down

0 comments on commit ae7e292

Please sign in to comment.