From 89b177d083db71039c518389641faecbd442d198 Mon Sep 17 00:00:00 2001 From: Zach Marshall <ZLMarshall@lbl.gov> Date: Sun, 28 Jul 2024 23:24:23 +0200 Subject: [PATCH] Updating python3 compatibility This makes all the models properly python3 compatible, we think. --- .gitignore | 2 ++ Coupling/NTGC_9_operators/object_library.py | 4 ++-- Coupling/NTGC_9_operators/write_param_card.py | 8 +++++--- Coupling/NTGC_VF/object_library.py | 4 ++-- Coupling/NTGC_VF/write_param_card.py | 8 +++++--- .../object_library.py | 4 ++-- .../write_param_card.py | 8 +++++--- py3compat.py | 2 ++ 8 files changed, 25 insertions(+), 15 deletions(-) mode change 100644 => 100755 Coupling/NTGC_9_operators/write_param_card.py mode change 100644 => 100755 Coupling/NTGC_VF/write_param_card.py mode change 100644 => 100755 VLQ/eVLQ_S012_diagonalCKM_5FNS_only3rd_NLO_UFO/write_param_card.py diff --git a/.gitignore b/.gitignore index 4846459f..22f3b053 100644 --- a/.gitignore +++ b/.gitignore @@ -13,5 +13,7 @@ */.* # Ignore caches */__pycache__ +# Ignore the py.py cache in case they ran in this directory +py.py # Ignore the *actual* updated model list model_list_updated.txt \ No newline at end of file diff --git a/Coupling/NTGC_9_operators/object_library.py b/Coupling/NTGC_9_operators/object_library.py index c196c695..f6db1c00 100644 --- a/Coupling/NTGC_9_operators/object_library.py +++ b/Coupling/NTGC_9_operators/object_library.py @@ -265,9 +265,9 @@ class Coupling(UFOBaseClass): if not CTparam: CTparam=param else: - raise UFOError, "UFO does not support yet more than one occurence of CTParameters in the couplings values." + raise UFOError("UFO does not support yet more than one occurence of CTParameters in the couplings values.") elif numberOfMatches>1: - raise UFOError, "UFO does not support yet more than one occurence of CTParameters in the couplings values." + raise UFOError("UFO does not support yet more than one occurence of CTParameters in the couplings values.") if not CTparam: if x==0: diff --git a/Coupling/NTGC_9_operators/write_param_card.py b/Coupling/NTGC_9_operators/write_param_card.py old mode 100644 new mode 100755 index 72781aa1..57a85b06 --- a/Coupling/NTGC_9_operators/write_param_card.py +++ b/Coupling/NTGC_9_operators/write_param_card.py @@ -1,8 +1,7 @@ -__date__ = "6 March 2020" +__date__ = "3 june 2010" __author__ = 'olivier.mattelaer@uclouvain.be' - class ParamCardWriter(object): header = \ @@ -118,7 +117,10 @@ class ParamCardWriter(object): import cmath from parameters import all_parameters for parameter in all_parameters: - exec("%s = %s" % (parameter.name, parameter.value)) + try: + exec("%s = %s" % (parameter.name, parameter.value)) + except Exception: + pass text = "## Not dependent paramater.\n" text += "## Those values should be edited following analytical the \n" text += "## analytical expression. Some generator could simply ignore \n" diff --git a/Coupling/NTGC_VF/object_library.py b/Coupling/NTGC_VF/object_library.py index c196c695..f6db1c00 100644 --- a/Coupling/NTGC_VF/object_library.py +++ b/Coupling/NTGC_VF/object_library.py @@ -265,9 +265,9 @@ class Coupling(UFOBaseClass): if not CTparam: CTparam=param else: - raise UFOError, "UFO does not support yet more than one occurence of CTParameters in the couplings values." + raise UFOError("UFO does not support yet more than one occurence of CTParameters in the couplings values.") elif numberOfMatches>1: - raise UFOError, "UFO does not support yet more than one occurence of CTParameters in the couplings values." + raise UFOError("UFO does not support yet more than one occurence of CTParameters in the couplings values.") if not CTparam: if x==0: diff --git a/Coupling/NTGC_VF/write_param_card.py b/Coupling/NTGC_VF/write_param_card.py old mode 100644 new mode 100755 index 72781aa1..57a85b06 --- a/Coupling/NTGC_VF/write_param_card.py +++ b/Coupling/NTGC_VF/write_param_card.py @@ -1,8 +1,7 @@ -__date__ = "6 March 2020" +__date__ = "3 june 2010" __author__ = 'olivier.mattelaer@uclouvain.be' - class ParamCardWriter(object): header = \ @@ -118,7 +117,10 @@ class ParamCardWriter(object): import cmath from parameters import all_parameters for parameter in all_parameters: - exec("%s = %s" % (parameter.name, parameter.value)) + try: + exec("%s = %s" % (parameter.name, parameter.value)) + except Exception: + pass text = "## Not dependent paramater.\n" text += "## Those values should be edited following analytical the \n" text += "## analytical expression. Some generator could simply ignore \n" diff --git a/VLQ/eVLQ_S012_diagonalCKM_5FNS_only3rd_NLO_UFO/object_library.py b/VLQ/eVLQ_S012_diagonalCKM_5FNS_only3rd_NLO_UFO/object_library.py index c196c695..f6db1c00 100644 --- a/VLQ/eVLQ_S012_diagonalCKM_5FNS_only3rd_NLO_UFO/object_library.py +++ b/VLQ/eVLQ_S012_diagonalCKM_5FNS_only3rd_NLO_UFO/object_library.py @@ -265,9 +265,9 @@ class Coupling(UFOBaseClass): if not CTparam: CTparam=param else: - raise UFOError, "UFO does not support yet more than one occurence of CTParameters in the couplings values." + raise UFOError("UFO does not support yet more than one occurence of CTParameters in the couplings values.") elif numberOfMatches>1: - raise UFOError, "UFO does not support yet more than one occurence of CTParameters in the couplings values." + raise UFOError("UFO does not support yet more than one occurence of CTParameters in the couplings values.") if not CTparam: if x==0: diff --git a/VLQ/eVLQ_S012_diagonalCKM_5FNS_only3rd_NLO_UFO/write_param_card.py b/VLQ/eVLQ_S012_diagonalCKM_5FNS_only3rd_NLO_UFO/write_param_card.py old mode 100644 new mode 100755 index 72781aa1..57a85b06 --- a/VLQ/eVLQ_S012_diagonalCKM_5FNS_only3rd_NLO_UFO/write_param_card.py +++ b/VLQ/eVLQ_S012_diagonalCKM_5FNS_only3rd_NLO_UFO/write_param_card.py @@ -1,8 +1,7 @@ -__date__ = "6 March 2020" +__date__ = "3 june 2010" __author__ = 'olivier.mattelaer@uclouvain.be' - class ParamCardWriter(object): header = \ @@ -118,7 +117,10 @@ class ParamCardWriter(object): import cmath from parameters import all_parameters for parameter in all_parameters: - exec("%s = %s" % (parameter.name, parameter.value)) + try: + exec("%s = %s" % (parameter.name, parameter.value)) + except Exception: + pass text = "## Not dependent paramater.\n" text += "## Those values should be edited following analytical the \n" text += "## analytical expression. Some generator could simply ignore \n" diff --git a/py3compat.py b/py3compat.py index 7b650f4b..c3347fa9 100755 --- a/py3compat.py +++ b/py3compat.py @@ -7,6 +7,8 @@ def test_source_code_compatible(code_data): except SyntaxError as exc: return False +print('Checking python3 compatibility of models') + import glob module_list = glob.glob('*/*/*.py') model = None -- GitLab