Skip to content
This repository has been archived by the owner on Jan 7, 2023. It is now read-only.

check for inheritance in list_objects_recursive #248

Closed
wants to merge 2 commits into from

Conversation

pseyfert
Copy link

following the check in rootls, check not only for exact class matches but also inheritance.
This catches the corner cases of e.g. TNtupleD

following the check in
[rootls](root-mirror/root/blob/master/main/python/cmdLineUtils.py#L186)
check not only for exact class matches but also inheritance.
This catches the corner cases of e.g. TNtupleD
@coveralls
Copy link

coveralls commented May 16, 2016

Coverage Status

Coverage remained the same at 99.693% when pulling 9b68706 on pseyfert:check_inheritance into d815593 on rootpy:master.

for t in types:
if cl.InheritsFrom(ROOT.gROOT.GetClass(t)):
objects.append(path + str(key.GetName()))
break
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not something like:

if numpy.any([cl.InheritsFrom(ROOT.gROOT.GetClass(t)) for t in types])

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point

@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.693% when pulling 4c6265e on pseyfert:check_inheritance into d815593 on rootpy:master.

@ndawe
Copy link
Member

ndawe commented May 17, 2016

Thanks for pointing this out. I've got a cython-level implementation in #249

objects.append(path + str(key.GetName()))
cl = ROOT.gROOT.GetClass(clsname)
if types is None or\
numpy.any([cl.InheritsFrom(ROOT.gROOT.GetClass(t)) for t in types]):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best to avoid PyROOT stuff in the cython .pyx. The generated C++ code will be rather bulky and slow.

@pseyfert
Copy link
Author

fine with me. then close this, and go for #249.

@ndawe ndawe closed this May 17, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants