From ae6684cc8d26c20ba3d2667ed585dd8ad091f270 Mon Sep 17 00:00:00 2001 From: Frank Winklmeier <fwinkl@cern> Date: Mon, 26 Oct 2020 12:23:04 +0100 Subject: [PATCH] CaloRec: enable flake8 and fix code --- Calorimeter/CaloRec/CMakeLists.txt | 2 +- .../CaloRec/python/CaloBCIDAvgAlgDefault.py | 4 +-- .../CaloRec/python/CaloCellAODGetter.py | 9 ++---- .../CaloRec/python/CaloTopoTowerGetter.py | 28 +++++++++---------- 4 files changed, 20 insertions(+), 23 deletions(-) diff --git a/Calorimeter/CaloRec/CMakeLists.txt b/Calorimeter/CaloRec/CMakeLists.txt index 1b8deec908a..0df8dff9ac6 100644 --- a/Calorimeter/CaloRec/CMakeLists.txt +++ b/Calorimeter/CaloRec/CMakeLists.txt @@ -55,7 +55,7 @@ atlas_add_test( CaloBCIDLumiCondAlg_test LINK_LIBRARIES CaloRecLib CaloLumiConditions LArRawConditions IdDictParser TestTools ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py share/*.txt ) diff --git a/Calorimeter/CaloRec/python/CaloBCIDAvgAlgDefault.py b/Calorimeter/CaloRec/python/CaloBCIDAvgAlgDefault.py index c2950f7be41..487ab8ce2e1 100644 --- a/Calorimeter/CaloRec/python/CaloBCIDAvgAlgDefault.py +++ b/Calorimeter/CaloRec/python/CaloBCIDAvgAlgDefault.py @@ -1,11 +1,11 @@ - +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration def CaloBCIDAvgAlgDefault(): from CaloRec.CaloRecConf import CaloBCIDAvgAlg from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() if not hasattr(topSequence,"CaloBCIDAvgAlg"): - from IOVDbSvc.CondDB import conddb + from IOVDbSvc.CondDB import conddb # noqa: F401 from LArRecUtils.LArMCSymCondAlg import LArMCSymCondAlgDefault LArMCSymCondAlgDefault() from CaloRec.CaloBCIDLumiCondAlgDefault import CaloBCIDLumiCondAlgDefault diff --git a/Calorimeter/CaloRec/python/CaloCellAODGetter.py b/Calorimeter/CaloRec/python/CaloCellAODGetter.py index a25287b515d..b6cdbf86c73 100644 --- a/Calorimeter/CaloRec/python/CaloCellAODGetter.py +++ b/Calorimeter/CaloRec/python/CaloCellAODGetter.py @@ -11,9 +11,6 @@ # addClusterToCaloCellAOD("MuonClusterCollection") def addClusterToCaloCellAOD(clustersInputName): - from AthenaCommon.Logging import logging - mlog = logging.getLogger( 'addClusterToCaloCellAOD' ) - from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() @@ -29,9 +26,9 @@ def addClusterToCaloCellAOD(clustersInputName): # Include all TileGap3 cells. from CaloRec.CaloRecConf import CaloThinCellsBySamplingAlg salg = CaloThinCellsBySamplingAlg ('CaloThinCellsBySamplingAlg_TileGap3', - StreamName = 'StreamAOD', - SamplingCellsName = ['TileGap3'], - Cells = 'AllCalo') + StreamName = 'StreamAOD', + SamplingCellsName = ['TileGap3'], + Cells = 'AllCalo') if salg not in topSequence: topSequence += salg diff --git a/Calorimeter/CaloRec/python/CaloTopoTowerGetter.py b/Calorimeter/CaloRec/python/CaloTopoTowerGetter.py index 4492db077fa..ee7f5938d5b 100644 --- a/Calorimeter/CaloRec/python/CaloTopoTowerGetter.py +++ b/Calorimeter/CaloRec/python/CaloTopoTowerGetter.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 # specifies Tower/TopoCluster -> TopoTower from AthenaCommon.JobProperties import jobproperties as jp @@ -19,7 +19,7 @@ class CaloTopoTowerGetter ( Configured ) : # get handle to upstream CaloCells theCaloCellGetter = self.getInputGetter\ (jp.CaloRecFlags.clusterCellGetterName()) - + # ----- get handle to upstream tower objects try: from CaloRec.CaloTowerCmbGetter import CaloTowerCmbGetter @@ -28,15 +28,15 @@ class CaloTopoTowerGetter ( Configured ) : mlog.error("could not get handle to CaloTowerCmbGetter Quit") print(traceback.format_exc()) return False - + if not theCaloTowerCmbGetter.usable(): if not self.ignoreConfigError(): mlog.error("CaloTowerCmbGetter unusable. Quit.") return False else: mlog.error("CaloTowerCmbGetter unusable. Continue nevertheless") - - + + # ------ get handle to upstream topo cluster object try: from CaloRec.CaloClusterTopoGetter import CaloClusterTopoGetter @@ -52,7 +52,7 @@ class CaloTopoTowerGetter ( Configured ) : return False else: mlog.error("theCaloClusterTopoGetter unusable. Continue nevertheless") - + # ------ get handle to upstream topo cluster object try: from CaloRec.CaloClusterTopoGetter import CaloClusterTopoGetter @@ -63,14 +63,14 @@ class CaloTopoTowerGetter ( Configured ) : mlog.error("could not get handle to CaloCell2TopoClusterMapperGetter Quit") print(traceback.format_exc()) return False - + if not theCaloCell2TopoClusterMapperGetter.usable(): if not self.ignoreConfigError(): mlog.error("theCaloCell2TopoClusterMapperGetter unusable. Quit.") return False else: mlog.error("theCaloCell2TopoClusterMapperGetter unusable. Continue nevertheless") - + # now configure the algorithm, part of this could be done in a separate class # cannot have same name try: @@ -94,7 +94,7 @@ class CaloTopoTowerGetter ( Configured ) : return False theCaloTopoTowerAlgorithm.TowerBuilderTools+= [ theCaloTopoTowerBuilderTool.getFullName() ] - + ######################## # extra cuts which can be applied at the topo tower level @@ -103,7 +103,7 @@ class CaloTopoTowerGetter ( Configured ) : theCaloTopoTowerAlgorithm.ClusterContainerName = theCaloClusterTopoGetter.outputKey() theCaloTopoTowerAlgorithm.CellContainerName = theCaloCellGetter.outputKey() theCaloTopoTowerAlgorithm.Cell2ClusterMapName = theCaloCell2TopoClusterMapperGetter.outputKey() - + # sets output key theCaloTopoTowerAlgorithm.OutputTowerContainerName =self.outputKey() @@ -136,12 +136,12 @@ class CaloTopoTowerGetter ( Configured ) : topSequence += theCaloTopoTowerAlgorithm return True - + def caloTowerAlgorithmHandle(self): return self._CaloTopoTowerAlgorithmHandle - - - # would work only if one output object type + + + # would work only if one output object type def outputKey(self): return self._output[self._outputType] -- GitLab