[IPython-dev] Ticket #127

Jörgen Stenarson jorgen.stenarson at bostream.nu
Sun Mar 11 12:02:23 EDT 2007


I just attached a possible patch to ticket #127 (by the way #128 seems 
to be a copy of #127). It is not a completely finished I know there are 
some problems left but it fixes the most immediate problems.

This is the patch description I attached to the ticket:

The attachment ipy_stock_completers.diff tries to address this problem.

The %run tabcompletion handler had its own filematcher. The %cd handler 
seemed to rely on the standard completer and thus it would match both on 
files and directories.

The patch addresses these things:

1. With a single " at the beginning of the line it does not crash now. 
There are however still possible problems with \ and ' that are not 
properly handled.

2. The filematcher from ipython.completer has been copied and slightly 
changed to work on its own and not as a method.

3. Both cd and run now uses this extracted filematcher and should have 
more of a standard behaviour.

For the future I think it would be nice to do a refactoring of the 
completer functionality. For instance use the exact same code for file 
matching in the standard completer as in the handlers. It would probably 
also be good to have a standard function to decompose a line for the 
handlers to avoid future problems with "'\ handling. As well as adding 
some tests for this functionality.


More information about the IPython-dev mailing list