diff --git a/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt b/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt index 978d8f603141be59f6a39c0e5296e9a5305c2f6b..8a58635cbda9a7c2276e1f1df9674a4451f4c867 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt +++ b/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt @@ -3,9 +3,6 @@ # Declare the package name: atlas_subdir( TriggerMenuMT ) -# External dependencies: -find_package( six ) - atlas_add_test( flake8 SCRIPT flake8 --select=ATL,F,E7,E9,W6,E101 --enable-extension=ATL900,ATL901,ATL902 ${CMAKE_CURRENT_SOURCE_DIR}/python ${CMAKE_CURRENT_SOURCE_DIR}/scripts diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetDef.py index 07e528d660e5a49f03bca4172ffdcc0dbf86303c..f4f3a71a5579223056018c55df1fff3ff7cb3de6 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetDef.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon.Logging import logging logging.getLogger().info("Importing %s",__name__) @@ -29,7 +29,7 @@ class BjetChainConfiguration(ChainConfigurationBase): # Assemble the chain depending on information from chainName # ---------------------- def assembleChain(self): - log.debug("Assembling chain for " + self.chainName) + log.debug("Assembling chain for %s", self.chainName) # -------------------- # define here the names of the steps and obtain the chainStep configuration @@ -64,7 +64,7 @@ class BjetChainConfiguration(ChainConfigurationBase): # -------------------- def getBjetSequence(self): stepName = "Step2_bjet" - log.debug("Configuring step " + stepName) + log.debug("Configuring step %s", stepName) return self.getStep(2, stepName, [bjetSequenceCfg]) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bphysics/BphysicsDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bphysics/BphysicsDef.py index 64b514870e3dbc9c22eaba4c3e4ae929cfe000af..10bddb46f2a60e4095eacb824f4279c71000939e 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bphysics/BphysicsDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bphysics/BphysicsDef.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ######################################################################## # @@ -35,7 +35,7 @@ class BphysicsChainConfiguration(MuonChainConfiguration): # ---------------------- def assembleBphysChain(self): - log.debug("Assembling chain for " + self.chainName) + log.debug("Assembling chain for %s", self.chainName) stepDictionary = self.getBphysStepDictionary() key = self.getBphysKey() diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py index 41fce5817ef833cce87552861c5a0d3095423e5e..c1cd7911254bb0f0d54d86323009c87ada44ca60 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon.Logging import logging logging.getLogger().info("Importing %s",__name__) @@ -83,7 +83,7 @@ class BeamspotChainConfiguration(ChainConfigurationBase): # ---------------------- def assembleChain(self): chainSteps = [] - log.debug("Assembling chain for " + self.chainName) + log.debug("Assembling chain for %s", self.chainName) stepDictionary = self.getStepDictionary() diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/CalibChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/CalibChainConfiguration.py index bf77bfef96571fabf3c91684730a248a67fb3b3f..1108806ab7fc52ef43b74aa785eddf3c3f5cbcec 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/CalibChainConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/CalibChainConfiguration.py @@ -18,7 +18,7 @@ class CalibChainConfiguration(ChainConfigurationBase): def assembleChain(self): chainSteps = [] - log.debug("Assembling chain for " + self.chainName) + log.debug("Assembling chain for %s", self.chainName) if self.chainPartName == 'larnoiseburst': chainSteps.append(self.getLArNoiseBurst()) myChain = self.buildChain(chainSteps) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/CosmicChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/CosmicChainConfiguration.py index 333d56e5cdd5f689e751cc922aa05e4294df2056..a682b80081f1d62cdef38a79daeabaedfee23a68 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/CosmicChainConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/CosmicChainConfiguration.py @@ -18,7 +18,7 @@ class CosmicChainConfiguration(ChainConfigurationBase): def assembleChain(self): chainSteps = [] - log.debug("Assembling chain for " + self.chainName) + log.debug("Assembling chain for %s", self.chainName) # -------------------- # define here the names of the steps and obtain the chainStep configuration # -------------------- diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/EnhancedBiasChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/EnhancedBiasChainConfiguration.py index 53fa0c40e0a6ad840025941f2c35ddd3aec4b0a1..656d3dcd85321ee5f0c8437cc3cda3c0b85e4241 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/EnhancedBiasChainConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/EnhancedBiasChainConfiguration.py @@ -122,7 +122,7 @@ class EnhancedBiasChainConfiguration(ChainConfigurationBase): def assembleChain(self): chainSteps = [] - log.debug("Assembling chain for " + self.chainName) + log.debug("Assembling chain for %s", self.chainName) chainSteps.append( self.getStep(1,"EnhancedBias", [enahncedBiasSequence_Cfg]) ) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/MonitorChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/MonitorChainConfiguration.py index 97f82f80bc9c3ce9b4076ca13b085f2182eea23b..1edc59f84bb49acb74d52d241bb14817e594ee12 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/MonitorChainConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/MonitorChainConfiguration.py @@ -47,7 +47,7 @@ class MonitorChainConfiguration(ChainConfigurationBase): # ---------------------- def assembleChain(self): chainSteps = [] - log.debug("Assembling chain for " + self.chainName) + log.debug("Assembling chain for %s", self.chainName) if self.chainPartName == 'costmonitor': pass # costmonitor is a streamer so has no steps diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/EgammaDefs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/EgammaDefs.py index 3b2f0f9dbb398d8fe215f89c36849aefd1317e2f..5fa74ab7687d7d0e18285847ef021abbb2cd8ad9 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/EgammaDefs.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/EgammaDefs.py @@ -27,7 +27,7 @@ def TrigElectronSelectors(sel): # Configure the LH selectors from AthenaCommon import CfgMgr #TrigEgammaKeys.pidVersion.set_On() - mlog.info("TrigEgammaPidTools version " + str(TrigEgammaKeys.pidVersion)) + mlog.info("TrigEgammaPidTools version %s", TrigEgammaKeys.pidVersion) ConfigFilePath = 'ElectronPhotonSelectorTools/trigger/'+TrigEgammaKeys.pidVersion SelectorNames = { @@ -47,10 +47,10 @@ def TrigElectronSelectors(sel): mlog.info('Configuring electron PID tools...') if sel not in SelectorNames: - mlog.error('No selector defined for working point '+sel+' for electrons :-( ') + mlog.error('No selector defined for working point %s for electrons :-( ', sel) return else: - mlog.info('Configuring electron PID for '+sel) + mlog.info('Configuring electron PID for %s', sel) SelectorTool=CfgMgr.AsgElectronLikelihoodTool(SelectorNames[sel]) SelectorTool.ConfigFile = ConfigFilePath + '/' + ElectronToolConfigFile[sel] SelectorTool.usePVContainer = False @@ -93,14 +93,14 @@ def TrigPhotonSelectors(sel): mlog.info('Configuring photon PID tools...') if sel not in SelectorNames: - mlog.error('No selector defined for working point '+sel+' for photons :-( ') + mlog.error('No selector defined for working point %s for photons :-( ', sel) return else: - mlog.info('Configuring photon PID for '+sel) + mlog.info('Configuring photon PID for %s', sel) SelectorTool = ConfiguredAsgPhotonIsEMSelector(SelectorNames[sel], SelectorPID[sel]) ConfigFilePath = 'ElectronPhotonSelectorTools/trigger/'+TrigEgammaKeys.pidVersion ConfigFile = ConfigFilePath + '/' + PhotonToolConfigFile[sel] - mlog.info('Configuration file: '+ConfigFile) + mlog.info('Configuration file: %s', ConfigFile) SelectorTool.ConfigFile = ConfigFile SelectorTool.ForceConvertedPhotonPID = True SelectorTool.isEMMask = PhotonIsEMBits[sel] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py index 6bf1450f6ab1e9300bf6fb25cd64ebe5e9bb5ccb..2cd2fadec6b5d8376e3fc70e63abe6fd7189f9cd 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py @@ -61,7 +61,7 @@ class ElectronChainConfiguration(ChainConfigurationBase): # ---------------------- def assembleChain(self): chainSteps = [] - log.debug("Assembling chain for " + self.chainName) + log.debug("Assembling chain for %s", self.chainName) # -------------------- # define here the names of the steps and obtain the chainStep configuration @@ -90,21 +90,21 @@ class ElectronChainConfiguration(ChainConfigurationBase): 'lhtightivartight' : ['getFastCalo', 'getFastElectron', 'getPrecisionCaloElectron', 'getPrecisionTracking', 'getPrecisionElectron'], } - log.debug('electron chain part = ' + str(self.chainPart)) + log.debug('electron chain part = %s', self.chainPart) key = self.chainPart['extra'] + self.chainPart['IDinfo'] + self.chainPart['L2IDAlg'] + self.chainPart['isoInfo'] for addInfo in self.chainPart['addInfo']: key+=addInfo - log.debug('electron key = ' + key) + log.debug('electron key = %s', key) if key in stepDictionary: steps=stepDictionary[key] else: raise RuntimeError("Chain configuration unknown for electron chain with key: " + key ) for step in steps: - log.debug('Adding electron trigger step ' + str(step)) + log.debug('Adding electron trigger step %s', step) chainstep = getattr(self, step)() chainSteps+=[chainstep] @@ -136,7 +136,7 @@ class ElectronChainConfiguration(ChainConfigurationBase): def getPrecisionElectron(self): isocut = self.chainPart['isoInfo'] - log.debug(' isolation cut = ' + str(isocut)) + log.debug(' isolation cut = %s', isocut) if "Zee" in self.chainName: stepName = "precision_topoelectron"+isocut diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonDef.py index d5505e52f60b135acb4e1ca2ce486f1bea61a367..fb82bd518e21e6b603078cf45d180f32f4e192d2 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonDef.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # from AthenaCommon.Logging import logging @@ -53,7 +53,7 @@ class PhotonChainConfiguration(ChainConfigurationBase): # Assemble the chain depending on information from chainName # ---------------------- def assembleChain(self): - log.debug("Assembling chain for " + self.chainName) + log.debug("Assembling chain for %s", self.chainName) # -------------------- # define here the names of the steps and obtain the chainStep configuration @@ -76,12 +76,12 @@ class PhotonChainConfiguration(ChainConfigurationBase): } ## This needs to be configured by the Egamma Developer!! - log.debug('photon chain part = ' + str(self.chainPart)) + log.debug('photon chain part = %s', self.chainPart) key = self.chainPart['extra'] + self.chainPart['IDinfo'] + self.chainPart['isoInfo'] for addInfo in self.chainPart['addInfo']: key+=addInfo - log.debug('photon key = ' + key) + log.debug('photon key = %s', key) if key in stepDictionary: steps=stepDictionary[key] else: @@ -90,7 +90,7 @@ class PhotonChainConfiguration(ChainConfigurationBase): chainSteps = [] for step in steps: - log.debug('Adding photon trigger step ' + str(step)) + log.debug('Adding photon trigger step %s', step) chainstep = getattr(self, step)() chainSteps+=[chainstep] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetChainConfiguration.py index feef2d17126acd1e046da1dac8ed1ea10d20918c..e3754153984ee8a2ebe427dd36352a9af3341949 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetChainConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetChainConfiguration.py @@ -56,7 +56,7 @@ class JetChainConfiguration(ChainConfigurationBase): # Assemble the chain depending on information from chainName # ---------------------- def assembleChain(self): - log.debug("Assembling chain " + self.chainName) + log.debug("Assembling chain %s", self.chainName) # -------------------- # define here the names of the steps and obtain the chainStep configuration diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py index 1d6109a0dcc4485c00877e343afc7ef59f49f0bc..d02b8838e59359d972a551e8c3058018f2c51b48 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py @@ -33,8 +33,7 @@ def extractRecoDict(chainParts): # found the key, check for consistency with other chain parts of this chain if k in recoDict.keys(): if p[k] != recoDict[k]: - log.error('Inconsistent reco setting for' + k) - exit(1) + raise RuntimeError('Inconsistent reco setting for %s' % k) # copy this entry to the reco dictionary recoDict[k] = p[k] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/ConfigHelpers.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/ConfigHelpers.py index 683dbad2d431c8af3c0201246c2b866f4b9c9a74..a502306913d06ff9938c33db0c37be815fc2c0df 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/ConfigHelpers.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/ConfigHelpers.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """ Helper functions for configuring MET chains """ @@ -124,7 +124,7 @@ class AlgConfig(ABC): inputMakers = self.inputMakers() # Retrieve the inputss - log.verbose(f"Create inputs for {self._suffix}") + log.verbose("Create inputs for %s", self._suffix) steps, inputs = self.inputRegistry.build_steps( self._inputs, metFSRoIs, self.recoDict ) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/METChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/METChainConfiguration.py index 1f8d05ba344bee160e820febda14cf12f2c90881..c9f414318a3099b09b9a43d8d7c2c602d604a1a8 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/METChainConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/METChainConfiguration.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon.Logging import logging @@ -38,6 +38,6 @@ class METChainConfiguration(ChainConfigurationBase): # Assemble the chain depending on information from chainName # ---------------------- def assembleChain(self): - log.debug("Assembling chain for " + self.chainName) + log.debug("Assembling chain for %s", self.chainName) conf = AlgConfig.fromRecoDict(**self.recoDict) return self.buildChain(conf.make_steps(self.dict)) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainConfigurationBase.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainConfigurationBase.py index c3553ff78002a65c4f259830d39a4a5b0a64f2e7..1fead3dfadfa33173487c7cb1c2b621532814951 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainConfigurationBase.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainConfigurationBase.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon.Logging import logging @@ -47,7 +47,7 @@ class ChainConfigurationBase(object): stepName = 'Step%d'%stepID + '_%d'%self.mult + stepPartName if self.mult >1 : stepName = 'Step%d'%stepID + '_N' + stepPartName - log.debug("Configuring step " + stepName) + log.debug("Configuring step %s", stepName) seqArray = [] for sequenceCfg in sequenceCfgArray: seqArray.append( RecoFragmentsPool.retrieve( sequenceCfg, None)) @@ -55,7 +55,7 @@ class ChainConfigurationBase(object): def getEmptyStep(self, stepID, stepPartName): stepName = 'Step%d'%stepID + '_%d'%self.mult + stepPartName - log.debug("Configuring empty step " + stepName) + log.debug("Configuring empty step %s", stepName) return ChainStep(stepName, Sequences=[], multiplicity=[] ,chainDicts=[self.dict]) def buildChain(self, chainSteps): diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py index d0e5832554b1a68d3b789f5b7700bce9641be7eb..6c4a49f123ef6ae1440a745938efb5a6485c3b67 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py @@ -127,13 +127,13 @@ def serial_zip(allSteps, chainName, chainDefList): newsteps = [] for chain_index, chainsteps in enumerate(allSteps): for step_index, step in enumerate(chainsteps): - log.debug('chain_index: ' + str(chain_index) + " step_index: " + str(step_index)) + log.debug('chain_index: %s step_index: %s', chain_index, step_index) # create list of correct length stepList = [None]*n_chains # put the step from the current sub-chain into the right place stepList[chain_index] = step - log.debug('Put step: ' + str(step.name)) + log.debug('Put step: %s', step.name) # all other steps should contain an empty sequence for step_index2, emptyStep in enumerate(stepList): diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py index 057d6f7eef225344288f6875251663b97bbdf2ca..17c7be9e9d0645b9df6c09fbfa254c758c920059 100755 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """ Class to obtain the chain configuration dictionary from the short or long name @@ -281,7 +281,7 @@ def analyseChainName(chainName, L1thresholds, L1item): (AllowedBeamspotChainIdentifiers, 'Beamspot', 'beamspot'), (['eb'], 'EnhancedBias', 'eb')]: if cpart in chainCategory[0]: - log.debug('Doing chain type {}'.format(chainCategory[1])) + log.debug('Doing chain type %s', chainCategory[1]) multichainindex.append(hltChainNameShort.index(cpart)) buildDict(chainCategory[1], chainCategory[2]) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py index e67017394db74b71353750ba8319288a414aba0f..4e30ed524ad460dd8f80ddb85fe9dc2b2a0ab98e 100755 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py @@ -1,7 +1,6 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from PyUtils.Decorators import memoize -from six import add_metaclass # Configure the scheduler from AthenaCommon.AlgScheduler import AlgScheduler @@ -33,8 +32,7 @@ class Singleton(type): # for now we make this a singleton because calling menu generation twice leads to problems -@add_metaclass(Singleton) -class GenerateMenuMT(object): +class GenerateMenuMT(object, metaclass=Singleton): @staticmethod def overwriteSignaturesWith(f): diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py index ad2ca2e8bbd522d0b70ae0a4238987888b6fd1bc..6afa8ae8ff9953fd374a5dcc6cc49bd9acfa5047 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py @@ -6,7 +6,6 @@ from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig_newJO import generateDecisionT from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import TriggerConfigHLT from TriggerMenuMT.HLTMenuConfig.Menu.ChainMerging import mergeChainDefs from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitInterSignatureChainDict -from six import iteritems from AthenaCommon.Logging import logging log = logging.getLogger( __name__ ) @@ -46,7 +45,7 @@ def generateMenu( flags ): menuAcc.addSequence( seqAND(mainSequenceName) ) - for name, cfgFlag in list(iteritems(flags._flagdict)): + for name, cfgFlag in list(flags._flagdict.items()): if 'Trigger.menu.' not in name: continue value = flags._get(name) @@ -86,7 +85,7 @@ def generateMenu( flags ): signature = chainDict['signature'].lower() if signature not in signatureToGenerator: - log.warning('Generator for {} is missing. Chain dict will not be built'.format(signature)) + log.warning('Generator for %s is missing. Chain dict will not be built', signature) continue chainConfig = signatureToGenerator[signature](flags, chainDict) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GroupInfo.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GroupInfo.py index 3e653e722bfaf3a5f7b05acabb7837c20fea034c..c7d9f825efb720d847949c1f14ab10b7e7a82e2e 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GroupInfo.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GroupInfo.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon.Logging import logging log = logging.getLogger( __name__ ) @@ -36,5 +36,4 @@ def getAllAllowedGroups(menu): elif 'HI' in menu: return AllowedGroups+AllowedGroup_HI else: - log.error("No list of allowed groups for "+menu) - + log.error("No list of allowed groups for %s", menu) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py index 2e2d2bd671a390eb29e6e4dcf9fcfd7ec8339eba..1624a5ab8fb705c4903a4f6aef20fef53bcec9dc 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py @@ -181,7 +181,7 @@ def generateDecisionTree(chains): acc.addEventAlgo(filterAlg, sequenceName=filtersStep.name) acc.addEventAlgo(filterAlg, sequenceName=singleMenuSeq.name) - log.debug('Created filter {}'.format(filterAlg.name)) + log.debug('Created filter %s', filterAlg.name) return acc.getEventAlgo(filterAlg.name) @@ -410,29 +410,35 @@ def generateDecisionTree(chains): for chain in chains: - log.info( "CF algorithms for chain {}".format(chain.name)) + log.info("CF algorithms for chain %s", chain.name) for stepCounter, step in enumerate( chain.steps, 1 ): filterAlg = getFilterAlg( stepCounter, step.name, isEmpty(step)) if filterAlg and hasattr(filterAlg, "Input"): - log.info("{} FilterAlg: {} input: {} output: {} IO mapping: {}".format(stepCounter, filterAlg.name, ", ".join(filterAlg.Input), ", ".join(filterAlg.Output), filterAlg.IOMapping)) + log.info("%s FilterAlg: %s input: %s output: %s IO mapping: %s", + stepCounter, filterAlg.name, ", ".join(filterAlg.Input), + ", ".join(filterAlg.Output), filterAlg.IOMapping) for inIndex, input in enumerate(filterAlg.Input): - log.info("{} filered chains from input: {} : {}".format( stepCounter, input, ", ".join(filterAlg.ChainsPerInput[inIndex]) )) + log.info("%s filered chains from input: %s : %s", + stepCounter, input, ", ".join(filterAlg.ChainsPerInput[inIndex])) assert len(filterAlg.IOMapping) == len(filterAlg.Output), "Not all output will be filled in filter" imAlgs = findAllInputMakers( stepCounter, step.name ) for imAlg in imAlgs: if imAlg: - log.info("{} InputMaker: {} input: {} output: {}".format(stepCounter, imAlg.name, ", ".join(imAlg.InputMakerInputDecisions), imAlg.InputMakerOutputDecisions)) + log.info("%s InputMaker: %s input: %s output: %s", stepCounter, imAlg.name, + ", ".join(imAlg.InputMakerInputDecisions), imAlg.InputMakerOutputDecisions) hypoAlgs = findAllHypoAlgs(stepCounter, step.name) for hypoAlg in hypoAlgs: if hypoAlg: - log.info("{} HypoAlg: {} input: {} output: {}".format(stepCounter, hypoAlg.name, hypoAlg.HypoInputDecisions, hypoAlg.HypoOutputDecisions)) - log.info("{} hypo tools: {}".format(stepCounter, ",".join([t.name for t in hypoAlg.HypoTools]))) + log.info("%s HypoAlg: %s input: %s output: %s", stepCounter, hypoAlg.name, + hypoAlg.HypoInputDecisions, hypoAlg.HypoOutputDecisions) + log.info("%s hypo tools: %s", stepCounter, ",".join([t.name for t in hypoAlg.HypoTools])) combo = findComboHypoAlg(stepCounter, step.name) if combo: - log.info("{} ComboHypoAlg: {} input: {} output: {}".format(stepCounter, combo.name, ". ".join(combo.HypoInputDecisions), ", ".join(combo.HypoOutputDecisions))) - log.info("{} multiplicities: {}".format(stepCounter, combo.MultiplicitiesMap)) + log.info("%s ComboHypoAlg: %s input: %s output: %s", stepCounter, combo.name, + ". ".join(combo.HypoInputDecisions), ", ".join(combo.HypoOutputDecisions)) + log.info("%s multiplicities: %s", stepCounter, combo.MultiplicitiesMap) assert len(combo.HypoInputDecisions) == len(combo.HypoInputDecisions), "Missconfiguraiton of {} ComboHypo input/output counts differ".format(combo.name) log.info("-"*50) log.info("") diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1_newJO.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1_newJO.py index 1e95b4e6f7087133c734d574701bb0ba72279945..0e814f98b5bdf83c7775875cd43a9083ee3107b7 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1_newJO.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1_newJO.py @@ -1,8 +1,6 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from TriggerMenuMT.HLTMenuConfig.Menu.ChainDefInMenu import ChainProp -import six - # def get_flag_item(chainName, L1itemsChainParts, groups): # PhysicsStream = 'Main' @@ -109,7 +107,7 @@ if __name__ == "__main__": # print all hypo algs and their hypo tools for debugging from AthenaCommon.CFElements import flatAlgorithmSequences fs = flatAlgorithmSequences( menu.getSequence('HLTAllSteps') ) - for seq, algs in six.iteritems (fs): + for seq, algs in fs.items(): for alg in algs: if 'HypoTools' in alg._properties: log.verbose("%s %s", alg.name, [ t.getFullJobOptName() for t in alg.HypoTools ]) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuAlignmentTools.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuAlignmentTools.py index 4ec9960baa200040c759335b03260a11aeff39fd..e0386d159123520b36e2f069c4d15abf87f053d6 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuAlignmentTools.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuAlignmentTools.py @@ -172,8 +172,8 @@ class MenuAlignment(): def single_align(self, chainDict, chainConfig): if len(set(chainDict['alignmentGroups'])) != 1: - log.error("Cannot call single_align on chain {} with alignment groups {}".format( - chainDict['chainName'], ",".join(chainDict['alignmentGroups']))) + log.error("Cannot call single_align on chain %s with alignment groups %s", + chainDict['chainName'], ",".join(chainDict['alignmentGroups'])) raise Exception("Will not proceed, the chain is not suitable for single alignment.") alignment_grp = chainDict['alignmentGroups'][0] @@ -292,6 +292,3 @@ class MenuAlignment(): chainConfig.numberAllSteps() return chainConfig - - - \ No newline at end of file diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py index f21f12636640ad92e714ccb80070a4d5b16974ce..66985d89a64cde2d49cb67e41538d8555f7606d7 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py @@ -173,7 +173,8 @@ class HypoAlgNode(AlgNode): elif self.initialOutput in outputs: AlgNode.addOutput(self, name) else: - log.error("Hypo " + self.name +" has already %s as configured output: you may want to duplicate the Hypo!" + outputs[0]) + log.error("Hypo %s has already %s as configured output: you may want to duplicate the Hypo!", + self.name, outputs[0]) def addHypoTool (self, hypoToolConf): @@ -597,7 +598,7 @@ class Chain(object): for stepID in range(1,n_new_steps+1): new_step_name = prev_step_name+'_'+empty_step_name+'%d_'%stepID+next_step_name - log.debug("Configuring empty step " + new_step_name) + log.debug("Configuring empty step %s", new_step_name) steps_to_add += [ChainStep(new_step_name, [], [], chainDicts=prev_chain_dict, comboHypoCfg=ComboHypoCfg)] self.steps = chain_steps_pre_split + steps_to_add + chain_steps_post_split @@ -647,7 +648,7 @@ class Chain(object): log.debug("N(seq)=%d, N(chainDicts)=%d", len(step.sequences), len(step.stepDicts)) for seq, onePartChainDict in zip(step.sequences, step.stepDicts): log.debug(' seq: %s, onePartChainDict:', seq.name) - log.debug(' ' + str(onePartChainDict)) + log.debug(' %s', onePartChainDict) seq.createHypoTools( onePartChainDict ) step.createComboHypoTools(self.name) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuPrescaleConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuPrescaleConfig.py index ca403b3980e93eeb69ae5500c510d4d9f4d0eb62..7ff099548b03ac841e6697e37a1920f19d88c760 100755 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuPrescaleConfig.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuPrescaleConfig.py @@ -1,7 +1,6 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from TriggerJobOpts.TriggerFlags import TriggerFlags -from six import iteritems from AthenaCommon.Logging import logging log = logging.getLogger( __name__ ) @@ -22,10 +21,9 @@ def MenuPrescaleConfig(triggerConfigHLT): elif menu_name == 'MC_tight_default': menu_name = 'LS2_v1' - log.info( 'Menu name: '+ menu_name) + log.info('Menu name: %s', menu_name) if menu_name.startswith('LS2_v1'): - log.info('LS2_v1 menu setup') from TriggerMenuMT.HLTMenuConfig.Menu.LS2_v1 import setupMenu setupMenu() if 'tight_mc_prescale' in menu_name: @@ -40,7 +38,6 @@ def MenuPrescaleConfig(triggerConfigHLT): HLTPrescales = Prescales.HLTPrescales elif menu_name.startswith('Physics_pp_run3_v1'): - log.info('Physics_pp_run3_v1 menu setup') from TriggerMenuMT.HLTMenuConfig.Menu.Physics_pp_run3_v1 import setupMenu setupMenu() if 'tight_mc_prescale' in menu_name: @@ -51,7 +48,6 @@ def MenuPrescaleConfig(triggerConfigHLT): HLTPrescales = Prescales.HLTPrescales elif menu_name.startswith('PhysicsP1_pp_run3_v1'): - log.info('PhysicsP1_pp_run3_v1 menu setup') from TriggerMenuMT.HLTMenuConfig.Menu.PhysicsP1_pp_run3_v1 import setupMenu setupMenu() if 'tight_mc_prescale' in menu_name: @@ -62,7 +58,6 @@ def MenuPrescaleConfig(triggerConfigHLT): HLTPrescales = Prescales.HLTPrescales elif menu_name.startswith('MC_pp_run3_v1'): - log.info('MC_pp_run3_v1 menu setup') from TriggerMenuMT.HLTMenuConfig.Menu.MC_pp_run3_v1 import setupMenu setupMenu() if 'tight_mc_prescale' in menu_name: @@ -73,7 +68,6 @@ def MenuPrescaleConfig(triggerConfigHLT): HLTPrescales = Prescales.HLTPrescales elif menu_name.startswith('PhysicsP1_HI_run3_v1'): - log.info('PhysicsP1_HI_run3_v1 menu setup') from TriggerMenuMT.HLTMenuConfig.Menu.PhysicsP1_HI_run3_v1 import setupMenu setupMenu() if 'tight_mc_prescale' in menu_name: @@ -84,7 +78,6 @@ def MenuPrescaleConfig(triggerConfigHLT): HLTPrescales = Prescales.HLTPrescales elif menu_name.startswith('Dev_HI_run3_v1'): - log.info('Dev_HI_run3_v1 menu setup') from TriggerMenuMT.HLTMenuConfig.Menu.Dev_HI_run3_v1 import setupMenu setupMenu() if 'tight_mc_prescale' in menu_name: @@ -95,7 +88,6 @@ def MenuPrescaleConfig(triggerConfigHLT): HLTPrescales = Prescales.HLTPrescales elif menu_name.startswith('LS2_emu_v1'): - log.info('LS2_v1 menu setup') from TriggerMenuMT.HLTMenuConfig.Menu.LS2_v1 import setupMenu setupMenu() if 'tight_mc_prescale' in menu_name: @@ -106,14 +98,13 @@ def MenuPrescaleConfig(triggerConfigHLT): HLTPrescales = Prescales.HLTPrescales elif menu_name.startswith('Cosmic_run3_v1'): - log.info('Cosmic_run3_v1 menu setup') from TriggerMenuMT.HLTMenuConfig.Menu.Cosmic_run3_v1 import setupMenu setupMenu() L1Prescales = Prescales.L1Prescales HLTPrescales = Prescales.HLTPrescales else: - log.fatal ('Menu with name %s is not known in this version of TriggerMenu! ', menu_name) + log.fatal('Menu with name %s is not known in this version of TriggerMenu! ', menu_name) return return (L1Prescales, HLTPrescales) @@ -126,7 +117,7 @@ def disableChains(flags, trigvalid_prescales, type_group): if slice.signatures(): signatures.extend(slice.signatures()) else: - log.debug('SKIPPING ' + str(slice_prop)) + log.debug('SKIPPING %s', slice_prop) chain_online_list=[] @@ -138,7 +129,7 @@ def disableChains(flags, trigvalid_prescales, type_group): def applyHLTPrescale(triggerPythonConfig, HLTPrescale, signaturesOverwritten): - for item, prescales in iteritems(HLTPrescale): + for item, prescales in HLTPrescale.items(): # prescales is a list of 3 integers [HLT_prescale, HLT_pass_through, rerun_prescale] if item not in triggerPythonConfig.dicts().keys(): if signaturesOverwritten: @@ -151,7 +142,7 @@ def applyHLTPrescale(triggerPythonConfig, HLTPrescale, signaturesOverwritten): hltchain = triggerPythonConfig.dicts()[item] if n > 0: hltchain['prescale'] = str(prescales[0]) - log.info('Applied HLTPS to the item '+item+': PS'+ hltchain['prescale']) + log.info('Applied HLTPS to the item %s: PS %s', item, hltchain['prescale']) class PrescaleClass(object): # Item name | Prescale diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtil.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtil.py index 3c965544e20f73645211a33fffdbe37024367e35..cc7a4f23d06891a72352b97568bd9add35986184 100755 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtil.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtil.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from TriggerJobOpts.TriggerFlags import TriggerFlags from AthenaCommon.Logging import logging @@ -8,7 +8,7 @@ def checkGroups(triggerPythonConfig): """ Make sure the groups used in Physics and MC menu exists """ menu_name = TriggerFlags.triggerMenuSetup() - log.info( "Menu: " + menu_name) + log.info("Menu: %s", menu_name) from TriggerMenuMT.HLTMenuConfig.Menu.GroupInfo import getAllAllowedGroups allgroup=getAllAllowedGroups(menu_name) @@ -31,7 +31,7 @@ def checkTriggerGroupAssignment(triggerPythonConfig): which allows only primary, supporting and calibration triggers. """ menu_name = TriggerFlags.triggerMenuSetup() - log.info( "Menu: " + menu_name) + log.info("Menu: %s", menu_name) GroupItems = [] CheckGroups=False @@ -60,7 +60,7 @@ def checkStreamConsistency(triggerPythonConfig): Checks that all chains are assigned to existing streams """ menu_name = TriggerFlags.triggerMenuSetup() - log.info( "Menu: " + menu_name) + log.info("Menu: %s", menu_name) from TriggerMenuMT.HLTMenuConfig.Menu.StreamInfo import getAllStreams @@ -75,14 +75,15 @@ def checkStreamConsistency(triggerPythonConfig): else: for stream in chain.stream_tag: if stream[0] not in allStreams: - log.error(' Chain: ' + chain.chain_name + ' has the wrong streamer ' + stream[0]) + log.error('Chain: %s has the wrong streamer %s', chain.chain_name, stream[0]) else: ##check data scouting streaming name if "DataScouting" in stream[0]: rob_id= stream[0].split("_")[1] if rob_id in already_used_robs and stream[0] is not already_used_robs[rob_id]: - log.error( "Duplicated ROB in stream " + stream[0] + - "(ROB number " + str(stream[0].split("_")[1]) + " already used in stream " + already_used_robs[stream[0].split("_")[1]] + ")") + log.error("Duplicated ROB in stream %s (ROB number %s already used in stream %s)", + stream[0], stream[0].split("_")[1], + already_used_robs[stream[0].split("_")[1]]) already_used_robs[rob_id]=stream[0] else: already_used_robs[rob_id]=stream[0] @@ -94,8 +95,8 @@ def checkStreamConsistency(triggerPythonConfig): if "DataScouting" in stream: rob_id= stream.split("_")[1] if rob_id in already_used_robs: - log.error( "Duplicated ROB in stream " + stream + - "(ROB number " + str(rob_id) + " already used in stream " + already_used_robs[rob_id] + ")") + log.error("Duplicated ROB in stream %s (ROB number %s already used in stream %s)", + stream, rob_id, already_used_robs[rob_id]) already_used_robs[rob_id]=stream else: already_used_robs[rob_id]=stream diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py index dad431596e854b456fe150af542e72ec3305e063..8ea012e8f2eeacb12605701e488128740a22875f 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py @@ -4,7 +4,6 @@ log = logging.getLogger( __name__ ) log.info("Importing %s",__name__) from copy import deepcopy -import six #========================================================== # This is stored in chainDict['Signature'] @@ -894,7 +893,7 @@ AllowedTopos = AllowedTopos_e + AllowedTopos_mu + AllowedTopos_Bphysics + Allowe #========================================================== def getSignatureNameFromToken(chainpart): theMatchingTokens = [] - reverseSliceIDDict = dict([(value, key) for key, value in six.iteritems (SliceIDDict)]) #reversed SliceIDDict + reverseSliceIDDict = { value: key for key, value in SliceIDDict.items() } #reversed SliceIDDict for sig,token in SliceIDDict.items(): if (token in chainpart): theMatchingTokens += [token] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py index d55b693e617f915e2a4e6caa6097bc645bd2e7da..688b27cbcb755d8e68b14e0e0cfd893cdde51209 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ######################################################################################### # @@ -7,7 +7,6 @@ ######################################################################################### import sys -from six import itervalues from AthenaCommon.Logging import logging log = logging.getLogger(__name__) @@ -51,11 +50,11 @@ class TriggerConfigHLT(object): @classmethod def dictsList(cls): - return list(itervalues(cls.__allChainDicts)) + return list(cls.__allChainDicts.values()) @classmethod def configsList(cls): - return list(itervalues(cls.__allChainConfigs)) + return list(cls.__allChainConfigs.values()) @classmethod def getChainDictFromChainName(cls, chainName): diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py index 1214b696d22898e61c114707bddad089ae1e1e9a..80b73fb57195700f87cc3af56565bdb8f2cc405b 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py @@ -28,7 +28,7 @@ class MinBiasChainConfig(ChainConfigurationBase): # Assemble the chain depending on information from chainName # ---------------------- def assembleChain(self): - log.debug("Assembling chain for " + self.chainName) + log.debug("Assembling chain for %s", self.chainName) SpStep = self.getMinBiasSpStep() TrkStep = self.getMinBiasTrkStep() return self.buildChain([SpStep,TrkStep]) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauChainConfiguration.py index b2ef5d75c6835feabfc19a0938f1acc7105b6ec2..7091e3fe471461c9eb8f0e09b8bbb32fcb594660 100755 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauChainConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauChainConfiguration.py @@ -72,7 +72,7 @@ class TauChainConfiguration(ChainConfigurationBase): # ---------------------- def assembleChain(self): chainSteps = [] - log.debug("Assembling chain for " + self.chainName) + log.debug("Assembling chain for %s", self.chainName) # -------------------- # define here the names of the steps and obtain the chainStep configuration diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/TestDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/TestDef.py index 0fcd582641eeab1cbc6e2d176b9fb0546f6cdbff..8a7e9b14dd8cdfea591ea13cdc7d035aca8ebfae 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/TestDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/TestDef.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon.Logging import logging logging.getLogger().info("Importing %s",__name__) @@ -81,7 +81,7 @@ class TestChainConfiguration(ChainConfigurationBase): stepDictionary = self.getStepDictionary() key = self.chainPart['extra'] - log.debug('testChain key = ' + key) + log.debug('testChain key = %s', key) if key in stepDictionary: steps=stepDictionary[key] else: diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/ViewCFTest.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/ViewCFTest.py index 4721965a9c2ce6cb8b8d716c346223636a997ca7..8aad0a9da32fe6d2cb62e2fb92439592e24af184 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/ViewCFTest.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/ViewCFTest.py @@ -4,13 +4,10 @@ from TriggerMenuMT.HLTMenuConfig.Menu.CFValidation import findViewAlgs, checkVDV from AthenaCommon.AlgSequence import AlgSequence from AthenaCommon.CFElements import seqOR import AthenaCommon.CfgMgr as CfgMgr -import six import unittest class ViewCFTest( unittest.TestCase ): - if six.PY2: - assertRaisesRegex = unittest.TestCase.assertRaisesRegexp def runTest( self ): diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/UnconventionalTracking/UnconventionalTrackingChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/UnconventionalTracking/UnconventionalTrackingChainConfiguration.py index bb83906a355eb50d2769129232fad814e3fb6f46..f400f129a253ce0a4e74ae6947b8e73ad8772c2b 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/UnconventionalTracking/UnconventionalTrackingChainConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/UnconventionalTracking/UnconventionalTrackingChainConfiguration.py @@ -29,7 +29,7 @@ class UnconventionalTrackingChainConfiguration(ChainConfigurationBase): # Assemble the chain depending on information from chainName # ---------------------- def assembleChain(self): - log.debug("Assembling chain " + self.chainName) + log.debug("Assembling chain %s", self.chainName) chainSteps = [] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/L1MenuFlags.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/L1MenuFlags.py index 521644ecc203c0ac1e5f5c24020705c9189822cc..8d50cb2ac757dcaaa940d94a6339761f4f6b848c 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/L1MenuFlags.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/L1MenuFlags.py @@ -4,7 +4,6 @@ __doc__="Level 1 specific configuration for L1 Run 3" from .Limits import Limits from collections import Iterable, OrderedDict -import six class FlagWrapper: @@ -37,12 +36,12 @@ class L1MenuFlagsCont(object): statusOn = set() __slots__ = { - "MenuSetup" : FlagArgs( six.string_types ), + "MenuSetup" : FlagArgs( str ), "CTPVersion" : FlagArgs( int, 4, val_check = lambda x: x in range(5), action = lambda x: Limits.setLimits(x) ), "BunchGroupPartitioning" : FlagArgs( Iterable, val_check = lambda x: len(list(filter(lambda y: y not in range(16), x)))==0 ), - "BunchGroupNames" : FlagArgs( Iterable, val_check = lambda x: len(list(filter(lambda y: not isinstance(y, six.string_types), x)))==0), + "BunchGroupNames" : FlagArgs( Iterable, val_check = lambda x: len(list(filter(lambda y: not isinstance(y, str), x)))==0), "MenuPartitioning" : FlagArgs( Iterable, val_check = lambda x: len(list(filter(lambda y: y not in range(512), x)))==0 ), - "items" : FlagArgs( Iterable, val_check = lambda x: len(list(filter(lambda y: not isinstance(y, six.string_types), x)))==0), + "items" : FlagArgs( Iterable, val_check = lambda x: len(list(filter(lambda y: not isinstance(y, str), x)))==0), "boards" : FlagArgs( OrderedDict, OrderedDict() ), "legacyBoards" : FlagArgs( OrderedDict, OrderedDict() ), "prescales" : FlagArgs( dict, dict() ), diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/Limits.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/Limits.py index b930e16df61a94b6199e1c621f86a818a00f9e9e..d263cda51dc83f1d428f1b5bcd77d74b58ec8bec 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/Limits.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/Limits.py @@ -1,9 +1,8 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """ This temporarily holds CTP sizes """ -import six from AthenaCommon.Logging import logging log = logging.getLogger('Menu.L1.Base.Limits') @@ -40,8 +39,7 @@ class Access(type): -@six.add_metaclass(Access) -class Limits(object): +class Limits(object, metaclass=Access): CTPVersion = None L1CommonVersion = None diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TypeWideThresholdConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TypeWideThresholdConfig.py index 0fe451494a081dece84f43723913021bae7e3f3c..844bb1e48f0b0faa72b1532ca710742228ad8bc1 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TypeWideThresholdConfig.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TypeWideThresholdConfig.py @@ -1,6 +1,5 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -import six from collections import OrderedDict as odict from AthenaCommon.Logging import logging @@ -9,7 +8,7 @@ log = logging.getLogger('Menu.L1.Config.TypeWideThresholdConfig') from ..Base.ThresholdType import ThrType def getTypeWideThresholdConfig(ttype): - if isinstance(ttype,six.string_types): + if isinstance(ttype, str): ttype = ThrType[ttype] if ttype == ThrType.MU: diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/L1MenuConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/L1MenuConfig.py index 00da7cbbb708fd0e59dc8688754eb96663a92ad5..8dcc7ffce8c11b933ce5dc6133bc38009f01ad1c 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/L1MenuConfig.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/L1MenuConfig.py @@ -124,7 +124,7 @@ class L1MenuConfig(object): if algo.name in self._registeredTopoAlgos[self.currentAlgoDef]: raise RuntimeError('%s algo %s is already registered as such' % (self.currentAlgoDef.desc, algo.name)) self._registeredTopoAlgos[self.currentAlgoDef][algo.name] = algo - log.debug("Added in the {0} type the algo: {1} ID:{2}" .format(self.currentAlgoDef.desc, algo.name,algo.algoId)) + log.debug("Added in the %s type the algo: %s ID:%s", self.currentAlgoDef.desc, algo.name, algo.algoId) return algo @@ -285,7 +285,8 @@ class L1MenuConfig(object): log.info("... L1 legacy menu %s contains %i legacy boards (%s)", self.menuFilesToLoad, len(L1MenuFlags.legacyBoards()), ', '.join(L1MenuFlags.legacyBoards().keys())) except ImportError as ie: if ie.name == 'TriggerMenuMT.L1.Menu.Menu_%s_inputs_legacy' % self.menuFilesToLoad: - log.info(f"==> No menu defining the legacy inputs was found, will assume this intended. {ie.msg} {ie.name} {ie.path}") + log.info("==> No menu defining the legacy inputs was found, will assume this intended. %s %s %s", + ie.msg, ie.name, ie.path) else: raise diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Limits.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Limits.py index 333ce939ed8a8883fa0b35c78178651376352533..f371bb7b725c5c7da55e108696db8b379a2c36cc 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Limits.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Limits.py @@ -1,9 +1,8 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """ This temporarily holds CTP sizes """ -import six from AthenaCommon.Logging import logging log = logging.getLogger('LVL1.Limits') @@ -40,8 +39,7 @@ class Access(type): -@six.add_metaclass(Access) -class Limits(object): +class Limits(object, metaclass=Access): CTPVersion = None L1CommonVersion = None diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1Thresholds.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1Thresholds.py index 2b7849f1b70ab8716aab689b27dead67593af499..d74fe35b8cfcd50e9c554b31e6f25417b11dcc33 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1Thresholds.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1Thresholds.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from .Limits import CaloLimits as CL IsolationOff = CL.IsolationOff @@ -6,7 +6,6 @@ IsolationOff = CL.IsolationOff from copy import deepcopy from past.builtins import cmp -import six class ThresholdValue(object): @@ -385,11 +384,8 @@ class LVL1Thresholds(object): return None def xml(self, ind=1, step=2): - if six.PY2: - self.thresholds.sort(LVL1Thresholds.compThreshold) - else: - import functools - self.thresholds.sort(key=functools.cmp_to_key(LVL1Thresholds.compThreshold)) + import functools + self.thresholds.sort(key=functools.cmp_to_key(LVL1Thresholds.compThreshold)) s = ind * step * ' ' + '<TriggerThresholdList>\n' for thr in self.thresholds: s += thr.xml(ind+1,step) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/TriggerConfigL1Topo.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/TriggerConfigL1Topo.py index 4d21191b48571dfeffdb0da890218a2ab9bca157..83771f8854a65341e1a8db5ce075dd53be8c653e 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/TriggerConfigL1Topo.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/TriggerConfigL1Topo.py @@ -66,7 +66,7 @@ class TriggerConfigL1Topo(object): raise RuntimeError('L1Topo algo %s is already registered' % algo.name) self.registeredAlgos[algo.name] = algo - log.debug("Added in the algo list: {0}, ID:{1}" .format(algo.name,algo.algoId)) + log.debug("Added in the algo list: %s, ID:%s", algo.name, algo.algoId) return algo