From 6dba041daf6c6f62862e5fc4adc45c8f40d40045 Mon Sep 17 00:00:00 2001
From: Frank Winklmeier <fwinkl@cern>
Date: Tue, 27 Oct 2020 09:58:05 +0100
Subject: [PATCH] FileStager: enable flake8 and fix code

---
 Database/FileStager/python/FileStagerConfig.py |  2 +-
 Database/FileStager/python/FileStagerTool.py   | 15 +++++++--------
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/Database/FileStager/python/FileStagerConfig.py b/Database/FileStager/python/FileStagerConfig.py
index 6ad9e3dbc47..f3f72b906c5 100644
--- a/Database/FileStager/python/FileStagerConfig.py
+++ b/Database/FileStager/python/FileStagerConfig.py
@@ -1,7 +1,7 @@
 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 
 from AthenaCommon.Configurable import ConfigurableAlgorithm
-from AthenaCommon.Constants import *   # for "INFO"
+from AthenaCommon.Constants import WARNING
 
 class FileStagerAlg( ConfigurableAlgorithm ):
    # slots is a sequence of properties that the use is allowed to set
diff --git a/Database/FileStager/python/FileStagerTool.py b/Database/FileStager/python/FileStagerTool.py
index 36f168a3781..50d5f45669a 100644
--- a/Database/FileStager/python/FileStagerTool.py
+++ b/Database/FileStager/python/FileStagerTool.py
@@ -3,8 +3,7 @@
 from __future__ import print_function
 
 import os
-import sys, string
-from datetime import datetime
+import sys
 
 from future import standard_library
 standard_library.install_aliases()
@@ -12,7 +11,7 @@ import subprocess
 
 ## Needed to correct ROOT behavior; see below
 CWD = os.getcwd()
-import ROOT
+import ROOT  # noqa: F401
 ## Importing gSystem may change the current directory to one of the
 ## command-line arguments; chdir to original directory to have
 ## predictable behavior
@@ -125,22 +124,22 @@ class FileStagerTool:
     # last fallback
     try:
       defaultTmpdir = os.environ['TMPDIR'] 
-    except Exception as inst:
+    except Exception:
       pass
     # cern lxbatch
     try:
       defaultTmpdir = os.environ['WORKDIR']
-    except Exception as inst:
+    except Exception:
       pass
     # osg
     try:
       defaultTmpdir = os.environ['OSG_WN_TMP']
-    except Exception as inst:
+    except Exception:
       pass
     # lcg
     try:
       defaultTmpdir = os.environ['EDG_WL_SCRATCH']
-    except Exception as inst:
+    except Exception:
       pass
 
     # use given tmpdir
@@ -176,7 +175,7 @@ class FileStagerTool:
       rfioPiece = self.sampleList[0].split(self.InfilePrefix)
       nPieces = len(rfioPiece)
       
-      inFile  = rfioPiece[nPieces-1]
+      inFile  = rfioPiece[nPieces-1]   # noqa: F841
       outFile = self.tmpSampleList[0]
       stderr  = outFile+"_stage.err"
       stdout  = outFile+"_stage.out"
-- 
GitLab