diff --git a/Generators/AlpGenControl/CMakeLists.txt b/Generators/AlpGenControl/CMakeLists.txt
index bb7fc4c19c362dee61fa4687856b222848e600bc..e546b936d0f89edbeed9301f04ff11fa6b263a17 100644
--- a/Generators/AlpGenControl/CMakeLists.txt
+++ b/Generators/AlpGenControl/CMakeLists.txt
@@ -6,6 +6,6 @@
 atlas_subdir( AlpGenControl )
 
 # 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 )
 
diff --git a/Generators/AlpGenControl/python/AlpGenUtils.py b/Generators/AlpGenControl/python/AlpGenUtils.py
index c0e4a65a09eaca5a96520e26c2cbc51490428d55..5451b662f4188ad677d9e1141056b099bbd3961d 100644
--- a/Generators/AlpGenControl/python/AlpGenUtils.py
+++ b/Generators/AlpGenControl/python/AlpGenUtils.py
@@ -1,13 +1,13 @@
 #! /usr/bin/env python
 
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Pythonized version of AlpGen steering executables 
 #    written by Zach Marshall <zach.marshall@cern.ch>
 #  Attempts to remove path-dependence of AlpGen so that
 #    it can be used safely in the production system.
 
-import os,sys,subprocess,shutil,time,glob
+import os,subprocess,shutil,glob
 from AthenaCommon import Logging
 
 def SimpleRun( proc_name='wjet' , events=10000 , nwarm = [4,1000000] , energy=3500. , jets=[2,0] , seed = 1234 , special1 = None , special2 = None , special3 = None, inputgridfile = None, configOnly=False):
