From adde0b33c0e0ef03501a6867ee91bd852feb5d8e Mon Sep 17 00:00:00 2001 From: scott snyder <snyder@bnl.gov> Date: Wed, 18 Dec 2019 17:15:50 +0100 Subject: [PATCH] AthenaPython: Update CORAL attribute access for python 3. Update the handling of CORAL attributes to work with both py3 and py2. Can simplify it now using a pyroot template proxy. --- Control/AthenaPython/python/FilePeekerLib.py | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/Control/AthenaPython/python/FilePeekerLib.py b/Control/AthenaPython/python/FilePeekerLib.py index 6d657827f94c..116165ac590c 100644 --- a/Control/AthenaPython/python/FilePeekerLib.py +++ b/Control/AthenaPython/python/FilePeekerLib.py @@ -15,22 +15,6 @@ __doc__ = "provide components to peek into pool files" import AthenaPython.PyAthena as PyAthena StatusCode = PyAthena.StatusCode -# MN/sss: make Coral.AttributeList work in Coral3/ROOT6/gcc5 -from PyCool import coral -_attribute_methods = dir(coral.Attribute) -_methnames = ['data<std::__cxx11::basic_string<char> >', - 'data<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >', - 'data<std::basic_string<char> >', - 'data<std::string>'] -for _m in _methnames: - if _m in _attribute_methods: - _attribute_getdata = _m - break -else: - raise Exception("Can't find data method in Attribute") -def attr_str_data(attr): - return getattr(attr, _attribute_getdata) () - ### helper functions ---------------------------------------------------------- def _import_ROOT(): @@ -245,14 +229,14 @@ class FilePeeker(PyAthena.Alg): spec = a.specification() a_type = spec.typeName() if a_type.find('string') >= 0: - a_data = attr_str_data(a) + a_data = a.data('string')() try: a_data = eval(a_data,{},{}) except Exception: # swallow and keep as a string pass else: - a_data = getattr(a,'data<%s>'%a_type)() + a_data = a.data(a_type)() #msg.info("%s: %s %s", spec.name(), a_data, type(a_data) ) attr_data.append( (spec.name(), a_data) ) attrs.append(dict(attr_data)) -- GitLab