From 4bc71ee2fd899e5156549a2a444c8975d994bfc5 Mon Sep 17 00:00:00 2001 From: scott snyder <snyder@bnl.gov> Date: Sat, 18 Jan 2020 17:23:14 +0100 Subject: [PATCH] AthenaPython: More python 3 fixes - iteritems - coerce iterator to list --- Control/AthenaPython/python/ConfigLib.py | 7 ++++--- Control/AthenaPython/python/FilePeekerLib.py | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Control/AthenaPython/python/ConfigLib.py b/Control/AthenaPython/python/ConfigLib.py index c38112a76036..aa9d19fd942e 100644 --- a/Control/AthenaPython/python/ConfigLib.py +++ b/Control/AthenaPython/python/ConfigLib.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # @file AthenaPython/ConfigLib.py # @purpose functions to ease the configuration of reading/copying files @@ -6,6 +6,7 @@ from __future__ import print_function from past.builtins import basestring +import six __doc__ = "functions to ease the configuration of reading/copying files" __version__ = "$Revision: 285924 $" @@ -269,11 +270,11 @@ class AutoCfg(object): from AthenaCommon.AthenaCommonFlags import jobproperties as jp acf = jp.AthenaCommonFlags - for k,v in self.acf.iteritems(): + for k,v in six.iteritems (self.acf): getattr(acf, k).set_Value_and_Lock(v) from RecExConfig.RecFlags import rec - for k,v in self.rec.iteritems(): + for k,v in six.iteritems (self.rec): globals()[k] = False # FIXME: backward compat... getattr(rec, k).set_Value_and_Lock(v) diff --git a/Control/AthenaPython/python/FilePeekerLib.py b/Control/AthenaPython/python/FilePeekerLib.py index 116165ac590c..cd676d2b0743 100644 --- a/Control/AthenaPython/python/FilePeekerLib.py +++ b/Control/AthenaPython/python/FilePeekerLib.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # @file PyAthena.FilePeekerLib # @purpose provide components to peek into pool files @@ -15,6 +15,8 @@ __doc__ = "provide components to peek into pool files" import AthenaPython.PyAthena as PyAthena StatusCode = PyAthena.StatusCode +import six + ### helper functions ---------------------------------------------------------- def _import_ROOT(): @@ -366,7 +368,7 @@ class FilePeeker(PyAthena.Alg): return (_typename(clid) or str(clid), # str or keep the int? sgkey) item_list = esi.item_list() - item_list = map(_make_item_list, item_list) + item_list = list(map(_make_item_list, item_list)) peeked_data['eventdata_items'] = item_list # print ("======",len(item_list)) peeked_data['lumi_block'] = esi.lumi_blocks() @@ -493,7 +495,7 @@ class FilePeeker(PyAthena.Alg): def mergeMultipleDict(inDicts): outDict={} for d in inDicts: - for k,o in d.iteritems(): + for k,o in six.iteritems(d): if k not in outDict: outDict[k]=o if len(outDict)==0: -- GitLab