From c27baef0aef5a169e1c834e8e20048dbc1a66c94 Mon Sep 17 00:00:00 2001 From: scott snyder <snyder@bnl.gov> Date: Tue, 3 Mar 2020 17:01:24 +0100 Subject: [PATCH] DerivationFrameworkTau: Python 3 / flake 8 fixes Updates for python 3 compatibility. Also enable flake8 checking and fix warnings. --- .../DerivationFrameworkTau/CMakeLists.txt | 4 ++++ .../DerivationFrameworkTau/python/TauCommon.py | 16 ++++++++++------ .../python/TauTruthCommon.py | 12 ++++++++---- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/CMakeLists.txt b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/CMakeLists.txt index 47d9226a5ba5..74ab42c4f053 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/CMakeLists.txt +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/CMakeLists.txt @@ -31,3 +31,7 @@ atlas_add_component( DerivationFrameworkTau atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) +atlas_add_test( flake8 + SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python + POST_EXEC_SCRIPT nopost.sh ) + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauCommon.py index c9deea403d0c..02d2b874face 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauCommon.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauCommon.py @@ -1,11 +1,16 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration #******************************************************************** # TauCommon.py # Schedules all tools needed for tau object selection and writes # results into SG. These may then be accessed along the train. #******************************************************************** -from DerivationFrameworkCore.DerivationFrameworkMaster import * + +from __future__ import print_function + +from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob +from AthenaCommon.AppMgr import ToolSvc +from AthenaCommon import CfgMgr #==================================================================== # MAKE TAU ENUMS AVAILABLE @@ -30,7 +35,7 @@ DFCommonTausLooseWrapper = DerivationFramework__AsgSelectionToolWrapper( name = StoreGateEntryName = "DFCommonTausLoose", ContainerName = "TauJets") ToolSvc += DFCommonTausLooseWrapper -print DFCommonTausLooseWrapper +print (DFCommonTausLooseWrapper) DFCommonTauWrapperTools.append(DFCommonTausLooseWrapper) # Medium @@ -43,7 +48,7 @@ DFCommonTausMediumWrapper = DerivationFramework__AsgSelectionToolWrapper( name = StoreGateEntryName = "DFCommonTausMedium", ContainerName = "TauJets") ToolSvc += DFCommonTausMediumWrapper -print DFCommonTausMediumWrapper +print (DFCommonTausMediumWrapper) DFCommonTauWrapperTools.append(DFCommonTausMediumWrapper) # Tight @@ -56,13 +61,12 @@ DFCommonTausTightWrapper = DerivationFramework__AsgSelectionToolWrapper( name = StoreGateEntryName = "DFCommonTausTight", ContainerName = "TauJets") ToolSvc += DFCommonTausTightWrapper -print DFCommonTausTightWrapper +print (DFCommonTausTightWrapper) DFCommonTauWrapperTools.append(DFCommonTausTightWrapper) #======================================= # CREATE THE DERIVATION KERNEL ALGORITHM #======================================= -from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation("TauCommonKernel", AugmentationTools = DFCommonTauWrapperTools) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauTruthCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauTruthCommon.py index 2a4642c9c4b2..945f60641cfd 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauTruthCommon.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/python/TauTruthCommon.py @@ -1,11 +1,16 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration #******************************************************************** # TauTruthCommon.py # Schedules all tools needed for tau truth object selection and writes # results into SG. These may then be accessed along the train. #******************************************************************** -from DerivationFrameworkCore.DerivationFrameworkMaster import * + +from __future__ import print_function + +from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob, DerivationFrameworkIsMonteCarlo +from AthenaCommon.AppMgr import ToolSvc +from AthenaCommon import CfgMgr #==================================================================== # AUGMENTATION TOOLS @@ -43,13 +48,12 @@ if DerivationFrameworkIsMonteCarlo: TauTruthMatchingTool = DFCommonTauTruthMatchingTool, TauContainerName = "TauJets") ToolSvc += DFCommonTauTruthMatchingWrapper - print DFCommonTauTruthMatchingWrapper + print (DFCommonTauTruthMatchingWrapper) DFCommonTauTruthWrapperTools.append(DFCommonTauTruthMatchingWrapper) #======================================= # CREATE THE DERIVATION KERNEL ALGORITHM #======================================= - from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation("TauTruthCommonKernel", AugmentationTools = DFCommonTauTruthWrapperTools) -- GitLab