diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/CMakeLists.txt b/InnerDetector/InDetExample/InDetBeamSpotExample/CMakeLists.txt
index f21e04492db8de425e4e1be36e2474709455034b..13568a474a2f9382600231bd7c29c07956ab0384 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/CMakeLists.txt
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/CMakeLists.txt
@@ -1,6 +1,4 @@
-################################################################################
-# Package: InDetBeamSpotExample
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( InDetBeamSpotExample )
@@ -10,7 +8,7 @@ find_package( cx_Oracle )
 find_package( pyyaml )
 
 # 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_scripts( bin/dumpBeamSpot.py bin/checkJobs.py bin/runJobs.py bin/beamSpotT0_ESDToDPD_trf.py bin/beamSpotT0_Vertex_tf.py bin/taskman.py bin/beamspotman.py bin/beamspotnt.py bin/pickleTool.py bin/plotBeamSpotMon.py bin/plotBeamSpotVert.py bin/plotBeamSpotVxVal.py bin/beamSpotT1_Vertex_trf.py bin/dumpLBFileMap.py bin/makeDatasetOnDiskList bin/plotBeamSpotCompare.py bin/dqBeamSpot.py bin/periodInfo.py bin/resolveBeamSpotTag.py bin/bsCompare.py bin/getLatestRuns.py bin/updateCoolNtuple.py bin/extractScanInfo.py )
 
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotDPDFlags.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotDPDFlags.py
index 1ff2ece608df7505df32988bca4c2cc96136f9f6..e4070de4e67d834c8b0694f59abdf053cf586eb0 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotDPDFlags.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotDPDFlags.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
 
 ##=============================================================================
 ## Name:        BeamSpotDPDFlags
@@ -16,10 +16,7 @@ __version__ = "0.0.1"
 __author__  = "James Walder <jwalder@cern.ch>"
 __version__ = "$Id $"
 