@@ -30,8 +30,8 @@ def SimpleRun( proc_name='wjet' , events=10000 , nwarm = [4,1000000] , energy=35
 
     app_path = alpgenpath+'/'+proc_name+'work/'+proc_name+'gen'
     if not os.access(app_path,os.R_OK):
-        log.error('AlpGen module for process'+str(proc_name)+'not found at expected location:')
-        log.error('   '+str(app_path))
+        log.error('AlpGen module for process %s not found at expected location:', proc_name)
+        log.error('   %s', app_path)
         return error
     
     SkipWarmUp = False
@@ -41,7 +41,7 @@ def SimpleRun( proc_name='wjet' , events=10000 , nwarm = [4,1000000] , energy=35
         gridname = value
         if len(value) <1 : 
             log.fatal('Grid file is not correct, please provide a grid file.')
-            raise RunTimeError('Corrupted grid file.')
+            raise RuntimeError('Corrupted grid file.')
 
         gridfile = glob.glob(gridname+".grid")
 
@@ -55,7 +55,7 @@ def SimpleRun( proc_name='wjet' , events=10000 , nwarm = [4,1000000] , energy=35
 """
     
     if SkipWarmUp:
-        log.info('Grid File provided: '+gridfile[0]+' ... Skipping Warm-Up!')
+        log.info('Grid File provided: %s ... Skipping Warm-Up!', gridfile[0])
         nwarm[1]=0
         nwarm[0]=0
         tmp_card = """alpout          ! label for files
@@ -70,7 +70,7 @@ def SimpleRun( proc_name='wjet' , events=10000 , nwarm = [4,1000000] , energy=35
     tmp_card += '%i          ! Nevents generated after warm-up \n'%(events)
     tmp_card += 'njets %i \n'%(int(jets[0]))
     tmp_card += 'ebeam %f         ! E beam\n'%(float(energy))
-    if not 'ndns' in special1: tmp_card += 'ndns 9               ! PDF CTEQ6L1 \n'
+    if 'ndns' not in special1: tmp_card += 'ndns 9               ! PDF CTEQ6L1 \n'
     else:
         log.info('Spotted ndns setting in your special input - will not use the default CTEQ6L1 PDF.')
 
@@ -98,7 +98,7 @@ cluopt 1             ! kt scale option. 1:kt propto pt, 2:kt propto mt
 """
 
     if seed>100000:
-        log.warning('Using seed '+str(seed)+'>100000 - not recommended by the Alpgen authors.')
+        log.warning('Using seed %s>100000 - not recommended by the Alpgen authors.', seed)
 
     tmp_card += 'iseed1 %i       ! first  random seed for weighting process \n'%(int(seed))
     tmp_card += 'iseed2 %i       ! second random seed for weighting process \n'%((int(seed)+123))
@@ -125,7 +125,7 @@ cluopt 1             ! kt scale option. 1:kt propto pt, 2:kt propto mt
     else:
         log.info('Would now run mode 1 generation')
         shutil.copy('input_card.'+str(pid),'input_card.mode_1.dat')
-        log.info(app_path+' < input_card.mode_1.dat')
+        log.info('%s < input_card.mode_1.dat', app_path)
 
     alp_card = open( 'input_card.'+str(pid) , 'w' )
     alp_card.write('2               ! imode\n')
@@ -140,7 +140,7 @@ cluopt 1             ! kt scale option. 1:kt propto pt, 2:kt propto mt
     else:
         log.info('Would now run mode 2 generation')
         shutil.copy('input_card.'+str(pid),'input_card.mode_2.dat')
-        log.info(app_path+' < input_card.mode_2.dat')
+        log.info('%s < input_card.mode_2.dat', app_path)
         # don't need to do anything else, so return
         return
 
diff --git a/Generators/CosmicGenerator/CMakeLists.txt b/Generators/CosmicGenerator/CMakeLists.txt
index 498f329297b88c03152abe8c61abaace439fc489..77f6eb9151d1b28c61b5f87044a0727438c53268 100644
--- a/Generators/CosmicGenerator/CMakeLists.txt
+++ b/Generators/CosmicGenerator/CMakeLists.txt
@@ -22,6 +22,6 @@ atlas_add_component( CosmicGenerator
                      LINK_LIBRARIES CosmicGeneratorLib )
 
 # 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/*.txt share/*.py )
 
diff --git a/Generators/CosmicGenerator/python/CosmicGeneratorConfig.py b/Generators/CosmicGenerator/python/CosmicGeneratorConfig.py
index b2d8e21da79b0aee767bac61acdc63fb2c4e1b1b..9fc867df6f71aefab8bd1f8363afe937e242e662 100644
--- a/Generators/CosmicGenerator/python/CosmicGeneratorConfig.py
+++ b/Generators/CosmicGenerator/python/CosmicGeneratorConfig.py
@@ -207,7 +207,7 @@ def getInput_GenericCosmicGenerator(name="GenericCosmicGenerator", **kwargs):
         kwargs.setdefault('doReweighting', True)           # Whether to use reweighting for cosmic ray generation
         kwargs.setdefault('rvert_max', 300000.)            # - radius in mm for generating primary vertex
 
-    if simFlags.CosmicPtSlice.statusOn and simFlags.CosmicPtSlice() is not 'NONE':
+    if simFlags.CosmicPtSlice.statusOn and simFlags.CosmicPtSlice() != 'NONE':
         print ("Configuring cosmic pT slice: %s" % simFlags.CosmicPtSlice.get_Value())
         theCavern.reconfigureCavernGeometry()
 
@@ -223,7 +223,7 @@ def getInput_GenericCosmicGenerator(name="GenericCosmicGenerator", **kwargs):
 ############## Input: Creating cosmics from scratch ###############
 def getInput_EvgenCosmicGenerator(name="EvgenCosmicGenerator", **kwargs):
     ## Configuring the Athena application for a 'generator' job
-    import AthenaCommon.AtlasUnixGeneratorJob
+    import AthenaCommon.AtlasUnixGeneratorJob  # noqa: F401
 
     from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
     athenaCommonFlags.PoolEvgenInput.set_Off()
@@ -234,7 +234,6 @@ def getInput_EvgenCosmicGenerator(name="EvgenCosmicGenerator", **kwargs):
         simFlags.CosmicFilterVolumeName = "CaloEntryLayer"
 
     #fix for bug: 49362
-    import sys
     from AthenaCommon.AppMgr import ServiceMgr
     ServiceMgr.EventSelector.EventsPerRun = int(2**31 - 1) #sys.maxint on a 32-bit machine
 
diff --git a/Generators/EvgenJobTransforms/CMakeLists.txt b/Generators/EvgenJobTransforms/CMakeLists.txt
index c449d97a4d61268e96dcb0c98cbcda2425353c6d..8736b66f00e777de4bf9cb00187f38ead37cc1dd 100644
--- a/Generators/EvgenJobTransforms/CMakeLists.txt
+++ b/Generators/EvgenJobTransforms/CMakeLists.txt
@@ -4,6 +4,6 @@
 atlas_subdir( EvgenJobTransforms )
 
 # 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 )
 atlas_install_runtime( scripts/*.py )
diff --git a/Generators/EvgenJobTransforms/python/EvgenConfig.py b/Generators/EvgenJobTransforms/python/EvgenConfig.py
index a68e11e6cb1ebba0c10fc92627b5bcef1e0d978f..6c86cb444857a50ebaeb9e6b132e8fdd0095a7a0 100644
--- a/Generators/EvgenJobTransforms/python/EvgenConfig.py
+++ b/Generators/EvgenJobTransforms/python/EvgenConfig.py
@@ -51,9 +51,9 @@ notuneGenerators = ["ParticleGenerator", "ParticleGun", "CosmicGenerator", "Beam
 
 def gen_require_steering(gennames):
     "Return a boolean of whether this set of generators requires the steering command line flag"
-    if not "EvtGen" in gennames: return False
-    if any(("Pythia" in gen and not "Pythia8" in gen) for gen in gennames): return True
-    if any(("Herwig" in gen and not "Herwigpp" in gen and not "Herwig7" in gen) for gen in gennames): return True
+    if "EvtGen" not in gennames: return False
+    if any(("Pythia" in gen and "Pythia8" not in gen) for gen in gennames): return True
+    if any(("Herwig" in gen and "Herwigpp" not in gen and "Herwig7" not in gen) for gen in gennames): return True
     return False
 
 def gen_known(genname):
@@ -103,7 +103,7 @@ def gen_sortkey(genname):
     return (genstage, isjimmy, genname)
 
 
-from PyJobTransformsCore.TransformConfig import *
+from PyJobTransformsCore.TransformConfig import TransformConfig, String, ListOfStrings, Boolean, Integer, AllowedExpression, TransformConfigError
 class EvgenConfig(TransformConfig):
     __slots__ = ()
     generators = ListOfStrings("List of used generators", allowedValues=knownGenerators)
diff --git a/Generators/EvgenJobTransforms/python/jo_proxy.py b/Generators/EvgenJobTransforms/python/jo_proxy.py
index fdbd2b3a75e15d39eb199e7dde8d7dcab5e8604b..d3facd14c7c685ceb9c575ffaf6fd263e9197cc7 100644
--- a/Generators/EvgenJobTransforms/python/jo_proxy.py
+++ b/Generators/EvgenJobTransforms/python/jo_proxy.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Helper functions for setting up a job options proxy
 import os,shutil
@@ -17,7 +17,7 @@ def mk_jo_proxy(targetbasepath, pkgname, proxypath, addtosearch=True):
     os.environ['LOCAL_DATA_DIR'] = (os.environ['DATAPATH']).split(":")[0]
 
     dirlist =  get_immediate_subdirectories(targetbasepath)
-    subdirlist=dirlist;
+    subdirlist=dirlist
     for dd in (dirlist):
       if (('.svn' not in dd) and ('cmt' not in dd) and ('_joproxy' not in dd)):
         deepdir = os.path.join(targetbasepath, dd)
@@ -43,4 +43,4 @@ def mk_jo_proxy(targetbasepath, pkgname, proxypath, addtosearch=True):
             os.environ["DATAPATH"] =os.path.join(targetbasepath, d)+":"+os.environ["DATAPATH"]
 
     os.environ["JOBOPTSEARCHPATH"] = os.environ['LOCAL_INSTALL_DIR']+":"+os.environ["JOBOPTSEARCHPATH"]
-    os.environ["DATAPATH"] = os.environ['LOCAL_DATA_DIR']+":"+os.environ["DATAPATH"]
\ No newline at end of file
+    os.environ["DATAPATH"] = os.environ['LOCAL_DATA_DIR']+":"+os.environ["DATAPATH"]
diff --git a/Generators/GeneratorModules/CMakeLists.txt b/Generators/GeneratorModules/CMakeLists.txt
index 1239ed294e3a612ad2b4fdb62fc8e543544ddc29..0169106379a7b002e6d789021688e4565ef89bea 100644
--- a/Generators/GeneratorModules/CMakeLists.txt
+++ b/Generators/GeneratorModules/CMakeLists.txt
@@ -21,5 +21,5 @@ atlas_add_component( GeneratorModules
                      LINK_LIBRARIES GeneratorModulesLib )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 
diff --git a/Generators/GeneratorModules/python/EvgenAlg.py b/Generators/GeneratorModules/python/EvgenAlg.py
index a91051415f7ef4d598767c3161fb821a62547c11..878765d65ae001948c094450dafbab5b38d6cca1 100644
--- a/Generators/GeneratorModules/python/EvgenAlg.py
+++ b/Generators/GeneratorModules/python/EvgenAlg.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaPython import PyAthena
 from AthenaPython.PyAthena import StatusCode
@@ -27,8 +27,8 @@ class EvgenAlg(PyAthena.Alg):
 
 
     def initialize(self):
-        import McParticleEvent.Pythonizations
-        self.msg.debug("Initializing [%s]"% self.getName())
+        import McParticleEvent.Pythonizations  # noqa: F401
+        self.msg.debug("Initializing [%s]", self.getName())
 
         return self.genInitialize()
 
@@ -36,21 +36,21 @@ class EvgenAlg(PyAthena.Alg):
     def execute(self):
         from AthenaPython.PyAthena import McEventCollection, HepMC
 
-        self.msg.debug("Executing [%s]"% self.getName())
+        self.msg.debug("Executing [%s]", self.getName())
 
         ## Retrieve MC event collection or create a new one
         mcevts = None
         if self.evtStore.contains(McEventCollection, self.McEventKey):
-            self.msg.debug(self.McEventKey + " found before alg execution!")
+            self.msg.debug("%s found before alg execution!", self.McEventKey)
             mcevts = self.evtStore[self.McEventKey]
         else:
-            self.msg.debug("Creating " + self.McEventKey + " before alg execution!")
+            self.msg.debug("Creating %s before alg execution!", self.McEventKey)
             mcevts = McEventCollection()
             self.evtStore.record(mcevts, self.McEventKey, True, False)
         ROOT.SetOwnership(mcevts, False)
 
         if self.evtStore.contains(McEventCollection, self.McEventKey):
-            self.msg.debug(self.McEventKey + " found after alg execution!")
+            self.msg.debug("%s found after alg execution!", self.McEventKey)
 
         ## Get the first event from the MCEC, or make a new one
         evt = None
diff --git a/Generators/GeneratorModules/python/EvgenAnalysisAlg.py b/Generators/GeneratorModules/python/EvgenAnalysisAlg.py
index a504e2e59671c9e62a29fbdb08671e8b55366867..915380772c14c3f9dc8f19873527c2e0ede2d6b2 100644
--- a/Generators/GeneratorModules/python/EvgenAnalysisAlg.py
+++ b/Generators/GeneratorModules/python/EvgenAnalysisAlg.py
@@ -1,8 +1,7 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaPython import PyAthena
-from AthenaPython.PyAthena import StatusCode, McEventCollection, HepMC, CLHEP
-import McParticleEvent.Pythonizations
+import McParticleEvent.Pythonizations  # noqa: F401
 
 
 class EvgenAnalysisAlg(PyAthena.Alg):
diff --git a/Generators/HepMCAnalysis_i/CMakeLists.txt b/Generators/HepMCAnalysis_i/CMakeLists.txt
index 832b31e70c13b677845b594d48b4ef67bb1e2c22..7ebe07cdcb886c0e61d21d232f7923a1a54c02e2 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 00d3cb459f03023fc7dffc5b16f187460b77aa55..4bcb5331996b1af279a2ef4fca4edae425b5918b 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 2e58add5048c66b9ed7497e65c1d352fc12eb934..a228d435e7cdb9780cfe4dc3338ea32b09c09665 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):
diff --git a/Generators/Herwig7_i/CMakeLists.txt b/Generators/Herwig7_i/CMakeLists.txt
index 0c4b498f6801e290ebba0c7556ed9e8dcae15e7c..65d4fb39621a199f1057fb30f3634c46106b51b2 100644
--- a/Generators/Herwig7_i/CMakeLists.txt
+++ b/Generators/Herwig7_i/CMakeLists.txt
@@ -42,7 +42,7 @@ endif()
 # ${OPENLOOPS_INCLUDE_DIRS} ${OPENLOOPS_LIBRARIES}
 
 # 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/common/*.py )
 atlas_install_runtime( share/file/*.pdt share/file/*.dat )
 
diff --git a/Generators/Herwig7_i/python/Herwig7Config.py b/Generators/Herwig7_i/python/Herwig7Config.py
index 8f2ed3b366e1762eee2beb8e1976ad345c128241..31255e346973772ef2a7d7a3583156b58307b872 100644
--- a/Generators/Herwig7_i/python/Herwig7Config.py
+++ b/Generators/Herwig7_i/python/Herwig7Config.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ## \file Herwig7Config.py
 ## \brief Python convenience snippets providing re-usable bits of settings for use in the jobOptions
@@ -187,7 +187,7 @@ set /Herwig/Decays/PScalar4f:GenerateIntermediates 0
   ## \param[in] value Value of the strong coupling at the given scale
   def me_alphas_commands(self, order="NLO", scale=91.1876, value=0.118):
 
-    if not order in ["LO", "NLO"]:
+    if order not in ["LO", "NLO"]:
       raise RuntimeError(hw7Utils.ansi_format_error("Parameter 'order' must either be 'LO' or 'NLO'!"))
 
     self.commands += """
@@ -207,7 +207,7 @@ set /Herwig/Model:QCD/RunningAlphaS /Herwig/Couplings/{0}AlphaS
   ## \param[in] max_flav number of massless quark flavours
   def me_pdf_commands(self, order="NLO", name="MMHT2014nlo68cl", member=0, max_flav=5):
 
-    if not order in ["LO", "NLO"]:
+    if order not in ["LO", "NLO"]:
       raise RuntimeError(hw7Utils.ansi_format_error("Parameter 'order' must either be 'LO' or 'NLO'!"))
 
     self.me_pdf_name = name
@@ -233,7 +233,7 @@ set /Herwig/Partons/PPExtractor:SecondPDF /Herwig/Partons/Hard{0}PDF
   ## \param[in] max_flav number of massless quark flavours
   def shower_pdf_commands(self, order="LO", name="MMHT2014lo68cl", member=0, max_flav=5):
 
-    if not order in ["LO", "NLO"]:
+    if order not in ["LO", "NLO"]:
       raise RuntimeError(hw7Utils.ansi_format_error("Parameter 'order' must either be 'LO' or 'NLO'!"))
 
     ## set parton shower PDF name in the Herwig7 C++ class
@@ -298,7 +298,7 @@ set /Herwig/Partons/RemnantPDF:MaxFlav {}
 ## Tune Settings
 ## -------------
 """
-
+    self.commands += cmds
     self.ps_tune_commands(tune_name = ps_tune_name)
     self.ue_tune_commands(tune_name = ue_tune_name)
 
@@ -374,7 +374,7 @@ set /Herwig/Partons/RemnantPDF:MaxFlav {}
       pathNow = path + "/InstallArea/" + cmt_dir + "/share/"
       try:
         fileList = os.listdir(pathNow)
-      except:
+      except Exception:
         fileList = []
       if "HerwigDefaults.rpo" in fileList:
         simSharePath = pathNow
diff --git a/Generators/Herwig7_i/python/Herwig7ConfigBuiltinME.py b/Generators/Herwig7_i/python/Herwig7ConfigBuiltinME.py
index 329d00e36c21f1952c6a212299ab000bf7fd32fb..0cc8bb2dcc05d799d60f8d82bf2dc90a4e72fe30 100644
--- a/Generators/Herwig7_i/python/Herwig7ConfigBuiltinME.py
+++ b/Generators/Herwig7_i/python/Herwig7ConfigBuiltinME.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ## \file Herwig7ConfigBuiltinME.py
 ## \brief Configuration class for built-in / "old-style" matrix elements
@@ -19,7 +19,7 @@ class Hw7ConfigBuiltinME(hw7Config.Hw7Config):
   def __init__(self, genSeq, runArgs, run_name="Herwig", beams="pp"):
 
     beams = beams.upper()
-    if not beams in ["EE", "EP" , "PP"]:
+    if beams not in ["EE", "EP" , "PP"]:
       raise RuntimeError(hw7Utils.ansi_format_error("Parameter 'beams' must be one of the following: ['EE', 'EP' , 'PP']"))
 
     ## provide variables initialized by the parent class
diff --git a/Generators/Herwig7_i/python/Herwig7ConfigFxFx.py b/Generators/Herwig7_i/python/Herwig7ConfigFxFx.py
index c85bf5ffc6b5b4671d5b2732dd77d40266edd38f..273ee2932d6d55bf4ea45f9ce2672a9354ba1b0a 100644
--- a/Generators/Herwig7_i/python/Herwig7ConfigFxFx.py
+++ b/Generators/Herwig7_i/python/Herwig7ConfigFxFx.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ## \file Herwig7ConfigFxFx.py
 ## \brief Configuration class for showering FxFx-merged LHE files from MG5_aMC@NLO
@@ -26,7 +26,7 @@ class Hw7ConfigFxFx(hw7Config.Hw7Config):
   def __init__(self, genSeq, runArgs, run_name="Herwig", beams="pp"):
 
     beams = beams.upper()
-    if not beams in ["EE", "EP" , "PP"]:
+    if beams not in ["EE", "EP" , "PP"]:
       raise RuntimeError(hw7Utils.ansi_format_error("Parameter 'beams' must be one of the following: ['EE', 'EP' , 'PP']"))
 
     # provide variables initialized by the parent class
@@ -117,7 +117,7 @@ saverun {} /Herwig/Generators/EventGenerator
                     ihrd = None,
                     ihvy = None):
 
-    if not me_pdf_order in ["LO", "NLO"]:
+    if me_pdf_order not in ["LO", "NLO"]:
       raise RuntimeError(hw7Utils.ansi_format_error("Herwig7ConfigLHEF.py:__lhef_commands: Parameter 'me_pdf_order' must either be 'LO' or 'NLO'!"))
 
     self.set_fxfx_commands = True
@@ -239,6 +239,6 @@ set /Herwig/Shower/FxFxShowerHandler:PDFB    /Herwig/Partons/Hard{MEPDFOrder}PDF
            MEPDFOrder = me_pdf_order,
            RClus = r_clus,
            EtaClusMax = eta_clus_max,
-           IncludeSpin = "Yes" if usespin==True else "No",
+           IncludeSpin = "Yes" if usespin is True else "No",
            AutomaticProcessDetection = "Automatic" if automatic_process_detection else "Manual",
            ProcessSelection = process_selection)
diff --git a/Generators/Herwig7_i/python/Herwig7ConfigGeneric.py b/Generators/Herwig7_i/python/Herwig7ConfigGeneric.py
index ea7a388cc1dc7b585e334081d38a26a95e176108..a35cd89ebfe1b34d0570aa0a3efee95dca37fa91 100644
--- a/Generators/Herwig7_i/python/Herwig7ConfigGeneric.py
+++ b/Generators/Herwig7_i/python/Herwig7ConfigGeneric.py
@@ -1,10 +1,9 @@
-#! /usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ## \file Herwig7ConfigGeneric.py
 ## \brief Python class for reproducing standalone runs inside of athena
 
 import Herwig7Control as hw7Control
-import Herwig7Utils as hw7Utils
 
 ## Configuration base class for %Herwig7
 class Hw7ConfigGeneric(object):
diff --git a/Generators/Herwig7_i/python/Herwig7ConfigLHEF.py b/Generators/Herwig7_i/python/Herwig7ConfigLHEF.py
index 9fcb055a8bf52092cbafd4fa7deaee48d5fc0324..cd9e20c9e3442b45b383de66c197780ef411a6fe 100644
--- a/Generators/Herwig7_i/python/Herwig7ConfigLHEF.py
+++ b/Generators/Herwig7_i/python/Herwig7ConfigLHEF.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ## \file Herwig7ConfigLHEF.py
 ## \brief Configuration class for showering LHE files from MG5_aMC@NLO or PowhegBox
@@ -61,7 +61,7 @@ class Hw7ConfigLHEF(hw7Config.Hw7Config):
   def __init__(self, genSeq, runArgs, run_name="Herwig", beams="pp"):
 
     beams = beams.upper()
-    if not beams in ["EE", "EP" , "PP"]:
+    if beams not in ["EE", "EP" , "PP"]:
       raise RuntimeError(hw7Utils.ansi_format_error("Parameter 'beams' must be one of the following: ['EE', 'EP' , 'PP']"))
 
     ## provide variables initialized by the parent class
@@ -132,7 +132,7 @@ saverun {} /Herwig/Generators/EventGenerator
   ## \param usespin Use the spin of tau leptons from the LHE file (spins of other particles are ignored anyways)
   def __lhef_commands(self, lhe_filename="events.lhe", me_pdf_order="NLO", usespin=True):
 
-    if not me_pdf_order in ["LO", "NLO"]:
+    if me_pdf_order not in ["LO", "NLO"]:
       raise RuntimeError(hw7Utils.ansi_format_error("Herwig7ConfigLHEF.py:__lhef_commands: Parameter 'me_pdf_order' must either be 'LO' or 'NLO'!"))
 
     if lhe_filename.endswith(".tar.gz"): # athena will decompress the LHE file for us
@@ -198,7 +198,7 @@ set /Herwig/EventHandlers/LHEReader:Cuts /Herwig/Cuts/NoCuts
 {BeamCommands}
 """.format(FileName = lhe_filename,
            Beams = self.beams,
-           IncludeSpin = "Yes" if usespin==True else "No",
+           IncludeSpin = "Yes" if usespin is True else "No",
            MomentumTreatment = momentum_treatment,
            BeamCommands = beam_commands)
 
@@ -224,7 +224,7 @@ set /Herwig/EventHandlers/LHEReader:Cuts /Herwig/Cuts/NoCuts
   ##
   def lhef_mg5amc_commands(self, lhe_filename="events.lhe", me_pdf_order="NLO", usespin=True):
 
-    if not me_pdf_order in ["LO", "NLO"]:
+    if me_pdf_order not in ["LO", "NLO"]:
       raise RuntimeError(hw7Utils.ansi_format_error("Herwig7ConfigLHEF.py:lhef_mg5amc_commands: Parameter 'me_pdf_order' must either be 'LO' or 'NLO'!"))
 
     self.set_lhef_mg5amc_commands = True
@@ -273,7 +273,7 @@ set /Herwig/Shower/ShowerHandler:SpinCorrelations No
   ##
   def lhef_powhegbox_commands(self, lhe_filename="events.lhe", me_pdf_order="NLO", usespin=True):
 
-    if not me_pdf_order in ["LO", "NLO"]:
+    if me_pdf_order not in ["LO", "NLO"]:
       raise RuntimeError(hw7Utils.ansi_format_error("Herwig7ConfigLHEF.py:lhef_powhegbox_commands: Parameter 'me_pdf_order' must either be 'LO' or 'NLO'!"))
 
     self.set_lhef_powhegbox_commands = True
diff --git a/Generators/Herwig7_i/python/Herwig7ConfigMatchbox.py b/Generators/Herwig7_i/python/Herwig7ConfigMatchbox.py
index 518824b5a48db8a12a09a3f28072482616db139d..5a9a04bf82003525c900f49947a0febdc48bdee7 100644
--- a/Generators/Herwig7_i/python/Herwig7ConfigMatchbox.py
+++ b/Generators/Herwig7_i/python/Herwig7ConfigMatchbox.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ## \file Herwig7ConfigMatchbox.py
 ## \brief Configuration class for Matchbox runs with %Herwig7
@@ -214,7 +214,7 @@ class Hw7ConfigMatchbox(hw7Config.Hw7Config):
   def __init__(self, genSeq, runArgs, run_name="Herwig", beams="pp"):
 
     beams = beams.upper()
-    if not beams in ["EE", "EP", "PP"]:
+    if beams not in ["EE", "EP", "PP"]:
       raise RuntimeError(hw7Utils.ansi_format_error("Parameter 'beams' must be one of the following ['EE', 'EP', 'PP']!"))
 
     ## provide variables initialized by the parent class
@@ -233,7 +233,7 @@ class Hw7ConfigMatchbox(hw7Config.Hw7Config):
     # try to locate the GoSam installation
     try:
       GoSam_path = os.environ['GOSAM_PATH']
-    except:
+    except KeyError:
       # \todo Get rid of this and just use the environment variable `GOSAMPATH`
       GoSam_path = '/cvmfs/sft.cern.ch/lcg/releases/LCG_88/MCGenerators/gosam/2.0.4/x86_64-slc6-gcc62-opt'
       os.environ["LD_LIBRARY_PATH"]="/cvmfs/sft.cern.ch/lcg/releases/LCG_88/MCGenerators/gosam/2.0.4/x86_64-slc6-gcc62-opt/lib:"+os.environ["LD_LIBRARY_PATH"]
@@ -243,7 +243,7 @@ class Hw7ConfigMatchbox(hw7Config.Hw7Config):
 
     try:
       OpenLoops_path= os.environ['OPENLOOPS_PATH']
-    except:
+    except KeyError:
       OpenLoops_path = '/cvmfs/sft.cern.ch/lcg/releases/LCG_88/MCGenerators/openloops/2.0.0/x86_64-slc6-gcc62-opt'
       os.environ["LD_LIBRARY_PATH"]="/cvmfs/sft.cern.ch/lcg/releases/LCG_88/MCGenerators/openloops/2.0.0/x86_64-slc6-gcc62-opt/lib:"+os.environ["LD_LIBRARY_PATH"]
       athMsgLog.warn(hw7Utils.ansi_format_warning("Falling back to hard-coded OPENLOOPS installation location at '{}' - please ensure that the OPENLOOPS_PATH environment variable is correctly set".format(OpenLoops_path)))
@@ -397,7 +397,7 @@ saverun {} /Herwig/Generators/EventGenerator
 
     bin_samplers = ["CellGridSampler", "MonacoSampler", "FlatBinSampler"]
 
-    if not bin_sampler in bin_samplers:
+    if bin_sampler not in bin_samplers:
       raise RuntimeError(hw7Utils.ansi_format_error("Parameter 'bin_sampler' must be one of {}!".format(bin_samplers)))
 
     self.commands += """
diff --git a/Generators/Herwig7_i/python/Herwig7ConfigMerging.py b/Generators/Herwig7_i/python/Herwig7ConfigMerging.py
index c45e2f559a79dfd07b623c420794366d5fba35eb..b9484cd118cc6a10a8b3c09b1f6de1fdd47505ef 100644
--- a/Generators/Herwig7_i/python/Herwig7ConfigMerging.py
+++ b/Generators/Herwig7_i/python/Herwig7ConfigMerging.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ## \file Herwig7ConfigMatchbox.py
 ## \brief Configuration class for Matchbox runs with %Herwig7
@@ -214,7 +214,7 @@ class Hw7ConfigMerging(hw7Config.Hw7Config):
   def __init__(self, genSeq, runArgs, run_name="Herwig", beams="pp"):
 
     beams = beams.upper()
-    if not beams in ["EE", "EP", "PP"]:
+    if beams not in ["EE", "EP", "PP"]:
       raise RuntimeError(hw7Utils.ansi_format_error("Parameter 'beams' must be one of the following ['EE', 'EP', 'PP']!"))
 
     ## provide variables initialized by the parent class
@@ -233,7 +233,7 @@ class Hw7ConfigMerging(hw7Config.Hw7Config):
     # try to locate the GoSam installation
     try:
       GoSam_path = os.environ['GOSAM_PATH']
-    except:
+    except KeyError:
       # \todo Get rid of this and just use the environment variable `GOSAMPATH`
       GoSam_path = '/cvmfs/sft.cern.ch/lcg/releases/LCG_88/MCGenerators/gosam/2.0.4/x86_64-slc6-gcc62-opt'
       os.environ["LD_LIBRARY_PATH"]="/cvmfs/sft.cern.ch/lcg/releases/LCG_88/MCGenerators/gosam/2.0.4/x86_64-slc6-gcc62-opt/lib:"+os.environ["LD_LIBRARY_PATH"]
@@ -243,7 +243,7 @@ class Hw7ConfigMerging(hw7Config.Hw7Config):
 
     try:
       OpenLoops_path= os.environ['OPENLOOPS_PATH']
-    except:
+    except KeyError:
       OpenLoops_path = '/cvmfs/sft.cern.ch/lcg/releases/LCG_88/MCGenerators/openloops/2.0.0/x86_64-slc6-gcc62-opt'
       os.environ["LD_LIBRARY_PATH"]="/cvmfs/sft.cern.ch/lcg/releases/LCG_88/MCGenerators/openloops/2.0.0/x86_64-slc6-gcc62-opt/lib:"+os.environ["LD_LIBRARY_PATH"]
       athMsgLog.warn(hw7Utils.ansi_format_warning("Falling back to hard-coded OPENLOOPS installation location at '{}' - please ensure that the OPENLOOPS_PATH environment variable is correctly set".format(OpenLoops_path)))
@@ -402,7 +402,7 @@ saverun {} /Herwig/Generators/EventGenerator
 
     bin_samplers = ["CellGridSampler", "MonacoSampler", "FlatBinSampler"]
 
-    if not bin_sampler in bin_samplers:
+    if bin_sampler not in bin_samplers:
       raise RuntimeError(hw7Utils.ansi_format_error("Parameter 'bin_sampler' must be one of {}!".format(bin_samplers)))
 
     self.commands += """
@@ -424,7 +424,7 @@ set /Herwig/Samplers/CellGridSampler:ExplorationPoints {}
 read snippets/MonacoSampler.in"""
 
   def merging_weight(self, htPower=0, maxPtPower=0, onlyColoured="No"):
-    if not onlyColoured in ["Yes","No"]:
+    if onlyColoured not in ["Yes","No"]:
       raise RuntimeError(hw7Utils.ansi_format_error("OnlyColoured must be Yes or No"))
 
     self.commands+="""
diff --git a/Generators/Herwig7_i/python/Herwig7Control.py b/Generators/Herwig7_i/python/Herwig7Control.py
index ccf5588af6bfdd9b80d2fa1ba1f7ba8b94a61a56..92220aa01fc77cc02bf7de236d33cc2bd50afe97 100644
--- a/Generators/Herwig7_i/python/Herwig7Control.py
+++ b/Generators/Herwig7_i/python/Herwig7Control.py
@@ -1,3 +1,4 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 ## \file Herwig7Control.py
 ## \brief Main python interface for %Herwig7 for preparing the event generation
 ## \author Daniel Rauch (daniel.rauch@desy.de)
@@ -10,10 +11,9 @@
 ## The event generation itself starting from reading the runfile is handled
 ## in Herwig7_i/Herwig7.h and src/Herwig7.cxx.
 
-import datetime, os, shutil, subprocess, sys, time
+import os, shutil, subprocess, sys
 import six
 
-from . import Herwig7Config as hw7Config
 from . import Herwig7Utils as hw7Utils
 # import Herwig7Defaults as HwDefaults
 
@@ -36,7 +36,7 @@ def get_share_path():
     path = os.path.join(path, "InstallArea", cmt_config, "share")
     try:
       filelist = os.listdir(path)
-    except:
+    except Exception:
       filelist = []
     if "HerwigDefaults.rpo" in filelist: return(path)
 
@@ -88,8 +88,6 @@ def matchbox_run(gen_config, integration_jobs, cleanup_herwig_scratch):
 ## \param[in] cleanup_herwig_scratch Remove `Herwig-scratch` folder after event generation to save disk space
 def matchbox_run_gridpack(gen_config, integration_jobs, gridpack_name, cleanup_herwig_scratch):
 
-  print_integration_logs = True
-
   gridpack_exists = hasattr(gen_config.runArgs, 'inputGenConfFile')
 
   ## print start banner including version numbers
@@ -132,11 +130,11 @@ def do_step(step, command, logfile_name=None):
     raise RuntimeError(hw7Utils.ansi_format_error("Some error occured during the '{}' step.".format(step)))
 
   if logfile:
-    athMsgLog.info("Content of {} log file '{}':".format(step, logfile_name))
+    athMsgLog.info("Content of %s log file '%s':", step, logfile_name)
     athMsgLog.info("")
     with open(logfile_name, 'r') as logfile:
       for line in logfile:
-        athMsgLog.info('  {}'.format(line.rstrip('\n')))
+        athMsgLog.info('  %s', line.rstrip('\n'))
     athMsgLog.info("")
 
 
@@ -261,7 +259,7 @@ def do_compress_gridpack(run_name, gridpack_name):
 
 def do_uncompress_gridpack(gridpack_name):
 
-  athMsgLog.info("unpacking gridpack '{}'".format(gridpack_name))
+  athMsgLog.info("unpacking gridpack '%s'", gridpack_name)
   do_step('uncompress', ['tar', 'xzf', gridpack_name])
 
 
@@ -401,13 +399,13 @@ def write_infile(gen_config, print_infile=True):
     with open(infile_name, 'w') as infile:
         for command in commands:
           infile.write(command+'\n')
-  except:
+  except Exception:
     raise RuntimeError('Could not write Herwig/Matchbox infile')
 
   if print_infile:
     athMsgLog.info("")
     for command in commands:
-      athMsgLog.info('  {}'.format(command))
+      athMsgLog.info('  %s', command)
     athMsgLog.info("")
 
 
@@ -417,16 +415,16 @@ def write_setupfile(run_name, commands, print_setupfile=True):
 
   if len(commands) > 0:
     if print_setupfile: athMsgLog.info("")
-    athMsgLog.info("Writing setupfile '{}'".format(setupfile_name))
+    athMsgLog.info("Writing setupfile '%s'", setupfile_name)
     try:
       with open(setupfile_name, 'w') as setupfile:
           for command in commands: setupfile.write(command+'\n')
-    except:
+    except Exception:
       raise RuntimeError('Could not write Herwig/Matchbox setupfile')
 
     if print_setupfile:
       athMsgLog.info("")
-      for command in commands: athMsgLog.info('  {}'.format(command))
+      for command in commands: athMsgLog.info('  %s', command)
       athMsgLog.info("")
 
   else:
diff --git a/Generators/Herwig7_i/python/Herwig7Utils.py b/Generators/Herwig7_i/python/Herwig7Utils.py
index 37fa0849200080b92d868191c598891a32e257a1..6fd0e1ed21beaf65d3e12611f3da7bb87824ace4 100644
--- a/Generators/Herwig7_i/python/Herwig7Utils.py
+++ b/Generators/Herwig7_i/python/Herwig7Utils.py
@@ -1,10 +1,10 @@
-#! /usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ## \file Herwig7Utils.py
 ## \brief Module with helper functions and classes
 ## \author Daniel Rauch (daniel.rauch@desy.de)
 
-import math, os, subprocess, time
+import math, os, subprocess
 
 from AthenaCommon import Logging
 athMsgLog = Logging.logging.getLogger('Herwig7Utils')
@@ -30,7 +30,7 @@ class ConfigurationCommands:
     self.locked = True
   
   def add(self, commands):
-    if self.locked == False:
+    if self.locked is False:
       self.commands += commands
     else:
       raise RuntimeError("The commands associated to this configuration object can't be modified anymore because the Herwig7 infile has already been written to disk. Therefore, any subsequent additional modifications can't be adopted in the Herwig7 run.")
@@ -55,7 +55,7 @@ class ProcessHandler:
     while len(self.processes) > 0:
       for ID, process in enumerate(self.processes):
         returncode = process.poll()
-        if not returncode is None:
+        if returncode is not None:
 
           ## print exit status and number of pending process
           self.processes.remove(process)
@@ -72,11 +72,11 @@ class ProcessHandler:
           # self.logger.info('================================================================================')
           # self.logger.info("Including content of integration log file '{}'".format(process.logfile_title))
           # self.logger.info('================================================================================')
-          athMsgLog.info("Content of integration log file '{}':".format(process.logfile_title))
+          athMsgLog.info("Content of integration log file '%s':", process.logfile_title)
           athMsgLog.info("")
           with open(process.logfile_title, 'r') as logfile:
             for line in logfile:
-              athMsgLog.info('  {}'.format(line.rstrip('\n')))
+              athMsgLog.info('  %s', line.rstrip('\n'))
           athMsgLog.info("")
           # self.logger.info('================================================================================')
           # self.logger.info("End of integration log file '{}'".format(process.logfile_title))
@@ -114,7 +114,7 @@ def get_cross_section(run_name, integration_jobs=1):
 
   for logfile in logfiles:
 
-    athMsgLog.info("- {}".format(logfile))
+    athMsgLog.info("- %s", logfile)
 
     ## entire file content
     with open(logfile, 'r') as log: data = log.read().strip()
@@ -125,7 +125,7 @@ def get_cross_section(run_name, integration_jobs=1):
       for line in log:
         if 'Integrate ' in line:
           n_subprocs = int(line.split('of')[1].replace(':',''))
-          athMsgLog.info("  found {} subprocesses".format(n_subprocs))
+          athMsgLog.info("  found %s subprocesses", n_subprocs)
           break
 
     data = data.split("Integrate ")[1:]
@@ -137,7 +137,7 @@ def get_cross_section(run_name, integration_jobs=1):
         if 'integrated ( ' in line:
           _xsec = float(line.split()[2])
           _err = float(line.split()[4])
-      athMsgLog.info("  - subprocess {}: xsec = {} +/- {} nb".format(s, _xsec, _err))
+      athMsgLog.info("  - subprocess %s: xsec = %s +/- %s nb", s, _xsec, _err)
       xsec += _xsec
       err  += _err*_err
 
diff --git a/Generators/Herwig7_i/python/config.py b/Generators/Herwig7_i/python/config.py
index 685404255741115345a191cbc13382a9b901b405..f6074476c7c940f9722fb0c74a56a5a29d2063b3 100644
--- a/Generators/Herwig7_i/python/config.py
+++ b/Generators/Herwig7_i/python/config.py
@@ -5,8 +5,6 @@
 ## \author Daniel Rauch (daniel.rauch@desy.de)
 ##
 
-from __future__ import print_function
-
 ## Choose symmetric collider energy
 def energy_cmds(sqrts):
     "Set sqrts(s) in GeV"
@@ -316,7 +314,7 @@ set /Herwig/EventHandlers/LHEReader:Cuts /Herwig/Cuts/NoCuts
 ##
 def mg5amc_cmds():
     return """
-## commands specific to showering of events produced with MG5_aMC\@NLO
+## commands specific to showering of events produced with MG5_aMC\\@NLO
 set /Herwig/Shower/KinematicsReconstructor:ReconstructionOption General
 set /Herwig/Shower/KinematicsReconstructor:InitialInitialBoostOption LongTransBoost
 set /Herwig/Shower/KinematicsReconstructor:InitialStateReconOption Rapidity
@@ -405,24 +403,24 @@ set /Herwig/Model:EW/Sin2ThetaW 0.23113
 
 
 def get_dpdf_path():
-	import os
-	cmt_path = os.environ.get("CMTPATH")
-	cmt_dir = os.environ.get("CMTCONFIG")
-	
-	cmtPaths = cmt_path.split(':')
-	
-	for path in cmtPaths:
-		pathNow = path + "/InstallArea/" + cmt_dir + "/share/"
-		try:
-			fileList = os.listdir(pathNow)
-		except:
-			fileList = []
-		if "HerwigDefaults.rpo" in fileList:
-			simSharePath = pathNow
-
-	dpdf_path = os.path.dirname(os.path.normpath(os.path.join(simSharePath, os.readlink(simSharePath + 'HerwigDefaults.rpo')))) + "/PDF/diffraction/"
-	
-	return dpdf_path
+        import os
+        cmt_path = os.environ.get("CMTPATH")
+        cmt_dir = os.environ.get("CMTCONFIG")
+
+        cmtPaths = cmt_path.split(':')
+
+        for path in cmtPaths:
+                pathNow = path + "/InstallArea/" + cmt_dir + "/share/"
+                try:
+                        fileList = os.listdir(pathNow)
+                except Exception:
+                        fileList = []
+                if "HerwigDefaults.rpo" in fileList:
+                        simSharePath = pathNow
+
+        dpdf_path = os.path.dirname(os.path.normpath(os.path.join(simSharePath, os.readlink(simSharePath + 'HerwigDefaults.rpo')))) + "/PDF/diffraction/"
+
+        return dpdf_path
 
 ## Set pomeron structure function
 def pdf_pomeron_cmds(flux, pdf):
diff --git a/Generators/ParticleGun/CMakeLists.txt b/Generators/ParticleGun/CMakeLists.txt
index 5e530ece9193887f71fe40dc0d748d4814273859..b503f5b4131d76f8e8e0fd5861cd28a86364c549 100644
--- a/Generators/ParticleGun/CMakeLists.txt
+++ b/Generators/ParticleGun/CMakeLists.txt
@@ -6,5 +6,5 @@
 atlas_subdir( ParticleGun )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 
diff --git a/Generators/ParticleGun/python/__init__.py b/Generators/ParticleGun/python/__init__.py
index c03c4fc7c032984a448cb4c6d9e0810eebe413a1..bb1155eb91409995cd5ed0323d536206ceb32d12 100644
--- a/Generators/ParticleGun/python/__init__.py
+++ b/Generators/ParticleGun/python/__init__.py
@@ -1,10 +1,11 @@
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaCommon.AppMgr import ServiceMgr as svcMgr
 from GeneratorModules.EvgenAlg import EvgenAlg
-from ParticleGun.samplers import *
-from ParticleGun.histsampling import TH1, TH2
+from ParticleGun.samplers import ParticleSampler
 from AthenaPython.PyAthena import StatusCode
+import ROOT
+import random
 
 __author__ = "Andy Buckley <andy.buckley@cern.ch>"
 
@@ -35,7 +36,7 @@ class ParticleGun(EvgenAlg):
         """
         Pass the AtRndmGenSvc seed to Python's random module, or use a fixed value set via pg.randomSeed.
         """
-        import McParticleEvent.Pythonizations
+        import McParticleEvent.Pythonizations  # noqa: F401
         seed = None
         ## Use self.randomSeed directly, or if it's None find a seed string from the ATLAS random number service
         if self.randomSeed is not None:
@@ -46,18 +47,18 @@ class ParticleGun(EvgenAlg):
                 for seedstr in randomSvc.Seeds:
                     if seedstr.startswith(self.randomStream):
                         seed = seedstr
-                        self.msg.info("ParticleGun: Using random seed '%s'" % seed)
+                        self.msg.info("ParticleGun: Using random seed '%s'", seed)
                         break
                 if seed is None:
-                    self.msg.warning("ParticleGun: Failed to find a seed for the random stream named '%s'" % self.randomStream)
+                    self.msg.warning("ParticleGun: Failed to find a seed for the random stream named '%s'", self.randomStream)
             else:
-                self.msg.warning("ParticleGun: Failed to find random number service called '%s'" % self.randomSvcName)
+                self.msg.warning("ParticleGun: Failed to find random number service called '%s'", self.randomSvcName)
         ## Apply the seed
         if seed is not None:
             random.seed(seed)
             return StatusCode.Success
         else:
-            self.msg.error("ParticleGun: randomSeed property not set, and no %s random number service found" % self.randomSvcName)
+            self.msg.error("ParticleGun: randomSeed property not set, and no %s random number service found", self.randomSvcName)
             return StatusCode.Failure
 
 
diff --git a/Generators/ParticleGun/python/histsampling.py b/Generators/ParticleGun/python/histsampling.py
index 6d97ca2a92944b9bf02962b8a995e0f103a42316..1d0e155d91a1ef81d0c467cbccc444f6d5f978e1 100644
--- a/Generators/ParticleGun/python/histsampling.py
+++ b/Generators/ParticleGun/python/histsampling.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 """
 Tools for histogram sampling, in particular inverse transform sampling which is
@@ -19,9 +19,9 @@ def load_hist(*args):
     if len(args) == 1 and issubclass(type(args[0]), ROOT.TH1):
         h = args[0].Clone()
     elif len(args) == 2:
-        if type(args[0]) is type(args[1]) is str:
+        if isinstance(args[0], str) and isinstance(args[1], str):
             f = ROOT.TFile.Open(args[0])
-            htmp = f.Get(args[1])
+            htmp = f.Get(args[1])   # noqa: F841
             h = f.Get(args[1]).Clone()
             #f.Close()
         elif type(args[0]) is ROOT.TFile and type(args[1]) is str:
@@ -42,14 +42,14 @@ def get_sampling_vars(h):
     globalbins = [] # because they aren't easily predicted, nor contiguous
     cheights = [0] # cumulative "histogram" from which to uniformly sample
     if issubclass(type(h), ROOT.TH1):
-        for ix in xrange(1, h.GetNbinsX()+1):
+        for ix in range(1, h.GetNbinsX()+1):
             iglobal = h.GetBin(ix)
             globalbins.append(iglobal)
             globalbin_to_axisbin[iglobal] = (ix,)
             cheights.append(cheights[-1] + h.GetBinContent(iglobal))
     elif issubclass(type(h), ROOT.TH2):
-        for ix in xrange(1, h.GetNbinsX()+1):
-            for iy in xrange(1, h.GetNbinsY()+1):
+        for ix in range(1, h.GetNbinsX()+1):
+            for iy in range(1, h.GetNbinsY()+1):
                 iglobal = h.GetBin(ix, iy)
                 globalbins.append(iglobal)
                 globalbin_to_axisbin[iglobal] = (ix, iy)
@@ -66,7 +66,6 @@ def get_random_bin(globalbins, cheights):
     """
     assert len(cheights) == len(globalbins)+1
     randomheight = random.uniform(0, cheights[-1])
-    randombin = None
     for i, iglobal in enumerate(globalbins):
         if randomheight >= cheights[i] and randomheight < cheights[i+1]:
             return iglobal
diff --git a/Generators/ParticleGun/python/samplers.py b/Generators/ParticleGun/python/samplers.py
index c706a9a4a61d71c31cbb713c79e3b3b09b19fa64..982be4fc4e0b1235fbc8f82d7ebf47a21f78cd8d 100644
--- a/Generators/ParticleGun/python/samplers.py
+++ b/Generators/ParticleGun/python/samplers.py
@@ -1,8 +1,7 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from AthenaPython import PyAthena
 import ROOT, math, random
-from ParticleGun.histsampling import TH1, TH2
+from ParticleGun.histsampling import TH1
 
 ## For convenience
 PI = math.pi
@@ -487,7 +486,7 @@ class EEtaMPhiSampler(MomSampler):
         => theta = 2 atan( exp(-eta) )
         """
         eta = self.eta()
-        theta = 2 * math.atan(math.exp(-eta));
+        theta = 2 * math.atan(math.exp(-eta))
         e = self.energy()
         m = self.mass()
         p = math.sqrt( e**2 - m**2 )
@@ -505,7 +504,7 @@ class ERapMPhiSampler(MomSampler):
 
     # TODO: ensure that E >= m!
 
-    def __init__(self, energy, eta, mass=0.0, phi=[0, TWOPI]):
+    def __init__(self, energy, rap, mass=0.0, phi=[0, TWOPI]):
         self.energy = energy
         self.rap = rap
         self.mass = mass
@@ -559,8 +558,8 @@ class ERapMPhiSampler(MomSampler):
         m = self.mass()
         pt = math.sqrt( sqrt_pt2_m2**2 - m**2 )
         phi = self.phi()
-        px = pt * math.cos(phi);
-        py = pt * math.sin(phi);
+        px = pt * math.cos(phi)
+        py = pt * math.sin(phi)
         v4 = ROOT.TLorentzVector(px, py, pz, e)
         return v4
 
@@ -674,7 +673,7 @@ class PtEtaMPhiSampler(MomSampler):
         => theta = 2 atan( exp(-eta) )
         """
         eta = self.eta()
-        theta = 2 * math.atan(math.exp(-eta));
+        theta = 2 * math.atan(math.exp(-eta))
         pt = self.pt()
         p = pt / math.sin(theta)
         phi = self.phi()
@@ -746,8 +745,8 @@ class PtRapMPhiSampler(MomSampler):
         e = sqrt_pt2_m2 * math.cosh(y)
         pz = sqrt_pt2_m2 * math.sinh(y)
         phi = self.phi()
-        px = pt * math.cos(phi);
-        py = pt * math.sin(phi);
+        px = pt * math.cos(phi)
+        py = pt * math.sin(phi)
         v4 = ROOT.TLorentzVector(px, py, pz, e)
         return v4
 
diff --git a/Generators/PowhegControl/CMakeLists.txt b/Generators/PowhegControl/CMakeLists.txt
index 0faa78f91d673fbdf5dfce5fb9104736f995fb62..acd11a3a269888fba47d6072f63e4dc5c7785e50 100644
--- a/Generators/PowhegControl/CMakeLists.txt
+++ b/Generators/PowhegControl/CMakeLists.txt
@@ -1,6 +1,4 @@
-################################################################################
-# Package: PowhegControl
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( PowhegControl )
@@ -8,7 +6,8 @@ atlas_subdir( PowhegControl )
 # Install files from the package:
 atlas_install_python_modules( python/*.py
    python/algorithms python/decorators python/parameters
-   python/processes python/utility )
+   python/processes python/utility
+   POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_joboptions( share/common/*.py share/control/*.py )
 
 # Set up the runtime environment for Powheg.
diff --git a/Generators/PowhegControl/python/DecoratorFactory.py b/Generators/PowhegControl/python/DecoratorFactory.py
index 958a3304493d7e47e2e8b280a25b2dcf41ff0cfb..a6404931177bc080eb0b62c83dd41325282d71cc 100644
--- a/Generators/PowhegControl/python/DecoratorFactory.py
+++ b/Generators/PowhegControl/python/DecoratorFactory.py
@@ -5,7 +5,8 @@
 #
 #  Authors: James Robinson  <james.robinson@cern.ch>
 
-#! /usr/bin/env python
+# flake8: noqa (too many * imports)
+
 from .decorators import *
 
 def decorate( powheg_controller, decorator, **kwargs ) :
diff --git a/Generators/PowhegControl/python/PowhegConfig_base.py b/Generators/PowhegControl/python/PowhegConfig_base.py
index 1f9a0c895003dc2a108ad21b57f7e5ed3a9cc93e..90546ea1854da22baa8a689e2da7a78721da9e93 100644
--- a/Generators/PowhegControl/python/PowhegConfig_base.py
+++ b/Generators/PowhegControl/python/PowhegConfig_base.py
@@ -7,7 +7,6 @@
 #           Daniel Hayden   <danhayden0@googlemail.com>
 #           Stephen Bieniek <stephen.paul.bieniek@cern.ch>
 
-#! /usr/bin/env python
 import glob, os, subprocess, time
 from . import strategies
 from AthenaCommon import Logging
@@ -62,7 +61,7 @@ class PowhegConfig_base(object) :
     self.add_parameter_set( 'base' )
 
     # Initialise values from runArgs
-    if runArgs == None :
+    if runArgs is None :
       self.logger.warning( 'No run arguments found! Using defaults.' )
     else :
       # Read values from runArgs
@@ -299,7 +298,7 @@ class PowhegConfig_base(object) :
     parameter_names, parameter_values = [], []
     for parameter, ( name, desc ) in self.configurable_parameters.items() :
       if isinstance( getattr(self,name), list ) :
-        if not name in [ 'PDF', 'mu_R', 'mu_F' ] : # these are treated separately
+        if name not in [ 'PDF', 'mu_R', 'mu_F' ] : # these are treated separately
           assert( len(weight_names) == len(getattr(self,name)) ), 'Number of parameter variations must be the same as the number of names provided'
           parameter_names.append( parameter )
           parameter_values.append( getattr(self,name) )
diff --git a/Generators/PowhegControl/python/__init__.py b/Generators/PowhegControl/python/__init__.py
index bd6fa95714e2e816c8cd997a7522d3307141defa..06aebdb2bff753bb8c73ba2c3b28b1cf95df8f8d 100644
--- a/Generators/PowhegControl/python/__init__.py
+++ b/Generators/PowhegControl/python/__init__.py
@@ -1,5 +1,5 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-
+# flake8: noqa
 from .PowhegConfig_base import *
 from .decorators import *
 from .processes import *
diff --git a/Generators/PowhegControl/python/decorators/BaseDecorator.py b/Generators/PowhegControl/python/decorators/BaseDecorator.py
index 688ae7a27e094a1eddb2259029b861d271493c4d..69c66183302e9c123d1566393cadf74d21202101 100644
--- a/Generators/PowhegControl/python/decorators/BaseDecorator.py
+++ b/Generators/PowhegControl/python/decorators/BaseDecorator.py
@@ -1,13 +1,10 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ## @PowhegControl BaseDecorator
 #  Powheg runcard decorator for universal functionality
 #
 #  Authors: James Robinson  <james.robinson@cern.ch>
 
-#! /usr/bin/env python
-from .. import ATLASCommonParameters
-
 class BaseDecorator(object) :
 
   ## Define decorator name string
diff --git a/Generators/PowhegControl/python/decorators/__init__.py b/Generators/PowhegControl/python/decorators/__init__.py
index de628eb3c0ffc6abcd2de6866297bfaac80343ac..bf1ea49032d860e8f5b328cd0f9c98a606ac7540 100644
--- a/Generators/PowhegControl/python/decorators/__init__.py
+++ b/Generators/PowhegControl/python/decorators/__init__.py
@@ -1,5 +1,5 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-
+# flake8: noqa
 from .AnomalousCouplingDecorator import *
 from .BaseDecorator import *
 from .CKKWDecorator import *
diff --git a/Generators/PowhegControl/python/processes/PowhegConfig_Wt_DR.py b/Generators/PowhegControl/python/processes/PowhegConfig_Wt_DR.py
index 93bedcf0e193f7a9e6225699b54f036ecbde4452..979835de5b6220a0e133b1cdd4a0b709b0a31ead 100644
--- a/Generators/PowhegControl/python/processes/PowhegConfig_Wt_DR.py
+++ b/Generators/PowhegControl/python/processes/PowhegConfig_Wt_DR.py
@@ -1,13 +1,11 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ## @PowhegControl PowhegConfig_Wt_DR
 #  Powheg configuration for Wt_DR subprocess
 #
 #  Authors: James Robinson  <james.robinson@cern.ch>
 
-#! /usr/bin/env python
 from ..PowhegConfig_base import PowhegConfig_base
-from .. import ATLASCommonParameters
 
 ## Default Powheg configuration for Wt_DR generation
 #
diff --git a/Generators/PowhegControl/python/processes/PowhegConfig_Wt_DS.py b/Generators/PowhegControl/python/processes/PowhegConfig_Wt_DS.py
index 3ecb6e0360aaaa6f66bf1c63e17172752beeea8f..b6b9735619e40cbf9e7b6d83bc2a02a8ed8c69e9 100644
--- a/Generators/PowhegControl/python/processes/PowhegConfig_Wt_DS.py
+++ b/Generators/PowhegControl/python/processes/PowhegConfig_Wt_DS.py
@@ -5,9 +5,7 @@
 #
 #  Authors: James Robinson  <james.robinson@cern.ch>
 
-#! /usr/bin/env python
 from ..PowhegConfig_base import PowhegConfig_base
-from .. import ATLASCommonParameters
 
 ## Default Powheg configuration for Wt_DS generation
 #
diff --git a/Generators/PowhegControl/python/processes/PowhegConfig_t_sch.py b/Generators/PowhegControl/python/processes/PowhegConfig_t_sch.py
index 75c00f0fca1526357444618db021e48e2605d588..7eced388c8f77bdaebbd4cbcd25df32da22b3531 100644
--- a/Generators/PowhegControl/python/processes/PowhegConfig_t_sch.py
+++ b/Generators/PowhegControl/python/processes/PowhegConfig_t_sch.py
@@ -1,13 +1,11 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ## @PowhegControl PowhegConfig_t_sch
 #  Powheg configuration for t_sch subprocess
 #
 #  Authors: James Robinson  <james.robinson@cern.ch>
 
-#! /usr/bin/env python
 from ..PowhegConfig_base import PowhegConfig_base
-from .. import ATLASCommonParameters
 
 ## Default Powheg configuration for t_sch generation
 #
diff --git a/Generators/PowhegControl/python/processes/PowhegConfig_ttH.py b/Generators/PowhegControl/python/processes/PowhegConfig_ttH.py
index 26802bea1121922d8594887bcf3b489ac67f640d..0456fc6f950118f5681dee5404b45c71e06cd539 100644
--- a/Generators/PowhegControl/python/processes/PowhegConfig_ttH.py
+++ b/Generators/PowhegControl/python/processes/PowhegConfig_ttH.py
@@ -1,13 +1,11 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ## @PowhegControl PowhegConfig_ttH
 #  Powheg configuration for ttH subprocess
 #
 #  Authors: James Robinson  <james.robinson@cern.ch>
 
-#! /usr/bin/env python
 from ..PowhegConfig_base import PowhegConfig_base
-from .. import ATLASCommonParameters
 
 ## Default Powheg configuration for ttH generation
 #
diff --git a/Generators/PowhegControl/python/processes/__init__.py b/Generators/PowhegControl/python/processes/__init__.py
index f8e165239568e88ffab72e6cede8a14ea501cd3f..4a97be8484eb63ccaecfeb62c158a732a04364c5 100644
--- a/Generators/PowhegControl/python/processes/__init__.py
+++ b/Generators/PowhegControl/python/processes/__init__.py
@@ -1,5 +1,5 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-
+# flake8: noqa
 from .PowhegConfig_bb import *
 from .PowhegConfig_DMS_tloop import *
 from .PowhegConfig_DMV import *
diff --git a/Generators/PowhegControl/python/utility/IntegrationGridTester.py b/Generators/PowhegControl/python/utility/IntegrationGridTester.py
index 2ab436ef83d1873982c2951b6edfb3f5876da02f..0da5ae396c2fbb30cd58f4a8e1dbec9ca8a41183 100644
--- a/Generators/PowhegControl/python/utility/IntegrationGridTester.py
+++ b/Generators/PowhegControl/python/utility/IntegrationGridTester.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 ## @PowhegControl IntegrationGridTester
 #  Helper class to calculate and output integration grid quality
@@ -39,7 +39,7 @@ class IntegrationGridTester(object):
               inclusive_xs_values = map( float, re.findall( cls.__re_match_floats, matched_lines[0] ) )
               inclusive_xs += inclusive_xs_values[0]
               inclusive_xs_error += inclusive_xs_values[1]
-          except : # catch all exceptions
+          except Exception: # catch all exceptions
             pass
         # Negative weight test
         with open( file_name, 'rb' ) as data_file :
@@ -48,7 +48,7 @@ class IntegrationGridTester(object):
             if len(matched_lines) > 0 :
               negative_weights += map( float, re.findall( cls.__re_match_floats, [line for line in matched_lines if 'btilde |neg.|' in line][0] ) )[0]
               total_weights += map( float, re.findall( cls.__re_match_floats, [line for line in matched_lines if 'btilde Total' in line][0] ) )[0]
-          except : # catch all exceptions
+          except Exception: # catch all exceptions
             pass
 
     for file_name in glob.glob( 'pwgcounters*.dat' ) :
@@ -60,21 +60,21 @@ class IntegrationGridTester(object):
             if len(matched_lines) > 0 :
               n_events += map( float, re.findall( cls.__re_match_floats, [line for line in matched_lines if 'event' in line][0] ) )[0]
               n_upper_bound_failures += sum( map( float, sum( [ re.findall( cls.__re_match_floats, line ) for line in matched_lines if 'upper bound failure' in line ], [] ) ) )
-          except : # catch all exceptions
+          except Exception: # catch all exceptions
             pass
 
     # Calculate test statistics
     try :
       inclusive_xs_test = 100 * inclusive_xs_error / inclusive_xs
-    except : # catch all exceptions
+    except Exception: # catch all exceptions
       inclusive_xs_test = float('nan')
     try :
       negative_weight_test = 100 * negative_weights / total_weights
-    except : # catch all exceptions
+    except Exception: # catch all exceptions
       negative_weight_test = float('nan')
     try :
       upper_bound_test = 100 * n_upper_bound_failures / n_events
-    except : # catch all exceptions
+    except Exception: # catch all exceptions
       upper_bound_test = float('nan')
 
     # Write output
@@ -82,5 +82,5 @@ class IntegrationGridTester(object):
       getattr( logger, ['warning','info'][0.0 <= inclusive_xs_test < 1.0] )( 'Integration test :: {0:>25} : {1:.2f}%'.format('cross-section uncertainty', inclusive_xs_test) )
       getattr( logger, ['warning','info'][0.0 <= negative_weight_test < 1.0] )( 'Integration test :: {0:>25} : {1:.2f}%'.format('negative weight fraction', negative_weight_test) )
       getattr( logger, ['warning','info'][0.0 <= upper_bound_test < 1.0] )( 'Integration test :: {0:>25} : {1:.2f}%'.format('upper bound violations', upper_bound_test) )
-    except : # catch all exceptions
+    except Exception: # catch all exceptions
       pass
diff --git a/Generators/PowhegControl/python/utility/ProcessHandling.py b/Generators/PowhegControl/python/utility/ProcessHandling.py
index 74030929da7028e6c415b0b959ea929ca3216e0b..1a92f2be379fb21de3201e73f1425f5b7b431671 100644
--- a/Generators/PowhegControl/python/utility/ProcessHandling.py
+++ b/Generators/PowhegControl/python/utility/ProcessHandling.py
@@ -5,9 +5,7 @@
 #
 #  Authors: James Robinson  <james.robinson@cern.ch>
 
-#! /usr/bin/env python
 import subprocess
-import time
 from .NonBlockingStreamReader import NonBlockingStreamReader
 
 ## A wrapper to handle multiple Powheg subprocesses
diff --git a/Generators/PowhegControl/python/utility/__init__.py b/Generators/PowhegControl/python/utility/__init__.py
index 9c2314160216d40a29bb5262ef14ea07e80b6246..09d2c51a46843cb14504b127a93df38c4e1ef722 100644
--- a/Generators/PowhegControl/python/utility/__init__.py
+++ b/Generators/PowhegControl/python/utility/__init__.py
@@ -1,5 +1,5 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-
+# flake8: noqa
 from .FileParser import *
 from .IntegrationGridTester import *
 from .LHEHandler import *
diff --git a/Generators/Prophecy4fControl/CMakeLists.txt b/Generators/Prophecy4fControl/CMakeLists.txt
index ab8154addd443fa8d004b34ab714d52c33f85723..62d883c17120ce31ac0b2e016d211e00f90833cf 100644
--- a/Generators/Prophecy4fControl/CMakeLists.txt
+++ b/Generators/Prophecy4fControl/CMakeLists.txt
@@ -15,6 +15,6 @@ atlas_add_executable( DRM
                       LINK_LIBRARIES ${ROOT_LIBRARIES} )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py python/decorators )
+atlas_install_python_modules( python/*.py python/decorators POST_BUILD_CMD ${ATLAS_FLAKE8} )
 atlas_install_joboptions( share/*.py )
 
diff --git a/Generators/Prophecy4fControl/python/DecoratorFactory.py b/Generators/Prophecy4fControl/python/DecoratorFactory.py
index 60b329bf5a8ea30e51bc0d107b77a04491b9140b..998d37b19c18a6b5ae14f97bec71133014579f01 100644
--- a/Generators/Prophecy4fControl/python/DecoratorFactory.py
+++ b/Generators/Prophecy4fControl/python/DecoratorFactory.py
@@ -1,6 +1,6 @@
-#! /usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from decorators import *
+from decorators import DecoratorFromDefault, DecoratorFromPowheg
 
 def decorate( prophecy_controller, decorator, **kwargs ) :
   ## Initialise correct decorator for Prophecy configurable
diff --git a/Generators/Prophecy4fControl/python/ProphecyConfig.py b/Generators/Prophecy4fControl/python/ProphecyConfig.py
index 6f7cbedd16d6969b8fef094a352a803820e79e8a..40682d29ae01e1aa46f80a86f816ec3000eae234 100644
--- a/Generators/Prophecy4fControl/python/ProphecyConfig.py
+++ b/Generators/Prophecy4fControl/python/ProphecyConfig.py
@@ -1,4 +1,5 @@
-#! /usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
 import os, subprocess, time
 from DecoratorFactory import decorate
 from AthenaCommon import Logging
@@ -33,7 +34,7 @@ class ProphecyConfig(object) :
     self.add_parameter_set( 'fromDefault' )
 
     ## Initialise values from runArgs
-    if runArgs == None :
+    if runArgs is None :
       self.logger.warning( 'No run arguments found! Using defaults.' )
     else :
       # Read values from runArgs
diff --git a/Generators/Prophecy4fControl/python/ProphecyPowhegDefault.py b/Generators/Prophecy4fControl/python/ProphecyPowhegDefault.py
index 7e27b8b9067d899f58c423a97f23e212f62c93dc..49fdc5a5f888cc9f586be34f8c5cb3b4fcb0ccab 100644
--- a/Generators/Prophecy4fControl/python/ProphecyPowhegDefault.py
+++ b/Generators/Prophecy4fControl/python/ProphecyPowhegDefault.py
@@ -1,4 +1,5 @@
-#! /usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
 from ProphecyConfig import ProphecyConfig
 
 class ProphecyPowhegDefault(ProphecyConfig) :
diff --git a/Generators/Prophecy4fControl/python/ProphecyPowhegMerge.py b/Generators/Prophecy4fControl/python/ProphecyPowhegMerge.py
index 4a60dcf5fba4a2fb9fba9ffebfed3ce0747c193a..129415436a625446a7a9aeedbac82cb8b8c02dee 100644
--- a/Generators/Prophecy4fControl/python/ProphecyPowhegMerge.py
+++ b/Generators/Prophecy4fControl/python/ProphecyPowhegMerge.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 import os, subprocess, time, glob
 from AthenaCommon import Logging
 from PowhegControl import RepeatingTimer
@@ -26,7 +26,7 @@ class ProphecyPowhegMerge(object) :
     self.__input_prophecy_file_name = 'ProphecyOTF._1.events'
 
     ## Initialise values from runArgs
-    if runArgs == None :
+    if runArgs is None :
       self.logger.warning( 'No run arguments found! Using defaults.' )
     else :
       # Read values from runArgs
diff --git a/Generators/Prophecy4fControl/python/__init__.py b/Generators/Prophecy4fControl/python/__init__.py
index 9ee08c96c733e24334f81c60aa33750908cfb584..88d7b7298111ea3822ada474b458b970ecad90ff 100644
--- a/Generators/Prophecy4fControl/python/__init__.py
+++ b/Generators/Prophecy4fControl/python/__init__.py
@@ -1,4 +1,5 @@
-from ProphecyConfig import *
-from ProphecyPowhegDefault import *
-from ProphecyPowhegMerge import *
-from .decorators import *
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+from ProphecyConfig import *          # noqa: F401, F403
+from ProphecyPowhegDefault import *   # noqa: F401, F403
+from ProphecyPowhegMerge import *     # noqa: F401, F403
+from .decorators import *             # noqa: F401, F403
diff --git a/Generators/Prophecy4fControl/python/decorators/DecoratorFromDefault.py b/Generators/Prophecy4fControl/python/decorators/DecoratorFromDefault.py
index ebff63cbf61644e0ce69a8042b92fa1a369d8396..7a1343df89696e292f454b9023148015b454c362 100644
--- a/Generators/Prophecy4fControl/python/decorators/DecoratorFromDefault.py
+++ b/Generators/Prophecy4fControl/python/decorators/DecoratorFromDefault.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 class DecoratorFromDefault(object) :
 
diff --git a/Generators/Prophecy4fControl/python/decorators/DecoratorFromPowheg.py b/Generators/Prophecy4fControl/python/decorators/DecoratorFromPowheg.py
index 5e77016e9fc63a7607ea1661655fd86ba532dfd1..98c74d5f02421cbb726366e7be822789946f3be4 100644
--- a/Generators/Prophecy4fControl/python/decorators/DecoratorFromPowheg.py
+++ b/Generators/Prophecy4fControl/python/decorators/DecoratorFromPowheg.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from PowhegControl import ATLASCommonParameters
 
diff --git a/Generators/Prophecy4fControl/python/decorators/__init__.py b/Generators/Prophecy4fControl/python/decorators/__init__.py
index 6e4d88587e9b7ea8d44f36d548c7755d652185e8..a2de9e3a2ab3b9cdaa986943f7e24a2f4851dacb 100644
--- a/Generators/Prophecy4fControl/python/decorators/__init__.py
+++ b/Generators/Prophecy4fControl/python/decorators/__init__.py
@@ -1,2 +1,3 @@
-from DecoratorFromDefault import *
-from DecoratorFromPowheg import *
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+from DecoratorFromDefault import *  # noqa: F401, F403
+from DecoratorFromPowheg import *   # noqa: F401, F403