This repository was archived by the owner on Apr 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 133
Lazy types in caching #1757
Merged
Merged
Lazy types in caching #1757
Changes from 105 commits
Commits
Show all changes
116 commits
Select commit
Hold shift + click to select a range
c6a9c22
Remove stale reference
1360827
Merge branch 'master' of https://github.com/microsoft/python-language…
ccaaa02
Merge branch 'master' of https://github.com/microsoft/python-language…
da40dcc
Merge branch 'master' of https://github.com/microsoft/python-language…
c348ac3
Merge branch 'master' of https://github.com/microsoft/python-language…
53bc044
Merge branch 'master' of https://github.com/microsoft/python-language…
484a92a
Merge branch 'master' of https://github.com/MikhailArkhipov/python-la…
e6df3aa
Merge branch 'master' of https://github.com/microsoft/python-language…
1d289d8
Merge branch 'master' of https://github.com/microsoft/python-language…
126f355
Merge branch 'master' of https://github.com/microsoft/python-language…
7e715f3
Merge branch 'master' of https://github.com/microsoft/python-language…
745a3eb
Fix saving of ALL import statements
2a1ca14
Attributes
91f3ca6
Initial
b2e92ff
Partial
32923a5
Merge branch 'master' of https://github.com/microsoft/python-language…
9b691e6
Part I
9612990
Test pass
1b72f4b
Merge branch 'master' of https://github.com/microsoft/python-language…
2fa422b
Partial proxies
832d981
Initial lazy types
d613300
Fix test
cdc7875
AST library test passed
9e6917b
Fix more tests
960ee87
Fix generics
45ed4eb
Handle specialization in dependencies
fd7a285
Merge master
68b2f3b
Merge issues
e68e1b6
Fix os test (posix stub)
800e231
Fix sys.stdin case
d49e246
Better handle circular references, cache models and resolve os.path
013df6a
Improve stub handling
5ebcdfe
Test fixes
3fff06f
Test updates
a928741
Fix deadlock
da64646
Simplify
a5bc47f
Merge branch 'master' of https://github.com/microsoft/python-language…
2b93042
Properly handle caching level setting
2abe2cf
Caching level fix
4711d90
Fix endless analysis
fdbf219
Fix 'missing keys' message with cached modules
01f763b
Optimize IO
d569619
More IO optimizations
f74d5b6
Merge branch 'master' of https://github.com/microsoft/python-language…
2a64510
Full restore tests
f2bd272
Deeper comparison in tests
d8b46ba
Merge branch 'master' of https://github.com/microsoft/python-language…
d7ca27f
Fix instance/class mismatch in operators eval
79e8b2d
Properly handle variables in type.AddMember
f197a6d
Fix function inner members restore
3f9ee9a
Cache models by qualified name
7a488b3
Don't restore all members on GetMember. Improves tensorflow by 30%
c5f2cb8
Turn off indexing of libraries, 25%
dee8420
optimize db access
d7a6fea
fix test
f109701
Remove debug code
c4891cf
Fix comment
6726924
Delete debug file
1d0b1ba
Bump up db version
36aba0b
Bump db version to 5
8b4942c
Merge branch 'master' of https://github.com/microsoft/python-language…
e155470
Test fix
e0de03e
Handle empty bases
a2caf6a
Fix one more 'missing keys' case
aa60787
Remove null declaring module from iterators
d9db6a3
Add queued cache write
3f9e96f
Dispose writer
cd60912
Formatting
72dd9c8
Simplify unique name
4541035
Merge branch 'master' of https://github.com/microsoft/python-language…
ac490f7
Cache unique id against multiple calls
053249a
Delay writing analysis into cache until done.
0b28fa4
Merge branch 'master' of https://github.com/microsoft/python-language…
6109ac7
Don't suppress LHS diagnostics on augmented assign
bcfc3b7
Revert "Don't suppress LHS diagnostics on augmented assign"
0c13e00
Merge branch 'master' of https://github.com/microsoft/python-language…
e8c7a9d
Baseline updates
883fd73
Baselines
2ea1631
Add option to write analysis immediately to disk for tests
471d1f7
Workaround for named tuples naming
8e766a2
Comment
dc286b8
Merge branch 'master' of https://github.com/microsoft/python-language…
1f716e8
Sync builtins creation
e304507
Sync builtins
6e1a119
Usings
6093070
Debug code
63ed836
Merge builtins fix
0de428d
Merge fix
cc909be
Merge master
3229082
Merge branch 'master' of https://github.com/microsoft/python-language…
9ca0422
Fix test code
c771595
Undo accidental checkin
f93aa44
Add handling of exceptions to indexer
3edce72
Update baseline
e397e2a
Improve synchronization of analysis sessions
0564a28
Tweak locks
cd42f79
Reduce lock
6aee99e
Track next session
cfd339a
Better next session tracking
a01d309
Adjust timeout for slower machines
fd9445d
Timeout on slower machines
ad53c29
Extend lock in invalidate
234733e
Revert "Extend lock in invalidate"
e22f03f
Account for modules still in parsing
25fb86a
Unify type member collection lock
2b11782
Correct AST used in stub loop analysis
caf77c9
Unify type member collection lock
10a577e
Spelling
4dbc1b1
Null check
026b40a
Comment out services dispose for test stability since when test compl…
e63a4ac
Remove another dispose
cd68be8
Merge branch 'newdb' of https://github.com/MikhailArkhipov/python-lan…
337ff52
Old code in comments
777d7ee
Relax completion checking
fb93a4f
Undo a bit
11e0f9c
Comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// Copyright(c) Microsoft Corporation | ||
// All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the License); you may not use | ||
// this file except in compliance with the License. You may obtain a copy of the | ||
// License at http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS | ||
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY | ||
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
// MERCHANTABILITY OR NON-INFRINGEMENT. | ||
// | ||
// See the Apache Version 2.0 License for specific language governing | ||
// permissions and limitations under the License. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Microsoft.Python.Analysis.Analyzer.Evaluation; | ||
using Microsoft.Python.Analysis.Diagnostics; | ||
using Microsoft.Python.Analysis.Documents; | ||
using Microsoft.Python.Analysis.Utilities; | ||
using Microsoft.Python.Analysis.Values; | ||
using Microsoft.Python.Core; | ||
using Microsoft.Python.Core.Diagnostics; | ||
using Microsoft.Python.Parsing.Ast; | ||
|
||
namespace Microsoft.Python.Analysis.Analyzer { | ||
/// <summary> | ||
/// Analysis of a module restored from database. | ||
/// </summary> | ||
internal sealed class CachedAnalysis : IDocumentAnalysis { | ||
public CachedAnalysis(IDocument document, IServiceContainer services) { | ||
Check.ArgumentNotNull(nameof(document), document); | ||
Document = document; | ||
ExpressionEvaluator = new ExpressionEval(services, document, AstUtilities.MakeEmptyAst(document.Uri)); | ||
} | ||
|
||
#region IDocumentAnalysis | ||
/// <summary> | ||
/// Analyzed document. | ||
/// </summary> | ||
public IDocument Document { get; } | ||
|
||
/// <summary> | ||
/// Version of the analysis. Usually matches document version, | ||
/// but can be lower when document or its dependencies were | ||
/// updated since. | ||
/// </summary> | ||
public int Version => 0; | ||
|
||
/// <summary> | ||
/// Empty AST. | ||
/// </summary> | ||
public PythonAst Ast => ExpressionEvaluator.Ast; | ||
|
||
/// <summary> | ||
/// Document/module global scope. | ||
/// </summary> | ||
public IGlobalScope GlobalScope => Document.GlobalScope; | ||
|
||
/// <summary> | ||
/// Expression evaluator used in the analysis. | ||
/// Only supports scope operation since there is no AST | ||
/// when library analysis is complete. | ||
/// </summary> | ||
public IExpressionEvaluator ExpressionEvaluator { get; } | ||
|
||
/// <summary> | ||
/// Members of the module which are transferred during a star import. null means __all__ was not defined. | ||
/// </summary> | ||
public IReadOnlyList<string> StarImportMemberNames => Array.Empty<string>(); | ||
|
||
/// <summary> | ||
/// Analysis diagnostics. | ||
/// </summary> | ||
public IEnumerable<DiagnosticsEntry> Diagnostics => Enumerable.Empty<DiagnosticsEntry>(); | ||
#endregion | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.