-## Import the module that allows to use named units, e.g. GeV
-import AthenaCommon.SystemOfUnits as Units
-
-from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
+from AthenaCommon.JobProperties import JobProperty
 from AthenaCommon.JobProperties import jobproperties
 
 # Filename stream
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotData.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotData.py
index d46effd0531afc6952d0f2ecc7204776e5b595eb..cb7e7df529dd78051e11105ec595e040a0c12f63 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotData.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotData.py
@@ -2,8 +2,6 @@
 
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import print_function
-
 """
 Tools for handling beam spot data in ntuples or in COOL.
 For functionality requiring COOL access, you'll probably need to use
@@ -17,9 +15,7 @@ __version__ = '$Id: BeamSpotData.py 759522 2016-07-04 12:47:58Z amorley $'
 import time
 import copy
 from array import array
-#from CoolConvUtilities import AtlCoolLib
-#from PyCool import cool
-from math import *
+from math import sqrt, atan
 import csv
 
 import numpy   # WARNING: must be last import, so numpy can override sqrt etc
@@ -37,7 +33,7 @@ varDefsGen = {
     'fill':  {},
     'bcid':  {},
     'nEvents':   {},
-    'nValid':    {'altfmt': '%i', 'latexheader': '$n_{\mathrm{vtx}}$'},
+    'nValid':    {'altfmt': '%i', 'latexheader': r'$n_{\mathrm{vtx}}$'},
     'nVtxAll':   {},
     'nVtxPrim':  {},
     'status':    {'fmt': '%4i', 'altfmt': '%4i','latexheader' : 'Status' },
@@ -50,13 +46,13 @@ varDefsGen = {
     'posZ':      {'units': 'mm', 'fmt': '%10.2f', 'latexheader': '$z$ [mm]',
                   'altfmt': '%10.1f', 'altlatexheader': '\\lumposz [mm]',
                   'title': 'Beam Spot Position z', 'atit': 'Luminous centroid z [mm]', 'min': -100, 'max': 100},
-    'sigmaX':    {'units': 'mm', 'fmt': '%10.4f', 'latexheader': '$\sigma_x$ [mm]',
-                  'altfmt': '%10.0f', 'altfactor': 1000., 'altlatexheader': '\\lumsigx [$\mu$m]',
+    'sigmaX':    {'units': 'mm', 'fmt': '%10.4f', 'latexheader': r'$\sigma_x$ [mm]',
+                  'altfmt': '%10.0f', 'altfactor': 1000., 'altlatexheader': r'\\lumsigx [$\mu$m]',
                   'title': 'Beam Spot Size #sigma_{x}', 'atit': 'Luminous size #sigma_{x} [mm]', 'min': 0, 'max': 0.6},
-    'sigmaY':    {'units': 'mm', 'fmt': '%10.4f', 'latexheader': '$\sigma_y$ [mm]',
-                  'altfmt': '%10.0f','altfactor': 1000., 'altlatexheader': '\\lumsigy [$\mu$m]',
+    'sigmaY':    {'units': 'mm', 'fmt': '%10.4f', 'latexheader': r'$\sigma_y$ [mm]',
+                  'altfmt': '%10.0f','altfactor': 1000., 'altlatexheader': r'\\lumsigy [$\mu$m]',
                   'title': 'Beam Spot Size #sigma_{y}', 'atit': 'Luminous size #sigma_{y} [mm]', 'min': 0, 'max': 0.6},
-    'sigmaZ':    {'units': 'mm', 'fmt': '%10.2f', 'latexheader': '$\sigma_z$ [mm]',
+    'sigmaZ':    {'units': 'mm', 'fmt': '%10.2f', 'latexheader': r'$\sigma_z$ [mm]',
                   'altfmt': '%10.0f', 'altlatexheader': '\\lumsigz [mm]',
                   'title': 'Beam Spot Size #sigma_{z}', 'atit': 'Luminous size #sigma_{z} [mm]', 'min': 0, 'max': 150},
     'tiltX':     {'units': 'rad', 'fmt': '%10.6f', 'latexheader': 'tilt$_{xz}$ [rad]',
@@ -96,7 +92,7 @@ varDefsGen = {
                   'title': 'Error Scale Factor k', 'atit': 'k', 'min': 0.5, 'max': 2.0},
     'kErr':      {'fmt': '%10.3f',
                   'title': 'Uncertainty on Error Scale Factor k', 'atit': 'Uncertainty on k', 'min': 0, 'max': 0.2},
-    'sigmaXY':   {'fmt': '%10.6f', 'latexheader': '$\sigma_{xy}$',
+    'sigmaXY':   {'fmt': '%10.6f', 'latexheader': r'$\sigma_{xy}$',
                   'title': 'Beam Spot Size #sigma_{xy}', 'atit': '#sigma_{xy}', 'min': -0.0005, 'max': 0.0005},
 }
 
@@ -246,7 +242,7 @@ def varDef(var,property,default='',useAlternate=False,override=None):
         if useAlternate:
             v = varDefs[var].get('alt'+property,v)
         return v
-    except:
+    except Exception:
         return default
 
 def fmtVal(var,value,strip=False,useAlternate=False):
@@ -402,7 +398,7 @@ class BeamSpotValue:
     def thetaXY(self):
         try:
             txy = .5*atan((2*self.sigmaX*self.sigmaY*self.rhoXY)/(self.sigmaY**2-self.sigmaX**2))
-        except:
+        except Exception:
             txy = 0
         return txy
 
@@ -413,7 +409,7 @@ class BeamSpotValue:
             tpy = -1*(self.rhoXY*self.sigmaX*(self.sigmaX**2+self.sigmaY**2))/(self.sigmaX**4+2*(2*self.rhoXY**2-1)*self.sigmaX**2*self.sigmaY**2+self.sigmaY**4)
             tpr = (self.sigmaX*self.sigmaY**3-self.sigmaY*self.sigmaX**3)/(self.sigmaX**4+2*(2*self.rhoXY**2-1)*self.sigmaX**2*self.sigmaY**2+self.sigmaY**4)
             txye = sqrt(tpx*tpx*self.sigmaXErr**2 + tpy*tpy*self.sigmaYErr**2 + tpr*tpr*self.rhoXYErr**2 + 2*(tpx*tpy*self.covSxSy + tpx*tpr*self.covSxRhoXY + tpy*tpr*self.covSyRhoXY))
-        except:
+        except Exception:
             txye = 0
         return txye
 
@@ -430,15 +426,15 @@ class BeamSpotValue:
             BeamSpotValue.coolQuery = COOLQuery()
         try:
             self.timeStart = BeamSpotValue.coolQuery.lbTime(self.run,self.lbStart)[0]
-        except:
+        except Exception:
             pass
         try:
             self.timeEnd = BeamSpotValue.coolQuery.lbTime(self.run,self.lbEnd-1)[1]
-        except:
+        except Exception:
             pass
         try:
             self.fill = BeamSpotValue.coolQuery.getLHCInfo(self.timeStart).get('FillNumber',0)
-        except:
+        except Exception:
             pass
     
     def fillDataFromPseudoLb(self, pseudoLbFile, timeUnit = 1.):
@@ -451,7 +447,7 @@ class BeamSpotValue:
                 print ("point %s %s %s %s" % (point,start,sep,acq))
                 BeamSpotValue.pseudoLbDict[int(point)] = (int(int(start)*timeUnit), int(int(end)*timeUnit), float(sep), float(acq))
 
-        if not self.lbStart in self.pseudoLbDict:
+        if self.lbStart not in self.pseudoLbDict:
             print ("Missing %s in pseudoLbDict" % self.lbStart)
             return
 
@@ -468,7 +464,7 @@ class BeamSpotValue:
 
         try:
             self.fill = BeamSpotValue.coolQuery.getLHCInfo(self.timeStart).get('FillNumber',0)
-        except:
+        except Exception:
             pass
         
         return
@@ -590,7 +586,7 @@ class BeamSpotAverage:
             lumi = lumiNt.IntLumi
             try:
                 self.lumiData[run][lb] = lumi
-            except:
+            except Exception:
                 self.lumiData[run] = {}
                 self.lumiData[run][lb] = lumi
         lumiSum = 0.
@@ -610,7 +606,7 @@ class BeamSpotAverage:
             for lb in range(b.lbStart,b.lbEnd):
                 try:
                     lumi += self.lumiData[b.run][lb]
-                except:
+                except Exception:
                     print ('ERROR: missing luminosity information for run %i LB %i (in [%i,%i]) - weight set to zero!!' % (b.run,lb,b.lbStart,b.lbEnd))
                     self.nWarnings += 1
         for i in range(len(self.varList)):
@@ -647,7 +643,7 @@ class BeamSpotAverage:
             self.ave = self.sumx/self.sum
             self.err = self.rms/numpy.sqrt(self.sum)
 
-    def getIndex(varName):
+    def getIndex(self, varName):
         for i in range(len(self.varList)):
             if self.varList[i]==varName:
                 return i
@@ -847,7 +843,7 @@ class BeamSpotContainer:
         cache = {}
         for b in self:
             r = b.run
-            if not r in cache:
+            if r not in cache:
                 cache[r] = {}
             if b.lbEnd-b.lbStart > 500:
                 print ('WARNING: Cannot cache LB range %i ... %i for run %i' % (b.lbStart,b.lbEnd,r))
@@ -986,28 +982,28 @@ class BeamSpotFinderNt(BeamSpotContainer):
             bs = BeamSpotValue(self.fullCorrelations)
             try:
                 bs.status = BeamSpotFinderNt.fitIdToStatusMap[self.nt.fitID]+BeamSpotFinderNt.fitResultToStatusMap[self.nt.fitStatus]
-            except:
+            except Exception:
                 bs.status = 0
                 print ("ERROR: can't translate (fitID,fitStatus) = (%i,%i) into status word" % (self.nt.fitID,self.nt.fitStatus))
             bs.run = self.nt.run
             try:
                 bs.bcid = self.nt.bcid
-            except:
+            except Exception:
                 pass
             bs.lbStart = self.nt.lumiStart
             bs.lbEnd = self.nt.lumiStart+self.nt.lumiRange
             bs.nEvents = self.nt.nEvents
             try:
                 bs.nValid = self.nt.nValid
-            except:
+            except Exception:
                 pass
             try:
                 bs.nVtxAll = self.nt.nVtxAll
-            except:
+            except Exception:
                 pass
             try:
                 bs.nVtxPrim = self.nt.nVtxPrim
-            except:
+            except Exception:
                 pass                        
             bs.posX = self.nt.xc
             bs.posY = self.nt.yc
@@ -1128,7 +1124,6 @@ class BeamSpotCOOL(BeamSpotContainer):
             lumiBegin = since & 0xFFFFFFFF
 
             until = obj.until()
-            runUntil = until >> 32
             lumiUntil = until & 0xFFFFFFFF
 
             bs            = BeamSpotValue()                            
@@ -1163,7 +1158,7 @@ class BeamSpotCOOL(BeamSpotContainer):
 
             try:
                 rhoXYtmp = sigmaXYtmp / sigmaXtmp / sigmaYtmp
-            except:
+            except Exception:
                 rhoXYtmp = 0
             bs.rhoXY      = rhoXYtmp
 
@@ -1172,7 +1167,7 @@ class BeamSpotCOOL(BeamSpotContainer):
                 sumtmp += sigmaXErrtmp * sigmaXErrtmp / sigmaXtmp / sigmaXtmp
                 sumtmp += sigmaYErrtmp * sigmaYErrtmp / sigmaYtmp / sigmaYtmp
                 rhoXYErrtmp = sqrt(rhoXYtmp * rhoXYtmp * sumtmp)
-            except:
+            except Exception:
                 rhoXYErrtmp = 0
 
             bs.rhoXYErr = rhoXYErrtmp
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotJobProperties.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotJobProperties.py
index 1561eeb926f14de0af450e71fb79400e7df25493..0c54dd14f3955c84e7f4bfea08423ebaea19d72e 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotJobProperties.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotJobProperties.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
 
 ##=============================================================================
 ## Name:        BeamSpotFlags
@@ -16,9 +16,6 @@ __version__ = "0.0.1"
 __author__  = "James Walder <jwalder@cern.ch>"
 __version__ = "$Id $"
 
-## Import the module that allows to use named units, e.g. GeV
-import AthenaCommon.SystemOfUnits as Units
-
 from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
 from AthenaCommon.JobProperties import jobproperties
 
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotPostProcessing.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotPostProcessing.py
index cf0fbbc24a70220363a2355614cad8e353577e63..e6317a61f9e2abffb20639a7145ad976cc8b2c95 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotPostProcessing.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotPostProcessing.py
@@ -2,8 +2,6 @@
 
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import print_function
-
 """
 Beam spot postprocessing library.
 """
@@ -13,7 +11,7 @@ __version__ = '$Id $'
 
 import os
 
-from InDetBeamSpotExample.PostProcessing import *
+from InDetBeamSpotExample.PostProcessing import PostProcessingStep, PostProcessingError, PostponeProcessing, runPostProcStep
 from InDetBeamSpotExample.TaskManager import TaskManager
 from InDetBeamSpotExample import COOLUtils
 
@@ -74,7 +72,7 @@ class JobPostProcessing(PostProcessingStep):
         #if self.oldStatus==TaskManager.StatusCodes['POSTPROCESSING']:
         try:
             postProcSteps = self.getJobConfig(self.jobName)['jobpostprocsteps'].split()
-        except:
+        except Exception:
             raise PostProcessingError('ERROR: No config file or jobpostprocsteps parameter found for %s/%s' % (self.dsName,self.taskName),self.executedSteps)
         for step in postProcSteps:
             self.log('Running postprocessing step:  %s' % step)
@@ -143,7 +141,7 @@ class PlotBeamSpotCompareReproc(PostProcessingStep):
         # tag will be the one containing the best results to date and hence we compare to that
         try: 
             beamspottag = COOLUtils.resolveCurrentBeamSpotFolder()
-        except:
+        except Exception:
             raise PostProcessingError('ERROR: Unable to resolve beamspot folder tag',self.executedSteps,TaskManager.StatusCodes['POSTPROCFAILED'])
 
         if os.path.exists('/'.join([self.taskDir,ntFileName])):
@@ -307,7 +305,7 @@ class CheckT0Status(PostProcessingStep):
             f = self.getJobConfig(self.jobName)['inputfiles'][0]
             if 'ESD' in f:
                 filter = 'ESD'
-        except:
+        except Exception:
             self.log('WARNING: Unable to determine input file type - will assume default (%s)\n' % filter, doPrint=True)
         cmd = 'beamspotman.py -n -f %s queryT0 %s %s' % (filter,self.dsName,self.taskName)
         status = self.logExec(cmd,doPrint=True,abortOnError=False)
@@ -330,7 +328,7 @@ class UploadBeamSpot(PostProcessingStep):
         # Resolve beamspot tag
         try: 
             beamspottag = COOLUtils.resolveCurrentBeamSpotFolder()
-        except:
+        except Exception:
             raise PostProcessingError('ERROR: Unable to resolve beamspot folder tag',self.executedSteps,TaskManager.StatusCodes['POSTPROCFAILED'])
         
         # Check that we haven't uploaded yet
@@ -414,7 +412,7 @@ class UploadDataQuality(PostProcessingStep):
         if os.path.exists('/'.join([self.taskDir,dataQualityDbFileName])):
             self.logExec('beamspotman.py -b -n --dqtag %s dqflag %s %s' % (dqtag,self.dsName,self.taskName))            
         else:
-            self.log(text='ERROR: No beam spot DQ flag SQLite file %s\n       Nothing to upload - was DQ determination successful?\n' % dqDbFileName,doPrint=True)
+            self.log(text='ERROR: No beam spot DQ flag SQLite file %s\n       Nothing to upload - was DQ determination successful?\n' % dataQualityDbFileName,doPrint=True)
 
 
 class BeamSpotNtNoAve(PostProcessingStep):
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/COOLUtils.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/COOLUtils.py
index ae5ba68c96dca06b2c39f85556f6fbb2dfcbddde..86b222a1b9e92af300859dfb0cf1e43025573371 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/COOLUtils.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/COOLUtils.py
@@ -1,7 +1,5 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import print_function
-
 """
 Miscellaneous utilities related to COOL.
 """
@@ -149,7 +147,7 @@ class COOLQuery:
           self.cooldb.closeDatabase()
           self.cooltrigdb.closeDatabase()
           self.cooldcsdb.closeDatabase()
-        except:
+        except Exception:
           print ("DB time out -- ignore")
 
     def getRunStartTime(self,runnr):
@@ -161,10 +159,9 @@ class COOLQuery:
         try:
             itr.goToNext()
             obj = itr.currentRef()
-            run = obj.payload()['RunNumber']
             sorTime = obj.payload()['SORTime']
             return COOLToUnixTime(sorTime)
-        except:
+        except Exception:
             return
 
 
@@ -186,10 +183,10 @@ class COOLQuery:
             for k in info.keys():
                 try:
                     info[k] = obj.payload()[k]
-                except:
+                except Exception:
                     print ('WARNING: Cannot find value for',k)
             return info
-        except:
+        except Exception:
             return None
 
     def getRunEndTime(self,runnr):
@@ -201,10 +198,9 @@ class COOLQuery:
         try:
             itr.goToNext()
             obj = itr.currentRef()
-            run = obj.payload()['RunNumber']
             eorTime = obj.payload()['EORTime']
             return COOLToUnixTime(eorTime)
-        except:
+        except Exception:
             return
 
     def getLbTimes(self,runnr):
@@ -257,7 +253,7 @@ def resolveNextAlias(tagtype='ST'):
     alias = ''
     try:
         alias = resolveAlias.getNext()
-    except:
+    except Exception:
         alias = ''
         
     return alias.replace('*', tagtype)
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/DQUtilities.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/DQUtilities.py
index 73f4ee4d47d5051abf66b475806e61e85e48c3bd..87c099835e80b8c864d862202a2ea850e161e5ee 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/DQUtilities.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/DQUtilities.py
@@ -1,15 +1,8 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import absolute_import, print_function
-
-import os, sys
-from operator import itemgetter
-from itertools import groupby
-from PyCool import cool
-from CoolConvUtilities import AtlCoolLib
-from DetectorStatus import DetStatusLib
+import os
 from DQDefects import DefectsDB
-from DQUtils.sugar import IOVSet,RANGEIOV_VAL,RunLumiType, RunLumi, define_iov_type
+from DQUtils.sugar import IOVSet, RunLumiType, RunLumi, define_iov_type
 from DQUtils import fetch_iovs, process_iovs    
 
 
@@ -167,7 +160,7 @@ class IDBSDefectWriter:
         Write a single defect to the database
         """
 
