diff --git a/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/CMakeLists.txt b/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/CMakeLists.txt
index d74201ba19fbad4804a9e2913f5751adcf7ee57d..9e2c231d3fec147a21a12a16a5bc70d45c04f856 100644
--- a/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/CMakeLists.txt
+++ b/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/CMakeLists.txt
@@ -1,27 +1,24 @@
-################################################################################
-# Package: TriggerD3PDMaker
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( TriggerD3PDMaker )
 
 # External dependencies:
-find_package( Boost COMPONENTS filesystem thread system )
+find_package( Boost )
 
 # Component(s) in the package:
 atlas_add_library( TriggerD3PDMakerLib
                    src/*.cxx
                    PUBLIC_HEADERS TriggerD3PDMaker
                    INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${Boost_LIBRARIES} AthenaBaseComps AthenaKernel CxxUtils EventKernel FourMomUtils GaudiKernel D3PDMakerUtils TrigSteeringEvent TrigDecisionToolLib TrigObjectMatchingLib StoreGateLib SGtests
-                   PRIVATE_LINK_LIBRARIES xAODTrigger AnalysisTriggerEvent TrigConfHLTData TrigConfL1Data TrigMonitoringEvent TrigT1Interfaces TrigT1Result TrigAnalysisInterfaces )
+                   LINK_LIBRARIES ${Boost_LIBRARIES} AthenaBaseComps AthenaKernel CxxUtils D3PDMakerInterfaces D3PDMakerUtils EventKernel FourMomUtils GaudiKernel TrigAnalysisInterfaces TrigDecisionToolLib TrigObjectMatchingLib TrigT1Result
+                   PRIVATE_LINK_LIBRARIES AnalysisTriggerEvent StoreGateLib TrigConfHLTData TrigConfInterfaces TrigConfL1Data TrigMonitoringEvent TrigSteeringEvent TrigT1Interfaces xAODTrigger )
 
 atlas_add_component( TriggerD3PDMaker
                      src/components/*.cxx
-                     INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${Boost_LIBRARIES} AthenaBaseComps AthenaKernel CxxUtils EventKernel FourMomUtils GaudiKernel D3PDMakerUtils TrigDecisionToolLib TrigObjectMatchingLib TrigSteeringEvent StoreGateLib SGtests xAODTrigger AnalysisTriggerEvent TrigConfHLTData TrigConfL1Data TrigMonitoringEvent TrigT1Interfaces TrigT1Result TriggerD3PDMakerLib TrigAnalysisInterfaces )
+                     LINK_LIBRARIES TriggerD3PDMakerLib )
 
 # 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/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/BunchStructureMetadata.py b/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/BunchStructureMetadata.py
index 0c9a6c95edcfb177bb464bd05e3d1ebdfab7c51d..e9b207ff260fc9a8472a6843918147224c2bd03b 100644
--- a/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/BunchStructureMetadata.py
+++ b/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/BunchStructureMetadata.py
@@ -1,6 +1,5 @@
 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 
-# $Id: BunchStructureMetadata.py 345964 2011-02-15 15:25:18Z ssnyder $
 
 ## @package BunchStructureMetadata
 #
@@ -9,8 +8,6 @@
 #
 # @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
 #
-# $Revision: 345964 $
-# $Date: 2011-02-15 16:25:18 +0100 (Tue, 15 Feb 2011) $
 
 ##
 # @short Function adding the bunch structure metadata to the D3PD
@@ -27,13 +24,9 @@
 #
 # @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
 #
-# $Revision: 345964 $
-# $Date: 2011-02-15 16:25:18 +0100 (Tue, 15 Feb 2011) $
-#
 def addBunchStructureMetadata( d3pdalg = None, source = "" ):
 
     # Create a logger for the function:
-    if "logger" in dir(): orig_logger = logger
     from AthenaCommon.Logging import logging
     logger = logging.getLogger( "addBunchStructureMetadata" )
 
@@ -55,9 +48,9 @@ def addBunchStructureMetadata( d3pdalg = None, source = "" ):
     _d3pdSvc = getattr( ServiceMgr, _d3pdSvcName )
 
     # If no D3PD::MakerAlg has been provided, create a dummy one:
-    if d3pdalg == None:
+    if d3pdalg is None:
         logger.warning( "No D3PD MakerAlg given to function!" )
-        logger.warning( "The bunch configuration will be saved into file: " +
+        logger.warning( "The bunch configuration will be saved into file: "
                         "\"BunchConfig.root\"" )
         from AthenaCommon.AlgSequence import AlgSequence
         theJob = AlgSequence()
@@ -68,7 +61,7 @@ def addBunchStructureMetadata( d3pdalg = None, source = "" ):
 
     # Add the metadata tool:
     _d3pdToolName = "BunchStructureMetadataTool"
-    if not _d3pdToolName in [ t.name() for t in d3pdalg.MetadataTools ]:
+    if _d3pdToolName not in [ t.name() for t in d3pdalg.MetadataTools ]:
         import TriggerD3PDMaker
         from TrigBunchCrossingTool.BunchCrossingConfProvider import BunchCrossingConfProvider
         d3pdalg.MetadataTools += [
@@ -90,7 +83,4 @@ def addBunchStructureMetadata( d3pdalg = None, source = "" ):
     else:
         logger.info( "BunchConfigIDD3PDObject already added to the D3PD::MakerAlg" )
 
-    # Restore the original logger if necessary:
-    if "orig_logger" in dir(): logger = orig_logger
-
     return
diff --git a/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/CTPD3PDObject.py b/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/CTPD3PDObject.py
index 9daa23f56b1c7f27d8e58b8c16af5be74dd10572..4441f41195a83483547cd0e5519dc5cca44eb398 100644
--- a/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/CTPD3PDObject.py
+++ b/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/CTPD3PDObject.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
 
 #
 # D3PD object saving the CTP_RDO information into the D3PD
@@ -6,8 +6,6 @@
 # is active...)
 #
 
-import D3PDMakerCoreComps
-from D3PDMakerCoreComps.D3PDObject import D3PDObject
 from D3PDMakerCoreComps.D3PDObject import make_SG_D3PDObject
 import TriggerD3PDMaker
 
diff --git a/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/EmTauROID3PDObject.py b/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/EmTauROID3PDObject.py
index 20f851907c4c9a89de0cce4d5db5090a198c1788..702f619311551f0502fc7e5fde8be97336b0f75d 100644
--- a/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/EmTauROID3PDObject.py
+++ b/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/EmTauROID3PDObject.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
 
-# $Id: EmTauROID3PDObject.py 633616 2014-12-04 10:10:12Z ssnyder $
 #
 # D3PD object saving the LVL1 Em/Tau RoI information into the D3PD
 #
 
 from D3PDMakerCoreComps.D3PDObject  import make_SGDataVector_D3PDObject
 import TriggerD3PDMaker
-import EventCommonD3PDMaker
 import D3PDMakerCoreComps
 
 
diff --git a/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/MuCTPID3PDObject.py b/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/MuCTPID3PDObject.py
index c000fad52131fdfd30aedf72af37d8749f689e9f..02b95661bcc085648481e1baa0062fa16ea8547e 100644
--- a/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/MuCTPID3PDObject.py
+++ b/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/MuCTPID3PDObject.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
 
 #
 # D3PD object saving the MuCTPI_RDO information into the D3PD
@@ -6,8 +6,6 @@
 # is active...)
 #
 
-import D3PDMakerCoreComps
-from D3PDMakerCoreComps.D3PDObject import D3PDObject
 from D3PDMakerCoreComps.D3PDObject import make_SG_D3PDObject
 import TriggerD3PDMaker
 
@@ -28,8 +26,8 @@ MuCTPID3PDObject = make_SG_D3PDObject( "MuCTPI_RDO", "MUCTPI_RDO",
 
 if _haveRDO:
     # Make sure the cabling services are configured:
-    import TrigT1RPCRecRoiSvc.TrigT1RPCRecRoiConfig
-    import TrigT1TGCRecRoiSvc.TrigT1TGCRecRoiConfig
+    import TrigT1RPCRecRoiSvc.TrigT1RPCRecRoiConfig  # noqa: F401
+    import TrigT1TGCRecRoiSvc.TrigT1TGCRecRoiConfig  # noqa: F401
 
     # Define the blocks:
     MuCTPID3PDObject.defineBlock( 0, "RDOInfo",
diff --git a/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/MuonROID3PDObject.py b/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/MuonROID3PDObject.py
index f1a36fe504536b82b9f35d2796c1411d1589487a..bd396c7f0b1781ce6e9b0032a79681b7403809f4 100644
--- a/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/MuonROID3PDObject.py
+++ b/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/MuonROID3PDObject.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
 
-# $Id: MuonROID3PDObject.py 620244 2014-10-06 19:02:48Z ssnyder $
 #
 # D3PD object saving the LVL1 muon RoI information into the D3PD
 #
 
 from D3PDMakerCoreComps.D3PDObject import make_SGDataVector_D3PDObject
 import TriggerD3PDMaker
-import EventCommonD3PDMaker
 import D3PDMakerCoreComps
 
 MuonROID3PDObject = \
diff --git a/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/TrigConfMetadata.py b/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/TrigConfMetadata.py
index 26b66437fe4413c4a6cf9efea6f7316508ae9792..3b18eed10f4c61ba3bce55a37339d885eb190e96 100644
--- a/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/TrigConfMetadata.py
+++ b/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/TrigConfMetadata.py
@@ -5,7 +5,7 @@
 # metadata to the D3PD.
 #
 
-def addTrigConfMetadata( d3pdalg = None, useTrigConfEventSummaries = False, doCostL2 = False, doCostEF = False, doCostHLT = False, saveKeys = True, tuplePath = "" ):
+def addTrigConfMetadata( d3pdalg = None, useTrigConfEventSummaries = False, saveKeys = True, tuplePath = "" ):
 
     """Helper function that adds the necessary tool(s) and service(s) to the
        job to save the trigger configuration metadata to the output D3PD
@@ -20,7 +20,6 @@ def addTrigConfMetadata( d3pdalg = None, useTrigConfEventSummaries = False, doCo
     """
 
     # Create a logger for the function:
-    if "logger" in dir(): orig_logger = logger
     from AthenaCommon.Logging import logging
     logger = logging.getLogger( "addTrigConfMetadata" )
 
@@ -41,9 +40,9 @@ def addTrigConfMetadata( d3pdalg = None, useTrigConfEventSummaries = False, doCo
     _d3pdSvc = getattr( ServiceMgr, _d3pdSvcName )
 
     # If no D3PD::MakerAlg has been provided, create a dummy one:
-    if d3pdalg == None:
+    if d3pdalg is None:
         logger.warning( "No D3PD MakerAlg given to function!" )
-        logger.warning( "The trigger configuration will be saved into file: " +
+        logger.warning( "The trigger configuration will be saved into file: "
                         "\"TrigConfig.root\"" )
         from AthenaCommon.AlgSequence import AlgSequence
         theJob = AlgSequence()
@@ -53,7 +52,7 @@ def addTrigConfMetadata( d3pdalg = None, useTrigConfEventSummaries = False, doCo
 
     # Add the metadata tool:
     _d3pdToolName = "TrigConfMetadataTool"
-    if not _d3pdToolName in [ t.name() for t in d3pdalg.MetadataTools ]:
+    if _d3pdToolName not in [ t.name() for t in d3pdalg.MetadataTools ]:
         import TriggerD3PDMaker
         if (tuplePath == ""):
           tuplePath = d3pdalg.TuplePath
@@ -62,26 +61,17 @@ def addTrigConfMetadata( d3pdalg = None, useTrigConfEventSummaries = False, doCo
                                                                ConfigDir = tuplePath + "Meta" )
         _trigConfTool.UseTrigConfEventSummaries = useTrigConfEventSummaries
         if useTrigConfEventSummaries:
-            # Figure out if old or new style HLT if using CostMon to get correct storegate key
-            # Old key fomat was HLT_OPI_HLT_monitoring_config
-            if (doCostL2 == True or doCostEF == True or doCostHLT == True):
-              logger.info( "TrigConfMetadataTool will use passed arguments [L2="+str(doCostL2)+",EF="+str(doCostEF)+",HLT="+str(doCostHLT)+"]" )
-              if (doCostL2 == True or doCostEF == True):
-                _trigConfTool.keyConfig = "HLT_TrigMonConfigCollection_OPI_EF_monitoring_config"
-              elif (doCostHLT == True):
+            logger.info( "TrigConfMetadataTool will use TriggerFlags flags for config" )
+            from TriggerJobOpts.TriggerFlags import TriggerFlags
+            if TriggerFlags.doHLT():
                 _trigConfTool.keyConfig = "HLT_TrigMonConfigCollection_OPI_HLT_monitoring_config"
-            else: 
-              logger.info( "TrigConfMetadataTool will use TriggerFlags flags for config" )
-              from TriggerJobOpts.TriggerFlags import TriggerFlags
-              if TriggerFlags.doHLT():
-                _trigConfTool.keyConfig = "HLT_TrigMonConfigCollection_OPI_HLT_monitoring_config"
-            logger.info( "TrigConfMetadataTool will use the StoreGate key " + _trigConfTool.keyConfig )
+            logger.info( "TrigConfMetadataTool will use the StoreGate key %s", _trigConfTool.keyConfig )
             d3pdalg.MetadataTools += [ _trigConfTool ]
     else:
       logger.info( "TrigConfMetadataTool was already added to the D3PD::MakerAlg" )
 
     # Add the DB key filler object:
-    if saveKeys == True:
+    if saveKeys is True:
       _dbKeysFillerName = "TrigDBKeysFiller"
       if not hasattr( d3pdalg, _dbKeysFillerName ):
           from TriggerD3PDMaker.TrigDBKeysD3PDObject import TrigDBKeysD3PDObject
@@ -89,7 +79,4 @@ def addTrigConfMetadata( d3pdalg = None, useTrigConfEventSummaries = False, doCo
       else:
           logger.info( "TrigDBKeysD3PDObject already added to the D3PD::MakerAlg" )
 
-    # Restore the original logger if necessary:
-    if "orig_logger" in dir(): logger = orig_logger
-
     return
diff --git a/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/TrigRoiDescD3PDObject.py b/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/TrigRoiDescD3PDObject.py
index d81c2ce3197653f840cd6fa5c708c1ba6ef93849..3c76c4fe7111283e1853761cf9222e7083c97d98 100644
--- a/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/TrigRoiDescD3PDObject.py
+++ b/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/TrigRoiDescD3PDObject.py
@@ -1,12 +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
 
-# $Id: TrigRoiDescD3PDObject.py 338058 2010-12-20 13:20:43Z krasznaa $
 #
 # D3PD object saving information about TrigRoiDescriptor objects.
 # By default it saves the "initial RoIs", the RoIs that are given
 # to the LVL2 algorithms from LVL1.
 
-from D3PDMakerCoreComps.D3PDObject import D3PDObject
 from D3PDMakerCoreComps.D3PDObject import make_SGDataVector_D3PDObject
 import TriggerD3PDMaker
 
diff --git a/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/defineTriggerBits.py b/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/defineTriggerBits.py
index 21be38ef0912dcfe6c8b99892ada3c8e00c2f595..af6ba52ec989330982d0d89c2b2da6e89cc23154 100644
--- a/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/defineTriggerBits.py
+++ b/PhysicsAnalysis/D3PDMaker/TriggerD3PDMaker/python/defineTriggerBits.py
@@ -1,6 +1,5 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
-# $Id: defineTriggerBits.py 484175 2012-02-21 13:06:42Z krasznaa $
 #
 # @file  TriggerD3PDMaker/python/addTriggerBits.py
 # @author scott snyder <snyder@bnl.gov>
@@ -28,7 +27,6 @@
 import TriggerD3PDMaker
 from D3PDMakerCoreComps.D3PDObject  import make_Void_D3PDObject
 from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
-from AthenaCommon.AppMgr            import theApp
 
 
 triggerBitsD3PDObject = \
@@ -84,7 +82,7 @@ This allows one to segregate the trigger decision flags in a separate tree.
             pass
 
         pat = pattern
-        if type(pat) != type([]):
+        if not isinstance(pat, list):
             pat = [pat]
             pass
         filler.TriggerBitsFiller_TriggerBits.Triggers += pat