Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Missing numpy and tensorflow completion, members not showing up #642

Closed

Description

numpy and tensorflow.nn are missing completion.

import numpy as np
np.

Nothing shows up after np. except some oddball stuff.

Doing this:

import tensorflow
tensorflow.nn

nn has no completion, and tensorflow.nn itself doesn't say that nn exists at all.

Activity

  1. MikhailArkhipov commented on Feb 28, 2019

    @MikhailArkhipov

    This is about submodules in folders you are working on

  2. MikhailArkhipov commented on Mar 1, 2019

    @MikhailArkhipov

    Related: #490

    from setuptools. # misses `archive*`

    image

  3. jakebailey commented on Mar 5, 2019

    @jakebailey
    MemberAuthor

    So in looking at #690, I realized that I hadn't checked __all__ for numpy, and behold:

    https://github.com/numpy/numpy/blob/15b092f5541e80d7c3d0108957406c6f8686aba0/numpy/__init__.py#L169

        __all__.extend(['__version__', 'show_config'])
        __all__.extend(core.__all__)
        __all__.extend(_mat.__all__)
        __all__.extend(lib.__all__)
        __all__.extend(['linalg', 'fft', 'random', 'ctypeslib', 'ma'])

    Which explains why we aren't getting numpy completion anymore; we have the __all__ filtering.

  4. jakebailey commented on Mar 5, 2019

    @jakebailey
    MemberAuthor

    Commenting out all of the code in PythonModule.GetMemberNames which filters:

    image

    It's really slow to show up, but it's there. Maybe we need to drop the filters for now until we can better handle __all__. The old LS worked because it didn't even do anything.

  5. MikhailArkhipov commented on Mar 5, 2019

    @MikhailArkhipov

    If we drop all filters then all the typing and others imported will show up in the completion. But it may be smaller price to pay.

  6. jakebailey commented on Mar 5, 2019

    @jakebailey
    MemberAuthor

    The above is just:

                // Try __all__ since it contains exported members
                var all = Analysis.GlobalScope.Variables["__all__"];
                // if (all?.Value is IPythonCollection collection) {
                //     return collection.Contents
                //         .OfType<IPythonConstant>()
                //         .Select(c => c.GetString())
                //         .Where(s => !string.IsNullOrEmpty(s));
                // }
    
                // __all__ is not declared. Try filtering by origin:
                // drop imported modules and generics.
                return Analysis.GlobalScope.Variables
                    .Where(v => !(v.Value?.GetPythonType() is PythonModule)
                                && !(v.Value?.GetPythonType().DeclaringModule is TypingModule && !(this is TypingModule)))
                    // .Where(v => v.Value?.MemberType != PythonMemberType.Generic
                    //             && !(v.Value?.GetPythonType() is PythonModule)
                    //             && !(v.Value?.GetPythonType().DeclaringModule is TypingModule && !(this is TypingModule)))
                    .Select(v => v.Name);

    So theoretically I'm not leaking typing or modules out.

  7. MikhailArkhipov commented on Mar 6, 2019

    @MikhailArkhipov

    OK, sure

  8. added a commit that references this issue on Mar 6, 2019
    1072de6
  9. added a commit that references this issue on Nov 1, 2019
    6c2246a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions