From aa78925fa689b8703ac7a1e2d4ce6bc8ce423053 Mon Sep 17 00:00:00 2001 From: Enric Tejedor Saavedra <enric.tejedor.saavedra@cern.ch> Date: Tue, 17 Mar 2020 10:14:16 +0100 Subject: [PATCH] [Exp PyROOT] Convert to Python str to use its methods When iterating over a std::vector<std::string>, new cppyy returns std::strings. If we want to use Python str features like strip or sorted, we need to convert the std::strings to Python strs. --- bindings/jupyroot/python/JupyROOT/helpers/cppcompleter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/jupyroot/python/JupyROOT/helpers/cppcompleter.py b/bindings/jupyroot/python/JupyROOT/helpers/cppcompleter.py index ebeb8e45ffa..e6f2b178d0a 100644 --- a/bindings/jupyroot/python/JupyROOT/helpers/cppcompleter.py +++ b/bindings/jupyroot/python/JupyROOT/helpers/cppcompleter.py @@ -133,7 +133,7 @@ class CppCompleter(object): def _completeImpl(self, line): line=line.split()[-1] - suggestions = self._getSuggestions(line) + suggestions = [ str(s) for s in self._getSuggestions(line) ] suggestions = filter(lambda s: len(s.strip()) != 0, suggestions) suggestions = sorted(suggestions) if not suggestions: return [] -- GitLab