importmagic icon indicating copy to clipboard operation
importmagic copied to clipboard

from datetime import datetime is never given for datetime

Open paradoxxxzero opened this issue 8 years ago • 3 comments

I narrowed it down to the fixup method but no real succes in fixing it, except from not calling the method when the symbol is in the path https://github.com/alecthomas/importmagic/compare/master...paradoxxxzero:master but this seems hackish and would not work for module in module in module all with the same name...

Any thoughts?

paradoxxxzero avatar Sep 16 '16 16:09 paradoxxxzero

Can you check your index to see if that symbol is available?

alecthomas avatar Sep 17 '16 07:09 alecthomas

Yes it is, all works fine until the fixup method removes the variable because it's the same as the module, which is what we want for datetime.datetime but not for datetime. In both of these cases, the fixup method is called twice, once with datetime, None and once with datetime, datetime. However it always returns datetime, None which is wrong for the latter case.

I hope I'm being clear enough :)

Btw Thanks for this awesome project, that I now use daily in http://github.com/Kozea/wdb and Atom https://github.com/paradoxxxzero/atom-python-import-magic

Le sam. 17 sept. 2016 à 09:24, Alec Thomas [email protected] a écrit :

Can you check your index to see if that symbol is available?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/alecthomas/importmagic/issues/41#issuecomment-247754928, or mute the thread https://github.com/notifications/unsubscribe-auth/AAQjKEcsd_7zq23B1YoJWDJsVO0KBgb8ks5qq5WkgaJpZM4J_Gyf .

paradoxxxzero avatar Sep 17 '16 10:09 paradoxxxzero

Ran into the same issue today with pprint.pprint, which I normally import as

from pprint import pprint

Possibly related: For sin, the completing from numpy.ma.core import sin is offered, but not the more sensible from numpy import sin.

kbauer avatar Jun 29 '18 23:06 kbauer