-        if not defect in self.db.defect_names:
+        if defect not in self.db.defect_names:
             self.db.create_defect(defect, description)
 
         self.db.insert(defect, since, until, comment, self.user, present, recoverable) 
@@ -366,7 +359,7 @@ class IDBSDefectEncoding:
     def defectToInt(cls, defect):
         """Encode defect as an int.  If defect is unknown raise error"""
 
-        if not defect in IDBSDefectEncoding.defectBitPos:
+        if defect not in IDBSDefectEncoding.defectBitPos:
             raise DefectError ('ERROR: Unknown defect %s encountered' % defect)
 
         return (1 << IDBSDefectEncoding.defectBitPos.index(defect))
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/JobRunner.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/JobRunner.py
index 7641ef2386920d3f4ef94270bbb78ff832f32b84..03d487e5103b30335382e1944052aa7ea397f44b 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/JobRunner.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/JobRunner.py
@@ -158,13 +158,13 @@ class JobRunner:
            parameters is relevant. insertAtFront can be set to True to force early
            evaluation of a given parameter."""
         p = self.params[name] = self.params.get(name,JobRunnerParameter(name))
-        if value!=None:
+        if value is not None:
             p.value = value
-        if description!=None:
+        if description is not None:
             p.description = description
-        if isSpecial!=None:
+        if isSpecial is not None:
             p.isSpecial=isSpecial
-        if not name in self.paramOrder:
+        if name not in self.paramOrder:
             if insertAtFront:
                 self.paramOrder.insert(0,name)
             else:
@@ -176,7 +176,7 @@ class JobRunner:
            setParam is called to create it. If it does exist, only the value is updated
            and the description and flag arguments are ignored."""
         if name in self.params:
-            if value!=None:
+            if value is not None:
                 p = self.params[name]
                 if isinstance(p.value,str) and p.value:
                     p.value = p.value + endOfLine + value
@@ -217,7 +217,7 @@ class JobRunner:
                     tmp[p] = value % tmp
                 else:
                     tmp[p] = value
-        except:
+        except Exception:
             raise JobRunnerError ('Unable to evaluate parameter: '+p+' = '+value+' (check parameter order)')
 
 
@@ -380,7 +380,7 @@ class JobRunner:
             inputfiles = self.getParam('inputfiles')
             jobInputDict = {}
             jobLBDict = {}
-            lbpattern = re.compile('lb(\d+)')
+            lbpattern = re.compile(r'lb(\d+)')
             for f in inputfiles:
                 lbnrs = lbpattern.findall(f)
                 
@@ -400,13 +400,13 @@ class JobRunner:
 
                     jobId = int((lbnr-1)/lbperjob)
                     #print ('LB = %4i  jobid = %i' % (lbnr,jobId))
-                    if not jobId in jobInputDict:
+                    if jobId not in jobInputDict:
                         jobInputDict[jobId] = [f]
                         jobLBDict[jobId] = [lbnr]
                     else:
-                        if not f in jobInputDict[jobId] :
+                        if f not in jobInputDict[jobId] :
                             jobInputDict[jobId].append(f)
-                        if not lbnr in jobLBDict[jobId] :    
+                        if lbnr not in jobLBDict[jobId] :
                             jobLBDict[jobId].append(lbnr)
 
                     lbnr = lbnr+1
@@ -451,7 +451,7 @@ class JobRunner:
 
     def runJob(self,jobnr):
         """Run a single configured job."""
-        if not jobnr in self.jobs:
+        if jobnr not in self.jobs:
             raise JobRunnerError ('Job number %s is not configured' % jobnr)
         jobConfig = self.jobs[jobnr]
         subprocess.call('touch '+jobConfig['subflag'], shell=True)
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/PlotLibrary.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/PlotLibrary.py
index 3e4bbbe1bd1c16bc115008a71fd0092350302de7..f5a077bff65611d91f3f982ff39b985c22336c64 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/PlotLibrary.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/PlotLibrary.py
@@ -2,8 +2,6 @@
 
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import print_function
-
 """
 A library with miscellaneous beam spot related utilities and plots.
 """
@@ -11,9 +9,9 @@ __author__  = 'Juerg Beringer'
 __version__ = '$Id $'
 
 
-from math import *
-from time import *
-from numpy import *
+from math import sqrt
+from time import mktime, strptime
+from numpy import array
 
 import ROOT
 from InDetBeamSpotExample import ROOTUtils
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/PostProcessing.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/PostProcessing.py
index cf7253f21e5f2946c57bfc3f8076caf8f5a4da23..036fe32d463baaa41be1ea57ddbbe6e5a269db83 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/PostProcessing.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/PostProcessing.py
@@ -2,8 +2,6 @@
 
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import print_function
-
 """
 This module defines the generic infrastructure for task postprocessing.
 """
@@ -11,14 +9,13 @@ __author__  = 'Juerg Beringer'
 __version__ = '$Id $'
 
 
-import dircache, glob, re, time, sys, os, math
+import dircache, glob, time, sys, os, math
+import subprocess
 
-from InDetBeamSpotExample.TaskManager import *
+from InDetBeamSpotExample.TaskManager import TaskAnalyzer, TaskManager, getKey
 from InDetBeamSpotExample.Utils import getUserName
 
-from future import standard_library
-standard_library.install_aliases()
-import subprocess
+
 
 
 # Exception classes
@@ -221,7 +218,7 @@ class PostProcessingStep:
     def jobList(self):
         try:
             l = dircache.listdir(self.taskDir)
-        except:
+        except Exception:
             l = []
         return l
 
@@ -273,9 +270,9 @@ class PostProcessingStep:
         if not resultFileName:
             return
         resultFiles = self.taskDict['RESULTFILES']
-        if resultFiles==None:
+        if resultFiles is None:
             resultFiles = ''
