From a53a258d5ee3b115674456a6d1cbfc19fb016d4f Mon Sep 17 00:00:00 2001
From: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Date: Mon, 17 Apr 2023 21:05:07 -0400
Subject: [PATCH] DD4hepSimulation: fix for flake8

---
 DDG4/python/DDSim/DD4hepSimulation.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/DDG4/python/DDSim/DD4hepSimulation.py b/DDG4/python/DDSim/DD4hepSimulation.py
index 41e41c224..c9d995820 100644
--- a/DDG4/python/DDSim/DD4hepSimulation.py
+++ b/DDG4/python/DDSim/DD4hepSimulation.py
@@ -541,7 +541,8 @@ class DD4hepSimulation(object):
       fileNames = [fileNames]
     if not all(fileName.endswith(tuple(extensions)) for fileName in fileNames):
       self._errorMessages.append("ERROR: Unknown fileformat for file: %s" % fileNames)
-    if not self.hepmc3.useHepMC3 and any(fileName.endswith(tuple(HEPMC3_SUPPORTED_EXTENSIONS)) for fileName in fileNames):
+    is_hepmc3_extension = any(fileName.endswith(tuple(HEPMC3_SUPPORTED_EXTENSIONS)) for fileName in fileNames)
+    if not self.hepmc3.useHepMC3 and is_hepmc3_extension:
       self._errorMessages.append("ERROR: HepMC3 files or compressed HepMC2 require the use of HepMC3 library")
     return fileNames
 
-- 
GitLab