Skip to content

Commit 86a3691

Browse files
author
Ahmed Bilal
committed
Fix Python linting errors: remove unused imports, fix None comparisons, fix bare except
1 parent a1d518c commit 86a3691

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

main/python/cmdLineUtils.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313
# http://stackoverflow.com/questions/4675728/redirect-stdout-to-a-file-in-python/22434262#22434262
1414
# Thanks J.F. Sebastian !!
1515

16-
from contextlib import contextmanager
1716
import os
1817
import sys
19-
from time import sleep
20-
from itertools import zip_longest
18+
from contextlib import contextmanager
19+
2120

2221
def fileno(file_or_fd):
2322
"""
@@ -81,9 +80,10 @@ def stderrRedirected():
8180
ROOT.PyConfig.IgnoreCommandLineOptions = True
8281
ROOT.gROOT.GetVersion()
8382

83+
# ruff: noqa: E402
8484
import argparse
85-
import glob
8685
import fnmatch
86+
import glob
8787
import logging
8888

8989
LOG_FORMAT = "%(levelname)s: %(message)s"
@@ -328,12 +328,12 @@ def openROOTFileCompress(fileName, compress, recreate):
328328
Open a ROOT file (like openROOTFile) with the possibility
329329
to change compression settings
330330
"""
331-
if compress != None and os.path.isfile(fileName):
331+
if compress is not None and os.path.isfile(fileName):
332332
logging.warning("can't change compression settings on existing file")
333333
return None
334334
mode = "recreate" if recreate else "update"
335335
theFile = openROOTFile(fileName, mode)
336-
if compress != None:
336+
if compress is not None:
337337
theFile.SetCompressionSettings(compress)
338338
return theFile
339339

@@ -501,7 +501,7 @@ def getSourceListArgs(parser, wildcards=True):
501501
inputFiles = []
502502
try:
503503
inputFiles = args.FILE
504-
except:
504+
except Exception:
505505
inputFiles = args.SOURCE
506506
sourceList = [tup for pattern in inputFiles for tup in patternToFileNameAndPathSplitList(pattern, wildcards)]
507507
return sourceList, args

0 commit comments

Comments
 (0)