[IPython-dev] ipy_traits_completer

Darren Dale darren.dale@cornell....
Fri Nov 23 11:59:19 CST 2007


On Friday 23 November 2007 11:11:42 am Darren Dale wrote:
> On Friday 23 November 2007 02:45:19 am Ville M. Vainio wrote:
> > On Sep 19, 2007 3:52 PM, Darren Dale <dd55@cornell.edu> wrote:
> > > I just activated ipy_traits_completer in my ipy_user_conf.py file:
> > >
> > > def main():
> > >     from ipy_traits_completer import activate
> > >     complete_threshold = 3
> > >     activate(complete_threshold)
> > >
> > >     import ipy_stock_completers
> > >
> > >     o = ip.options
> > > main()
> > >
> > > When the traits completer is activated, my readline_omit__names setting
> > > in ipythonrc is ignored.
> >
> > Try changing it in your ipy_user_conf.py after activate(). This is not
> > strictly a bug, python-side configuration overrides ipythonrc.
>
> Thank you, Ville, your suggestion worked. I notice, though, that
> ip_traits_completer does not respect readline_omit__names. I would like to
> fix this before the release, I think I can get it done today.

This is done. Here is the change I made:


Index: IPython/Extensions/ipy_traits_completer.py
===================================================================
--- IPython/Extensions/ipy_traits_completer.py  (revision 2868)
+++ IPython/Extensions/ipy_traits_completer.py  (working copy)
@@ -99,6 +99,13 @@
     attr_start = symbol_parts[-1]
     if attr_start:
         attrs = [a for a in attrs if a.startswith(attr_start)]
+
+    # Let's also respect the user's readline_omit__names setting:
+    omit__names = ipget().options.readline_omit__names
+    if omit__names == 1:
+        attrs = [a for a in attrs if not a.startswith('__')]
+    elif omit__names == 2:
+        attrs = [a for a in attrs if not a.startswith('_')]

     #print '\nastart:<%r>' % attr_start  # dbg


Darren


More information about the IPython-dev mailing list