Does not complete mpylayer #192

Closed
dbrgn opened this Issue Apr 2, 2013 · 5 comments

Projects

None yet

4 participants

@dbrgn
Collaborator
dbrgn commented Apr 2, 2013

Jedi does not seem to complete the mpylayer MPLayerControl() instance:

Python 2.7.3 (default, Dec 22 2012, 21:14:12) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import jedi
>>> source = 'import mpylayer; mp = mpylayer.MPlayerControl(); mp.l'
>>> script = jedi.Script(source, 1, len(source), None)
>>> script.complete()
[]

Tried it with pip version as well as current dev branch. mp.loadfile should be in the completions. Completion works with IPython.

>>> import mpylayer
>>> mp = mpylayer.MPlayerControl()
>>> type(mp)
<class 'mpylayer.mpylayer_control.SelectMPlayerControl'>
>>> mp.loadfile
<bound method SelectMPlayerControl.loadfile of <mpylayer.mpylayer_control.SelectMPlayerControl object at 0x7ff0e2875c90>>

Note that although I created an MPlayerControl object, a SelectMPlayerControl instance was returned.

@tkf
Collaborator
tkf commented Apr 2, 2013

The __init__.py is just

from mpylayer.mpylayer_control import *

Can star import be the reason?

Does Jedi handle __new__? If so, I think mpylayer_control.py can be handled by Jedi.

@dbrgn
Collaborator
dbrgn commented Apr 2, 2013

I didn't take a closer look at the mpylayer source code yet. As far as I know, star imports should be handled well enough by Jedi. But the __new__ could indeed be a problem.

@dbrgn
Collaborator
dbrgn commented Apr 2, 2013

Ah, there we go. You're right, the commands are created at runtime based on mplayer output: https://code.google.com/p/mpylayer/source/browse/trunk/mpylayer/mpylayer_control.py#89

Does IPython analyze the objects at runtime to generate the completions?

@schlamar
schlamar commented Apr 3, 2013

Does IPython analyze the objects at runtime to generate the completions?

Yes, you can just do the following and get auto-completion on a.t

In [1]: a = type('', (object,), {'test': 1})()

In [2]: a.test
Out[2]: 1
@davidhalter
Owner

This will not be supported in the nearer feature. At least not from me. I'll close it for now.

However if somebody wants to do that. Go for it.

@davidhalter davidhalter closed this May 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment