diff --git a/Control/AthenaConfiguration/python/AthConfigFlags.py b/Control/AthenaConfiguration/python/AthConfigFlags.py index 22f35aa084bd76a441b0da859f09eaf8cb02c4bd..b122a659bf9d2b211cea0e5e261e27cf4b56d23a 100644 --- a/Control/AthenaConfiguration/python/AthConfigFlags.py +++ b/Control/AthenaConfiguration/python/AthConfigFlags.py @@ -6,6 +6,7 @@ from enum import EnumMeta import importlib from AthenaCommon.Logging import logging from PyUtils.moduleExists import moduleExists +from PyUtils.Decorators import deprecate _msg = logging.getLogger('AthConfigFlags') @@ -415,6 +416,7 @@ class AthConfigFlags(object): raise KeyError(f"No flag with name '{name}' found" + (f". Did you mean '{closestMatch[0]}'?" if closestMatch else "")) + @deprecate("Use '[...]' rather than '(...)' to access flags", print_context=True) def __call__(self,name): return self._get(name) diff --git a/Control/AthenaConfiguration/python/DetectorConfigFlags.py b/Control/AthenaConfiguration/python/DetectorConfigFlags.py index a618877372633e7311d5ba7a8dfd48a208af5770..a3cb59397fec7b6c0a7468a8386feb3966fe937f 100644 --- a/Control/AthenaConfiguration/python/DetectorConfigFlags.py +++ b/Control/AthenaConfiguration/python/DetectorConfigFlags.py @@ -176,7 +176,7 @@ def getEnabledDetectors(flags, geometry=False): # test whether each detector is on name = f'Detector.Geometry{d}' if geometry else f'Detector.Enable{d}' if flags.hasFlag(name): - if flags(name) is not False: + if flags[name] is not False: values.append(d) return values @@ -254,7 +254,7 @@ def _getDetectorFlagStatus(flags, list=None, geometry=False): else: values.append('--') else: - if flags(name) is not False: + if flags[name] is not False: values.append('ON') else: values.append('--') @@ -395,7 +395,7 @@ def setupDetectorsFromList(flags, detectors, toggle_geometry=False, validate_onl status = d in detectors name = f'Detector.Enable{d}' if flags.hasFlag(name): - if flags(name) != status: + if flags[name] != status: changed = True if validate_only: log.warning("Flag '%s' should be %s but is set to %s", name, status, not status) @@ -405,7 +405,7 @@ def setupDetectorsFromList(flags, detectors, toggle_geometry=False, validate_onl if toggle_geometry: name = f'Detector.Geometry{d}' if flags.hasFlag(name): - if flags(name) != status: + if flags[name] != status: changed = True if validate_only: log.warning("Flag '%s' should be %s but is set to %s", name, status, not status) diff --git a/Reconstruction/RecJobTransforms/python/RecoConfigFlags.py b/Reconstruction/RecJobTransforms/python/RecoConfigFlags.py index e3350322ce0389290a9c5119194d8c505a84dadf..335f1663dd48c805b17a8f6c5c6517aca27c15b3 100644 --- a/Reconstruction/RecJobTransforms/python/RecoConfigFlags.py +++ b/Reconstruction/RecJobTransforms/python/RecoConfigFlags.py @@ -176,7 +176,7 @@ def printRecoFlags(flags): else: raise RuntimeError(f'Unknown reconstruction domain {d}') - if flags(name) is not False: + if flags[name] is not False: enabled.append('ON') else: enabled.append('--') diff --git a/Tools/PyUtils/CMakeLists.txt b/Tools/PyUtils/CMakeLists.txt index f8194e8681d0e99eb59dced6059e88417de84bf3..b6a0c739b96f6287ee083365712e1355d4648814 100644 --- a/Tools/PyUtils/CMakeLists.txt +++ b/Tools/PyUtils/CMakeLists.txt @@ -17,6 +17,7 @@ if( XAOD_STANDALONE ) python/moduleExists.py python/RootUtils.py python/Helpers.py + python/Decorators.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_scripts( bin/meta-reader.py bin/meta-diff.py POST_BUILD_CMD ${ATLAS_FLAKE8} )