From 33c8c1d20793acf4ca8f51e53cd18ab4683e3904 Mon Sep 17 00:00:00 2001 From: Frank Winklmeier <fwinkl@cern> Date: Wed, 11 Nov 2020 15:02:59 +0100 Subject: [PATCH] HepMCAnalysis_i: enable flake8 and make code compliant --- Generators/HepMCAnalysis_i/CMakeLists.txt | 2 +- .../python/HepMCAnalysis_iConfig.py | 86 +++++++++---------- .../python/Pythia6TrfConfig.py | 6 +- 3 files changed, 46 insertions(+), 48 deletions(-) diff --git a/Generators/HepMCAnalysis_i/CMakeLists.txt b/Generators/HepMCAnalysis_i/CMakeLists.txt index 832b31e70c1..7ebe07cdcb8 100644 --- a/Generators/HepMCAnalysis_i/CMakeLists.txt +++ b/Generators/HepMCAnalysis_i/CMakeLists.txt @@ -31,7 +31,7 @@ atlas_add_component( HepMCAnalysis_i # Install files from the package: atlas_install_headers( HepMCAnalysis_i ) -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) atlas_install_runtime( test/*.xml share/*.C share/*.py share/common/*.py share/RTTJO/HepMCAnalysisJO_*.py ) diff --git a/Generators/HepMCAnalysis_i/python/HepMCAnalysis_iConfig.py b/Generators/HepMCAnalysis_i/python/HepMCAnalysis_iConfig.py index 00d3cb459f0..4bcb5331996 100644 --- a/Generators/HepMCAnalysis_i/python/HepMCAnalysis_iConfig.py +++ b/Generators/HepMCAnalysis_i/python/HepMCAnalysis_iConfig.py @@ -1,43 +1,43 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - - -from HepMCAnalysis_i.HepMCAnalysis_iConf import HepMCAnalysis - -class HepMCAnalysis_i(HepMCAnalysis): - - def __init__(self, name = "HepMCAnalysis_i", file = None): - super( HepMCAnalysis_i, self ).__init__( name ) - - self.OutputFile = "hepmcanalysis.root" - - from AthenaCommon.Logging import logging - log = logging.getLogger( 'HepMCAnalysis_i' ) - - # set defaults - if file: - self.OutputFile = file - log.info("changing output file name to %s" % self.OutputFile) - - # create THistSvc if not yet done - from AthenaCommon.AppMgr import ServiceMgr as svcMgr - if not hasattr( svcMgr, "THistSvc"): - log.info("will setup THistSvc and add instance to ServiceMgr") - from GaudiSvc.GaudiSvcConf import THistSvc - myHistSvc = THistSvc() - svcMgr += myHistSvc - else: - myHistSvc = svcMgr.THistSvc - - # defining stream and output file - log.info("here0") - log.info("Output file: %s" % self.OutputFile) - - myHistSvc.Output += [ ("hepmcanalysis DATAFILE='%s' OPT='RECREATE'" % self.OutputFile)] ####if this line is commented in the segmentation fault appears!!!!! - myHistSvc.OutputLevel = 1 - #####if the above line is commented out then the segmentation fault appears at event number 5!!!!! STRANGE!!!!! - #myHistSvc.Output += [ ("hepmcanalysis DATAFILE='test.root' OPT='RECREATE'") ] - - # overriding default IHistSvc in algorithm - self.ITHistSvc = myHistSvc - #self.ITHistSvc.Output = [ ("hepmcanalysis DATAFILE='%s' OPT='RECREATE'" % self.OutputFile)] ####if this line is commented in the segmentation fault appears!!!!! - #####if the above line is commented out then the segmentation fault appears at event number 5!!!!! STRANGE!!!!! +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + + +from HepMCAnalysis_i.HepMCAnalysis_iConf import HepMCAnalysis + +class HepMCAnalysis_i(HepMCAnalysis): + + def __init__(self, name = "HepMCAnalysis_i", file = None): + super( HepMCAnalysis_i, self ).__init__( name ) + + self.OutputFile = "hepmcanalysis.root" + + from AthenaCommon.Logging import logging + log = logging.getLogger( 'HepMCAnalysis_i' ) + + # set defaults + if file: + self.OutputFile = file + log.info("changing output file name to %s", self.OutputFile) + + # create THistSvc if not yet done + from AthenaCommon.AppMgr import ServiceMgr as svcMgr + if not hasattr( svcMgr, "THistSvc"): + log.info("will setup THistSvc and add instance to ServiceMgr") + from GaudiSvc.GaudiSvcConf import THistSvc + myHistSvc = THistSvc() + svcMgr += myHistSvc + else: + myHistSvc = svcMgr.THistSvc + + # defining stream and output file + log.info("here0") + log.info("Output file: %s", self.OutputFile) + + myHistSvc.Output += [ ("hepmcanalysis DATAFILE='%s' OPT='RECREATE'" % self.OutputFile)] ####if this line is commented in the segmentation fault appears!!!!! + myHistSvc.OutputLevel = 1 + #####if the above line is commented out then the segmentation fault appears at event number 5!!!!! STRANGE!!!!! + #myHistSvc.Output += [ ("hepmcanalysis DATAFILE='test.root' OPT='RECREATE'") ] + + # overriding default IHistSvc in algorithm + self.ITHistSvc = myHistSvc + #self.ITHistSvc.Output = [ ("hepmcanalysis DATAFILE='%s' OPT='RECREATE'" % self.OutputFile)] ####if this line is commented in the segmentation fault appears!!!!! + #####if the above line is commented out then the segmentation fault appears at event number 5!!!!! STRANGE!!!!! diff --git a/Generators/HepMCAnalysis_i/python/Pythia6TrfConfig.py b/Generators/HepMCAnalysis_i/python/Pythia6TrfConfig.py index 2e58add5048..a228d435e7c 100644 --- a/Generators/HepMCAnalysis_i/python/Pythia6TrfConfig.py +++ b/Generators/HepMCAnalysis_i/python/Pythia6TrfConfig.py @@ -1,10 +1,8 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -import os +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration __all__ = [] -from PyJobTransformsCore.TransformConfig import * +from PyJobTransformsCore.TransformConfig import TransformConfig class Pythia6TrfConfig(TransformConfig): -- GitLab