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.

Numpy analysis is inconsistent from run to run #1414

Closed

Description

import numpy
numpy.

Run analysis, look at icons in the completion list. Reload and run again - you get different set. Ex, 3 sequential runs (look at AxisError, ALLOW_THREADS, DataSource). [abc] icon actually means Unknown

image

image

image

Activity

  1. MikhailArkhipov commented on Aug 19, 2019

    @MikhailArkhipov
    Author

    I'll see if I can get better repro

  2. AlexanderSher commented on Aug 28, 2019

    @AlexanderSher
    Contributor

    Here is the minimal test that reproduces the issue:

            [TestMethod, Priority(0)]
            public async Task LoopImports_Variables() {
                var module1Code = @"
    class A1: 
        def M1(self): return 0; pass
    
    from module2 import y3
    x = y3.M3()
    ";
                var module2Code = @"
    from module1 import A1
    y1 = A1()
    from module3 import A3
    y3 = A3()
    ";
                var module3Code = @"
    class A3:
        def M3(self): return '0'; pass
    
    from module2 import y1
    z = y1.M1()
    ";
    
                var appCode = @"
    from module1 import x
    from module3 import z
    
    x.
    z.";
    
                var module1Uri = TestData.GetTestSpecificUri("module1.py");
                var module2Uri = TestData.GetTestSpecificUri("module2.py");
                var module3Uri = TestData.GetTestSpecificUri("module3.py");
                var appUri = TestData.GetTestSpecificUri("app.py");
    
                var root = Path.GetDirectoryName(appUri.AbsolutePath);
                await CreateServicesAsync(root, PythonVersions.LatestAvailable3X);
                var rdt = Services.GetService<IRunningDocumentTable>();
                var analyzer = Services.GetService<IPythonAnalyzer>();
    
                rdt.OpenDocument(module1Uri, module1Code);
                rdt.OpenDocument(module2Uri, module2Code);
                rdt.OpenDocument(module3Uri, module3Code);
    
                var app = rdt.OpenDocument(appUri, appCode);
                await analyzer.WaitForCompleteAnalysisAsync();
                var analysis = await app.GetAnalysisAsync(-1);
    
                var cs = new CompletionSource(new PlainTextDocumentationSource(), ServerSettings.completion);
                var comps = cs.GetCompletions(analysis, new SourceLocation(5, 3));
                comps.Should().HaveLabels("capitalize");
    
                comps = cs.GetCompletions(analysis, new SourceLocation(6, 3));
                comps.Should().HaveLabels("bit_length");
            }
  3. 6 remaining items

  4. AeneasZhu commented on Oct 8, 2019

    @AeneasZhu

    How to fix #1635 ?

  5. MikhailArkhipov commented on Oct 8, 2019

    @MikhailArkhipov
    Author

    There is no consistent fix. The problem is that analysis sometimes produces results as I showed and sometimes does not. It involves concurrency and circular dependencies between modules in numpy. You may try reloading window and see if the analysis result is different.

  6. MikhailArkhipov commented on Oct 8, 2019

    @MikhailArkhipov
    Author

    Partial PR #1584, parts can be reused.

  7. MikhailArkhipov commented on Oct 11, 2019

    @MikhailArkhipov
    Author

    In favor of #1666

  8. jakebailey commented on Nov 4, 2019

    @jakebailey
    Member

    Closing per #1686.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions