Skip to content
Snippets Groups Projects
Commit bbeace6b authored by Dan Guest's avatar Dan Guest Committed by Melissa Yexley
Browse files

Deprecate `AthConfigFlags.__call__`

Revert "remove deprecation on __call__, again"

This reverts commit 1b3d761e.
parent c3e73718
No related branches found
Tags nightly/main/2024-03-05T0301
No related merge requests found
......@@ -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)
......
......@@ -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)
......
......@@ -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('--')
......
......@@ -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} )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment