From a7e7244b58f6049569de52813c2764743f505c1d Mon Sep 17 00:00:00 2001 From: Tamas Gal <tgal@km3net.de> Date: Fri, 11 Dec 2020 13:53:59 +0100 Subject: [PATCH] Add tab completion --- km3io/rootio.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/km3io/rootio.py b/km3io/rootio.py index ccabe0d..a816ad1 100644 --- a/km3io/rootio.py +++ b/km3io/rootio.py @@ -111,6 +111,10 @@ class EventReader: self.nested_branches = valid_nested_branches self._keys = keys + def __dir__(self): + """Tab completion in IPython""" + return list(self.keys()) + ["header"] + def keys(self): """Returns all accessible branch keys, without the skipped ones.""" return self._keys @@ -320,6 +324,10 @@ class Branch: self._aliases = aliases self._index_chain = index_chain + def __dir__(self): + """Tab completion in IPython""" + return list(self.fields) + def __getattr__(self, attr): if attr not in self._aliases: raise AttributeError( -- GitLab