-        if not resultFileName in resultFiles.split():
+        if resultFileName not in resultFiles.split():
             resultFiles = ' '.join([resultFiles,resultFileName])
             self.taskman.setValue(self.dsName,self.taskName,'RESULTFILES',resultFiles)
             self.taskDict['RESULTFILES'] = resultFiles
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/ROOTUtils.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/ROOTUtils.py
index 2d1be151f5cead947676be3559ce96a95e15cbb8..82ac2d544196bfd8206e295e025229a40b644a22 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/ROOTUtils.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/ROOTUtils.py
@@ -1,9 +1,5 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-# $Id: ROOTUtils.py 759047 2016-07-01 00:45:13Z beringer $
-
-from __future__ import print_function
-
 """
 Miscellaneous utilities for PyROOT.
 """
@@ -12,8 +8,6 @@ __version__ = '$Id: ROOTUtils.py 759047 2016-07-01 00:45:13Z beringer $'
 
 
 import ROOT
-from array import array
-
 
 protectedObjectList = []
 
@@ -54,11 +48,11 @@ class MyCanvas(ROOT.TCanvas):
     def __init__(self,name='MyCanvas', size='default', xdivs=1, ydivs=1, saveAsList=None, autoSaveOnExit=None):
         super(MyCanvas,self).__init__(name,name,myCanvasSizes[size][0],myCanvasSizes[size][1])
         self.name = name
-        if saveAsList!=None:
+        if saveAsList is not None:
             self.saveAsList = saveAsList
         else:
             self.saveAsList = MyCanvas.saveAsList
-        if autoSaveOnExit!=None:
+        if autoSaveOnExit is not None:
             self.autoSaveOnExit = autoSaveOnExit
         else:
             self.autoSaveOnExit = MyCanvas.autoSaveOnExit
@@ -130,7 +124,7 @@ class PlotLibrary:
                 c.cd(iCanvas)
                 try:
                     self.__class__.__dict__[code](self,w,*args)
-                except:
+                except Exception:
                     self.__class__.__bases__[0].__dict__[code](self,w,*args)
                 ROOT.gPad.Update()
                 # For some strange reason, this works only for .eps, but not e.g. for gif files...???
@@ -162,7 +156,7 @@ class PlotLibrary:
             c = self.protect( MyCanvas(what,self.singleCanvasSize) )
             try:
                 self.__class__.__dict__[code](self,what,*args)
-            except:
+            except Exception:
                 self.__class__.__bases__[0].__dict__[code](self,what,*args)
             ROOT.gPad.Update()
             for o in self.saveAsList:
@@ -216,9 +210,9 @@ class StyleFactory:
 def drawAxisFrame(xmin,xmax,ymin,ymax,title='',xTitleOffset=None,yTitleOffset=None,doPlot=True,protectFrame=True):
     frame = ROOT.TH2F('axisFrame',title,100,xmin,xmax,100,ymin,ymax)
     frame.SetStats(False)
-    if xTitleOffset!=None:
+    if xTitleOffset is not None:
         frame.GetXaxis().SetTitleOffset(xTitleOffset)
-    if yTitleOffset!=None:
+    if yTitleOffset is not None:
         frame.GetYaxis().SetTitleOffset(yTitleOffset)
     if doPlot:
         frame.Draw()
@@ -304,7 +298,7 @@ def moveStats(h,dx,dy,xw=0,yw=0,label=''):
 
 
 def atlasLabel(x,y,isPreliminary=False,color=1,offset=0.115,isForApproval=False,energy=8,customstring="",size=0.05):
-    if x==None or y==None:
+    if x is None or y is None:
         print ("Must set (x,y) position using --atlasx and --atlasy to add labels.  No ATLAS labels created.")
         return
     offset = offset/0.05*size
@@ -343,69 +337,69 @@ def atlasStyle(protectStyle=True):
 
     # use plain black on white colors
     icol=0  # WHITE
-    s.SetFrameBorderMode(icol);
-    s.SetFrameFillColor(icol);
-    s.SetCanvasBorderMode(icol);
-    s.SetCanvasColor(icol);
-    s.SetPadBorderMode(icol);
-    s.SetPadColor(icol);
-    s.SetStatColor(icol);
-    #s.SetFillColor(icol); # don't use: white fill color floa *all* objects
+    s.SetFrameBorderMode(icol)
+    s.SetFrameFillColor(icol)
+    s.SetCanvasBorderMode(icol)
+    s.SetCanvasColor(icol)
+    s.SetPadBorderMode(icol)
+    s.SetPadColor(icol)
+    s.SetStatColor(icol)
+    #s.SetFillColor(icol) # don't use: white fill color floa *all* objects
 
     # set the paper & margin sizes
-    s.SetPaperSize(20,26);
-    s.SetPadTopMargin(0.05);
-    s.SetPadRightMargin(0.05);
-    s.SetPadBottomMargin(0.16);
-    s.SetPadLeftMargin(0.16);
+    s.SetPaperSize(20,26)
+    s.SetPadTopMargin(0.05)
+    s.SetPadRightMargin(0.05)
+    s.SetPadBottomMargin(0.16)
+    s.SetPadLeftMargin(0.16)
 
     # set title offsets (for axis label)
     s.SetTitleXOffset(1.4)
     s.SetTitleYOffset(1.4)
 
     # use large fonts
-    #Int_t font=72; # Helvetica italics
+    #Int_t font=72 # Helvetica italics
     font = 42 # Helvetica
     tsize = 0.05
-    s.SetTextFont(font);
-
-    s.SetTextSize(tsize);
-    s.SetLabelFont(font,"x");
-    s.SetTitleFont(font,"x");
-    s.SetLabelFont(font,"y");
-    s.SetTitleFont(font,"y");
-    s.SetLabelFont(font,"z");
-    s.SetTitleFont(font,"z");
-
-    s.SetLabelSize(tsize,"x");
-    s.SetTitleSize(tsize,"x");
-    s.SetLabelSize(tsize,"y");
-    s.SetTitleSize(tsize,"y");
-    s.SetLabelSize(tsize,"z");
-    s.SetTitleSize(tsize,"z");
+    s.SetTextFont(font)
+
+    s.SetTextSize(tsize)
+    s.SetLabelFont(font,"x")
+    s.SetTitleFont(font,"x")
+    s.SetLabelFont(font,"y")
+    s.SetTitleFont(font,"y")
+    s.SetLabelFont(font,"z")
+    s.SetTitleFont(font,"z")
+
+    s.SetLabelSize(tsize,"x")
+    s.SetTitleSize(tsize,"x")
+    s.SetLabelSize(tsize,"y")
+    s.SetTitleSize(tsize,"y")
+    s.SetLabelSize(tsize,"z")
+    s.SetTitleSize(tsize,"z")
 
     # use bold lines and markers
-    s.SetMarkerStyle(20);
-    s.SetMarkerSize(1.2);
-    s.SetHistLineWidth(2);
-    s.SetLineStyleString(2,"[12 12]"); # postscript dashes
+    s.SetMarkerStyle(20)
+    s.SetMarkerSize(1.2)
+    s.SetHistLineWidth(2)
+    s.SetLineStyleString(2,"[12 12]") # postscript dashes
 
     # get rid of X error bars and y error bar caps
-    #s.SetErrorX(0.001);
+    #s.SetErrorX(0.001)
 
     # get rid of error bar caps
-    s.SetEndErrorSize(0.);
+    s.SetEndErrorSize(0.)
 
     # do not display any of the standard histogram decorations
-    s.SetOptTitle(0);
-    #s.SetOptStat(1111);
-    s.SetOptStat(0);
-    #s.SetOptFit(1111);
-    s.SetOptFit(0);
+    s.SetOptTitle(0)
+    #s.SetOptStat(1111)
+    s.SetOptStat(0)
+    #s.SetOptFit(1111)
+    s.SetOptFit(0)
 
     # put tick marks on top and RHS of plots
-    s.SetPadTickX(1);
-    s.SetPadTickY(1);
+    s.SetPadTickX(1)
+    s.SetPadTickY(1)
 
     if protectStyle:
         protect(s)
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/TaskManager.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/TaskManager.py
index 10cc9d48be6ac4c403a2a6173140eef3b12676cc..bcbd33f4a2afecd8f09f97339ed93eb7c05104b3 100755
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/TaskManager.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/TaskManager.py
@@ -2,8 +2,6 @@
 
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import print_function
-
 """
 TaskManager is a tool for keeping track of JobRunner jobs using a
 database. TaskManager uses the notion of a task as the primary unit for
@@ -19,7 +17,7 @@ Written by Juerg Beringer (LBNL) in 2009.
 __author__  = 'Juerg Beringer'
 __version__ = 'TaskManager.py atlas/athena'
 
-import time, os, glob, dircache, sys
+import time, os, glob, dircache
 
 from InDetBeamSpotExample.Utils import getRunFromName
 from InDetBeamSpotExample.Utils import getUserName
@@ -68,7 +66,7 @@ def getStatusClass(status):
 def appendUnique(s,v):
     if not s:
         s = ''   # make sure it is not None
-    if not v in s.split():
+    if v not in s.split():
         s = ' '.join([s,v])
     return s
 
@@ -151,7 +149,7 @@ class TaskManager:
 
         try:
             dbtype, dbname = connstring.split(':', 1)
-        except:
+        except Exception:
             raise ValueError ('Illegal database connection string {}'.format(connstring))
 
         if dbtype == 'auth_file':
@@ -161,7 +159,7 @@ class TaskManager:
                 with open(authfile) as af:
                     connstring = af.read().strip()
                 dbtype, dbname = connstring.split(':', 1)
-            except:
+            except Exception:
                 raise ValueError ('Invalid authorization file {} (not readable or invalid format)'.format(authfile))
 
         return dbtype, dbname
@@ -196,7 +194,7 @@ class TaskManager:
             self.paramstyle = 'named'
             try:
                 self.dbcon = cx_Oracle.connect(self.dbname)
-            except:
+            except Exception:
                 print ('ERROR: First connection attempt to Beam Spot Oracle database failed; will retry in 10s ...')
                 time.sleep(10)
                 self.dbcon = cx_Oracle.connect(self.dbname)
@@ -214,7 +212,7 @@ class TaskManager:
         ''' Close the database connection at the end of the 'with' statement. '''
         try:
             self.dbcon.close()
-        except:
+        except Exception:
             print ('ERROR: Unable to close database connection')
 
     def _createSQLiteSchema(self):
@@ -357,7 +355,7 @@ end;
                 else:
                     sqlParts.append(p)
 
-        if sqlParts==None:
+        if sqlParts is None:
             raise ValueError ('Unknown SQL parameter style %s' % self.paramstyle)
             return None
         sql = ' '.join(sqlParts)
@@ -420,7 +418,7 @@ end;
                              ', NJOBS = ',DbParam(task['NJOBS']+njobs),
                              ', ONDISK = ',DbParam(onDisk)]
 
-                if not release in task['ATLREL']:
+                if release not in task['ATLREL']:
                     print ('WARNING: Updating task using different release: DSNAME = %s, TASKNAME = %s, release = = %s vs %s' % (dsName,taskName,task['ATLREL'],release))
                     release = '; '.join([task['ATLREL'],release])
                     updateStr += [', ATLREL = ',DbParam(release)]
@@ -687,7 +685,7 @@ class JobAnalyzer:
     def jobList(self):
         try:
             l = dircache.listdir(self.path)
-        except:
+        except Exception:
             l = []
         return l
 
@@ -719,7 +717,7 @@ class JobAnalyzer:
                     status = TaskManager.StatusCodes['FAILED']
             try:
                 exitcode = open(glob.glob(p+'/*.exitstatus.dat')[0]).read()
-            except:
+            except Exception:
                 pass
             if len(glob.glob(p+'/*.exit.*'))>len(glob.glob(p+'/*.exit.0')):
                 status = TaskManager.StatusCodes['FAILED']
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/TrfUtils.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/TrfUtils.py
index 24bafb7a0ceeed181696a44773bf3705a9d037e6..fc61851a540389cd329c7455ee6337cf09c24ad0 100755
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/TrfUtils.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/TrfUtils.py
@@ -2,8 +2,6 @@
 
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-from __future__ import print_function
-
 """
 Utilities for writing job transforms for use at T0 and at the CAF Task Management System.
 """
@@ -16,9 +14,6 @@ import json, yaml
 from InDetBeamSpotExample import JobRunner
 from InDetBeamSpotExample.TaskManager import TaskManager
 from optparse import OptionParser
-
-from future import standard_library
-standard_library.install_aliases()
 import subprocess
 
 def readJSON(fname):
@@ -71,7 +66,7 @@ def getGuid(name):
         try :
             (s,o) = subprocess.getstatusoutput('uuidgen')
             guid = o.strip()
-        except :
+        except Exception:
             guid = 'UUIDGENERROR'
     else :
         try :
@@ -83,7 +78,7 @@ def getGuid(name):
             if guid == '' :
                 (s,o) = subprocess.getstatusoutput('uuidgen')
                 guid = o.strip()
-        except :
+        except Exception:
             guid = 'PFCPARSINGERROR'
     return guid
 
@@ -121,9 +116,9 @@ class JobRunnerTransform:
         self.inputParamName = inputParamName
         self.outputParamName = outputParamName
         self.mandatoryArgs = mandatoryArgs
-        if not inputParamName in mandatoryArgs:
+        if inputParamName not in mandatoryArgs:
             mandatoryArgs.append(inputParamName)
-        if not outputParamName in mandatoryArgs:
+        if outputParamName not in mandatoryArgs:
             mandatoryArgs.append(outputParamName)
         self.optionalArgs = optionalArgs
         self.runner = None
@@ -159,7 +154,7 @@ class JobRunnerTransform:
         print ('\n')
 
         # Check for all mandatory parameters
-        missingArgs = [ x for x in mandatoryArgs if not x in self.argdict ]
+        missingArgs = [ x for x in mandatoryArgs if x not in self.argdict ]
         if missingArgs:
             self.report('MISSINGPARAM_ERROR','Mandatory parameter(s) missing from argdict: '+str(missingArgs))
             print ('ERROR: mandatory parameter(s) missing from argdict:', missingArgs)
@@ -307,7 +302,7 @@ class JobRunnerTransform:
             try:
                 jobStatus = self.runner.jobStatus[0]   # Assume we always run single jobs
                 jobStatusAcronym = 'OK' if jobStatus==0 else 'ATHENA_ERROR'
-            except:
+            except Exception:
                 jobStatus = 999
                 jobStatusAcronym = 'NOJOBSTATUS_ERROR'
                 moreText = "Jobrunner terminated abnormally and w/o a job status; athena job may or may not have run"
diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/Utils.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/Utils.py
index 2dbabd669d87fcfa024739488e2d8129922abde7..7c0802a6ac34d81acbcd2c475ce2d7d5d066071c 100644
--- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/Utils.py
+++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/Utils.py
@@ -1,6 +1,6 @@
 #!/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
 """
 This module defines miscellaneous utility functions.
 """
@@ -17,12 +17,12 @@ def getRunFromName(name,default='',asInt=False):
     name = os.path.basename(name)
     try:
         run = re.sub('^0*','',name.split('.')[1])
-        if not re.search('^\d+$',run):
+        if not re.search(r'^\d+$',run):
             # Probably wasn't the run number, so use the default instead
             run = default
         else:
             run = int(run) if asInt else run
-    except:
+    except Exception:
         run = default
     return run
 
@@ -50,7 +50,7 @@ def getUserName(default='UNKNOWN'):
     user = ''
     try:
         user = os.getlogin()     # this doesn't seem to work with acrontab
-    except:
+    except Exception:
         pass
     if not user:
         user = os.getenv('USER',default)