From 6ae0a93ecab90da2e85c18cd5045885a961daec9 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Sat, 3 Feb 2024 20:08:52 -0600 Subject: [PATCH] fix: placate flake8 --- DDG4/python/DDSim/Helper/Action.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/DDG4/python/DDSim/Helper/Action.py b/DDG4/python/DDSim/Helper/Action.py index dc7dbf34f..4afcedb81 100644 --- a/DDG4/python/DDSim/Helper/Action.py +++ b/DDG4/python/DDSim/Helper/Action.py @@ -123,7 +123,6 @@ def calorimeterSDTypes(self): def calorimeterSDTypes(self, val): self._calorimeterSDTypes = ConfigHelper.makeList(val) - @staticmethod def makeListOfDictFromJSON(val): if isinstance(val, str): @@ -131,7 +130,7 @@ def makeListOfDictFromJSON(val): import json try: val = json.loads(val) - except: + except ValueError as e: val = tuple(val.split(",")) if isinstance(val, tuple): # assumes: ( "Geant4TestEventAction", {"Property_int": 10} ) @@ -141,7 +140,7 @@ def makeListOfDictFromJSON(val): if isinstance(val, dict): # assumes: { "name": "Geant4TestEventAction", "parameter": {"Property_int": 10} } # creates: [ { "name": "Geant4TestEventAction", "parameter": {"Property_int": 10} } ] - val = [ val ] + val = [val] if isinstance(val, list): # assumes: [ { "name": "Geant4TestEventAction", "parameter": {"Property_int": 10} } ] return val