From b605b76da408c072d6234f20437f6dd3ecfd1003 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Fri, 17 May 2019 09:20:28 -0700 Subject: [PATCH 01/82] Remove old qualified name --- .../Types/Definitions/IHasQualifiedName.cs | 38 ------------------- .../Ast/Impl/Types/PythonFunctionType.cs | 6 --- src/Analysis/Ast/Impl/Types/PythonType.cs | 8 +--- .../Ast/Impl/Types/PythonTypeWrapper.cs | 8 +--- .../FluentAssertions/AssertionsUtilities.cs | 20 +++------- 5 files changed, 7 insertions(+), 73 deletions(-) delete mode 100644 src/Analysis/Ast/Impl/Types/Definitions/IHasQualifiedName.cs diff --git a/src/Analysis/Ast/Impl/Types/Definitions/IHasQualifiedName.cs b/src/Analysis/Ast/Impl/Types/Definitions/IHasQualifiedName.cs deleted file mode 100644 index 2b9f9a48b..000000000 --- a/src/Analysis/Ast/Impl/Types/Definitions/IHasQualifiedName.cs +++ /dev/null @@ -1,38 +0,0 @@ -// 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; - -namespace Microsoft.Python.Analysis.Types { - public interface IHasQualifiedName { - /// - /// Gets the fully qualified, dot-separated name of the value. - /// This is typically used for displaying to users. - /// - string FullyQualifiedName { get; } - - /// - /// Gets the import and eval names of the value. The first part - /// should be importable, and the second is a name that can be - /// resolved with getattr(). - /// These are often seen separated with a colon. - /// - /// - /// The value cannot be resolved (for example, a nested function). - /// - KeyValuePair FullyQualifiedNamePair { get; } - } -} diff --git a/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs b/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs index 2008f30fa..7e95cc557 100644 --- a/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs @@ -124,12 +124,6 @@ internal override void SetDocumentationProvider(Func provider) { public IReadOnlyList Overloads => _overloads; #endregion - #region IHasQualifiedName - public override string FullyQualifiedName => FullyQualifiedNamePair.CombineNames(); - public override KeyValuePair FullyQualifiedNamePair => - new KeyValuePair((DeclaringType as IHasQualifiedName)?.FullyQualifiedName ?? DeclaringType?.Name ?? DeclaringModule?.Name, Name); - #endregion - internal void Specialize(string[] dependencies) { _isSpecialized = true; Dependencies = dependencies != null diff --git a/src/Analysis/Ast/Impl/Types/PythonType.cs b/src/Analysis/Ast/Impl/Types/PythonType.cs index 41e9bda1c..b6c0798c6 100644 --- a/src/Analysis/Ast/Impl/Types/PythonType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonType.cs @@ -22,7 +22,7 @@ namespace Microsoft.Python.Analysis.Types { [DebuggerDisplay("{Name}")] - internal class PythonType : LocatedMember, IPythonType, IHasQualifiedName, IEquatable { + internal class PythonType : LocatedMember, IPythonType, IEquatable { private readonly object _lock = new object(); private readonly string _name; private Func _documentationProvider; @@ -98,12 +98,6 @@ public virtual IMember Call(IPythonInstance instance, string memberName, IArgume public virtual IMember Index(IPythonInstance instance, object index) => instance?.Index(index) ?? UnknownType; #endregion - #region IHasQualifiedName - public virtual string FullyQualifiedName => FullyQualifiedNamePair.CombineNames(); - public virtual KeyValuePair FullyQualifiedNamePair - => new KeyValuePair(DeclaringModule?.Name ?? string.Empty, Name); - #endregion - #region IMemberContainer public virtual IMember GetMember(string name) => Members.TryGetValue(name, out var member) ? member : null; public virtual IEnumerable GetMemberNames() => Members.Keys; diff --git a/src/Analysis/Ast/Impl/Types/PythonTypeWrapper.cs b/src/Analysis/Ast/Impl/Types/PythonTypeWrapper.cs index 5201297b1..edd879a58 100644 --- a/src/Analysis/Ast/Impl/Types/PythonTypeWrapper.cs +++ b/src/Analysis/Ast/Impl/Types/PythonTypeWrapper.cs @@ -16,13 +16,12 @@ using System; using System.Collections.Generic; using Microsoft.Python.Analysis.Values; -using Microsoft.Python.Core.Text; namespace Microsoft.Python.Analysis.Types { /// /// Delegates most of the methods to the wrapped/inner class. /// - internal class PythonTypeWrapper : IPythonType, IHasQualifiedName { + internal class PythonTypeWrapper : IPythonType { private readonly BuiltinTypeId _builtinTypeId; private IPythonType _innerType; @@ -86,11 +85,6 @@ public virtual IMember Index(IPythonInstance instance, object index) public virtual IEnumerable GetMemberNames() => InnerType.GetMemberNames(); #endregion - #region IHasQualifiedName - public virtual string FullyQualifiedName => (InnerType as IHasQualifiedName)?.FullyQualifiedName; - public virtual KeyValuePair FullyQualifiedNamePair => (InnerType as IHasQualifiedName)?.FullyQualifiedNamePair ?? default; - #endregion - protected IMember UnknownType => DeclaringModule.Interpreter.UnknownType; public override bool Equals(object obj) diff --git a/src/Analysis/Ast/Test/FluentAssertions/AssertionsUtilities.cs b/src/Analysis/Ast/Test/FluentAssertions/AssertionsUtilities.cs index a30be146a..9be29ed15 100644 --- a/src/Analysis/Ast/Test/FluentAssertions/AssertionsUtilities.cs +++ b/src/Analysis/Ast/Test/FluentAssertions/AssertionsUtilities.cs @@ -31,9 +31,9 @@ public static bool Is3X(IScope scope) => scope.GlobalScope.Module.Interpreter.LanguageVersion.Is3x(); public static void AssertTypeIds( - IEnumerable actualTypeIds, - IEnumerable typeIds, - string name, bool languageVersionIs3X, string because, + IEnumerable actualTypeIds, + IEnumerable typeIds, + string name, bool languageVersionIs3X, string because, object[] reasonArgs, string itemNameSingle = "type", string itemNamePlural = "types") { var expected = typeIds.Select(t => { switch (t) { @@ -163,22 +163,12 @@ private static StringBuilder AppendQuotedName(this StringBuilder stringBuilder, } public static string GetQuotedName(object value) { - string name; - switch (value) { - case IHasQualifiedName _: - case IPythonModule _: - name = GetName(value); - return string.IsNullOrEmpty(name) ? string.Empty : $"'{name}'"; - default: - name = GetName(value); - return string.IsNullOrEmpty(name) ? string.Empty : $"'{name}'"; - } + var name = GetName(value); + return string.IsNullOrEmpty(name) ? string.Empty : $"'{name}'"; } public static string GetName(object value) { switch (value) { - case IHasQualifiedName qualifiedName: - return qualifiedName.FullyQualifiedName; case IPythonModule pythonModule: return pythonModule.Name; case IScope scope: From 5471ce4dbc43f2e8821bd2ee40c4f7362a465d90 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Fri, 17 May 2019 10:12:16 -0700 Subject: [PATCH 02/82] Node storage --- .../Evaluation/ExpressionEval.Callables.cs | 2 +- .../Impl/Analyzer/Symbols/SymbolCollector.cs | 7 +- .../Impl/Extensions/PythonModuleExtensions.cs | 27 +++++ .../Modules/Definitions/IAstNodeContainer.cs | 39 +++++++ src/Analysis/Ast/Impl/Modules/PythonModule.cs | 105 ++++++++++-------- .../Specializations/Typing/TypingModule.cs | 8 +- .../Ast/Impl/Types/PythonFunctionOverload.cs | 43 ++++--- .../Ast/Impl/Types/PythonFunctionType.cs | 31 ++---- .../Ast/Impl/Types/PythonPropertyType.cs | 4 +- src/Analysis/Ast/Impl/Types/PythonType.cs | 18 +-- 10 files changed, 168 insertions(+), 116 deletions(-) create mode 100644 src/Analysis/Ast/Impl/Extensions/PythonModuleExtensions.cs create mode 100644 src/Analysis/Ast/Impl/Modules/Definitions/IAstNodeContainer.cs diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs index f2e79b8a5..87535666c 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs @@ -79,7 +79,7 @@ public IMember GetValueFromLambda(LambdaExpression expr) { var location = GetLocationOfName(expr.Function); var ft = new PythonFunctionType(expr.Function, null, location); - var overload = new PythonFunctionOverload(expr.Function, ft, location); + var overload = new PythonFunctionOverload(ft, location); ft.AddOverload(overload); return ft; } diff --git a/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs b/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs index f09974a28..ef71bf50f 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs @@ -119,8 +119,9 @@ private void AddOverload(FunctionDefinition fd, IPythonClassMember function, Act if (!_table.ReplacedByStubs.Contains(fd)) { var stubOverload = GetOverloadFromStub(fd); if (stubOverload != null) { - if (!string.IsNullOrEmpty(fd.GetDocumentation())) { - stubOverload.SetDocumentationProvider(_ => fd.GetDocumentation()); + var documentation = fd.GetDocumentation(); + if (!string.IsNullOrEmpty(documentation)) { + stubOverload.SetDocumentation(documentation); } addOverload(stubOverload); _table.ReplacedByStubs.Add(fd); @@ -131,7 +132,7 @@ private void AddOverload(FunctionDefinition fd, IPythonClassMember function, Act if (!_table.Contains(fd)) { // Do not evaluate parameter types just yet. During light-weight top-level information // collection types cannot be determined as imports haven't been processed. - var overload = new PythonFunctionOverload(fd, function, _eval.GetLocationOfName(fd)); + var overload = new PythonFunctionOverload(function, _eval.GetLocationOfName(fd)); addOverload(overload); _table.Add(new FunctionEvaluator(_eval, overload)); } diff --git a/src/Analysis/Ast/Impl/Extensions/PythonModuleExtensions.cs b/src/Analysis/Ast/Impl/Extensions/PythonModuleExtensions.cs new file mode 100644 index 000000000..36c55099e --- /dev/null +++ b/src/Analysis/Ast/Impl/Extensions/PythonModuleExtensions.cs @@ -0,0 +1,27 @@ +// 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 Microsoft.Python.Analysis.Modules; +using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Parsing.Ast; + +namespace Microsoft.Python.Analysis { + public static class PythonModuleExtensions { + internal static T GetAstNode(this IPythonModule module, IPythonType t) where T : Node + => ((IAstNodeContainer)module).GetAstNode(t); + internal static void AddAstNode(this IPythonModule module, IPythonType t, Node n) + => ((IAstNodeContainer)module).AddAstNode(t, n); + } +} diff --git a/src/Analysis/Ast/Impl/Modules/Definitions/IAstNodeContainer.cs b/src/Analysis/Ast/Impl/Modules/Definitions/IAstNodeContainer.cs new file mode 100644 index 000000000..f4f04a8d4 --- /dev/null +++ b/src/Analysis/Ast/Impl/Modules/Definitions/IAstNodeContainer.cs @@ -0,0 +1,39 @@ +// 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 Microsoft.Python.Analysis.Types; +using Microsoft.Python.Parsing.Ast; + +namespace Microsoft.Python.Analysis.Modules { + internal interface IAstNodeContainer { + /// + /// Provides access to AST nodes associated with types such as + /// for . + /// Nodes are not available for library modules as AST is not retained + /// in libraries in order to conserve memory. + /// + T GetAstNode(IPythonType t) where T : Node; + + /// + /// Associated AST node with the type. + /// + void AddAstNode(IPythonType t, Node n); + + /// + /// Removes all AST node associations. + /// + void Clear(); + } +} diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.cs index 3aa880aca..c033fc1e0 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.cs @@ -42,7 +42,7 @@ namespace Microsoft.Python.Analysis.Modules { /// to AST and the module analysis. /// [DebuggerDisplay("{Name} : {ModuleType}")] - internal class PythonModule : LocatedMember, IDocument, IAnalyzable, IEquatable { + internal class PythonModule : LocatedMember, IDocument, IAnalyzable, IEquatable, IAstNodeContainer { private enum State { None, Loading, @@ -56,13 +56,13 @@ private enum State { private readonly DocumentBuffer _buffer = new DocumentBuffer(); private readonly DisposeToken _disposeToken = DisposeToken.Create(); private IReadOnlyList _parseErrors = Array.Empty(); + private readonly Dictionary _astMap = new Dictionary(); private readonly IDiagnosticsService _diagnosticsService; private string _documentation; // Must be null initially. private CancellationTokenSource _parseCts; private CancellationTokenSource _linkedParseCts; // combined with 'dispose' cts private Task _parsingTask; - private PythonAst _ast; private bool _updated; protected ILogger Log { get; } @@ -129,7 +129,7 @@ internal PythonModule(ModuleCreationOptions creationOptions, IServiceContainer s public virtual string Documentation { get { - _documentation = _documentation ?? _ast?.Documentation; + _documentation = _documentation ?? GetAstNode(this)?.Documentation; if (_documentation == null) { var m = GetMember("__doc__"); _documentation = m.TryGetConstant(out var s) ? s : string.Empty; @@ -189,39 +189,6 @@ public virtual IEnumerable GetMemberNames() { /// wants to see library code and not a stub. /// public IPythonModule PrimaryModule { get; internal set; } - - protected virtual string LoadContent() { - if (ContentState < State.Loading) { - ContentState = State.Loading; - try { - var code = FileSystem.ReadTextWithRetry(FilePath); - ContentState = State.Loaded; - return code; - } catch (IOException) { } catch (UnauthorizedAccessException) { } - } - return null; // Keep content as null so module can be loaded later. - } - - private void InitializeContent(string content, int version) { - lock (AnalysisLock) { - LoadContent(content, version); - - var startParse = ContentState < State.Parsing && (_parsingTask == null || version > 0); - if (startParse) { - Parse(); - } - } - } - - private void LoadContent(string content, int version) { - if (ContentState < State.Loading) { - try { - content = content ?? LoadContent(); - _buffer.Reset(version, content); - ContentState = State.Loaded; - } catch (IOException) { } catch (UnauthorizedAccessException) { } - } - } #endregion #region IDisposable @@ -282,10 +249,10 @@ public async Task GetAstAsync(CancellationToken cancellationToken = d } } cancellationToken.ThrowIfCancellationRequested(); - return _ast; + return GetAstNode(this); } - public PythonAst GetAnyAst() => _ast; + public PythonAst GetAnyAst() => GetAstNode(this); /// /// Provides collection of parsing errors, if any. @@ -359,7 +326,7 @@ private void Parse(CancellationToken cancellationToken) { if (version != _buffer.Version) { throw new OperationCanceledException(); } - _ast = ast; + _astMap[this] = ast; _parseErrors = sink?.Diagnostics ?? Array.Empty(); // Do not report issues with libraries or stubs @@ -450,6 +417,19 @@ public void NotifyAnalysisComplete(IDocumentAnalysis analysis) { protected virtual void OnAnalysisComplete() { } #endregion + #region IEquatable + public bool Equals(IPythonModule other) => Name.Equals(other?.Name) && FilePath.Equals(other?.FilePath); + #endregion + + #region IAstNodeContainer + public T GetAstNode(IPythonType t) where T : Node => _astMap.TryGetValue(t, out var n) ? (T)n : null; + public void AddAstNode(IPythonType t, Node n) { + Debug.Assert(!_astMap.ContainsKey(t)); + _astMap[t] = n; + } + public void Clear() => _astMap.Clear(); + #endregion + #region Analysis public IDocumentAnalysis GetAnyAnalysis() => Analysis; @@ -458,14 +438,42 @@ public Task GetAnalysisAsync(int waitTime = 200, Cancellation #endregion - private void RemoveReferencesInModule(IPythonModule module) { - if (module.GlobalScope?.Variables != null) { - foreach (var v in module.GlobalScope.Variables) { - v.RemoveReferences(this); + #region Content management + protected virtual string LoadContent() { + if (ContentState < State.Loading) { + ContentState = State.Loading; + try { + var code = FileSystem.ReadTextWithRetry(FilePath); + ContentState = State.Loaded; + return code; + } catch (IOException) { } catch (UnauthorizedAccessException) { } + } + return null; // Keep content as null so module can be loaded later. + } + + private void InitializeContent(string content, int version) { + lock (AnalysisLock) { + LoadContent(content, version); + + var startParse = ContentState < State.Parsing && (_parsingTask == null || version > 0); + if (startParse) { + Parse(); } } } + private void LoadContent(string content, int version) { + if (ContentState < State.Loading) { + try { + content = content ?? LoadContent(); + _buffer.Reset(version, content); + ContentState = State.Loaded; + } catch (IOException) { } catch (UnauthorizedAccessException) { } + } + } + #endregion + + #region Documentation private string TryGetDocFromModuleInitFile() { if (string.IsNullOrEmpty(FilePath) || !FileSystem.FileExists(FilePath)) { return string.Empty; @@ -496,7 +504,7 @@ private string TryGetDocFromModuleInitFile() { // Also, handle quadruple+ quotes. line = line.Trim(); line = line.All(c => c == quote[0]) ? quote : line; - if (line.EndsWithOrdinal(quote) && line.IndexOf(quote, StringComparison.Ordinal) < line.LastIndexOf(quote, StringComparison.Ordinal)) { + if (line.EndsWithOrdinal(quote) && line.IndexOf(quote, StringComparison.Ordinal) < line.LastIndexOf(quote, StringComparison.Ordinal)) { return line.Substring(quote.Length, line.Length - 2 * quote.Length).Trim(); } var sb = new StringBuilder(); @@ -513,7 +521,14 @@ private string TryGetDocFromModuleInitFile() { } catch (IOException) { } catch (UnauthorizedAccessException) { } return string.Empty; } + #endregion - public bool Equals(IPythonModule other) => Name.Equals(other?.Name) && FilePath.Equals(other?.FilePath); + private void RemoveReferencesInModule(IPythonModule module) { + if (module.GlobalScope?.Variables != null) { + foreach (var v in module.GlobalScope.Variables) { + v.RemoveReferences(this); + } + } + } } } diff --git a/src/Analysis/Ast/Impl/Specializations/Typing/TypingModule.cs b/src/Analysis/Ast/Impl/Specializations/Typing/TypingModule.cs index d91afe25c..cf9be594d 100644 --- a/src/Analysis/Ast/Impl/Specializations/Typing/TypingModule.cs +++ b/src/Analysis/Ast/Impl/Specializations/Typing/TypingModule.cs @@ -46,7 +46,7 @@ private void SpecializeMembers() { var location = new Location(this, default); // TypeVar - var fn = new PythonFunctionType("TypeVar", location, null, GetMemberDocumentation); + var fn = new PythonFunctionType("TypeVar", location, null, GetMemberDocumentation("TypeVar")); var o = new PythonFunctionOverload(fn.Name, location); // When called, create generic parameter type. For documentation // use original TypeVar declaration so it appear as a tooltip. @@ -57,7 +57,7 @@ private void SpecializeMembers() { _members["TypeVar"] = fn; // NewType - fn = new PythonFunctionType("NewType", location, null, GetMemberDocumentation); + fn = new PythonFunctionType("NewType", location, null, GetMemberDocumentation("NewType")); o = new PythonFunctionOverload(fn.Name, location); // When called, create generic parameter type. For documentation // use original TypeVar declaration so it appear as a tooltip. @@ -66,7 +66,7 @@ private void SpecializeMembers() { _members["NewType"] = fn; // NewType - fn = new PythonFunctionType("Type", location, null, GetMemberDocumentation); + fn = new PythonFunctionType("Type", location, null, GetMemberDocumentation("Type")); o = new PythonFunctionOverload(fn.Name, location); // When called, create generic parameter type. For documentation // use original TypeVar declaration so it appear as a tooltip. @@ -124,7 +124,7 @@ private void SpecializeMembers() { _members["SupportsBytes"] = Interpreter.GetBuiltinType(BuiltinTypeId.Bytes); _members["ByteString"] = Interpreter.GetBuiltinType(BuiltinTypeId.Bytes); - fn = new PythonFunctionType("NamedTuple", location, null, GetMemberDocumentation); + fn = new PythonFunctionType("NamedTuple", location, null, GetMemberDocumentation("NamedTuple")); o = new PythonFunctionOverload(fn.Name, location); o.SetReturnValueProvider((interpreter, overload, args) => CreateNamedTuple(args.Values())); fn.AddOverload(o); diff --git a/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs b/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs index 6215512ad..33f47eb04 100644 --- a/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs +++ b/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs @@ -47,15 +47,26 @@ internal sealed class PythonFunctionOverload : LocatedMember, IPythonFunctionOve // Return value can be an instance or a type info. Consider type(C()) returning // type info of C vs. return C() that returns an instance of C. - private Func _documentationProvider; private bool _fromAnnotation; + private string _documentation; - public PythonFunctionOverload(FunctionDefinition fd, IPythonClassMember classMember, Location location) - : this(fd.Name, location) { - FunctionDefinition = fd; - ClassMember = classMember; + public PythonFunctionOverload(IPythonClassMember cm, Location location) + : this(cm.Name, location) { + ClassMember = cm; var ast = (location.Module as IDocument)?.Analysis.Ast; - _returnDocumentation = ast != null ? fd.ReturnAnnotation?.ToCodeString(ast) : null; + + FunctionDefinition fd = null; + switch(cm) { + case IPythonFunctionType ft: + fd = ft.FunctionDefinition; + break; + case IPythonPropertyType prop: + fd = prop.FunctionDefinition; + break; + } + + _documentation = fd?.Documentation; + _returnDocumentation = ast != null ? fd?.ReturnAnnotation?.ToCodeString(ast) : null; } public PythonFunctionOverload(string name, Location location) : base(location) { @@ -68,9 +79,6 @@ public PythonFunctionOverload(string name, Location location) : base(location) { internal void SetParameters(IReadOnlyList parameters) => Parameters = parameters; - internal void SetDocumentationProvider(Func documentationProvider) - => _documentationProvider = _documentationProvider ?? documentationProvider; - internal void AddReturnValue(IMember value) { if (value.IsUnknown()) { return; // Don't add useless values. @@ -94,23 +102,14 @@ internal void SetReturnValue(IMember value, bool fromAnnotation) { _fromAnnotation = fromAnnotation; } - internal void SetReturnValueProvider(ReturnValueProvider provider) - => _returnValueProvider = provider; + internal void SetReturnValueProvider(ReturnValueProvider provider) => _returnValueProvider = provider; + internal void SetDocumentation(string documentation) => _documentation = documentation; #region IPythonFunctionOverload - public FunctionDefinition FunctionDefinition { get; } + public FunctionDefinition FunctionDefinition => ClassMember.DeclaringModule.GetAstNode(ClassMember); public IPythonClassMember ClassMember { get; } public string Name { get; } - - public string Documentation { - get { - var s = _documentationProvider?.Invoke(Name); - if (string.IsNullOrEmpty(s)) { - s = FunctionDefinition.GetDocumentation(); - } - return s ?? string.Empty; - } - } + public string Documentation => _documentation ?? ClassMember.Documentation; public string GetReturnDocumentation(IPythonType self = null) { if (self == null) { diff --git a/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs b/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs index 7e95cc557..6708076e0 100644 --- a/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs @@ -53,21 +53,7 @@ public PythonFunctionType( Location location, IPythonType declaringType, string documentation - ) : this(name, location, declaringType, _ => documentation) { - Check.ArgumentNotNull(nameof(location), location.Module); - } - - /// - /// Creates function type to use in special cases when function is dynamically - /// created, such as in specializations and custom iterators, without the actual - /// function definition in the AST. - /// - public PythonFunctionType( - string name, - Location location, - IPythonType declaringType, - Func documentationProvider - ) : base(name, location, documentationProvider, declaringType != null ? BuiltinTypeId.Method : BuiltinTypeId.Function) { + ) : base(name, location, documentation, declaringType != null ? BuiltinTypeId.Method : BuiltinTypeId.Function) { DeclaringType = declaringType; } @@ -75,10 +61,9 @@ public PythonFunctionType( FunctionDefinition fd, IPythonType declaringType, Location location - ) : base(fd.Name, location, fd.Documentation, - declaringType != null ? BuiltinTypeId.Method : BuiltinTypeId.Function) { + ) : base(fd.Name, location, fd.Documentation, declaringType != null ? BuiltinTypeId.Method : BuiltinTypeId.Function) { - FunctionDefinition = fd; + location.Module.AddAstNode(this, fd); DeclaringType = declaringType; if (fd.Name == "__init__") { @@ -88,7 +73,6 @@ Location location } #region IPythonType - public override PythonMemberType MemberType => TypeId == BuiltinTypeId.Function ? PythonMemberType.Function : PythonMemberType.Method; @@ -98,18 +82,17 @@ public override IMember Call(IPythonInstance instance, string memberName, IArgum return overload?.Call(args, instance?.GetPythonType() ?? DeclaringType); } - internal override void SetDocumentationProvider(Func provider) { + internal override void SetDocumentation(string documentation) { foreach (var o in Overloads) { - (o as PythonFunctionOverload)?.SetDocumentationProvider(provider); + (o as PythonFunctionOverload)?.SetDocumentation(documentation); } - - base.SetDocumentationProvider(provider); + base.SetDocumentation(documentation); } #endregion #region IPythonFunction - public FunctionDefinition FunctionDefinition { get; } + public FunctionDefinition FunctionDefinition => DeclaringModule.GetAstNode(this); public IPythonType DeclaringType { get; } public override string Documentation => _documentation ?? base.Documentation ?? (_overloads.Count > 0 ? _overloads[0].Documentation : default); public virtual bool IsClassMethod { get; private set; } diff --git a/src/Analysis/Ast/Impl/Types/PythonPropertyType.cs b/src/Analysis/Ast/Impl/Types/PythonPropertyType.cs index 87ee5f713..f10078945 100644 --- a/src/Analysis/Ast/Impl/Types/PythonPropertyType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonPropertyType.cs @@ -23,7 +23,7 @@ class PythonPropertyType : PythonType, IPythonPropertyType { public PythonPropertyType(FunctionDefinition fd, Location location, IPythonType declaringType, bool isAbstract) : this(fd.Name, location, declaringType, isAbstract) { - FunctionDefinition = fd; + declaringType.DeclaringModule.AddAstNode(this, fd); } public PythonPropertyType(string name, Location location, IPythonType declaringType, bool isAbstract) @@ -37,7 +37,7 @@ public PythonPropertyType(string name, Location location, IPythonType declaringT #endregion #region IPythonPropertyType - public FunctionDefinition FunctionDefinition { get; } + public FunctionDefinition FunctionDefinition => DeclaringModule.GetAstNode(this); public override bool IsAbstract { get; } public bool IsReadOnly => true; public IPythonType DeclaringType { get; } diff --git a/src/Analysis/Ast/Impl/Types/PythonType.cs b/src/Analysis/Ast/Impl/Types/PythonType.cs index b6c0798c6..0c123906c 100644 --- a/src/Analysis/Ast/Impl/Types/PythonType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonType.cs @@ -25,8 +25,6 @@ namespace Microsoft.Python.Analysis.Types { internal class PythonType : LocatedMember, IPythonType, IEquatable { private readonly object _lock = new object(); private readonly string _name; - private Func _documentationProvider; - private string _documentation; private Dictionary _members; private BuiltinTypeId _typeId; private bool _readonly; @@ -42,16 +40,7 @@ public PythonType( string documentation, BuiltinTypeId typeId = BuiltinTypeId.Unknown ) : this(name, location, typeId) { - _documentation = documentation; - } - - public PythonType( - string name, - Location location, - Func documentationProvider, - BuiltinTypeId typeId = BuiltinTypeId.Unknown - ) : this(name, location, typeId) { - _documentationProvider = documentationProvider; + Documentation = documentation; } private PythonType(string name, Location location, BuiltinTypeId typeId) : base(location) { @@ -67,7 +56,7 @@ private PythonType(string name, Location location, BuiltinTypeId typeId) : base( #region IPythonType public virtual string Name => TypeId == BuiltinTypeId.Ellipsis ? "..." : _name; - public virtual string Documentation => _documentationProvider != null ? _documentationProvider.Invoke(Name) : _documentation; + public virtual string Documentation { get; private set; } public virtual BuiltinTypeId TypeId => _typeId; public bool IsBuiltin => DeclaringModule == null || DeclaringModule is IBuiltinsPythonModule; public virtual bool IsAbstract => false; @@ -111,8 +100,7 @@ internal bool TrySetTypeId(BuiltinTypeId typeId) { return true; } - internal virtual void SetDocumentationProvider(Func provider) => _documentationProvider = provider; - internal virtual void SetDocumentation(string documentation) => _documentation = documentation; + internal virtual void SetDocumentation(string documentation) => Documentation = documentation; internal void AddMembers(IEnumerable variables, bool overwrite) { lock (_lock) { From 8a8d847705a5e47ac06a1574ea5874c850d522ee Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Fri, 17 May 2019 10:20:01 -0700 Subject: [PATCH 03/82] Class and scope to use AST map --- .../Ast/Impl/Extensions/PythonModuleExtensions.cs | 8 ++++---- .../Ast/Impl/Modules/Definitions/IAstNodeContainer.cs | 8 ++++---- src/Analysis/Ast/Impl/Modules/PythonModule.cs | 10 +++++----- src/Analysis/Ast/Impl/Types/PythonClassType.cs | 4 ++-- src/Analysis/Ast/Impl/Values/Scope.cs | 5 ++--- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/Analysis/Ast/Impl/Extensions/PythonModuleExtensions.cs b/src/Analysis/Ast/Impl/Extensions/PythonModuleExtensions.cs index 36c55099e..6b5b5f22d 100644 --- a/src/Analysis/Ast/Impl/Extensions/PythonModuleExtensions.cs +++ b/src/Analysis/Ast/Impl/Extensions/PythonModuleExtensions.cs @@ -19,9 +19,9 @@ namespace Microsoft.Python.Analysis { public static class PythonModuleExtensions { - internal static T GetAstNode(this IPythonModule module, IPythonType t) where T : Node - => ((IAstNodeContainer)module).GetAstNode(t); - internal static void AddAstNode(this IPythonModule module, IPythonType t, Node n) - => ((IAstNodeContainer)module).AddAstNode(t, n); + internal static T GetAstNode(this IPythonModule module, object o) where T : Node + => ((IAstNodeContainer)module).GetAstNode(o); + internal static void AddAstNode(this IPythonModule module, object o, Node n) + => ((IAstNodeContainer)module).AddAstNode(o, n); } } diff --git a/src/Analysis/Ast/Impl/Modules/Definitions/IAstNodeContainer.cs b/src/Analysis/Ast/Impl/Modules/Definitions/IAstNodeContainer.cs index f4f04a8d4..c6fb7ce74 100644 --- a/src/Analysis/Ast/Impl/Modules/Definitions/IAstNodeContainer.cs +++ b/src/Analysis/Ast/Impl/Modules/Definitions/IAstNodeContainer.cs @@ -19,17 +19,17 @@ namespace Microsoft.Python.Analysis.Modules { internal interface IAstNodeContainer { /// - /// Provides access to AST nodes associated with types such as + /// Provides access to AST nodes associated with objects such as /// for . /// Nodes are not available for library modules as AST is not retained /// in libraries in order to conserve memory. /// - T GetAstNode(IPythonType t) where T : Node; + T GetAstNode(object o) where T : Node; /// - /// Associated AST node with the type. + /// Associated AST node with the object. /// - void AddAstNode(IPythonType t, Node n); + void AddAstNode(object o, Node n); /// /// Removes all AST node associations. diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.cs index c033fc1e0..d7cd58814 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.cs @@ -56,7 +56,7 @@ private enum State { private readonly DocumentBuffer _buffer = new DocumentBuffer(); private readonly DisposeToken _disposeToken = DisposeToken.Create(); private IReadOnlyList _parseErrors = Array.Empty(); - private readonly Dictionary _astMap = new Dictionary(); + private readonly Dictionary _astMap = new Dictionary(); private readonly IDiagnosticsService _diagnosticsService; private string _documentation; // Must be null initially. @@ -422,10 +422,10 @@ protected virtual void OnAnalysisComplete() { } #endregion #region IAstNodeContainer - public T GetAstNode(IPythonType t) where T : Node => _astMap.TryGetValue(t, out var n) ? (T)n : null; - public void AddAstNode(IPythonType t, Node n) { - Debug.Assert(!_astMap.ContainsKey(t)); - _astMap[t] = n; + public T GetAstNode(object o) where T : Node => _astMap.TryGetValue(o, out var n) ? (T)n : null; + public void AddAstNode(object o, Node n) { + Debug.Assert(!_astMap.ContainsKey(o)); + _astMap[o] = n; } public void Clear() => _astMap.Clear(); #endregion diff --git a/src/Analysis/Ast/Impl/Types/PythonClassType.cs b/src/Analysis/Ast/Impl/Types/PythonClassType.cs index dded0f17d..d189e6ad3 100644 --- a/src/Analysis/Ast/Impl/Types/PythonClassType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonClassType.cs @@ -51,7 +51,7 @@ public PythonClassType( BuiltinTypeId builtinTypeId = BuiltinTypeId.Type ) : base(classDefinition.Name, location, classDefinition.GetDocumentation(), builtinTypeId) { Check.ArgumentNotNull(nameof(location), location.Module); - ClassDefinition = classDefinition; + DeclaringModule.AddAstNode(this, classDefinition); } #region IPythonType @@ -153,7 +153,7 @@ public override IMember Index(IPythonInstance instance, object index) { #endregion #region IPythonClass - public ClassDefinition ClassDefinition { get; } + public ClassDefinition ClassDefinition => DeclaringModule.GetAstNode(this); public IReadOnlyList Bases => _bases; public IReadOnlyList Mro { diff --git a/src/Analysis/Ast/Impl/Values/Scope.cs b/src/Analysis/Ast/Impl/Values/Scope.cs index c62e93d58..53e6fc0bb 100644 --- a/src/Analysis/Ast/Impl/Values/Scope.cs +++ b/src/Analysis/Ast/Impl/Values/Scope.cs @@ -32,16 +32,15 @@ internal class Scope : IScope { private List _childScopes; public Scope(ScopeStatement node, IScope outerScope, IPythonModule module) { - Node = node; OuterScope = outerScope; Module = module; + Module.AddAstNode(this, node); DeclareBuiltinVariables(); } #region IScope - public string Name => Node?.Name ?? ""; - public virtual ScopeStatement Node { get; } + public virtual ScopeStatement Node => Module.GetAstNode(this); public IScope OuterScope { get; } public IPythonModule Module { get; } From 89ce2ca1af0463ab53df92f51f80493a4570098a Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Fri, 17 May 2019 10:31:58 -0700 Subject: [PATCH 04/82] Library analysis --- .../Ast/Impl/Analyzer/DocumentAnalysis.cs | 26 ------ .../Ast/Impl/Analyzer/EmptyAnalysis.cs | 48 +++++++++++ .../Evaluation/ExpressionEval.Annotations.cs | 48 +++++++++++ .../Evaluation/ExpressionEval.Scopes.cs | 28 ------- .../Analyzer/Evaluation/ExpressionEval.cs | 11 ++- .../Ast/Impl/Analyzer/LibraryAnalysis.cs | 84 +++++++++++++++++++ .../Ast/Impl/Analyzer/ModuleWalker.cs | 2 +- .../Impl/Analyzer/PythonAnalyzerSession.cs | 7 +- .../Ast/Impl/Utilities/AstUtilities.cs | 29 +++++++ 9 files changed, 225 insertions(+), 58 deletions(-) create mode 100644 src/Analysis/Ast/Impl/Analyzer/EmptyAnalysis.cs create mode 100644 src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Annotations.cs create mode 100644 src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs create mode 100644 src/Analysis/Ast/Impl/Utilities/AstUtilities.cs diff --git a/src/Analysis/Ast/Impl/Analyzer/DocumentAnalysis.cs b/src/Analysis/Ast/Impl/Analyzer/DocumentAnalysis.cs index 2d6abf826..51e0cd378 100644 --- a/src/Analysis/Ast/Impl/Analyzer/DocumentAnalysis.cs +++ b/src/Analysis/Ast/Impl/Analyzer/DocumentAnalysis.cs @@ -13,17 +13,11 @@ // 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.IO; -using System.Linq; -using Microsoft.Python.Analysis.Analyzer.Evaluation; using Microsoft.Python.Analysis.Diagnostics; using Microsoft.Python.Analysis.Documents; using Microsoft.Python.Analysis.Values; -using Microsoft.Python.Core; using Microsoft.Python.Core.Diagnostics; -using Microsoft.Python.Parsing; using Microsoft.Python.Parsing.Ast; namespace Microsoft.Python.Analysis.Analyzer { @@ -77,24 +71,4 @@ public DocumentAnalysis(IDocument document, int version, IGlobalScope globalScop public IEnumerable Diagnostics => ExpressionEvaluator.Diagnostics; #endregion } - - public sealed class EmptyAnalysis : IDocumentAnalysis { - private static PythonAst _emptyAst; - - public EmptyAnalysis(IServiceContainer services, IDocument document) { - Document = document ?? throw new ArgumentNullException(nameof(document)); - GlobalScope = new EmptyGlobalScope(document); - - _emptyAst = _emptyAst ?? (_emptyAst = Parser.CreateParser(new StringReader(string.Empty), PythonLanguageVersion.None).ParseFile(document.Uri)); - ExpressionEvaluator = new ExpressionEval(services, document, Ast); - } - - public IDocument Document { get; } - public int Version { get; } = -1; - public IGlobalScope GlobalScope { get; } - public PythonAst Ast => _emptyAst; - public IExpressionEvaluator ExpressionEvaluator { get; } - public IReadOnlyList StarImportMemberNames => null; - public IEnumerable Diagnostics => Enumerable.Empty(); - } } diff --git a/src/Analysis/Ast/Impl/Analyzer/EmptyAnalysis.cs b/src/Analysis/Ast/Impl/Analyzer/EmptyAnalysis.cs new file mode 100644 index 000000000..5f62e83ad --- /dev/null +++ b/src/Analysis/Ast/Impl/Analyzer/EmptyAnalysis.cs @@ -0,0 +1,48 @@ +// 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.IO; +using System.Linq; +using Microsoft.Python.Analysis.Analyzer.Evaluation; +using Microsoft.Python.Analysis.Diagnostics; +using Microsoft.Python.Analysis.Documents; +using Microsoft.Python.Analysis.Values; +using Microsoft.Python.Core; +using Microsoft.Python.Parsing; +using Microsoft.Python.Parsing.Ast; + +namespace Microsoft.Python.Analysis.Analyzer { + public sealed class EmptyAnalysis : IDocumentAnalysis { + private static PythonAst _emptyAst; + + public EmptyAnalysis(IServiceContainer services, IDocument document) { + Document = document ?? throw new ArgumentNullException(nameof(document)); + GlobalScope = new EmptyGlobalScope(document); + + _emptyAst = _emptyAst ?? (_emptyAst = Parser.CreateParser(new StringReader(string.Empty), PythonLanguageVersion.None).ParseFile(document.Uri)); + ExpressionEvaluator = new ExpressionEval(services, document, Ast); + } + + public IDocument Document { get; } + public int Version { get; } = -1; + public IGlobalScope GlobalScope { get; } + public PythonAst Ast => _emptyAst; + public IExpressionEvaluator ExpressionEvaluator { get; } + public IReadOnlyList StarImportMemberNames => null; + public IEnumerable Diagnostics => Enumerable.Empty(); + } +} diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Annotations.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Annotations.cs new file mode 100644 index 000000000..a5973ab5c --- /dev/null +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Annotations.cs @@ -0,0 +1,48 @@ +// 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 Microsoft.Python.Analysis.Types; +using Microsoft.Python.Parsing.Ast; + +namespace Microsoft.Python.Analysis.Analyzer.Evaluation { + internal sealed partial class ExpressionEval { + public IPythonType GetTypeFromAnnotation(Expression expr, LookupOptions options = LookupOptions.Global | LookupOptions.Builtins) + => GetTypeFromAnnotation(expr, out _, options); + + public IPythonType GetTypeFromAnnotation(Expression expr, out bool isGeneric, LookupOptions options = LookupOptions.Global | LookupOptions.Builtins) { + isGeneric = false; + switch (expr) { + case null: + return null; + case CallExpression callExpr: + // x: NamedTuple(...) + return GetValueFromCallable(callExpr)?.GetPythonType() ?? UnknownType; + case IndexExpression indexExpr: + // Try generics + var target = GetValueFromExpression(indexExpr.Target); + var result = GetValueFromGeneric(target, indexExpr); + if (result != null) { + isGeneric = true; + return result.GetPythonType(); + } + break; + } + + // Look at specialization and typing first + var ann = new TypeAnnotation(Ast.LanguageVersion, expr); + return ann.GetValue(new TypeAnnotationConverter(this, options)); + } + } +} diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Scopes.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Scopes.cs index a2060a301..f332513d9 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Scopes.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Scopes.cs @@ -21,7 +21,6 @@ using Microsoft.Python.Analysis.Values; using Microsoft.Python.Core; using Microsoft.Python.Core.Disposables; -using Microsoft.Python.Core.Text; using Microsoft.Python.Parsing.Ast; namespace Microsoft.Python.Analysis.Analyzer.Evaluation { @@ -117,33 +116,6 @@ public IMember LookupNameInScopes(string name, out IScope scope, out IVariable v return value; } - public IPythonType GetTypeFromAnnotation(Expression expr, LookupOptions options = LookupOptions.Global | LookupOptions.Builtins) - => GetTypeFromAnnotation(expr, out _, options); - - public IPythonType GetTypeFromAnnotation(Expression expr, out bool isGeneric, LookupOptions options = LookupOptions.Global | LookupOptions.Builtins) { - isGeneric = false; - switch (expr) { - case null: - return null; - case CallExpression callExpr: - // x: NamedTuple(...) - return GetValueFromCallable(callExpr)?.GetPythonType() ?? UnknownType; - case IndexExpression indexExpr: - // Try generics - var target = GetValueFromExpression(indexExpr.Target); - var result = GetValueFromGeneric(target, indexExpr); - if (result != null) { - isGeneric = true; - return result.GetPythonType(); - } - break; - } - - // Look at specialization and typing first - var ann = new TypeAnnotation(Ast.LanguageVersion, expr); - return ann.GetValue(new TypeAnnotationConverter(this, options)); - } - /// /// Locates and opens existing scope for a node or creates a new scope /// as a child of the specified scope. Scope is pushed on the stack diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs index 0a637412c..8bf17895b 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs @@ -20,6 +20,7 @@ using Microsoft.Python.Analysis.Diagnostics; using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Analysis.Utilities; using Microsoft.Python.Analysis.Values; using Microsoft.Python.Core; using Microsoft.Python.Core.Disposables; @@ -37,12 +38,18 @@ internal sealed partial class ExpressionEval : IExpressionEvaluator { private readonly object _lock = new object(); private readonly List _diagnostics = new List(); - public ExpressionEval(IServiceContainer services, IPythonModule module, PythonAst ast) { + public ExpressionEval(IServiceContainer services, IPythonModule module, GlobalScope gs) + : this(services, module, AstUtilities.MakeEmptyAst(module.Uri), gs) { } + + public ExpressionEval(IServiceContainer services, IPythonModule module, PythonAst ast) + : this(services, module, ast, new GlobalScope(module)) { } + + public ExpressionEval(IServiceContainer services, IPythonModule module, PythonAst ast, GlobalScope gs) { Services = services ?? throw new ArgumentNullException(nameof(services)); Module = module ?? throw new ArgumentNullException(nameof(module)); Ast = ast ?? throw new ArgumentNullException(nameof(ast)); - GlobalScope = new GlobalScope(module); + GlobalScope = gs; CurrentScope = GlobalScope; DefaultLocation = new Location(module); //Log = services.GetService(); diff --git a/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs b/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs new file mode 100644 index 000000000..3c8a76575 --- /dev/null +++ b/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs @@ -0,0 +1,84 @@ +// 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.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.Modules; +using Microsoft.Python.Analysis.Values; +using Microsoft.Python.Core; +using Microsoft.Python.Core.Diagnostics; +using Microsoft.Python.Parsing.Ast; + +namespace Microsoft.Python.Analysis.Analyzer { + /// + /// Analysis of a library code. + /// + internal sealed class LibraryAnalysis : IDocumentAnalysis { + public LibraryAnalysis(IDocument document, int version, IServiceContainer services, GlobalScope globalScope, IReadOnlyList starImportMemberNames) { + Check.ArgumentNotNull(nameof(document), document); + Check.ArgumentNotNull(nameof(globalScope), globalScope); + Document = document; + Version = version; + GlobalScope = globalScope; + ExpressionEvaluator = new ExpressionEval(services, document, globalScope); + StarImportMemberNames = starImportMemberNames; + ((IAstNodeContainer)Document).Clear(); + } + + #region IDocumentAnalysis + /// + /// Analyzed document. + /// + public IDocument Document { get; } + + /// + /// Version of the analysis. Usually matches document version, + /// but can be lower when document or its dependencies were + /// updated since. + /// + public int Version { get; } + + /// + /// Empty AST. + /// + public PythonAst Ast => ExpressionEvaluator.Ast; + + /// + /// Document/module global scope. + /// + public IGlobalScope GlobalScope { get; } + + /// + /// Expression evaluator used in the analysis. + /// Only supports scope operation since there is no AST + /// when library analysis is complete. + /// + public IExpressionEvaluator ExpressionEvaluator { get; } + + /// + /// Members of the module which are transferred during a star import. null means __all__ was not defined. + /// + public IReadOnlyList StarImportMemberNames { get; } + + /// + /// Analysis diagnostics. + /// + public IEnumerable Diagnostics => Enumerable.Empty(); + #endregion + } +} diff --git a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs index 1ad20860d..19784204f 100644 --- a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs +++ b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs @@ -206,7 +206,7 @@ public void Complete() { Eval.ClearCache(); } - public IGlobalScope GlobalScope => Eval.GlobalScope; + public GlobalScope GlobalScope => Eval.GlobalScope; public IReadOnlyList StarImportMemberNames { get; private set; } /// diff --git a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs index ca2a0a7df..fbe7d8ac4 100644 --- a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs +++ b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs @@ -349,7 +349,7 @@ private void AnalyzeEntry(PythonAnalyzerEntry entry, IPythonModule module, Pytho walker.Complete(); _analyzerCancellationToken.ThrowIfCancellationRequested(); - var analysis = new DocumentAnalysis((IDocument)module, version, walker.GlobalScope, walker.Eval, walker.StarImportMemberNames); + var analysis = CreateAnalysis((IDocument)module, version, walker); analyzable?.NotifyAnalysisComplete(analysis); entry.TrySetAnalysis(analysis, version); @@ -365,5 +365,10 @@ private enum State { Started = 1, Completed = 2 } + + private IDocumentAnalysis CreateAnalysis(IDocument document, int version, ModuleWalker walker) + => document.ModuleType == ModuleType.User + ? (IDocumentAnalysis)new DocumentAnalysis(document, version, walker.GlobalScope, walker.Eval, walker.StarImportMemberNames) + : new LibraryAnalysis(document, version, walker.Eval.Services, walker.GlobalScope, walker.StarImportMemberNames); } } diff --git a/src/Analysis/Ast/Impl/Utilities/AstUtilities.cs b/src/Analysis/Ast/Impl/Utilities/AstUtilities.cs new file mode 100644 index 000000000..816b0c304 --- /dev/null +++ b/src/Analysis/Ast/Impl/Utilities/AstUtilities.cs @@ -0,0 +1,29 @@ +// 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.IO; +using Microsoft.Python.Parsing; +using Microsoft.Python.Parsing.Ast; + +namespace Microsoft.Python.Analysis.Utilities { + public static class AstUtilities { + public static PythonAst MakeEmptyAst(Uri documentUri) { + using (var sr = new StringReader(string.Empty)) { + return Parser.CreateParser(sr, PythonLanguageVersion.None).ParseFile(documentUri); + } + } + } +} From 7a93bf7a85d65e3081e14bf99e7f25fc6ab33734 Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Sat, 18 May 2019 11:04:33 -0700 Subject: [PATCH 05/82] Fix SO --- .../Analyzer/Definitions/IPythonAnalyzer.cs | 2 +- .../Ast/Impl/Analyzer/PythonAnalyzer.cs | 10 ++++------ .../Ast/Impl/Analyzer/PythonAnalyzerEntry.cs | 18 +++++++----------- .../Impl/Extensions/PythonModuleExtensions.cs | 3 +++ src/Analysis/Ast/Impl/Modules/PythonModule.cs | 6 +++--- .../Ast/Impl/Types/PythonFunctionOverload.cs | 6 ++---- .../Ast/Impl/Types/PythonFunctionType.cs | 11 ++++------- src/Analysis/Ast/Impl/Values/Scope.cs | 6 ++++-- src/LanguageServer/Impl/Program.cs | 2 +- 9 files changed, 29 insertions(+), 35 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/Definitions/IPythonAnalyzer.cs b/src/Analysis/Ast/Impl/Analyzer/Definitions/IPythonAnalyzer.cs index 1922eb08e..94a298a26 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Definitions/IPythonAnalyzer.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Definitions/IPythonAnalyzer.cs @@ -27,7 +27,7 @@ public interface IPythonAnalyzer { /// /// Schedules module for analysis. Module will be scheduled if version of AST is greater than the one used to get previous analysis /// - void EnqueueDocumentForAnalysis(IPythonModule module, PythonAst ast, int version); + void EnqueueDocumentForAnalysis(IPythonModule module, int version); /// /// Schedules module for analysis for its existing AST, but with new dependencies. diff --git a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzer.cs b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzer.cs index 888a6a945..c6d88f9e2 100644 --- a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzer.cs +++ b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzer.cs @@ -30,7 +30,6 @@ using Microsoft.Python.Core.Disposables; using Microsoft.Python.Core.Logging; using Microsoft.Python.Core.Services; -using Microsoft.Python.Parsing.Ast; namespace Microsoft.Python.Analysis.Analyzer { public sealed class PythonAnalyzer : IPythonAnalyzer, IDisposable { @@ -63,9 +62,8 @@ public void Dispose() { _disposeToken.TryMarkDisposed(); } - public Task WaitForCompleteAnalysisAsync(CancellationToken cancellationToken = default) { - return _analysisCompleteEvent.WaitAsync(cancellationToken); - } + public Task WaitForCompleteAnalysisAsync(CancellationToken cancellationToken = default) + => _analysisCompleteEvent.WaitAsync(cancellationToken); public async Task GetAnalysisAsync(IPythonModule module, int waitTime, CancellationToken cancellationToken) { var key = new AnalysisModuleKey(module); @@ -144,7 +142,7 @@ public void EnqueueDocumentForAnalysis(IPythonModule module, ImmutableArray _analysisTcs; private IPythonModule _module; private bool _isUserModule; - private PythonAst _ast; private IDocumentAnalysis _previousAnalysis; private HashSet _parserDependencies; private HashSet _analysisDependencies; @@ -102,7 +101,7 @@ public Task GetAnalysisAsync(CancellationToken cancellationTo public bool IsValidVersion(int version, out IPythonModule module, out PythonAst ast) { lock (_syncObj) { module = _module; - ast = _ast; + ast = module.GetAst(); if (ast == null || module == null) { return false; } @@ -210,19 +209,18 @@ public bool Invalidate(ImmutableArray analysisDependencies, int a } } - public bool Invalidate(IPythonModule module, PythonAst ast, int bufferVersion, int analysisVersion, out ImmutableArray dependencies) { + public bool Invalidate(IPythonModule module, int bufferVersion, int analysisVersion, out ImmutableArray dependencies) { dependencies = ImmutableArray.Empty; if (_bufferVersion >= bufferVersion) { return false; } - var dependenciesHashSet = FindDependencies(module, ast, bufferVersion); + var dependenciesHashSet = FindDependencies(module, bufferVersion); lock (_syncObj) { if (_analysisVersion >= analysisVersion && _bufferVersion >= bufferVersion) { return false; } - _ast = ast; _module = module; _isUserModule = module.ModuleType == ModuleType.User; _parserDependencies = dependenciesHashSet; @@ -236,13 +234,13 @@ public bool Invalidate(IPythonModule module, PythonAst ast, int bufferVersion, i } } - private HashSet FindDependencies(IPythonModule module, PythonAst ast, int bufferVersion) { + private HashSet FindDependencies(IPythonModule module, int bufferVersion) { if (_bufferVersion > bufferVersion) { return new HashSet(); } - var walker = new DependencyWalker(this, module); - ast.Walk(walker); + var walker = new DependencyWalker(module); + module.GetAst().Walk(walker); var dependencies = walker.Dependencies; dependencies.Remove(new AnalysisModuleKey(module)); return dependencies; @@ -264,7 +262,6 @@ private void UpdateAnalysisTcs(int analysisVersion) { } private class DependencyWalker : PythonWalker { - private readonly PythonAnalyzerEntry _entry; private readonly IPythonModule _module; private readonly bool _isTypeshed; private readonly IModuleManagement _moduleResolution; @@ -272,8 +269,7 @@ private class DependencyWalker : PythonWalker { public HashSet Dependencies { get; } - public DependencyWalker(PythonAnalyzerEntry entry, IPythonModule module) { - _entry = entry; + public DependencyWalker(IPythonModule module) { _module = module; _isTypeshed = module is StubPythonModule stub && stub.IsTypeshed; _moduleResolution = module.Interpreter.ModuleResolution; diff --git a/src/Analysis/Ast/Impl/Extensions/PythonModuleExtensions.cs b/src/Analysis/Ast/Impl/Extensions/PythonModuleExtensions.cs index 6b5b5f22d..c33b4620f 100644 --- a/src/Analysis/Ast/Impl/Extensions/PythonModuleExtensions.cs +++ b/src/Analysis/Ast/Impl/Extensions/PythonModuleExtensions.cs @@ -19,6 +19,9 @@ namespace Microsoft.Python.Analysis { public static class PythonModuleExtensions { + internal static PythonAst GetAst(this IPythonModule module) + => ((IAstNodeContainer)module).GetAstNode(module); + internal static T GetAstNode(this IPythonModule module, object o) where T : Node => ((IAstNodeContainer)module).GetAstNode(o); internal static void AddAstNode(this IPythonModule module, object o, Node n) diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.cs index d7cd58814..9a05b8d99 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.cs @@ -343,7 +343,7 @@ private void Parse(CancellationToken cancellationToken) { ContentState = State.Analyzing; var analyzer = Services.GetService(); - analyzer.EnqueueDocumentForAnalysis(this, ast, version); + analyzer.EnqueueDocumentForAnalysis(this, version); } lock (AnalysisLock) { @@ -424,10 +424,10 @@ protected virtual void OnAnalysisComplete() { } #region IAstNodeContainer public T GetAstNode(object o) where T : Node => _astMap.TryGetValue(o, out var n) ? (T)n : null; public void AddAstNode(object o, Node n) { - Debug.Assert(!_astMap.ContainsKey(o)); + Debug.Assert(!_astMap.ContainsKey(o) || _astMap[o] == n); _astMap[o] = n; } - public void Clear() => _astMap.Clear(); + public void Clear() =>_astMap.Clear(); #endregion #region Analysis diff --git a/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs b/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs index 33f47eb04..51e28f638 100644 --- a/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs +++ b/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs @@ -48,7 +48,6 @@ internal sealed class PythonFunctionOverload : LocatedMember, IPythonFunctionOve // Return value can be an instance or a type info. Consider type(C()) returning // type info of C vs. return C() that returns an instance of C. private bool _fromAnnotation; - private string _documentation; public PythonFunctionOverload(IPythonClassMember cm, Location location) : this(cm.Name, location) { @@ -65,7 +64,6 @@ public PythonFunctionOverload(IPythonClassMember cm, Location location) break; } - _documentation = fd?.Documentation; _returnDocumentation = ast != null ? fd?.ReturnAnnotation?.ToCodeString(ast) : null; } @@ -103,13 +101,13 @@ internal void SetReturnValue(IMember value, bool fromAnnotation) { } internal void SetReturnValueProvider(ReturnValueProvider provider) => _returnValueProvider = provider; - internal void SetDocumentation(string documentation) => _documentation = documentation; + internal void SetDocumentation(string documentation) => Documentation = documentation; #region IPythonFunctionOverload public FunctionDefinition FunctionDefinition => ClassMember.DeclaringModule.GetAstNode(ClassMember); public IPythonClassMember ClassMember { get; } public string Name { get; } - public string Documentation => _documentation ?? ClassMember.Documentation; + public string Documentation { get; private set; } public string GetReturnDocumentation(IPythonType self = null) { if (self == null) { diff --git a/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs b/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs index 6708076e0..c05db492e 100644 --- a/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs @@ -13,7 +13,6 @@ // 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.Diagnostics; using System.Linq; @@ -27,7 +26,6 @@ namespace Microsoft.Python.Analysis.Types { [DebuggerDisplay("Function {Name} ({TypeId})")] internal class PythonFunctionType : PythonType, IPythonFunctionType { private ImmutableArray _overloads = ImmutableArray.Empty; - private readonly string _documentation; private bool _isAbstract; private bool _isSpecialized; @@ -61,14 +59,13 @@ public PythonFunctionType( FunctionDefinition fd, IPythonType declaringType, Location location - ) : base(fd.Name, location, fd.Documentation, declaringType != null ? BuiltinTypeId.Method : BuiltinTypeId.Function) { + ) : base(fd.Name, location, + fd.Name == "__init__" ? declaringType?.Documentation : fd.Documentation, + declaringType != null ? BuiltinTypeId.Method : BuiltinTypeId.Function) { location.Module.AddAstNode(this, fd); DeclaringType = declaringType; - if (fd.Name == "__init__") { - _documentation = declaringType?.Documentation; - } ProcessDecorators(fd); } @@ -94,7 +91,7 @@ internal override void SetDocumentation(string documentation) { #region IPythonFunction public FunctionDefinition FunctionDefinition => DeclaringModule.GetAstNode(this); public IPythonType DeclaringType { get; } - public override string Documentation => _documentation ?? base.Documentation ?? (_overloads.Count > 0 ? _overloads[0].Documentation : default); + public override string Documentation => (_overloads.Count > 0 ? _overloads[0].Documentation : default) ?? base.Documentation; public virtual bool IsClassMethod { get; private set; } public virtual bool IsStatic { get; private set; } public override bool IsAbstract => _isAbstract; diff --git a/src/Analysis/Ast/Impl/Values/Scope.cs b/src/Analysis/Ast/Impl/Values/Scope.cs index 53e6fc0bb..3ce44ab06 100644 --- a/src/Analysis/Ast/Impl/Values/Scope.cs +++ b/src/Analysis/Ast/Impl/Values/Scope.cs @@ -34,13 +34,15 @@ internal class Scope : IScope { public Scope(ScopeStatement node, IScope outerScope, IPythonModule module) { OuterScope = outerScope; Module = module; - Module.AddAstNode(this, node); + if (node != null) { + Module.AddAstNode(this, node); + } DeclareBuiltinVariables(); } #region IScope public string Name => Node?.Name ?? ""; - public virtual ScopeStatement Node => Module.GetAstNode(this); + public virtual ScopeStatement Node => Module.GetAstNode(this); public IScope OuterScope { get; } public IPythonModule Module { get; } diff --git a/src/LanguageServer/Impl/Program.cs b/src/LanguageServer/Impl/Program.cs index 024f9af18..24adfa924 100644 --- a/src/LanguageServer/Impl/Program.cs +++ b/src/LanguageServer/Impl/Program.cs @@ -13,7 +13,7 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. -// #define WAIT_FOR_DEBUGGER +#define WAIT_FOR_DEBUGGER using System; using System.Diagnostics; From 2a2bdf86d6beaa1d698479f7db8663e15dd4b85f Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Sat, 18 May 2019 14:02:29 -0700 Subject: [PATCH 06/82] Keep small AST with imports --- src/Analysis/Ast/Impl/Analyzer/EmptyAnalysis.cs | 12 ++++-------- .../Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs | 11 ++++------- src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs | 8 +++++++- src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs | 4 ++-- .../Ast/Impl/Analyzer/PythonAnalyzerSession.cs | 10 +++++----- src/Analysis/Ast/Impl/Modules/PythonModule.cs | 4 ++++ src/Analysis/Ast/Impl/Types/ArgumentSet.cs | 13 +++++++------ .../Ast/Impl/Types/PythonFunctionOverload.cs | 2 +- src/Analysis/Ast/Impl/Types/PythonFunctionType.cs | 3 +-- src/Analysis/Ast/Impl/Types/PythonType.cs | 10 +++++----- src/Parsing/Impl/Ast/SuiteStatement.cs | 8 ++++++-- 11 files changed, 46 insertions(+), 39 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/EmptyAnalysis.cs b/src/Analysis/Ast/Impl/Analyzer/EmptyAnalysis.cs index 5f62e83ad..b073f20b2 100644 --- a/src/Analysis/Ast/Impl/Analyzer/EmptyAnalysis.cs +++ b/src/Analysis/Ast/Impl/Analyzer/EmptyAnalysis.cs @@ -15,32 +15,28 @@ using System; using System.Collections.Generic; -using System.IO; 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.Parsing; using Microsoft.Python.Parsing.Ast; namespace Microsoft.Python.Analysis.Analyzer { public sealed class EmptyAnalysis : IDocumentAnalysis { - private static PythonAst _emptyAst; - public EmptyAnalysis(IServiceContainer services, IDocument document) { Document = document ?? throw new ArgumentNullException(nameof(document)); GlobalScope = new EmptyGlobalScope(document); - - _emptyAst = _emptyAst ?? (_emptyAst = Parser.CreateParser(new StringReader(string.Empty), PythonLanguageVersion.None).ParseFile(document.Uri)); - ExpressionEvaluator = new ExpressionEval(services, document, Ast); + Ast = AstUtilities.MakeEmptyAst(document.Uri); + ExpressionEvaluator = new ExpressionEval(services, document); } public IDocument Document { get; } public int Version { get; } = -1; public IGlobalScope GlobalScope { get; } - public PythonAst Ast => _emptyAst; + public PythonAst Ast { get; } public IExpressionEvaluator ExpressionEvaluator { get; } public IReadOnlyList StarImportMemberNames => null; public IEnumerable Diagnostics => Enumerable.Empty(); diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs index 8bf17895b..24c8515dc 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs @@ -38,16 +38,13 @@ internal sealed partial class ExpressionEval : IExpressionEvaluator { private readonly object _lock = new object(); private readonly List _diagnostics = new List(); - public ExpressionEval(IServiceContainer services, IPythonModule module, GlobalScope gs) - : this(services, module, AstUtilities.MakeEmptyAst(module.Uri), gs) { } + public ExpressionEval(IServiceContainer services, IPythonModule module) + : this(services, module, new GlobalScope(module)) { } - public ExpressionEval(IServiceContainer services, IPythonModule module, PythonAst ast) - : this(services, module, ast, new GlobalScope(module)) { } - - public ExpressionEval(IServiceContainer services, IPythonModule module, PythonAst ast, GlobalScope gs) { + public ExpressionEval(IServiceContainer services, IPythonModule module, GlobalScope gs) { Services = services ?? throw new ArgumentNullException(nameof(services)); Module = module ?? throw new ArgumentNullException(nameof(module)); - Ast = ast ?? throw new ArgumentNullException(nameof(ast)); + Ast = module.GetAst(); GlobalScope = gs; CurrentScope = GlobalScope; diff --git a/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs b/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs index 3c8a76575..240abfd5a 100644 --- a/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs +++ b/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs @@ -35,9 +35,15 @@ public LibraryAnalysis(IDocument document, int version, IServiceContainer servic Document = document; Version = version; GlobalScope = globalScope; + + var ast = Document.GetAst(); + (ast.Body as SuiteStatement)?.RemoveStatements(x => !(x is ImportStatement || x is FromImportStatement)); + var c = (IAstNodeContainer)Document; + c.Clear(); + c.AddAstNode(document, ast); + ExpressionEvaluator = new ExpressionEval(services, document, globalScope); StarImportMemberNames = starImportMemberNames; - ((IAstNodeContainer)Document).Clear(); } #region IDocumentAnalysis diff --git a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs index 19784204f..5d8fc92f3 100644 --- a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs +++ b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs @@ -36,8 +36,8 @@ internal class ModuleWalker : AnalysisWalker { private int _allReferencesCount; private bool _allIsUsable = true; - public ModuleWalker(IServiceContainer services, IPythonModule module, PythonAst ast) - : base(new ExpressionEval(services, module, ast)) { + public ModuleWalker(IServiceContainer services, IPythonModule module) + : base(new ExpressionEval(services, module)) { _stubAnalysis = Module.Stub is IDocument doc ? doc.GetAnyAnalysis() : null; } diff --git a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs index fbe7d8ac4..c9badc025 100644 --- a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs +++ b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs @@ -277,7 +277,7 @@ private void Analyze(IDependencyChainNode node, AsyncCountd return; } var startTime = stopWatch.Elapsed; - AnalyzeEntry(entry, module, ast, _walker.Version); + AnalyzeEntry(entry, module, _walker.Version); node.Commit(); _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) completed in {(stopWatch.Elapsed - startTime).TotalMilliseconds} ms."); @@ -314,13 +314,12 @@ private void AnalyzeEntry() { // Entry doesn't have ast yet. There should be at least one more session. Cancel(); } - _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) canceled."); return; } var startTime = stopWatch.Elapsed; - AnalyzeEntry(_entry, module, ast, Version); + AnalyzeEntry(_entry, module, Version); _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) completed in {(stopWatch.Elapsed - startTime).TotalMilliseconds} ms."); } catch (OperationCanceledException oce) { @@ -337,12 +336,13 @@ private void AnalyzeEntry() { } } - private void AnalyzeEntry(PythonAnalyzerEntry entry, IPythonModule module, PythonAst ast, int version) { + private void AnalyzeEntry(PythonAnalyzerEntry entry, IPythonModule module, int version) { // Now run the analysis. var analyzable = module as IAnalyzable; analyzable?.NotifyAnalysisBegins(); - var walker = new ModuleWalker(_services, module, ast); + var ast = module.GetAst(); + var walker = new ModuleWalker(_services, module); ast.Walk(walker); _analyzerCancellationToken.ThrowIfCancellationRequested(); diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.cs index 9a05b8d99..26204290a 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.cs @@ -326,7 +326,11 @@ private void Parse(CancellationToken cancellationToken) { if (version != _buffer.Version) { throw new OperationCanceledException(); } + + // Stored nodes are no longer valid. + _astMap.Clear(); _astMap[this] = ast; + _parseErrors = sink?.Diagnostics ?? Array.Empty(); // Do not report issues with libraries or stubs diff --git a/src/Analysis/Ast/Impl/Types/ArgumentSet.cs b/src/Analysis/Ast/Impl/Types/ArgumentSet.cs index 344f47dbb..4d0b741a8 100644 --- a/src/Analysis/Ast/Impl/Types/ArgumentSet.cs +++ b/src/Analysis/Ast/Impl/Types/ArgumentSet.cs @@ -81,6 +81,13 @@ public ArgumentSet(IPythonFunctionType fn, int overloadIndex, IPythonInstance in OverloadIndex = overloadIndex; DeclaringModule = fn.DeclaringModule; + if (callExpr == null) { + // Typically invoked by specialization code without call expression in the code. + // Caller usually does not care about arguments. + _evaluated = true; + return; + } + var overload = fn.Overloads[overloadIndex]; var fd = overload.FunctionDefinition; @@ -101,12 +108,6 @@ public ArgumentSet(IPythonFunctionType fn, int overloadIndex, IPythonInstance in return; } - if (callExpr == null) { - // Typically invoked by specialization code without call expression in the code. - // Caller usually does not care about arguments. - _evaluated = true; - return; - } var callLocation = callExpr.GetLocation(module); // https://www.python.org/dev/peps/pep-3102/#id5 diff --git a/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs b/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs index 51e28f638..4269fc5bf 100644 --- a/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs +++ b/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs @@ -104,7 +104,7 @@ internal void SetReturnValue(IMember value, bool fromAnnotation) { internal void SetDocumentation(string documentation) => Documentation = documentation; #region IPythonFunctionOverload - public FunctionDefinition FunctionDefinition => ClassMember.DeclaringModule.GetAstNode(ClassMember); + public FunctionDefinition FunctionDefinition => ClassMember?.DeclaringModule?.GetAstNode(ClassMember); public IPythonClassMember ClassMember { get; } public string Name { get; } public string Documentation { get; private set; } diff --git a/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs b/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs index c05db492e..041f91eaf 100644 --- a/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs @@ -62,10 +62,9 @@ Location location ) : base(fd.Name, location, fd.Name == "__init__" ? declaringType?.Documentation : fd.Documentation, declaringType != null ? BuiltinTypeId.Method : BuiltinTypeId.Function) { - - location.Module.AddAstNode(this, fd); DeclaringType = declaringType; + location.Module.AddAstNode(this, fd); ProcessDecorators(fd); } diff --git a/src/Analysis/Ast/Impl/Types/PythonType.cs b/src/Analysis/Ast/Impl/Types/PythonType.cs index 0c123906c..27c8ffaff 100644 --- a/src/Analysis/Ast/Impl/Types/PythonType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonType.cs @@ -22,7 +22,7 @@ namespace Microsoft.Python.Analysis.Types { [DebuggerDisplay("{Name}")] - internal class PythonType : LocatedMember, IPythonType, IEquatable { + internal class PythonType : LocatedMember, IPythonType {//, IEquatable { private readonly object _lock = new object(); private readonly string _name; private Dictionary _members; @@ -149,10 +149,10 @@ internal IMember AddMember(string name, IMember member, bool overwrite) { protected bool ContainsMember(string name) => Members.ContainsKey(name); protected IMember UnknownType => DeclaringModule.Interpreter.UnknownType; - public bool Equals(IPythonType other) => PythonTypeComparer.Instance.Equals(this, other); + //public bool Equals(IPythonType other) => PythonTypeComparer.Instance.Equals(this, other); - public override bool Equals(object obj) - => obj is IPythonType pt && PythonTypeComparer.Instance.Equals(this, pt); - public override int GetHashCode() => 0; + //public override bool Equals(object obj) + // => obj is IPythonType pt && PythonTypeComparer.Instance.Equals(this, pt); + //public override int GetHashCode() => 0; } } diff --git a/src/Parsing/Impl/Ast/SuiteStatement.cs b/src/Parsing/Impl/Ast/SuiteStatement.cs index ddb4c87ac..a47b197f4 100644 --- a/src/Parsing/Impl/Ast/SuiteStatement.cs +++ b/src/Parsing/Impl/Ast/SuiteStatement.cs @@ -14,7 +14,9 @@ // 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 System.Text; using System.Threading; using System.Threading.Tasks; @@ -22,16 +24,18 @@ namespace Microsoft.Python.Parsing.Ast { public sealed class SuiteStatement : Statement { - private readonly Statement[] _statements; + private Statement[] _statements; public SuiteStatement(Statement[] statements) { _statements = statements; } public IList Statements => _statements; - public override IEnumerable GetChildNodes() => _statements.WhereNotNull(); + public void RemoveStatements(Func filter) + => _statements = _statements.Where(filter).ToArray(); + public override void Walk(PythonWalker walker) { if (walker.Walk(this)) { foreach (var s in _statements.MaybeEnumerate()) { From 3edaa73be40b5907759c5a807679efa6cc058ec9 Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Sat, 18 May 2019 14:21:24 -0700 Subject: [PATCH 07/82] AST reduction --- src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs | 3 ++- src/Parsing/Impl/Ast/PythonAst.cs | 9 +++++---- src/Parsing/Impl/Ast/SuiteStatement.cs | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs b/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs index 240abfd5a..fb76b2fd4 100644 --- a/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs +++ b/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs @@ -37,7 +37,8 @@ public LibraryAnalysis(IDocument document, int version, IServiceContainer servic GlobalScope = globalScope; var ast = Document.GetAst(); - (ast.Body as SuiteStatement)?.RemoveStatements(x => !(x is ImportStatement || x is FromImportStatement)); + (ast.Body as SuiteStatement)?.FilterStatements(x => x is ImportStatement || x is FromImportStatement); + ast.Reduce(); var c = (IAstNodeContainer)Document; c.Clear(); c.AddAstNode(document, ast); diff --git a/src/Parsing/Impl/Ast/PythonAst.cs b/src/Parsing/Impl/Ast/PythonAst.cs index 8ce4a97de..c91ecfda5 100644 --- a/src/Parsing/Impl/Ast/PythonAst.cs +++ b/src/Parsing/Impl/Ast/PythonAst.cs @@ -36,7 +36,6 @@ public PythonAst(Uri module, Statement body, NewLineLocation[] lineLocations, Py LanguageVersion = langVersion; NewLineLocations = lineLocations; CommentLocations = commentLocations; - } public PythonAst(IEnumerable existingAst) { @@ -62,7 +61,6 @@ public PythonAst(IEnumerable existingAst) { public Uri Module { get; } public NewLineLocation[] NewLineLocations { get; } public SourceLocation[] CommentLocations { get; } - public override string Name => ""; /// @@ -76,7 +74,7 @@ public PythonAst(IEnumerable existingAst) { /// public bool HasVerbatim { get; internal set; } - public override IEnumerable GetChildNodes() => new[] {_body}; + public override IEnumerable GetChildNodes() => new[] { _body }; public override void Walk(PythonWalker walker) { if (walker.Walk(this)) { @@ -93,9 +91,12 @@ public override async Task WalkAsync(PythonWalkerAsync walker, CancellationToken } public override Statement Body => _body; - public PythonLanguageVersion LanguageVersion { get; } + public void Reduce() { + _attributes.Clear(); + } + internal bool TryGetAttribute(Node node, object key, out object value) { if (_attributes.TryGetValue(node, out var nodeAttrs)) { return nodeAttrs.TryGetValue(key, out value); diff --git a/src/Parsing/Impl/Ast/SuiteStatement.cs b/src/Parsing/Impl/Ast/SuiteStatement.cs index a47b197f4..920a1d8b6 100644 --- a/src/Parsing/Impl/Ast/SuiteStatement.cs +++ b/src/Parsing/Impl/Ast/SuiteStatement.cs @@ -33,7 +33,7 @@ public SuiteStatement(Statement[] statements) { public IList Statements => _statements; public override IEnumerable GetChildNodes() => _statements.WhereNotNull(); - public void RemoveStatements(Func filter) + public void FilterStatements(Func filter) => _statements = _statements.Where(filter).ToArray(); public override void Walk(PythonWalker walker) { From 73371e13a0e60c7de7a577c4d68cf6df3c750541 Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Sat, 18 May 2019 14:53:14 -0700 Subject: [PATCH 08/82] Final field --- .../Ast/Impl/Analyzer/LibraryAnalysis.cs | 3 +- .../Impl/Analyzer/PythonAnalyzerSession.cs | 13 +++--- .../Impl/Dependencies/DependencyResolver.cs | 1 + .../Impl/Dependencies/IDependencyChainNode.cs | 1 + src/Parsing/Impl/Ast/ClassDefinition.cs | 2 - src/Parsing/Impl/Ast/FunctionDefinition.cs | 2 - src/Parsing/Impl/Ast/PythonAst.cs | 13 ++++-- src/Parsing/Impl/Ast/ScopeStatement.cs | 46 ++++++------------- 8 files changed, 32 insertions(+), 49 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs b/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs index fb76b2fd4..f90d57985 100644 --- a/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs +++ b/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs @@ -37,8 +37,7 @@ public LibraryAnalysis(IDocument document, int version, IServiceContainer servic GlobalScope = globalScope; var ast = Document.GetAst(); - (ast.Body as SuiteStatement)?.FilterStatements(x => x is ImportStatement || x is FromImportStatement); - ast.Reduce(); + ast.Reduce(x => x is ImportStatement || x is FromImportStatement); var c = (IAstNodeContainer)Document; c.Clear(); c.AddAstNode(document, ast); diff --git a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs index c9badc025..d0f251ac2 100644 --- a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs +++ b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs @@ -277,7 +277,7 @@ private void Analyze(IDependencyChainNode node, AsyncCountd return; } var startTime = stopWatch.Elapsed; - AnalyzeEntry(entry, module, _walker.Version); + AnalyzeEntry(entry, module, _walker.Version, node.IsComplete); node.Commit(); _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) completed in {(stopWatch.Elapsed - startTime).TotalMilliseconds} ms."); @@ -319,7 +319,7 @@ private void AnalyzeEntry() { } var startTime = stopWatch.Elapsed; - AnalyzeEntry(_entry, module, Version); + AnalyzeEntry(_entry, module, Version, true); _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) completed in {(stopWatch.Elapsed - startTime).TotalMilliseconds} ms."); } catch (OperationCanceledException oce) { @@ -336,7 +336,7 @@ private void AnalyzeEntry() { } } - private void AnalyzeEntry(PythonAnalyzerEntry entry, IPythonModule module, int version) { + private void AnalyzeEntry(PythonAnalyzerEntry entry, IPythonModule module, int version, bool isFinalPass) { // Now run the analysis. var analyzable = module as IAnalyzable; analyzable?.NotifyAnalysisBegins(); @@ -349,7 +349,8 @@ private void AnalyzeEntry(PythonAnalyzerEntry entry, IPythonModule module, int v walker.Complete(); _analyzerCancellationToken.ThrowIfCancellationRequested(); - var analysis = CreateAnalysis((IDocument)module, version, walker); + + var analysis = CreateAnalysis((IDocument)module, version, walker, isFinalPass); analyzable?.NotifyAnalysisComplete(analysis); entry.TrySetAnalysis(analysis, version); @@ -366,8 +367,8 @@ private enum State { Completed = 2 } - private IDocumentAnalysis CreateAnalysis(IDocument document, int version, ModuleWalker walker) - => document.ModuleType == ModuleType.User + private IDocumentAnalysis CreateAnalysis(IDocument document, int version, ModuleWalker walker, bool isFinalPass) + => document.ModuleType == ModuleType.User || !isFinalPass ? (IDocumentAnalysis)new DocumentAnalysis(document, version, walker.GlobalScope, walker.Eval, walker.StarImportMemberNames) : new LibraryAnalysis(document, version, walker.Eval.Services, walker.GlobalScope, walker.StarImportMemberNames); } diff --git a/src/Analysis/Ast/Impl/Dependencies/DependencyResolver.cs b/src/Analysis/Ast/Impl/Dependencies/DependencyResolver.cs index 5e806d7a8..df05c9ee6 100644 --- a/src/Analysis/Ast/Impl/Dependencies/DependencyResolver.cs +++ b/src/Analysis/Ast/Impl/Dependencies/DependencyResolver.cs @@ -604,6 +604,7 @@ private sealed class DependencyChainNode : IDependencyChainNode { private DependencyChainWalker _walker; public TValue Value => _vertex.DependencyVertex.Value; public int VertexDepth { get; } + public bool IsComplete => _vertex.SecondPass == null; public DependencyChainNode(DependencyChainWalker walker, WalkingVertex vertex, int depth) { _walker = walker; diff --git a/src/Analysis/Ast/Impl/Dependencies/IDependencyChainNode.cs b/src/Analysis/Ast/Impl/Dependencies/IDependencyChainNode.cs index db637ad98..1e9ceb8be 100644 --- a/src/Analysis/Ast/Impl/Dependencies/IDependencyChainNode.cs +++ b/src/Analysis/Ast/Impl/Dependencies/IDependencyChainNode.cs @@ -19,5 +19,6 @@ internal interface IDependencyChainNode { TValue Value { get; } void Commit(); void Skip(); + bool IsComplete { get; } } } diff --git a/src/Parsing/Impl/Ast/ClassDefinition.cs b/src/Parsing/Impl/Ast/ClassDefinition.cs index c1db95498..9ec8289bf 100644 --- a/src/Parsing/Impl/Ast/ClassDefinition.cs +++ b/src/Parsing/Impl/Ast/ClassDefinition.cs @@ -85,8 +85,6 @@ internal override bool HasLateBoundVariableSets { set => base.HasLateBoundVariableSets = value; } - public override bool NeedsLocalContext => true; - internal override bool ExposesLocalVariable(PythonVariable variable) => true; internal override bool TryBindOuter(ScopeStatement from, string name, bool allowGlobals, out PythonVariable variable) { diff --git a/src/Parsing/Impl/Ast/FunctionDefinition.cs b/src/Parsing/Impl/Ast/FunctionDefinition.cs index 1b70c2c44..46efe1e7b 100644 --- a/src/Parsing/Impl/Ast/FunctionDefinition.cs +++ b/src/Parsing/Impl/Ast/FunctionDefinition.cs @@ -52,8 +52,6 @@ public FunctionDefinition(NameExpression name, Parameter[] parameters, Statement public Parameter[] Parameters { get; } - public override int ArgCount => Parameters.Length; - internal void SetKeywordEndIndex(int index) => _keywordEndIndex = index; public override int KeywordEndIndex => _keywordEndIndex ?? (DefIndex + (IsCoroutine ? 9 : 3)); public override int KeywordLength => KeywordEndIndex - StartIndex; diff --git a/src/Parsing/Impl/Ast/PythonAst.cs b/src/Parsing/Impl/Ast/PythonAst.cs index c91ecfda5..fc6d8661c 100644 --- a/src/Parsing/Impl/Ast/PythonAst.cs +++ b/src/Parsing/Impl/Ast/PythonAst.cs @@ -59,8 +59,8 @@ public PythonAst(IEnumerable existingAst) { } public Uri Module { get; } - public NewLineLocation[] NewLineLocations { get; } - public SourceLocation[] CommentLocations { get; } + public NewLineLocation[] NewLineLocations { get; private set; } + public SourceLocation[] CommentLocations { get; private set; } public override string Name => ""; /// @@ -93,8 +93,13 @@ public override async Task WalkAsync(PythonWalkerAsync walker, CancellationToken public override Statement Body => _body; public PythonLanguageVersion LanguageVersion { get; } - public void Reduce() { - _attributes.Clear(); + public void Reduce(Func filter) { + (Body as SuiteStatement)?.FilterStatements(filter); + _attributes?.Clear(); + Variables?.Clear(); + NewLineLocations = Array.Empty(); + CommentLocations = Array.Empty(); + base.Clear(); } internal bool TryGetAttribute(Node node, object key, out object value) { diff --git a/src/Parsing/Impl/Ast/ScopeStatement.cs b/src/Parsing/Impl/Ast/ScopeStatement.cs index 45900967d..d6181be4e 100644 --- a/src/Parsing/Impl/Ast/ScopeStatement.cs +++ b/src/Parsing/Impl/Ast/ScopeStatement.cs @@ -22,7 +22,6 @@ namespace Microsoft.Python.Parsing.Ast { public abstract class ScopeStatement : Statement { // due to "exec" or call to dir, locals, eval, vars... - private ClosureInfo[] _closureVariables; // closed over variables, bool indicates if we accessed it in this scope. private List _freeVars; // list of variables accessed from outer scopes private List _globalVars; // global variables accessed from this scope private List _cellVars; // variables accessed from nested scopes @@ -75,12 +74,10 @@ public abstract Statement Body { /// /// Gets the variables for this scope. /// - public ICollection ScopeVariables + public ICollection ScopeVariables => Variables?.Values ?? Array.Empty() as ICollection; public virtual bool IsGlobal => false; - public virtual bool NeedsLocalContext => NeedsLocalsDictionary || ContainsNestedFreeVariables; - public virtual int ArgCount => 0; public PythonAst GlobalParent { get { @@ -93,20 +90,23 @@ public PythonAst GlobalParent { } } - internal void AddFreeVariable(PythonVariable variable, bool accessedInScope) { - if (_freeVars == null) { - _freeVars = new List(); - } + protected void Clear() { + _references?.Clear(); + _cellVars?.Clear(); + _freeVars?.Clear(); + _globalVars?.Clear(); + _nonLocalVars?.Clear(); + } + internal void AddFreeVariable(PythonVariable variable, bool accessedInScope) { + _freeVars = _freeVars ?? new List(); if (!_freeVars.Contains(variable)) { _freeVars.Add(variable); } } internal string AddReferencedGlobal(string name) { - if (_globalVars == null) { - _globalVars = new List(); - } + _globalVars = _globalVars ?? new List(); if (!_globalVars.Contains(name)) { _globalVars.Add(name); } @@ -114,17 +114,12 @@ internal string AddReferencedGlobal(string name) { } internal void AddNonLocalVariable(NameExpression name) { - if (_nonLocalVars == null) { - _nonLocalVars = new List(); - } + _nonLocalVars = _nonLocalVars ?? new List(); _nonLocalVars.Add(name); } internal void AddCellVariable(PythonVariable variable) { - if (_cellVars == null) { - _cellVars = new List(); - } - + _cellVars = _cellVars ?? new List(); if (!_cellVars.Contains(variable.Name)) { _cellVars.Add(variable.Name); } @@ -135,17 +130,6 @@ internal void AddCellVariable(PythonVariable variable) { /// public IReadOnlyList FreeVariables => _freeVars; - /// - /// Variables that are bound to the global scope - /// - public IReadOnlyList GlobalVariables => _globalVars; - - /// - /// Variables that are referred to from a nested scope and need to be - /// promoted to cells. - /// - public IReadOnlyList CellVariables => _cellVars; - internal abstract bool ExposesLocalVariable(PythonVariable variable); public bool TryGetVariable(string name, out PythonVariable variable) { @@ -231,10 +215,6 @@ internal virtual void FinishBind(PythonNameBinder binder) { } } - if (closureVariables != null) { - _closureVariables = closureVariables.ToArray(); - } - // no longer needed _references = null; } From 7d60edc8da689885a6bbe6a1be0685b782a651ef Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Mon, 20 May 2019 11:40:05 -0700 Subject: [PATCH 09/82] Initial --- .../Impl/Caching/IModuleDatabaseService.cs | 36 ++++++++++++++++++ .../Ast/Impl/Caching/ModuleStorageState.cs | 37 +++++++++++++++++++ .../Ast/Impl/Caching/PythonDbModule.cs | 27 ++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 src/Analysis/Ast/Impl/Caching/IModuleDatabaseService.cs create mode 100644 src/Analysis/Ast/Impl/Caching/ModuleStorageState.cs create mode 100644 src/Analysis/Ast/Impl/Caching/PythonDbModule.cs diff --git a/src/Analysis/Ast/Impl/Caching/IModuleDatabaseService.cs b/src/Analysis/Ast/Impl/Caching/IModuleDatabaseService.cs new file mode 100644 index 000000000..3603c9284 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/IModuleDatabaseService.cs @@ -0,0 +1,36 @@ +// 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 Microsoft.Python.Analysis.Types; + +namespace Microsoft.Python.Analysis.Caching { + internal interface IModuleDatabaseService { + /// + /// Retrieves module representation from module index database + /// or null if module does not exist. + /// + /// Module unique id. + /// Python module. + /// Module storage state + ModuleStorageState TryGetModule(string uniqueId, out IPythonModule module); + + /// + /// Writes module data to the database. + /// + /// Module unique id. + /// Module analysis. + void StoreModule(string uniqueId, IDocumentAnalysis analysis); + } +} diff --git a/src/Analysis/Ast/Impl/Caching/ModuleStorageState.cs b/src/Analysis/Ast/Impl/Caching/ModuleStorageState.cs new file mode 100644 index 000000000..44f5b8756 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/ModuleStorageState.cs @@ -0,0 +1,37 @@ +// 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. + +namespace Microsoft.Python.Analysis.Caching { + /// + /// Describes module data stored in a database. + /// + internal enum ModuleStorageState { + /// + /// Module does not exist in the database. + /// + DoesNotExist, + + /// + /// Partial data. This means module is still being analyzed + /// and the data on the module members is incomplete. + /// + Partial, + + /// + /// Modules exist and the analysis is complete. + /// + Complete + } +} diff --git a/src/Analysis/Ast/Impl/Caching/PythonDbModule.cs b/src/Analysis/Ast/Impl/Caching/PythonDbModule.cs new file mode 100644 index 000000000..dd4469141 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/PythonDbModule.cs @@ -0,0 +1,27 @@ +// 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 Microsoft.Python.Analysis.Modules; +using Microsoft.Python.Core; + +namespace Microsoft.Python.Analysis.Caching { + internal sealed class PythonDbModule : SpecializedModule { + public PythonDbModule(string name, string modulePath, IServiceContainer services) + : base(name, modulePath, services) { + } + + protected override string LoadContent() => string.Empty; + } +} From 02475f446afefaeae0e8367df9910d8975fc97cf Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Tue, 21 May 2019 18:10:48 -0700 Subject: [PATCH 10/82] Reload --- src/Analysis/Ast/Impl/Modules/PythonModule.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.cs index 26204290a..d6cd41b20 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.cs @@ -339,6 +339,7 @@ private void Parse(CancellationToken cancellationToken) { } ContentState = State.Parsed; + Analysis = new EmptyAnalysis(Services, this); } NewAst?.Invoke(this, EventArgs.Empty); @@ -368,7 +369,7 @@ public override void Add(string message, SourceSpan span, int errorCode, Severit public void NotifyAnalysisBegins() { lock (AnalysisLock) { - if (_updated) { + if (_updated || Analysis is LibraryAnalysis) { _updated = false; // In all variables find those imported, then traverse imported modules // and remove references to this module. If variable refers to a module, @@ -378,6 +379,22 @@ public void NotifyAnalysisBegins() { return; } + if (Analysis is LibraryAnalysis) { + var sw = new Stopwatch(); + sw.Start(); + ContentState = State.None; + LoadContent(); + using (var sr = new StringReader(_buffer.Text)) { + var parser = Parser.CreateParser(sr, Interpreter.LanguageVersion, ParserOptions.Default); + var ast = parser.ParseFile(Uri); + // Stored nodes are no longer valid. + _astMap.Clear(); + _astMap[this] = ast; + } + sw.Stop(); + Log?.Log(TraceEventType.Verbose, $"Reloaded {Name} in {sw.ElapsedMilliseconds}ms because new analysis was requested."); + } + // TODO: Figure out where the nulls below are coming from. var importedVariables = ((IScope)GlobalScope) .TraverseDepthFirst(c => c?.Children ?? Enumerable.Empty()) From 6b6e928acabdb5d31434835b8721d449f8535322 Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Sat, 25 May 2019 11:22:39 -0700 Subject: [PATCH 11/82] Ignore post-final requests --- .../Impl/Analyzer/PythonAnalyzerSession.cs | 34 +++++++++---------- .../Impl/Dependencies/DependencyResolver.cs | 2 +- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs index 359f098b1..e95570605 100644 --- a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs +++ b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs @@ -262,11 +262,11 @@ private Task StartAnalysis(IDependencyChainNode node, Async /// of dependencies, it is intended for the single file analysis. /// private void Analyze(IDependencyChainNode node, AsyncCountdownEvent ace, Stopwatch stopWatch) { - IPythonModule module; try { ace?.AddOne(); var entry = node.Value; - if (!entry.IsValidVersion(_walker.Version, out module, out var ast)) { + + if (!entry.IsValidVersion(_walker.Version, out var module, out var ast)) { if (ast == null) { // Entry doesn't have ast yet. There should be at least one more session. Cancel(); @@ -276,6 +276,7 @@ private void Analyze(IDependencyChainNode node, AsyncCountd node.Skip(); return; } + var startTime = stopWatch.Elapsed; AnalyzeEntry(entry, module, _walker.Version, node.IsComplete); node.Commit(); @@ -317,7 +318,8 @@ private void AnalyzeEntry() { } var startTime = stopWatch?.Elapsed ?? TimeSpan.Zero; - AnalyzeEntry(_entry, module, ast, Version); + + AnalyzeEntry(_entry, module, Version, true); LogCompleted(module, stopWatch, startTime); } catch (OperationCanceledException oce) { @@ -333,6 +335,11 @@ private void AnalyzeEntry() { } private void AnalyzeEntry(PythonAnalyzerEntry entry, IPythonModule module, int version, bool isFinalPass) { + _log?.Log(TraceEventType.Verbose, $"Request to re-analyze finalized {module.Name} ignored."); + if (entry.PreviousAnalysis is LibraryAnalysis) { + return; + } + // Now run the analysis. var analyzable = module as IAnalyzable; analyzable?.NotifyAnalysisBegins(); @@ -357,23 +364,14 @@ private void AnalyzeEntry(PythonAnalyzerEntry entry, IPythonModule module, int v } } - private void LogCompleted(IPythonModule module, Stopwatch stopWatch, TimeSpan startTime) { - if (_log != null) { - _log.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) completed in {(stopWatch.Elapsed - startTime).TotalMilliseconds} ms."); - } - } + private void LogCompleted(IPythonModule module, Stopwatch stopWatch, TimeSpan startTime) + => _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) completed in {(stopWatch.Elapsed - startTime).TotalMilliseconds} ms."); - private void LogCanceled(IPythonModule module) { - if (_log != null) { - _log.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) canceled."); - } - } + private void LogCanceled(IPythonModule module) + => _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) canceled."); - private void LogException(IPythonModule module, Exception exception) { - if (_log != null) { - _log.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) failed. Exception message: {exception.Message}."); - } - } + private void LogException(IPythonModule module, Exception exception) + => _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) failed. Exception message: {exception.Message}."); private enum State { NotStarted = 0, diff --git a/src/Analysis/Ast/Impl/Dependencies/DependencyResolver.cs b/src/Analysis/Ast/Impl/Dependencies/DependencyResolver.cs index 4d62eb1e2..1d2e76c6b 100644 --- a/src/Analysis/Ast/Impl/Dependencies/DependencyResolver.cs +++ b/src/Analysis/Ast/Impl/Dependencies/DependencyResolver.cs @@ -681,7 +681,7 @@ private sealed class DependencyChainNode : IDependencyChainNode { public TValue Value => _vertex.DependencyVertex.Value; public bool HasMissingDependencies => _vertex.HasMissingDependencies; public int VertexDepth { get; } - public bool IsComplete => _vertex.SecondPass == null; + public bool IsComplete => _vertex.SecondPass == null && !HasMissingDependencies; public DependencyChainNode(DependencyChainWalker walker, WalkingVertex vertex, int depth) { _walker = walker; From 9692397637ce2127084a348917276f774b197a3e Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Sat, 25 May 2019 14:36:26 -0700 Subject: [PATCH 12/82] Drop AST --- .../Analyzer/Definitions/IPythonAnalyzer.cs | 1 - .../Evaluation/ExpressionEval.Callables.cs | 10 +++--- .../Analyzer/Evaluation/ExpressionEval.cs | 5 +-- .../Ast/Impl/Analyzer/LibraryAnalysis.cs | 4 ++- .../Ast/Impl/Analyzer/PythonAnalyzer.cs | 2 ++ .../Impl/Analyzer/PythonAnalyzerSession.cs | 4 +-- .../Ast/Impl/Extensions/NodeExtensions.cs | 4 +-- .../Ast/Impl/Extensions/ScopeExtensions.cs | 10 +++--- .../Modules/Definitions/IAstNodeContainer.cs | 4 ++- src/Analysis/Ast/Impl/Modules/PythonModule.cs | 34 +++++++++---------- src/Analysis/Ast/Test/PepHintTests.cs | 2 -- src/Analysis/Ast/Test/ValuesTests.cs | 1 - .../Impl/Completion/ExpressionLocator.cs | 8 ++--- .../FunctionDefinitionCompletion.cs | 2 +- .../Impl/Completion/ImportCompletion.cs | 2 +- .../Impl/Documentation/DocstringConverter.cs | 2 +- .../Impl/Indexing/SymbolIndexWalker.cs | 16 ++++----- .../Impl/Sources/HoverSource.cs | 6 ++-- src/Parsing/Impl/Ast/BinaryExpression.cs | 4 +-- src/Parsing/Impl/Ast/DictionaryExpression.cs | 1 - src/Parsing/Impl/Ast/DottedName.cs | 12 ------- src/Parsing/Impl/Ast/FromImportStatement.cs | 16 --------- src/Parsing/Impl/Ast/ImportStatement.cs | 15 -------- src/Parsing/Impl/Ast/MemberExpression.cs | 2 +- src/Parsing/Impl/Ast/NamedExpression.cs | 3 +- src/Parsing/Impl/Ast/Node.cs | 8 ++--- src/Parsing/Impl/Parser.cs | 8 ++--- src/Parsing/Impl/Token.cs | 8 +---- 28 files changed, 68 insertions(+), 126 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/Definitions/IPythonAnalyzer.cs b/src/Analysis/Ast/Impl/Analyzer/Definitions/IPythonAnalyzer.cs index 94a298a26..ed870cbe9 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Definitions/IPythonAnalyzer.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Definitions/IPythonAnalyzer.cs @@ -19,7 +19,6 @@ using Microsoft.Python.Analysis.Diagnostics; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Core.Collections; -using Microsoft.Python.Parsing.Ast; namespace Microsoft.Python.Analysis.Analyzer { public interface IPythonAnalyzer { diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs index 87535666c..e76d46dc6 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs @@ -101,13 +101,13 @@ public IMember GetValueFromClassCtor(IPythonClassType cls, CallExpression expr) return cls.CreateInstance(cls.Name, args); } - public IMember GetValueFromBound(IPythonBoundType t, CallExpression expr) { + private IMember GetValueFromBound(IPythonBoundType t, CallExpression expr) { switch (t.Type) { case IPythonFunctionType fn: return GetValueFromFunctionType(fn, t.Self, expr); case IPythonPropertyType p: return GetValueFromProperty(p, t.Self); - case IPythonIteratorType it when t.Self is IPythonCollection seq: + case IPythonIteratorType _ when t.Self is IPythonCollection seq: return seq.GetIterator(); } return UnknownType; @@ -173,7 +173,7 @@ public IMember GetValueFromFunctionType(IPythonFunctionType fn, IPythonInstance if (instanceType == null || fn.DeclaringType == null || fn.IsSpecialized || instanceType.IsSpecialized || fn.DeclaringType.IsSpecialized || instanceType.Equals(fn.DeclaringType) || - fn.IsStub || !string.IsNullOrEmpty(fn.Overloads[args.OverloadIndex].GetReturnDocumentation(null))) { + fn.IsStub || !string.IsNullOrEmpty(fn.Overloads[args.OverloadIndex].GetReturnDocumentation())) { LoadFunctionDependencyModules(fn); @@ -192,14 +192,14 @@ public IMember GetValueFromFunctionType(IPythonFunctionType fn, IPythonInstance // def func(a, b): return a + b // from working in libraries, but this is small sacrifice for significant performance // increase in library analysis. - if (fn.DeclaringModule is IDocument doc && fd?.Ast == doc.GetAnyAst() && EvaluateFunctionBody(fn)) { + if (fn.DeclaringModule is IDocument && EvaluateFunctionBody(fn)) { // Stubs are coming from another module. return TryEvaluateWithArguments(fn, args); } return UnknownType; } - public IMember GetValueFromProperty(IPythonPropertyType p, IPythonInstance instance) { + private IMember GetValueFromProperty(IPythonPropertyType p, IPythonInstance instance) { // Function may not have been walked yet. Do it now. SymbolTable.Evaluate(p.FunctionDefinition); return instance.Call(p.Name, ArgumentSet.Empty); diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs index 24c8515dc..fda123b1e 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs @@ -68,9 +68,10 @@ public Location GetLocationOfName(Node node) { } IndexSpan indexSpan; + var ast = Module.GetAst(); switch (node) { case MemberExpression mex: - indexSpan = mex.GetNameSpan().ToIndexSpan(mex.Ast); + indexSpan = mex.GetNameSpan(ast).ToIndexSpan(ast); break; case ClassDefinition cd: indexSpan = cd.NameExpression.IndexSpan; @@ -90,7 +91,7 @@ public Location GetLocationOfName(Node node) { // turns into span at line 1 and very large column. This DOES can // produce false positives occasionally. #if DEBUG - var sourceSpan = indexSpan.ToSourceSpan(node.Ast); + var sourceSpan = indexSpan.ToSourceSpan(ast); Debug.Assert(sourceSpan.Start.Line > 1 || sourceSpan.Start.Column < 1000); #endif return new Location(Module, indexSpan); diff --git a/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs b/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs index f90d57985..42caa54da 100644 --- a/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs +++ b/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs @@ -32,6 +32,7 @@ internal sealed class LibraryAnalysis : IDocumentAnalysis { public LibraryAnalysis(IDocument document, int version, IServiceContainer services, GlobalScope globalScope, IReadOnlyList starImportMemberNames) { Check.ArgumentNotNull(nameof(document), document); Check.ArgumentNotNull(nameof(globalScope), globalScope); + Document = document; Version = version; GlobalScope = globalScope; @@ -39,7 +40,8 @@ public LibraryAnalysis(IDocument document, int version, IServiceContainer servic var ast = Document.GetAst(); ast.Reduce(x => x is ImportStatement || x is FromImportStatement); var c = (IAstNodeContainer)Document; - c.Clear(); + c.ClearContent(); + c.ClearAst(); c.AddAstNode(document, ast); ExpressionEvaluator = new ExpressionEval(services, document, globalScope); diff --git a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzer.cs b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzer.cs index fcc298f50..d6b52c46b 100644 --- a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzer.cs +++ b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzer.cs @@ -193,6 +193,8 @@ public void ResetAnalyzer() { public IReadOnlyList LoadedModules => _analysisEntries.Values.ExcludeDefault().Select(v => v.Module).ExcludeDefault().ToArray(); + internal bool IsFinalSession => _nextSession == null; + private void AnalyzeDocument(AnalysisModuleKey key, PythonAnalyzerEntry entry, ImmutableArray dependencies) { _analysisCompleteEvent.Reset(); _log?.Log(TraceEventType.Verbose, $"Analysis of {entry.Module.Name}({entry.Module.ModuleType}) queued"); diff --git a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs index e95570605..931cebbd5 100644 --- a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs +++ b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs @@ -14,6 +14,7 @@ // permissions and limitations under the License. using System; +using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Runtime; @@ -27,7 +28,6 @@ using Microsoft.Python.Core; using Microsoft.Python.Core.Logging; using Microsoft.Python.Core.Services; -using Microsoft.Python.Parsing.Ast; namespace Microsoft.Python.Analysis.Analyzer { internal sealed class PythonAnalyzerSession { @@ -335,8 +335,8 @@ private void AnalyzeEntry() { } private void AnalyzeEntry(PythonAnalyzerEntry entry, IPythonModule module, int version, bool isFinalPass) { - _log?.Log(TraceEventType.Verbose, $"Request to re-analyze finalized {module.Name} ignored."); if (entry.PreviousAnalysis is LibraryAnalysis) { + _log?.Log(TraceEventType.Verbose, $"Request to re-analyze finalized {module.Name} ignored."); return; } diff --git a/src/Analysis/Ast/Impl/Extensions/NodeExtensions.cs b/src/Analysis/Ast/Impl/Extensions/NodeExtensions.cs index 4610d32ec..e5ccb7bfb 100644 --- a/src/Analysis/Ast/Impl/Extensions/NodeExtensions.cs +++ b/src/Analysis/Ast/Impl/Extensions/NodeExtensions.cs @@ -23,8 +23,8 @@ public static LocationInfo GetLocation(this Node node, IPythonModule module) { return LocationInfo.Empty; } - var start = node.GetStart(); - var end = node.GetEnd(); + var start = node.GetStart(module.GetAst()); + var end = node.GetEnd(module.GetAst()); return new LocationInfo(module.FilePath, module.Uri, start.Line, start.Column, end.Line, end.Column); } diff --git a/src/Analysis/Ast/Impl/Extensions/ScopeExtensions.cs b/src/Analysis/Ast/Impl/Extensions/ScopeExtensions.cs index 7dc6fdcdb..6ba17ce62 100644 --- a/src/Analysis/Ast/Impl/Extensions/ScopeExtensions.cs +++ b/src/Analysis/Ast/Impl/Extensions/ScopeExtensions.cs @@ -21,14 +21,14 @@ namespace Microsoft.Python.Analysis.Analyzer { public static class ScopeExtensions { - public static int GetBodyStartIndex(this IScope scope, PythonAst ast) { + public static int GetBodyStartIndex(this IScope scope) { switch (scope.Node) { case ClassDefinition cd: return cd.HeaderIndex; case FunctionDefinition fd: return fd.HeaderIndex; default: - return ast.LocationToIndex(scope.Node.GetStart()); + return scope.Node.StartIndex; } } @@ -47,7 +47,7 @@ public static IScope FindScope(this IScope parent, IDocument document, SourceLoc return children[i]; } - var start = children[i].GetBodyStartIndex(ast); + var start = children[i].GetBodyStartIndex(); if (start > index) { // We've gone past index completely so our last candidate is // the best one. @@ -114,10 +114,10 @@ private static int GetParentScopeIndent(IScope scope, PythonAst ast) { switch (scope.Node) { case ClassDefinition cd: // Return column of "class" statement - return cd.GetStart().Column; + return cd.GetStart(ast).Column; case FunctionDefinition fd when !fd.IsLambda: // Return column of "def" statement - return fd.GetStart().Column; + return fd.GetStart(ast).Column; default: return -1; } diff --git a/src/Analysis/Ast/Impl/Modules/Definitions/IAstNodeContainer.cs b/src/Analysis/Ast/Impl/Modules/Definitions/IAstNodeContainer.cs index c6fb7ce74..0ed36cb97 100644 --- a/src/Analysis/Ast/Impl/Modules/Definitions/IAstNodeContainer.cs +++ b/src/Analysis/Ast/Impl/Modules/Definitions/IAstNodeContainer.cs @@ -34,6 +34,8 @@ internal interface IAstNodeContainer { /// /// Removes all AST node associations. /// - void Clear(); + void ClearAst(); + + void ClearContent(); } } diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.cs index 39bcccf50..344443356 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.cs @@ -370,7 +370,7 @@ public override void Add(string message, SourceSpan span, int errorCode, Severit public void NotifyAnalysisBegins() { lock (AnalysisLock) { - if (_updated || Analysis is LibraryAnalysis) { + if (_updated) { _updated = false; // In all variables find those imported, then traverse imported modules // and remove references to this module. If variable refers to a module, @@ -380,22 +380,6 @@ public void NotifyAnalysisBegins() { return; } - if (Analysis is LibraryAnalysis) { - var sw = new Stopwatch(); - sw.Start(); - ContentState = State.None; - LoadContent(); - using (var sr = new StringReader(_buffer.Text)) { - var parser = Parser.CreateParser(sr, Interpreter.LanguageVersion, ParserOptions.Default); - var ast = parser.ParseFile(Uri); - // Stored nodes are no longer valid. - _astMap.Clear(); - _astMap[this] = ast; - } - sw.Stop(); - Log?.Log(TraceEventType.Verbose, $"Reloaded {Name} in {sw.ElapsedMilliseconds}ms because new analysis was requested."); - } - // TODO: Figure out where the nulls below are coming from. var importedVariables = ((IScope)GlobalScope) .TraverseDepthFirst(c => c?.Children ?? Enumerable.Empty()) @@ -426,6 +410,9 @@ public void NotifyAnalysisComplete(IDocumentAnalysis analysis) { // as declare additional variables, etc. OnAnalysisComplete(); ContentState = State.Analyzed; + + // For non-user code drop content to conserve memory + ClearContent(); } // Do not report issues with libraries or stubs @@ -449,7 +436,18 @@ public void AddAstNode(object o, Node n) { Debug.Assert(!_astMap.ContainsKey(o) || _astMap[o] == n); _astMap[o] = n; } - public void Clear() =>_astMap.Clear(); + + public void ClearAst() { + if (ModuleType != ModuleType.User) { + _astMap.Clear(); + } + } + + public void ClearContent() { + if (ModuleType != ModuleType.User) { + _buffer.Reset(_buffer.Version, string.Empty); + } + } #endregion #region Analysis diff --git a/src/Analysis/Ast/Test/PepHintTests.cs b/src/Analysis/Ast/Test/PepHintTests.cs index 91db0df13..8964ddc7f 100644 --- a/src/Analysis/Ast/Test/PepHintTests.cs +++ b/src/Analysis/Ast/Test/PepHintTests.cs @@ -13,14 +13,12 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. -using System.Linq; using System.Threading.Tasks; using FluentAssertions; using Microsoft.Python.Analysis.Tests.FluentAssertions; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; using Microsoft.Python.Parsing.Tests; -using Microsoft.Python.Tests.Utilities.FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using TestUtilities; diff --git a/src/Analysis/Ast/Test/ValuesTests.cs b/src/Analysis/Ast/Test/ValuesTests.cs index d200604a3..007c76b25 100644 --- a/src/Analysis/Ast/Test/ValuesTests.cs +++ b/src/Analysis/Ast/Test/ValuesTests.cs @@ -15,7 +15,6 @@ using System.IO; using System.Threading.Tasks; -using FluentAssertions; using Microsoft.Python.Analysis.Tests.FluentAssertions; using Microsoft.Python.Analysis.Types; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/LanguageServer/Impl/Completion/ExpressionLocator.cs b/src/LanguageServer/Impl/Completion/ExpressionLocator.cs index 9ce9cd0f6..f0835cb87 100644 --- a/src/LanguageServer/Impl/Completion/ExpressionLocator.cs +++ b/src/LanguageServer/Impl/Completion/ExpressionLocator.cs @@ -44,17 +44,17 @@ public static void FindExpression(PythonAst ast, SourceLocation position, FindEx expression = expression ?? (statement as ExpressionStatement)?.Expression; } - private static bool CanBackUp(PythonAst tree, Node node, Node statement, ScopeStatement scope, int column) { + private static bool CanBackUp(PythonAst ast, Node node, Node statement, ScopeStatement scope, int column) { if (node != null || !((statement as ExpressionStatement)?.Expression is ErrorExpression)) { return false; } var top = 1; if (scope != null) { - var scopeStart = scope.GetStart(); + var scopeStart = scope.GetStart(ast); if (scope.Body != null) { - top = scope.Body.GetEnd().Line == scopeStart.Line - ? scope.Body.GetStart().Column + top = scope.Body.GetEnd(ast).Line == scopeStart.Line + ? scope.Body.GetStart(ast).Column : scopeStart.Column; } else { top = scopeStart.Column; diff --git a/src/LanguageServer/Impl/Completion/FunctionDefinitionCompletion.cs b/src/LanguageServer/Impl/Completion/FunctionDefinitionCompletion.cs index 844cf3dda..629705baa 100644 --- a/src/LanguageServer/Impl/Completion/FunctionDefinitionCompletion.cs +++ b/src/LanguageServer/Impl/Completion/FunctionDefinitionCompletion.cs @@ -33,7 +33,7 @@ public static bool TryGetCompletionsForOverride(FunctionDefinition function, Com } if (function.Parent is ClassDefinition cd && function.NameExpression != null && context.Position > function.NameExpression.StartIndex) { - var loc = function.GetStart(); + var loc = function.GetStart(context.Ast); var overrideable = GetOverrideable(context, location).ToArray(); overrideable = !string.IsNullOrEmpty(function.Name) ? overrideable.Where(o => o.Name.StartsWithOrdinal(function.Name)).ToArray() diff --git a/src/LanguageServer/Impl/Completion/ImportCompletion.cs b/src/LanguageServer/Impl/Completion/ImportCompletion.cs index 3a156912b..9fb15e009 100644 --- a/src/LanguageServer/Impl/Completion/ImportCompletion.cs +++ b/src/LanguageServer/Impl/Completion/ImportCompletion.cs @@ -79,7 +79,7 @@ public static CompletionResult GetCompletionsInFromImport(FromImportStatement fr } if (context.Position >= name.StartIndex) { - var applicableSpan = name.GetSpan(); + var applicableSpan = name.GetSpan(context.Ast); var importSearchResult = mres.CurrentPathResolver.FindImports(document.FilePath, fromImport); return GetResultFromImportSearch(importSearchResult, context, false, applicableSpan); } diff --git a/src/LanguageServer/Impl/Documentation/DocstringConverter.cs b/src/LanguageServer/Impl/Documentation/DocstringConverter.cs index 466668890..aab46c877 100644 --- a/src/LanguageServer/Impl/Documentation/DocstringConverter.cs +++ b/src/LanguageServer/Impl/Documentation/DocstringConverter.cs @@ -77,7 +77,7 @@ private int NextBlockIndent private string CurrentLineWithinBlock => CurrentLine.Substring(_blockIndent); private DocstringConverter(string input) { - _builder = new StringBuilder(input.Length); + _builder = new StringBuilder(input?.Length ?? 0); _state = ParseText; _lines = SplitDocstring(input); } diff --git a/src/LanguageServer/Impl/Indexing/SymbolIndexWalker.cs b/src/LanguageServer/Impl/Indexing/SymbolIndexWalker.cs index 0ebe6dda1..ddd1565df 100644 --- a/src/LanguageServer/Impl/Indexing/SymbolIndexWalker.cs +++ b/src/LanguageServer/Impl/Indexing/SymbolIndexWalker.cs @@ -41,8 +41,8 @@ public override bool Walk(ClassDefinition node) { _stack.AddSymbol(new HierarchicalSymbol( node.Name, SymbolKind.Class, - node.GetSpan(), - node.NameExpression.GetSpan(), + node.GetSpan(_ast), + node.NameExpression.GetSpan(_ast), children, FunctionKind.Class )); @@ -58,13 +58,13 @@ public override bool Walk(FunctionDefinition node) { node.Body?.Walk(this); var children = _stack.Exit(); - var span = node.GetSpan(); + var span = node.GetSpan(_ast); var ds = new HierarchicalSymbol( node.Name, SymbolKind.Function, span, - node.IsLambda ? span : node.NameExpression.GetSpan(), + node.IsLambda ? span : node.NameExpression.GetSpan(_ast), children, FunctionKind.Function ); @@ -102,7 +102,7 @@ public override bool Walk(FunctionDefinition node) { public override bool Walk(ImportStatement node) { foreach (var (nameNode, nameString) in node.Names.Zip(node.AsNames, (name, asName) => asName != null ? (asName, asName.Name) : ((Node)name, name.MakeString()))) { - var span = nameNode.GetSpan(); + var span = nameNode.GetSpan(_ast); _stack.AddSymbol(new HierarchicalSymbol(nameString, SymbolKind.Module, span)); } @@ -115,7 +115,7 @@ public override bool Walk(FromImportStatement node) { } foreach (var name in node.Names.Zip(node.AsNames, (name, asName) => asName ?? name)) { - var span = name.GetSpan(); + var span = name.GetSpan(_ast); _stack.AddSymbol(new HierarchicalSymbol(name.Name, SymbolKind.Module, span)); } @@ -202,7 +202,7 @@ public override bool Walk(GeneratorExpression node) { private void ExitComprehension(Comprehension node) { var children = _stack.Exit(); - var span = node.GetSpan(); + var span = node.GetSpan(_ast); _stack.AddSymbol(new HierarchicalSymbol( $"<{node.NodeName}>", @@ -229,7 +229,7 @@ private void AddVarSymbol(NameExpression node) { break; } - var span = node.GetSpan(); + var span = node.GetSpan(_ast); _stack.AddSymbol(new HierarchicalSymbol(node.Name, kind, span)); } diff --git a/src/LanguageServer/Impl/Sources/HoverSource.cs b/src/LanguageServer/Impl/Sources/HoverSource.cs index 729b69c97..d4a2f4537 100644 --- a/src/LanguageServer/Impl/Sources/HoverSource.cs +++ b/src/LanguageServer/Impl/Sources/HoverSource.cs @@ -45,8 +45,8 @@ public Hover GetHover(IDocumentAnalysis analysis, SourceLocation location) { } var range = new Range { - start = expr.GetStart(), - end = expr.GetEnd() + start = expr.GetStart(analysis.Ast), + end = expr.GetEnd(analysis.Ast) }; var eval = analysis.ExpressionEvaluator; @@ -91,7 +91,7 @@ public Hover GetHover(IDocumentAnalysis analysis, SourceLocation location) { if (expr is MemberExpression mex) { name = mex.Name; range = new Range { - start = mex.Target.GetEnd(), + start = mex.Target.GetEnd(analysis.Ast), end = range.end }; diff --git a/src/Parsing/Impl/Ast/BinaryExpression.cs b/src/Parsing/Impl/Ast/BinaryExpression.cs index 3b0497b30..ca7c7536c 100644 --- a/src/Parsing/Impl/Ast/BinaryExpression.cs +++ b/src/Parsing/Impl/Ast/BinaryExpression.cs @@ -21,7 +21,7 @@ using System.Threading.Tasks; namespace Microsoft.Python.Parsing.Ast { - public partial class BinaryExpression : Expression { + public class BinaryExpression : Expression { public BinaryExpression(PythonOperator op, Expression left, Expression right, int operatorIndex) { if (op == PythonOperator.None) { throw new ArgumentException("bad operator"); @@ -88,8 +88,6 @@ public override async Task WalkAsync(PythonWalkerAsync walker, CancellationToken } internal override void AppendCodeString(StringBuilder res, PythonAst ast, CodeFormattingOptions format) { - var left = Left; - var right = Right; string op1, op2; if (Operator == PythonOperator.NotIn) { diff --git a/src/Parsing/Impl/Ast/DictionaryExpression.cs b/src/Parsing/Impl/Ast/DictionaryExpression.cs index 0feb297be..1ed01406d 100644 --- a/src/Parsing/Impl/Ast/DictionaryExpression.cs +++ b/src/Parsing/Impl/Ast/DictionaryExpression.cs @@ -17,7 +17,6 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Microsoft.Python.Core; using Microsoft.Python.Core.Collections; namespace Microsoft.Python.Parsing.Ast { diff --git a/src/Parsing/Impl/Ast/DottedName.cs b/src/Parsing/Impl/Ast/DottedName.cs index f0e6e4b96..b169aabfa 100644 --- a/src/Parsing/Impl/Ast/DottedName.cs +++ b/src/Parsing/Impl/Ast/DottedName.cs @@ -14,11 +14,9 @@ // permissions and limitations under the License. using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; -using Microsoft.Python.Core; using Microsoft.Python.Core.Collections; namespace Microsoft.Python.Parsing.Ast { @@ -44,16 +42,6 @@ public virtual string MakeString() { public override IEnumerable GetChildNodes() => Names; - public override PythonAst Ast { - get => base.Ast; - internal set { - base.Ast = value; - foreach (var n in Names) { - n.Ast = value; - } - } - } - public override void Walk(PythonWalker walker) { if (walker.Walk(this)) { } diff --git a/src/Parsing/Impl/Ast/FromImportStatement.cs b/src/Parsing/Impl/Ast/FromImportStatement.cs index d4bbdb97d..794f904f3 100644 --- a/src/Parsing/Impl/Ast/FromImportStatement.cs +++ b/src/Parsing/Impl/Ast/FromImportStatement.cs @@ -49,25 +49,9 @@ public FromImportStatement(ModuleName/*!*/ root, ImmutableArray Justification = "breaking change")] public PythonVariable[] Variables { get; set; } - public PythonReference[] GetReferences(PythonAst ast) => GetVariableReferences(this, ast); - // TODO: return names and aliases when they are united into one node public override IEnumerable GetChildNodes() => Enumerable.Empty(); - public override PythonAst Ast { - get => base.Ast; - internal set { - foreach (var n in Names.ExcludeDefault()) { - n.Ast = value; - } - foreach (var n in AsNames.ExcludeDefault()) { - n.Ast = value; - } - - Root.Ast = value; - base.Ast = value; - } - } public override void Walk(PythonWalker walker) { if (walker.Walk(this)) { } diff --git a/src/Parsing/Impl/Ast/ImportStatement.cs b/src/Parsing/Impl/Ast/ImportStatement.cs index a7126ba49..5c1a79fc3 100644 --- a/src/Parsing/Impl/Ast/ImportStatement.cs +++ b/src/Parsing/Impl/Ast/ImportStatement.cs @@ -13,14 +13,12 @@ // 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.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; -using Microsoft.Python.Core; using Microsoft.Python.Core.Collections; namespace Microsoft.Python.Parsing.Ast { @@ -44,19 +42,6 @@ public ImportStatement(ImmutableArray names, ImmutableArray GetChildNodes() => Enumerable.Empty(); - public override PythonAst Ast { - get => base.Ast; - internal set { - foreach (var n in Names.ExcludeDefault()) { - n.Ast = value; - } - foreach (var n in AsNames.ExcludeDefault()) { - n.Ast = value; - } - base.Ast = value; - } - } - public override void Walk(PythonWalker walker) { if (walker.Walk(this)) { } diff --git a/src/Parsing/Impl/Ast/MemberExpression.cs b/src/Parsing/Impl/Ast/MemberExpression.cs index b11db83c2..d49d32c2e 100644 --- a/src/Parsing/Impl/Ast/MemberExpression.cs +++ b/src/Parsing/Impl/Ast/MemberExpression.cs @@ -95,6 +95,6 @@ public override void SetLeadingWhiteSpace(PythonAst ast, string whiteSpace) /// /// Returns the span of the name component of the expression /// - public SourceSpan GetNameSpan() => new SourceSpan(Ast.IndexToLocation(NameHeader), GetEnd()); + public SourceSpan GetNameSpan(PythonAst ast) => new SourceSpan(ast.IndexToLocation(NameHeader), GetEnd(ast)); } } diff --git a/src/Parsing/Impl/Ast/NamedExpression.cs b/src/Parsing/Impl/Ast/NamedExpression.cs index 8a55cd3da..3f5693ab2 100644 --- a/src/Parsing/Impl/Ast/NamedExpression.cs +++ b/src/Parsing/Impl/Ast/NamedExpression.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Text; using System.Threading; using System.Threading.Tasks; diff --git a/src/Parsing/Impl/Ast/Node.cs b/src/Parsing/Impl/Ast/Node.cs index 82bc79c42..973ce6e70 100644 --- a/src/Parsing/Impl/Ast/Node.cs +++ b/src/Parsing/Impl/Ast/Node.cs @@ -23,8 +23,6 @@ namespace Microsoft.Python.Parsing.Ast { public abstract class Node { #region Public API - public virtual PythonAst Ast { get; internal set; } - public int EndIndex { get => IndexSpan.End; set => IndexSpan = new IndexSpan(IndexSpan.Start, value - IndexSpan.Start); @@ -50,11 +48,11 @@ public string ToCodeString(PythonAst ast, CodeFormattingOptions format) { return string.IsInterned(result) ?? result; } - public SourceLocation GetStart() => Ast.IndexToLocation(StartIndex); + public SourceLocation GetStart(PythonAst ast) => ast.IndexToLocation(StartIndex); - public SourceLocation GetEnd() => Ast.IndexToLocation(EndIndex); + public SourceLocation GetEnd(PythonAst ast) => ast.IndexToLocation(EndIndex); - public SourceSpan GetSpan() => new SourceSpan(GetStart(), GetEnd()); + public SourceSpan GetSpan(PythonAst ast) => new SourceSpan(GetStart(ast), GetEnd(ast)); /// /// Returns the proceeding whitespace (newlines and comments) that diff --git a/src/Parsing/Impl/Parser.cs b/src/Parsing/Impl/Parser.cs index 36f13fc28..0813780c0 100644 --- a/src/Parsing/Impl/Parser.cs +++ b/src/Parsing/Impl/Parser.cs @@ -197,10 +197,6 @@ private PythonAst CreateAst(Uri module, Statement ret) { ast.SetAttributes(_attributes); PythonNameBinder.BindAst(_langVersion, ast, _errors, _bindReferences); - foreach (var n in ((Node)ast).TraverseDepthFirst(c => c.GetChildNodes())) { - n.Ast = ast; - } - return ast; } @@ -3244,8 +3240,8 @@ private Expression buildFStringExpr(IEnumerable readTokens) { var openQuotes = readTokens.Where(t => t.Token.Kind == TokenKind.FString) .Select(t => ((FStringToken)t.Token).OpenQuotes).DefaultIfEmpty("'").First(); - List fStringChildren = new List(); - StringBuilder unparsedFStringBuilder = new StringBuilder(); + var fStringChildren = new List(); + var unparsedFStringBuilder = new StringBuilder(); foreach (var tokenWithSpan in readTokens) { if (tokenWithSpan.Token.Kind == TokenKind.FString) { diff --git a/src/Parsing/Impl/Token.cs b/src/Parsing/Impl/Token.cs index db7d8d1c5..703deb591 100644 --- a/src/Parsing/Impl/Token.cs +++ b/src/Parsing/Impl/Token.cs @@ -93,8 +93,6 @@ public ConstantValueToken(object value) Value = value; } - public object Constant => Value; - public override object Value { get; } public override string Image => Value == null ? "None" : Value.ToString(); @@ -140,11 +138,7 @@ public FStringToken(string value, string openQuote, bool isTriple, bool isRaw) public string Text => (string)Value; - public override string Image { - get { - return Value == null ? "None" : $"f{OpenQuotes}{Value.ToString()}{OpenQuotes}"; - } - } + public override string Image => Value == null ? "None" : $"f{OpenQuotes}{Value.ToString()}{OpenQuotes}"; } public sealed class VerbatimFStringToken : FStringToken { From 080beabab18df498c753ae2f2294d7b5f4d4a6f1 Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Sat, 25 May 2019 15:10:53 -0700 Subject: [PATCH 13/82] Remove local variables --- src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs | 4 ++++ src/Analysis/Ast/Impl/Values/VariableCollection.cs | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs b/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs index 6221d6af7..6684bd412 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs @@ -79,6 +79,10 @@ public override void Evaluate() { if (ctor || annotationType.IsUnknown() || Module.ModuleType == ModuleType.User) { // Return type from the annotation is sufficient for libraries and stubs, no need to walk the body. FunctionDefinition.Body?.Walk(this); + // For libraries remove declared local function variables to free up some memory. + if (Module.ModuleType != ModuleType.User) { + ((VariableCollection)Eval.CurrentScope.Variables).Clear(); + } } } Result = _function; diff --git a/src/Analysis/Ast/Impl/Values/VariableCollection.cs b/src/Analysis/Ast/Impl/Values/VariableCollection.cs index 893358d73..817456eca 100644 --- a/src/Analysis/Ast/Impl/Values/VariableCollection.cs +++ b/src/Analysis/Ast/Impl/Values/VariableCollection.cs @@ -122,5 +122,11 @@ internal void RemoveVariable(string name) { _variables.Remove(name); } } + + internal void Clear() { + lock (_syncObj) { + _variables.Clear(); + } + } } } From 93a691579eae83b3dc648490f831dc4b41b889db Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Sat, 25 May 2019 19:11:27 -0700 Subject: [PATCH 14/82] Test fixes --- .../Evaluation/ExpressionEval.Callables.cs | 2 +- .../Ast/Impl/Analyzer/Symbols/SymbolCollector.cs | 2 +- src/Analysis/Ast/Impl/Types/PythonClassType.cs | 2 +- .../Ast/Impl/Types/PythonFunctionOverload.cs | 16 ++-------------- .../Ast/Impl/Types/PythonFunctionType.cs | 2 +- src/Analysis/Ast/Test/ArgumentSetTests.cs | 8 ++++++-- 6 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs index e76d46dc6..ec4eb668d 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs @@ -79,7 +79,7 @@ public IMember GetValueFromLambda(LambdaExpression expr) { var location = GetLocationOfName(expr.Function); var ft = new PythonFunctionType(expr.Function, null, location); - var overload = new PythonFunctionOverload(ft, location); + var overload = new PythonFunctionOverload(ft, location, expr.Function.ReturnAnnotation?.ToCodeString(Ast)); ft.AddOverload(overload); return ft; } diff --git a/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs b/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs index ef71bf50f..ce3a1de22 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs @@ -132,7 +132,7 @@ private void AddOverload(FunctionDefinition fd, IPythonClassMember function, Act if (!_table.Contains(fd)) { // Do not evaluate parameter types just yet. During light-weight top-level information // collection types cannot be determined as imports haven't been processed. - var overload = new PythonFunctionOverload(function, _eval.GetLocationOfName(fd)); + var overload = new PythonFunctionOverload(function, _eval.GetLocationOfName(fd), fd.ReturnAnnotation?.ToCodeString(_eval.Ast)); addOverload(overload); _table.Add(new FunctionEvaluator(_eval, overload)); } diff --git a/src/Analysis/Ast/Impl/Types/PythonClassType.cs b/src/Analysis/Ast/Impl/Types/PythonClassType.cs index 16361a990..850cf4893 100644 --- a/src/Analysis/Ast/Impl/Types/PythonClassType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonClassType.cs @@ -50,7 +50,7 @@ public PythonClassType( BuiltinTypeId builtinTypeId = BuiltinTypeId.Type ) : base(classDefinition.Name, location, classDefinition.GetDocumentation(), builtinTypeId) { Check.ArgumentNotNull(nameof(location), location.Module); - DeclaringModule.AddAstNode(this, classDefinition); + location.Module.AddAstNode(this, classDefinition); } #region IPythonType diff --git a/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs b/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs index 4269fc5bf..9aac1a537 100644 --- a/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs +++ b/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs @@ -49,22 +49,10 @@ internal sealed class PythonFunctionOverload : LocatedMember, IPythonFunctionOve // type info of C vs. return C() that returns an instance of C. private bool _fromAnnotation; - public PythonFunctionOverload(IPythonClassMember cm, Location location) + public PythonFunctionOverload(IPythonClassMember cm, Location location, string returnDocumentation) : this(cm.Name, location) { ClassMember = cm; - var ast = (location.Module as IDocument)?.Analysis.Ast; - - FunctionDefinition fd = null; - switch(cm) { - case IPythonFunctionType ft: - fd = ft.FunctionDefinition; - break; - case IPythonPropertyType prop: - fd = prop.FunctionDefinition; - break; - } - - _returnDocumentation = ast != null ? fd?.ReturnAnnotation?.ToCodeString(ast) : null; + _returnDocumentation = returnDocumentation; } public PythonFunctionOverload(string name, Location location) : base(location) { diff --git a/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs b/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs index a2bbe4d09..31cf4092a 100644 --- a/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs @@ -60,7 +60,7 @@ public PythonFunctionType( IPythonType declaringType, Location location ) : base(fd.Name, location, - fd.Name == "__init__" ? declaringType?.Documentation : fd.Documentation, + fd.Name == "__init__" ? (declaringType?.Documentation ?? fd.GetDocumentation()) : fd.GetDocumentation(), declaringType != null ? BuiltinTypeId.Method : BuiltinTypeId.Function) { DeclaringType = declaringType; diff --git a/src/Analysis/Ast/Test/ArgumentSetTests.cs b/src/Analysis/Ast/Test/ArgumentSetTests.cs index fc613182a..2f4bee636 100644 --- a/src/Analysis/Ast/Test/ArgumentSetTests.cs +++ b/src/Analysis/Ast/Test/ArgumentSetTests.cs @@ -347,9 +347,14 @@ from builtins import pow [TestMethod, Priority(0)] public async Task DefaultArgumentAnotherFile() { const string code = @" -from DefaultArgument import func +from .module2 import func func() "; + const string code2 = @" +class A: ... +def func(a = A()): ... +"; + await TestData.CreateTestSpecificFileAsync("module2.py", code2); var argSet = await GetArgSetAsync(code, "func"); argSet.Arguments.Count.Should().Be(1); argSet.Evaluate(); @@ -361,7 +366,6 @@ from DefaultArgument import func t.MemberType.Should().Be(PythonMemberType.Class); } - private async Task GetArgSetAsync(string code, string funcName = "f") { var analysis = await GetAnalysisAsync(code); var f = analysis.Should().HaveFunction(funcName).Which; From cadd7ceeefa109c425614af4288ace83a6bab44c Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Sat, 25 May 2019 20:00:39 -0700 Subject: [PATCH 15/82] Fix overload match --- .../Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs | 7 ++++--- .../Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs | 3 ++- .../Ast/Impl/Analyzer/Symbols/ModuleSymbolTable.cs | 1 - src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs | 6 +++--- src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs | 5 +++-- src/Analysis/Ast/Test/FunctionTests.cs | 1 - 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs index ec4eb668d..55b4a8d02 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs @@ -77,9 +77,10 @@ public IMember GetValueFromLambda(LambdaExpression expr) { return null; } - var location = GetLocationOfName(expr.Function); - var ft = new PythonFunctionType(expr.Function, null, location); - var overload = new PythonFunctionOverload(ft, location, expr.Function.ReturnAnnotation?.ToCodeString(Ast)); + var fd = expr.Function; + var location = GetLocationOfName(fd); + var ft = new PythonFunctionType(fd, null, location); + var overload = new PythonFunctionOverload(ft, fd, location, expr.Function.ReturnAnnotation?.ToCodeString(Ast)); ft.AddOverload(overload); return ft; } diff --git a/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs b/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs index 6684bd412..8b7d70b73 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs @@ -43,7 +43,7 @@ public FunctionEvaluator(ExpressionEval eval, PythonFunctionOverload overload) FunctionDefinition = overload.FunctionDefinition; } - public FunctionDefinition FunctionDefinition { get; } + private FunctionDefinition FunctionDefinition { get; } public override void Evaluate() { var stub = SymbolTable.ReplacedByStubs.Contains(Target) @@ -79,6 +79,7 @@ public override void Evaluate() { if (ctor || annotationType.IsUnknown() || Module.ModuleType == ModuleType.User) { // Return type from the annotation is sufficient for libraries and stubs, no need to walk the body. FunctionDefinition.Body?.Walk(this); + // For libraries remove declared local function variables to free up some memory. if (Module.ModuleType != ModuleType.User) { ((VariableCollection)Eval.CurrentScope.Variables).Clear(); diff --git a/src/Analysis/Ast/Impl/Analyzer/Symbols/ModuleSymbolTable.cs b/src/Analysis/Ast/Impl/Analyzer/Symbols/ModuleSymbolTable.cs index ef4848991..31a3b4212 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Symbols/ModuleSymbolTable.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Symbols/ModuleSymbolTable.cs @@ -34,7 +34,6 @@ internal sealed class ModuleSymbolTable { public IEnumerable> Evaluators => _evaluators.ToArray(); public void Add(MemberEvaluator e) => _evaluators[e.Target] = e; - public MemberEvaluator Get(ScopeStatement target) => _evaluators.TryGetValue(target, out var w) ? w : null; public bool Contains(ScopeStatement node) => _evaluators.ContainsKey(node) || _processed.Contains(node); public void Build(ExpressionEval eval) diff --git a/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs b/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs index ce3a1de22..55b322520 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs @@ -73,7 +73,7 @@ public override bool Walk(FunctionDefinition fd) { if (IsDeprecated(fd)) { return false; } - if (!string.IsNullOrEmpty(fd.NameExpression?.Name)) { + if (!string.IsNullOrEmpty(fd.Name)) { AddFunctionOrProperty(fd); // Open function scope _scopes.Push(_eval.OpenScope(_eval.Module, fd, out _)); @@ -82,7 +82,7 @@ public override bool Walk(FunctionDefinition fd) { } public override void PostWalk(FunctionDefinition fd) { - if (!IsDeprecated(fd) && !string.IsNullOrEmpty(fd.NameExpression?.Name)) { + if (!IsDeprecated(fd) && !string.IsNullOrEmpty(fd.Name)) { _scopes.Pop().Dispose(); } base.PostWalk(fd); @@ -132,7 +132,7 @@ private void AddOverload(FunctionDefinition fd, IPythonClassMember function, Act if (!_table.Contains(fd)) { // Do not evaluate parameter types just yet. During light-weight top-level information // collection types cannot be determined as imports haven't been processed. - var overload = new PythonFunctionOverload(function, _eval.GetLocationOfName(fd), fd.ReturnAnnotation?.ToCodeString(_eval.Ast)); + var overload = new PythonFunctionOverload(function, fd, _eval.GetLocationOfName(fd), fd.ReturnAnnotation?.ToCodeString(_eval.Ast)); addOverload(overload); _table.Add(new FunctionEvaluator(_eval, overload)); } diff --git a/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs b/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs index 9aac1a537..43363a6d2 100644 --- a/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs +++ b/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs @@ -49,9 +49,10 @@ internal sealed class PythonFunctionOverload : LocatedMember, IPythonFunctionOve // type info of C vs. return C() that returns an instance of C. private bool _fromAnnotation; - public PythonFunctionOverload(IPythonClassMember cm, Location location, string returnDocumentation) + public PythonFunctionOverload(IPythonClassMember cm, FunctionDefinition fd, Location location, string returnDocumentation) : this(cm.Name, location) { ClassMember = cm; + cm.DeclaringModule.AddAstNode(this, fd); _returnDocumentation = returnDocumentation; } @@ -92,7 +93,7 @@ internal void SetReturnValue(IMember value, bool fromAnnotation) { internal void SetDocumentation(string documentation) => Documentation = documentation; #region IPythonFunctionOverload - public FunctionDefinition FunctionDefinition => ClassMember?.DeclaringModule?.GetAstNode(ClassMember); + public FunctionDefinition FunctionDefinition => ClassMember?.DeclaringModule?.GetAstNode(this); public IPythonClassMember ClassMember { get; } public string Name { get; } public string Documentation { get; private set; } diff --git a/src/Analysis/Ast/Test/FunctionTests.cs b/src/Analysis/Ast/Test/FunctionTests.cs index a1159af57..83693bf62 100644 --- a/src/Analysis/Ast/Test/FunctionTests.cs +++ b/src/Analysis/Ast/Test/FunctionTests.cs @@ -357,7 +357,6 @@ def e(cls): pass [TestMethod, Priority(0)] public async Task OverloadsParamTypeMatch() { const string code = @" - def f(a: bool) -> None: ... def f(a: int) -> float: ... def f(a: str) -> bytes: ... From f61b1a762ac7518c35107805eb6aad3e95c80565 Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Sat, 25 May 2019 22:25:04 -0700 Subject: [PATCH 16/82] Tests --- .../Analyzer/Evaluation/ExpressionEval.cs | 5 +- src/Analysis/Ast/Impl/Types/ArgumentSet.cs | 47 ++++++++++--------- .../Impl/Types/Definitions/IArgumentSet.cs | 5 -- .../Impl/Types/Definitions/IParameterInfo.cs | 16 +++---- src/Analysis/Ast/Impl/Types/Location.cs | 2 +- src/Analysis/Ast/Impl/Types/ParameterInfo.cs | 6 +-- .../FunctionDefinitionCompletion.cs | 4 +- src/Parsing/Impl/Ast/PythonAst.cs | 3 +- 8 files changed, 39 insertions(+), 49 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs index fda123b1e..392dc1abe 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs @@ -68,10 +68,9 @@ public Location GetLocationOfName(Node node) { } IndexSpan indexSpan; - var ast = Module.GetAst(); switch (node) { case MemberExpression mex: - indexSpan = mex.GetNameSpan(ast).ToIndexSpan(ast); + indexSpan = mex.GetNameSpan(Ast).ToIndexSpan(Ast); break; case ClassDefinition cd: indexSpan = cd.NameExpression.IndexSpan; @@ -91,7 +90,7 @@ public Location GetLocationOfName(Node node) { // turns into span at line 1 and very large column. This DOES can // produce false positives occasionally. #if DEBUG - var sourceSpan = indexSpan.ToSourceSpan(ast); + var sourceSpan = indexSpan.ToSourceSpan(Ast); Debug.Assert(sourceSpan.Start.Line > 1 || sourceSpan.Start.Column < 1000); #endif return new Location(Module, indexSpan); diff --git a/src/Analysis/Ast/Impl/Types/ArgumentSet.cs b/src/Analysis/Ast/Impl/Types/ArgumentSet.cs index 4d0b741a8..dbcd33293 100644 --- a/src/Analysis/Ast/Impl/Types/ArgumentSet.cs +++ b/src/Analysis/Ast/Impl/Types/ArgumentSet.cs @@ -91,7 +91,7 @@ public ArgumentSet(IPythonFunctionType fn, int overloadIndex, IPythonInstance in var overload = fn.Overloads[overloadIndex]; var fd = overload.FunctionDefinition; - if (fd == null || fn.IsSpecialized) { + if (fn.IsSpecialized) { // Typically specialized function, like TypeVar() that does not actually have AST definition. // Make the arguments from the call expression. If argument does not have name, // try using name from the function definition based on the argument position. @@ -99,11 +99,10 @@ public ArgumentSet(IPythonFunctionType fn, int overloadIndex, IPythonInstance in for (var i = 0; i < callExpr.Args.Count; i++) { var name = callExpr.Args[i].Name; if (string.IsNullOrEmpty(name)) { - name = fd != null && i < fd.Parameters.Length ? fd.Parameters[i].Name : null; + name = i < overload.Parameters.Count ? overload.Parameters[i].Name : $"arg{i}"; } - name = name ?? $"arg{i}"; - var parameter = fd != null && i < fd.Parameters.Length ? fd.Parameters[i] : null; - _arguments.Add(new Argument(name, ParameterKind.Normal, callExpr.Args[i].Expression, null, parameter)); + var node = fd != null && i < fd.Parameters.Length ? fd.Parameters[i] : null; + _arguments.Add(new Argument(name, ParameterKind.Normal, callExpr.Args[i].Expression, null, node)); } return; } @@ -116,7 +115,12 @@ public ArgumentSet(IPythonFunctionType fn, int overloadIndex, IPythonInstance in // had values assigned to them are marked as 'filled'.Slots which have // no value assigned to them yet are considered 'empty'. - var slots = fd.Parameters.Select(p => new Argument(p, p)).ToArray(); + var slots = new Argument[overload.Parameters.Count]; + for (var i = 0; i < overload.Parameters.Count; i++) { + var node = fd != null && i < fd.Parameters.Length ? fd.Parameters[i] : null; + slots[i] = new Argument(overload.Parameters[i], node); + } + // Locate sequence argument, if any var sa = slots.Where(s => s.Kind == ParameterKind.List).ToArray(); if (sa.Length > 1) { @@ -151,7 +155,7 @@ public ArgumentSet(IPythonFunctionType fn, int overloadIndex, IPythonInstance in break; } - if (formalParamIndex >= fd.Parameters.Length) { + if (formalParamIndex >= overload.Parameters.Count) { // We ran out of formal parameters and yet haven't seen // any sequence or dictionary ones. This looks like an error. _errors.Add(new DiagnosticsEntry(Resources.Analysis_TooManyFunctionArguments, arg.GetLocation(module).Span, @@ -159,8 +163,8 @@ public ArgumentSet(IPythonFunctionType fn, int overloadIndex, IPythonInstance in return; } - var formalParam = fd.Parameters[formalParamIndex]; - if (formalParam.IsList) { + var formalParam = overload.Parameters[formalParamIndex]; + if (formalParam.Kind == ParameterKind.List) { if (string.IsNullOrEmpty(formalParam.Name)) { // If the next unfilled slot is a vararg slot, and it does not have a name, then it is an error. _errors.Add(new DiagnosticsEntry(Resources.Analysis_TooManyPositionalArgumentBeforeStar, arg.GetLocation(module).Span, @@ -189,7 +193,7 @@ public ArgumentSet(IPythonFunctionType fn, int overloadIndex, IPythonInstance in break; // Sequence or dictionary parameter found. Done here. } - if (formalParam.IsDictionary) { + if (formalParam.Kind == ParameterKind.Dictionary) { // Next slot is a dictionary slot, but we have positional arguments still. _errors.Add(new DiagnosticsEntry(Resources.Analysis_TooManyPositionalArgumentBeforeStar, arg.GetLocation(module).Span, ErrorCodes.TooManyPositionalArgumentsBeforeStar, Severity.Warning, DiagnosticSource.Analysis)); @@ -248,8 +252,8 @@ public ArgumentSet(IPythonFunctionType fn, int overloadIndex, IPythonInstance in // then fill the slot with the default value. If there is no default value, // then it is an error. foreach (var slot in slots.Where(s => s.Kind != ParameterKind.List && s.Kind != ParameterKind.Dictionary && s.Value == null)) { - if (slot.ValueExpression == null) { - var parameter = fd.Parameters.First(p => p.Name == slot.Name); + if (slot.Value == null) { + var parameter = overload.Parameters.First(p => p.Name == slot.Name); if (parameter.DefaultValue == null) { // TODO: parameter is not assigned and has no default value. _errors.Add(new DiagnosticsEntry(Resources.Analysis_ParameterMissing.FormatUI(slot.Name), callLocation.Span, @@ -257,7 +261,7 @@ public ArgumentSet(IPythonFunctionType fn, int overloadIndex, IPythonInstance in } // Note that parameter default value expression is from the function definition AST // while actual argument values are from the calling file AST. - slot.ValueExpression = parameter.DefaultValue; + slot.Value = parameter.DefaultValue; slot.ValueIsDefault = true; } } @@ -274,7 +278,6 @@ public ArgumentSet Evaluate() { foreach (var a in _arguments.Where(x => x.Value == null)) { a.Value = GetArgumentValue(a); - a.Type = Eval.GetValueFromExpression(a.TypeExpression) as IPythonType; } if (_listArgument != null) { @@ -296,6 +299,9 @@ public ArgumentSet Evaluate() { } private IMember GetArgumentValue(Argument arg) { + if (arg.Value is IMember m) { + return m; + } // Evaluates expression in the specific module context. Typically used to evaluate // expressions representing default values of function arguments since they are // are defined in the function declaring module rather than in the caller context. @@ -345,24 +351,19 @@ private sealed class Argument : IArgument { /// public IPythonType Type { get; internal set; } - /// - /// Type annotation expression. - /// - public Expression TypeExpression { get; } - /// /// AST node that defines the argument. /// public Node Location { get; } - public Argument(Parameter p, Node location) : - this(p.Name, p.Kind, null, p.Annotation, location) { } + public Argument(IParameterInfo p, Node location) : + this(p.Name, p.Kind, null, p.Type, location) { } - public Argument(string name, ParameterKind kind, Expression valueValueExpression, Expression typeExpression, Node location) { + public Argument(string name, ParameterKind kind, Expression valueValueExpression, IPythonType type, Node location) { Name = name; Kind = kind; + Type = type; ValueExpression = valueValueExpression; - TypeExpression = typeExpression; Location = location; } diff --git a/src/Analysis/Ast/Impl/Types/Definitions/IArgumentSet.cs b/src/Analysis/Ast/Impl/Types/Definitions/IArgumentSet.cs index e4b952b6c..bc1caa61b 100644 --- a/src/Analysis/Ast/Impl/Types/Definitions/IArgumentSet.cs +++ b/src/Analysis/Ast/Impl/Types/Definitions/IArgumentSet.cs @@ -44,11 +44,6 @@ public interface IArgument { /// IPythonType Type { get; } - /// - /// Annotation expression. - /// - Expression TypeExpression { get; } - /// /// Parameter location in the AST. /// diff --git a/src/Analysis/Ast/Impl/Types/Definitions/IParameterInfo.cs b/src/Analysis/Ast/Impl/Types/Definitions/IParameterInfo.cs index d0875c2b7..8c79fea2f 100644 --- a/src/Analysis/Ast/Impl/Types/Definitions/IParameterInfo.cs +++ b/src/Analysis/Ast/Impl/Types/Definitions/IParameterInfo.cs @@ -14,6 +14,7 @@ // permissions and limitations under the License. using Microsoft.Python.Core.Text; +using Microsoft.Python.Parsing.Ast; namespace Microsoft.Python.Analysis.Types { /// @@ -36,16 +37,6 @@ public interface IParameterInfo { /// string Documentation { get; } - /// - /// True if the parameter is a *args parameter. - /// - bool IsParamArray { get; } - - /// - /// True if the parameter is a **args parameter. - /// - bool IsKeywordDict { get; } - /// /// Parameter type is generic and specific type will be /// determined at the time of the function call. @@ -62,5 +53,10 @@ public interface IParameterInfo { /// Default value. /// IMember DefaultValue { get; } + + /// + /// Parameter kind. + /// + ParameterKind Kind { get; } } } diff --git a/src/Analysis/Ast/Impl/Types/Location.cs b/src/Analysis/Ast/Impl/Types/Location.cs index 8cc2540bf..a7edb604d 100644 --- a/src/Analysis/Ast/Impl/Types/Location.cs +++ b/src/Analysis/Ast/Impl/Types/Location.cs @@ -30,7 +30,7 @@ public Location(IPythonModule module, IndexSpan indexSpan) { public LocationInfo LocationInfo { get { - var ast = Module?.Analysis.Ast; + var ast = Module.GetAst(); if (ast != null && !string.IsNullOrEmpty(Module?.FilePath) && Module?.Uri != null) { return new LocationInfo(Module.FilePath, Module.Uri, IndexSpan.ToSourceSpan(ast)); } diff --git a/src/Analysis/Ast/Impl/Types/ParameterInfo.cs b/src/Analysis/Ast/Impl/Types/ParameterInfo.cs index c6a67058b..15b0a04c0 100644 --- a/src/Analysis/Ast/Impl/Types/ParameterInfo.cs +++ b/src/Analysis/Ast/Impl/Types/ParameterInfo.cs @@ -34,17 +34,15 @@ public ParameterInfo(string name, IPythonType type, ParameterKind? kind, IMember Documentation = string.Empty; DefaultValue = defaultValue; Type = type; - IsParamArray = kind == ParameterKind.List; - IsKeywordDict = kind == ParameterKind.Dictionary; + Kind = kind ?? ParameterKind.Normal; } public string Name { get; } public string Documentation { get; } - public bool IsParamArray { get; } - public bool IsKeywordDict { get; } public bool IsGeneric { get; } public IPythonType Type { get; } public string DefaultValueString { get; } public IMember DefaultValue { get; } + public ParameterKind Kind { get; } } } diff --git a/src/LanguageServer/Impl/Completion/FunctionDefinitionCompletion.cs b/src/LanguageServer/Impl/Completion/FunctionDefinitionCompletion.cs index 629705baa..2c56cbc20 100644 --- a/src/LanguageServer/Impl/Completion/FunctionDefinitionCompletion.cs +++ b/src/LanguageServer/Impl/Completion/FunctionDefinitionCompletion.cs @@ -56,10 +56,10 @@ private static CompletionItem ToOverrideCompletionItem(IPythonFunctionOverload o } private static string MakeOverrideParameter(IParameterInfo paramInfo, string defaultValue) { - if (paramInfo.IsParamArray) { + if (paramInfo.Kind == ParameterKind.List) { return $"*{paramInfo.Name}"; } - if (paramInfo.IsKeywordDict) { + if (paramInfo.Kind == ParameterKind.Dictionary) { return $"**{paramInfo.Name}"; } return !string.IsNullOrEmpty(paramInfo.DefaultValueString) ? $"{paramInfo.Name}={defaultValue}" : paramInfo.Name; diff --git a/src/Parsing/Impl/Ast/PythonAst.cs b/src/Parsing/Impl/Ast/PythonAst.cs index fc6d8661c..8626600ef 100644 --- a/src/Parsing/Impl/Ast/PythonAst.cs +++ b/src/Parsing/Impl/Ast/PythonAst.cs @@ -97,8 +97,9 @@ public void Reduce(Func filter) { (Body as SuiteStatement)?.FilterStatements(filter); _attributes?.Clear(); Variables?.Clear(); - NewLineLocations = Array.Empty(); CommentLocations = Array.Empty(); + // DO keep NewLineLocations as they are required + // to calculate node positions for navigation; base.Clear(); } From 1b203267a2470867252703ce40cba0e6fdad0dea Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Mon, 27 May 2019 15:53:31 -0700 Subject: [PATCH 17/82] Add locks --- .../Ast/Impl/Analyzer/PythonAnalyzer.cs | 11 +++++--- src/Analysis/Ast/Impl/Modules/PythonModule.cs | 26 +++++++++++++------ 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzer.cs b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzer.cs index d6b52c46b..a8b9977ae 100644 --- a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzer.cs +++ b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzer.cs @@ -62,7 +62,7 @@ public void Dispose() { _disposeToken.TryMarkDisposed(); } - public Task WaitForCompleteAnalysisAsync(CancellationToken cancellationToken = default) + public Task WaitForCompleteAnalysisAsync(CancellationToken cancellationToken = default) => _analysisCompleteEvent.WaitAsync(cancellationToken); public async Task GetAnalysisAsync(IPythonModule module, int waitTime, CancellationToken cancellationToken) { @@ -190,8 +190,13 @@ public void ResetAnalyzer() { } } - public IReadOnlyList LoadedModules - => _analysisEntries.Values.ExcludeDefault().Select(v => v.Module).ExcludeDefault().ToArray(); + public IReadOnlyList LoadedModules { + get { + lock (_syncObj) { + return _analysisEntries.Values.ExcludeDefault().Select(v => v.Module).ExcludeDefault().ToArray(); + } + } + } internal bool IsFinalSession => _nextSession == null; diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.cs index 344443356..cbbd1b379 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.cs @@ -431,21 +431,31 @@ protected virtual void OnAnalysisComplete() { } #endregion #region IAstNodeContainer - public T GetAstNode(object o) where T : Node => _astMap.TryGetValue(o, out var n) ? (T)n : null; + public T GetAstNode(object o) where T : Node { + lock (AnalysisLock) { + return _astMap.TryGetValue(o, out var n) ? (T)n : null; + } + } + public void AddAstNode(object o, Node n) { - Debug.Assert(!_astMap.ContainsKey(o) || _astMap[o] == n); - _astMap[o] = n; + lock (AnalysisLock) { + Debug.Assert(!_astMap.ContainsKey(o) || _astMap[o] == n); + _astMap[o] = n; + } } public void ClearAst() { - if (ModuleType != ModuleType.User) { - _astMap.Clear(); + lock (AnalysisLock) { + if (ModuleType != ModuleType.User) { + _astMap.Clear(); + } } } - public void ClearContent() { - if (ModuleType != ModuleType.User) { - _buffer.Reset(_buffer.Version, string.Empty); + lock (AnalysisLock) { + if (ModuleType != ModuleType.User) { + _buffer.Reset(_buffer.Version, string.Empty); + } } } #endregion From d7efdac4256324c49e9c39420c4559338c93fa4d Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Sat, 25 May 2019 15:10:53 -0700 Subject: [PATCH 18/82] Remove local variables --- src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs | 4 ++++ src/Analysis/Ast/Impl/Values/VariableCollection.cs | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs b/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs index 6221d6af7..6684bd412 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs @@ -79,6 +79,10 @@ public override void Evaluate() { if (ctor || annotationType.IsUnknown() || Module.ModuleType == ModuleType.User) { // Return type from the annotation is sufficient for libraries and stubs, no need to walk the body. FunctionDefinition.Body?.Walk(this); + // For libraries remove declared local function variables to free up some memory. + if (Module.ModuleType != ModuleType.User) { + ((VariableCollection)Eval.CurrentScope.Variables).Clear(); + } } } Result = _function; diff --git a/src/Analysis/Ast/Impl/Values/VariableCollection.cs b/src/Analysis/Ast/Impl/Values/VariableCollection.cs index 893358d73..817456eca 100644 --- a/src/Analysis/Ast/Impl/Values/VariableCollection.cs +++ b/src/Analysis/Ast/Impl/Values/VariableCollection.cs @@ -122,5 +122,11 @@ internal void RemoveVariable(string name) { _variables.Remove(name); } } + + internal void Clear() { + lock (_syncObj) { + _variables.Clear(); + } + } } } From 98934d4a372e604530a84f11639ad4b299e3f74c Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Mon, 27 May 2019 16:48:44 -0700 Subject: [PATCH 19/82] Drop file content to save memory --- src/Analysis/Ast/Impl/Modules/PythonModule.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.cs index 18677e4b3..58ec9379d 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.cs @@ -438,6 +438,10 @@ public void NotifyAnalysisComplete(IDocumentAnalysis analysis) { // as declare additional variables, etc. OnAnalysisComplete(); ContentState = State.Analyzed; + + if (ModuleType != ModuleType.User) { + _buffer.Reset(_buffer.Version, string.Empty); + } } // Do not report issues with libraries or stubs From 417ae03eeb7ab655394505c5fe0732dbe8e1a68d Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Mon, 27 May 2019 17:01:15 -0700 Subject: [PATCH 20/82] Cache PEP hints --- .../Impl/Analyzer/Evaluation/ExpressionEval.Hints.cs | 11 ++++++++++- src/Parsing/Impl/Ast/PythonAst.cs | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Hints.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Hints.cs index b12e08072..557ad5a2e 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Hints.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Hints.cs @@ -26,8 +26,15 @@ namespace Microsoft.Python.Analysis.Analyzer.Evaluation { /// and types in a chain of scopes during analysis. /// internal sealed partial class ExpressionEval { + private const string _pepHintKey = "PEP Hint"; + public IPythonType GetTypeFromPepHint(Node node) { + if (Ast.TryGetAttribute(node, _pepHintKey, out var typeStringObject) && typeStringObject is string typeString) { + return GetTypeFromString(typeString); + } + var location = GetLocationInfo(node); + var content = (Module as IDocument)?.Content; if (string.IsNullOrEmpty(content) || !location.EndLine.HasValue) { return null; @@ -79,7 +86,9 @@ public IPythonType GetTypeFromPepHint(Node node) { } // Type alone is not a valid syntax, so we need to simulate the annotation. - var typeString = content.Substring(hintStart, i - hintStart).Trim(); + typeString = content.Substring(hintStart, i - hintStart).Trim(); + Ast.SetAttribute(node, _pepHintKey, typeString); + return GetTypeFromString(typeString); } diff --git a/src/Parsing/Impl/Ast/PythonAst.cs b/src/Parsing/Impl/Ast/PythonAst.cs index 8ce4a97de..17cc32571 100644 --- a/src/Parsing/Impl/Ast/PythonAst.cs +++ b/src/Parsing/Impl/Ast/PythonAst.cs @@ -96,7 +96,7 @@ public override async Task WalkAsync(PythonWalkerAsync walker, CancellationToken public PythonLanguageVersion LanguageVersion { get; } - internal bool TryGetAttribute(Node node, object key, out object value) { + public bool TryGetAttribute(Node node, object key, out object value) { if (_attributes.TryGetValue(node, out var nodeAttrs)) { return nodeAttrs.TryGetValue(key, out value); } @@ -104,7 +104,7 @@ internal bool TryGetAttribute(Node node, object key, out object value) { return false; } - internal void SetAttribute(Node node, object key, object value) { + public void SetAttribute(Node node, object key, object value) { if (!_attributes.TryGetValue(node, out var nodeAttrs)) { nodeAttrs = _attributes[node] = new Dictionary(); } From ec5605f8ba6ebdf778fa90277a1243c41065fe50 Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Mon, 27 May 2019 17:52:35 -0700 Subject: [PATCH 21/82] Recreate AST --- src/Analysis/Ast/Impl/Modules/PythonModule.cs | 20 ++++++++++++++++++- src/LanguageServer/Impl/Program.cs | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.cs index cbbd1b379..56e67d3d6 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.cs @@ -189,7 +189,7 @@ public virtual IEnumerable GetMemberNames() { /// Typically used in code navigation scenarios when user /// wants to see library code and not a stub. /// - public IPythonModule PrimaryModule { get; internal set; } + public IPythonModule PrimaryModule { get; private set; } #endregion #region IDisposable @@ -370,6 +370,13 @@ public override void Add(string message, SourceSpan span, int errorCode, Severit public void NotifyAnalysisBegins() { lock (AnalysisLock) { + if (Analysis is LibraryAnalysis) { + var sw = Log != null ? Stopwatch.StartNew() : null; + _astMap[this] = RecreateAst(); + sw?.Stop(); + Log?.Log(TraceEventType.Verbose, $"Reloaded AST of {Name} in {sw?.Elapsed.TotalMilliseconds} ms"); + } + if (_updated) { _updated = false; // In all variables find those imported, then traverse imported modules @@ -560,5 +567,16 @@ private void RemoveReferencesInModule(IPythonModule module) { } } } + + private PythonAst RecreateAst() { + lock (AnalysisLock) { + ContentState = State.None; + LoadContent(); + var parser = Parser.CreateParser(new StringReader(_buffer.Text), Interpreter.LanguageVersion, ParserOptions.Default); + var ast = parser.ParseFile(Uri); + ContentState = State.Parsed; + return ast; + } + } } } diff --git a/src/LanguageServer/Impl/Program.cs b/src/LanguageServer/Impl/Program.cs index 24adfa924..024f9af18 100644 --- a/src/LanguageServer/Impl/Program.cs +++ b/src/LanguageServer/Impl/Program.cs @@ -13,7 +13,7 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. -#define WAIT_FOR_DEBUGGER +// #define WAIT_FOR_DEBUGGER using System; using System.Diagnostics; From 713d87f52222469f442f278616dd6e7411a94e47 Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Mon, 27 May 2019 20:52:46 -0700 Subject: [PATCH 22/82] Fix specialization --- .../Ast/Impl/Analyzer/PythonAnalyzerSession.cs | 6 +++--- .../Ast/Impl/Extensions/AnalysisExtensions.cs | 2 +- .../Ast/Impl/Specializations/Specialized.cs | 4 ++-- .../Impl/Specializations/Typing/TypingModule.cs | 12 ++++++------ src/Analysis/Ast/Impl/Types/ArgumentSet.cs | 2 +- src/Analysis/Ast/Impl/Types/PythonFunctionType.cs | 14 +++++++------- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs index 931cebbd5..831e9d9b6 100644 --- a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs +++ b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs @@ -380,8 +380,8 @@ private enum State { } private IDocumentAnalysis CreateAnalysis(IDocument document, int version, ModuleWalker walker, bool isFinalPass) - => document.ModuleType == ModuleType.User || !isFinalPass - ? (IDocumentAnalysis)new DocumentAnalysis(document, version, walker.GlobalScope, walker.Eval, walker.StarImportMemberNames) - : new LibraryAnalysis(document, version, walker.Eval.Services, walker.GlobalScope, walker.StarImportMemberNames); + => document.ModuleType == ModuleType.Library && isFinalPass + ? new LibraryAnalysis(document, version, walker.Eval.Services, walker.GlobalScope, walker.StarImportMemberNames) + : (IDocumentAnalysis)new DocumentAnalysis(document, version, walker.GlobalScope, walker.Eval, walker.StarImportMemberNames); } } diff --git a/src/Analysis/Ast/Impl/Extensions/AnalysisExtensions.cs b/src/Analysis/Ast/Impl/Extensions/AnalysisExtensions.cs index 8e53962f2..1a2bf48bc 100644 --- a/src/Analysis/Ast/Impl/Extensions/AnalysisExtensions.cs +++ b/src/Analysis/Ast/Impl/Extensions/AnalysisExtensions.cs @@ -53,7 +53,7 @@ private static PythonFunctionType GetOrCreateFunction(this IDocumentAnalysis ana // We DO want to replace class by function. Consider type() in builtins. // 'type()' in code is a function call, not a type class instantiation. if (!(analysis.GlobalScope.Variables[name]?.Value is PythonFunctionType f)) { - f = PythonFunctionType.ForSpecialization(name, analysis.Document); + f = PythonFunctionType.Specialize(name, analysis.Document, string.Empty); f.AddOverload(new PythonFunctionOverload(name, new Location(analysis.Document))); analysis.GlobalScope.DeclareVariable(name, f, VariableSource.Declaration); } diff --git a/src/Analysis/Ast/Impl/Specializations/Specialized.cs b/src/Analysis/Ast/Impl/Specializations/Specialized.cs index 4da22b82c..e71222bc4 100644 --- a/src/Analysis/Ast/Impl/Specializations/Specialized.cs +++ b/src/Analysis/Ast/Impl/Specializations/Specialized.cs @@ -26,9 +26,9 @@ public static IPythonPropertyType Property(string name, IPythonModule declaringM return prop; } - public static IPythonFunctionType Function(string name, IPythonModule declaringModule, IPythonType declaringType, string documentation, IMember returnValue) { + public static IPythonFunctionType Function(string name, IPythonModule declaringModule, string documentation, IMember returnValue) { var location = new Location(declaringModule); - var prop = new PythonFunctionType(name, location, declaringType, documentation); + var prop = PythonFunctionType.Specialize(name, declaringModule, documentation); var o = new PythonFunctionOverload(prop.Name, location); o.AddReturnValue(returnValue); prop.AddOverload(o); diff --git a/src/Analysis/Ast/Impl/Specializations/Typing/TypingModule.cs b/src/Analysis/Ast/Impl/Specializations/Typing/TypingModule.cs index cf9be594d..8e280f25b 100644 --- a/src/Analysis/Ast/Impl/Specializations/Typing/TypingModule.cs +++ b/src/Analysis/Ast/Impl/Specializations/Typing/TypingModule.cs @@ -46,7 +46,7 @@ private void SpecializeMembers() { var location = new Location(this, default); // TypeVar - var fn = new PythonFunctionType("TypeVar", location, null, GetMemberDocumentation("TypeVar")); + var fn = PythonFunctionType.Specialize("TypeVar", this, GetMemberDocumentation("TypeVar")); var o = new PythonFunctionOverload(fn.Name, location); // When called, create generic parameter type. For documentation // use original TypeVar declaration so it appear as a tooltip. @@ -57,7 +57,7 @@ private void SpecializeMembers() { _members["TypeVar"] = fn; // NewType - fn = new PythonFunctionType("NewType", location, null, GetMemberDocumentation("NewType")); + fn = PythonFunctionType.Specialize("NewType", this, GetMemberDocumentation("NewType")); o = new PythonFunctionOverload(fn.Name, location); // When called, create generic parameter type. For documentation // use original TypeVar declaration so it appear as a tooltip. @@ -65,8 +65,8 @@ private void SpecializeMembers() { fn.AddOverload(o); _members["NewType"] = fn; - // NewType - fn = new PythonFunctionType("Type", location, null, GetMemberDocumentation("Type")); + // Type + fn = PythonFunctionType.Specialize("Type", this, GetMemberDocumentation("Type")); o = new PythonFunctionOverload(fn.Name, location); // When called, create generic parameter type. For documentation // use original TypeVar declaration so it appear as a tooltip. @@ -115,7 +115,7 @@ private void SpecializeMembers() { _members["Union"] = new GenericType("Union", CreateUnion, this); - _members["Counter"] = Specialized.Function("Counter", this, null, "Counter", + _members["Counter"] = Specialized.Function("Counter", this, GetMemberDocumentation("Counter"), new PythonInstance(Interpreter.GetBuiltinType(BuiltinTypeId.Int))); _members["SupportsInt"] = Interpreter.GetBuiltinType(BuiltinTypeId.Int); @@ -124,7 +124,7 @@ private void SpecializeMembers() { _members["SupportsBytes"] = Interpreter.GetBuiltinType(BuiltinTypeId.Bytes); _members["ByteString"] = Interpreter.GetBuiltinType(BuiltinTypeId.Bytes); - fn = new PythonFunctionType("NamedTuple", location, null, GetMemberDocumentation("NamedTuple")); + fn = PythonFunctionType.Specialize("NamedTuple", this, GetMemberDocumentation("NamedTuple")); o = new PythonFunctionOverload(fn.Name, location); o.SetReturnValueProvider((interpreter, overload, args) => CreateNamedTuple(args.Values())); fn.AddOverload(o); diff --git a/src/Analysis/Ast/Impl/Types/ArgumentSet.cs b/src/Analysis/Ast/Impl/Types/ArgumentSet.cs index dbcd33293..f014073da 100644 --- a/src/Analysis/Ast/Impl/Types/ArgumentSet.cs +++ b/src/Analysis/Ast/Impl/Types/ArgumentSet.cs @@ -252,7 +252,7 @@ public ArgumentSet(IPythonFunctionType fn, int overloadIndex, IPythonInstance in // then fill the slot with the default value. If there is no default value, // then it is an error. foreach (var slot in slots.Where(s => s.Kind != ParameterKind.List && s.Kind != ParameterKind.Dictionary && s.Value == null)) { - if (slot.Value == null) { + if (slot.ValueExpression == null) { var parameter = overload.Parameters.First(p => p.Name == slot.Name); if (parameter.DefaultValue == null) { // TODO: parameter is not assigned and has no default value. diff --git a/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs b/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs index 31cf4092a..82c1def63 100644 --- a/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs @@ -24,7 +24,7 @@ namespace Microsoft.Python.Analysis.Types { [DebuggerDisplay("Function {Name} ({TypeId})")] - internal class PythonFunctionType : PythonType, IPythonFunctionType { + internal sealed class PythonFunctionType : PythonType, IPythonFunctionType { private ImmutableArray _overloads = ImmutableArray.Empty; private bool _isAbstract; private bool _isSpecialized; @@ -32,11 +32,11 @@ internal class PythonFunctionType : PythonType, IPythonFunctionType { /// /// Creates function for specializations /// - public static PythonFunctionType ForSpecialization(string name, IPythonModule declaringModule) - => new PythonFunctionType(name, new Location(declaringModule, default), true); + public static PythonFunctionType Specialize(string name, IPythonModule declaringModule, string documentation) + => new PythonFunctionType(name, new Location(declaringModule, default), documentation, true); - private PythonFunctionType(string name, Location location, bool isSpecialized = false) : - base(name, location, string.Empty, BuiltinTypeId.Function) { + private PythonFunctionType(string name, Location location, string documentation, bool isSpecialized = false) : + base(name, location, documentation ?? string.Empty, BuiltinTypeId.Function) { Check.ArgumentNotNull(nameof(location), location.Module); _isSpecialized = isSpecialized; } @@ -91,8 +91,8 @@ internal override void SetDocumentation(string documentation) { public FunctionDefinition FunctionDefinition => DeclaringModule.GetAstNode(this); public IPythonType DeclaringType { get; } public override string Documentation => (_overloads.Count > 0 ? _overloads[0].Documentation : default) ?? base.Documentation; - public virtual bool IsClassMethod { get; private set; } - public virtual bool IsStatic { get; private set; } + public bool IsClassMethod { get; private set; } + public bool IsStatic { get; private set; } public override bool IsAbstract => _isAbstract; public override bool IsSpecialized => _isSpecialized; From 50e63e67401e5910ddd3605be586fbfa4c3bce12 Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Mon, 27 May 2019 21:06:57 -0700 Subject: [PATCH 23/82] Fix locations --- .../Ast/Impl/Modules/BuiltinsPythonModule.cs | 7 ++++--- src/Analysis/Ast/Impl/Values/GlobalScope.cs | 18 ++++++++++-------- src/Analysis/Ast/Impl/Values/Scope.cs | 19 ++++++++++--------- .../Ast/Impl/Values/VariableCollection.cs | 2 +- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/Analysis/Ast/Impl/Modules/BuiltinsPythonModule.cs b/src/Analysis/Ast/Impl/Modules/BuiltinsPythonModule.cs index 60cc720b7..3ce776620 100644 --- a/src/Analysis/Ast/Impl/Modules/BuiltinsPythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/BuiltinsPythonModule.cs @@ -121,13 +121,14 @@ private void SpecializeTypes() { _hiddenNames.Add("__builtin_module_names__"); + var location = new Location(this, default); if (_boolType != null) { - Analysis.GlobalScope.DeclareVariable("True", _boolType, VariableSource.Builtin, new Location(this, default)); - Analysis.GlobalScope.DeclareVariable("False", _boolType, VariableSource.Builtin, new Location(this, default)); + Analysis.GlobalScope.DeclareVariable("True", _boolType, VariableSource.Builtin, location); + Analysis.GlobalScope.DeclareVariable("False", _boolType, VariableSource.Builtin, location); } if (noneType != null) { - Analysis.GlobalScope.DeclareVariable("None", noneType, VariableSource.Builtin, new Location(this, default)); + Analysis.GlobalScope.DeclareVariable("None", noneType, VariableSource.Builtin, location); } foreach (var n in GetMemberNames()) { diff --git a/src/Analysis/Ast/Impl/Values/GlobalScope.cs b/src/Analysis/Ast/Impl/Values/GlobalScope.cs index 42e42e41d..fbdddd602 100644 --- a/src/Analysis/Ast/Impl/Values/GlobalScope.cs +++ b/src/Analysis/Ast/Impl/Values/GlobalScope.cs @@ -23,25 +23,27 @@ public GlobalScope(IPythonModule module): base(null, null, module) { DeclareBuiltinVariables(); } - public override ScopeStatement Node => Module.Analysis?.Ast; + public override ScopeStatement Node => Module.GetAstNode(this); private void DeclareBuiltinVariables() { if (Module.ModuleType != ModuleType.User) { return; } + var location = new Location(Module, default); + var boolType = Module.Interpreter.GetBuiltinType(BuiltinTypeId.Bool); var strType = Module.Interpreter.GetBuiltinType(BuiltinTypeId.Str); var listType = Module.Interpreter.GetBuiltinType(BuiltinTypeId.List); var dictType = Module.Interpreter.GetBuiltinType(BuiltinTypeId.Dict); - DeclareVariable("__debug__", boolType, VariableSource.Builtin); - DeclareVariable("__doc__", strType, VariableSource.Builtin); - DeclareVariable("__file__", strType, VariableSource.Builtin); - DeclareVariable("__name__", strType, VariableSource.Builtin); - DeclareVariable("__package__", strType, VariableSource.Builtin); - DeclareVariable("__path__", listType, VariableSource.Builtin); - DeclareVariable("__dict__", dictType, VariableSource.Builtin); + DeclareVariable("__debug__", boolType, VariableSource.Builtin, location); + DeclareVariable("__doc__", strType, VariableSource.Builtin, location); + DeclareVariable("__file__", strType, VariableSource.Builtin, location); + DeclareVariable("__name__", strType, VariableSource.Builtin, location); + DeclareVariable("__package__", strType, VariableSource.Builtin, location); + DeclareVariable("__path__", listType, VariableSource.Builtin, location); + DeclareVariable("__dict__", dictType, VariableSource.Builtin, location); } } } diff --git a/src/Analysis/Ast/Impl/Values/Scope.cs b/src/Analysis/Ast/Impl/Values/Scope.cs index 3ce44ab06..d517c4457 100644 --- a/src/Analysis/Ast/Impl/Values/Scope.cs +++ b/src/Analysis/Ast/Impl/Values/Scope.cs @@ -96,24 +96,25 @@ private void DeclareBuiltinVariables() { return; } + var location = new Location(Module, default); var strType = Module.Interpreter.GetBuiltinType(BuiltinTypeId.Str); var objType = Module.Interpreter.GetBuiltinType(BuiltinTypeId.Object); - VariableCollection.DeclareVariable("__name__", strType, VariableSource.Builtin); + VariableCollection.DeclareVariable("__name__", strType, VariableSource.Builtin, location); if (Node is FunctionDefinition) { var dictType = Module.Interpreter.GetBuiltinType(BuiltinTypeId.Dict); var tupleType = Module.Interpreter.GetBuiltinType(BuiltinTypeId.Tuple); - VariableCollection.DeclareVariable("__closure__", tupleType, VariableSource.Builtin); - VariableCollection.DeclareVariable("__code__", objType, VariableSource.Builtin); - VariableCollection.DeclareVariable("__defaults__", tupleType, VariableSource.Builtin); - VariableCollection.DeclareVariable("__dict__", dictType, VariableSource.Builtin); - VariableCollection.DeclareVariable("__doc__", strType, VariableSource.Builtin); - VariableCollection.DeclareVariable("__func__", objType, VariableSource.Builtin); - VariableCollection.DeclareVariable("__globals__", dictType, VariableSource.Builtin); + VariableCollection.DeclareVariable("__closure__", tupleType, VariableSource.Builtin, location); + VariableCollection.DeclareVariable("__code__", objType, VariableSource.Builtin, location); + VariableCollection.DeclareVariable("__defaults__", tupleType, VariableSource.Builtin, location); + VariableCollection.DeclareVariable("__dict__", dictType, VariableSource.Builtin, location); + VariableCollection.DeclareVariable("__doc__", strType, VariableSource.Builtin, location); + VariableCollection.DeclareVariable("__func__", objType, VariableSource.Builtin, location); + VariableCollection.DeclareVariable("__globals__", dictType, VariableSource.Builtin, location); } else if (Node is ClassDefinition) { - VariableCollection.DeclareVariable("__self__", objType, VariableSource.Builtin); + VariableCollection.DeclareVariable("__self__", objType, VariableSource.Builtin, location); } } } diff --git a/src/Analysis/Ast/Impl/Values/VariableCollection.cs b/src/Analysis/Ast/Impl/Values/VariableCollection.cs index 817456eca..878182211 100644 --- a/src/Analysis/Ast/Impl/Values/VariableCollection.cs +++ b/src/Analysis/Ast/Impl/Values/VariableCollection.cs @@ -98,7 +98,7 @@ public IEnumerable GetMemberNames() { #endregion - internal void DeclareVariable(string name, IMember value, VariableSource source, Location location = default) { + internal void DeclareVariable(string name, IMember value, VariableSource source, Location location) { name = !string.IsNullOrWhiteSpace(name) ? name : throw new ArgumentException(nameof(name)); lock (_syncObj) { if (_variables.TryGetValue(name, out var existing)) { From fcd0c06f34153014baa5ad3a0dedd904da70c03a Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Tue, 28 May 2019 09:38:58 -0700 Subject: [PATCH 24/82] usings --- src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs b/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs index 43363a6d2..7b136035e 100644 --- a/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs +++ b/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs @@ -17,7 +17,6 @@ using System.Collections.Generic; using System.Linq; using Microsoft.Python.Analysis.Analyzer.Evaluation; -using Microsoft.Python.Analysis.Documents; using Microsoft.Python.Analysis.Specializations.Typing; using Microsoft.Python.Analysis.Values; using Microsoft.Python.Core; From f6a992bbd23a3d515575987299079035f4743fa6 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Tue, 28 May 2019 11:00:54 -0700 Subject: [PATCH 25/82] Test fixes --- src/LanguageServer/Impl/Sources/DocumentationSource.cs | 7 ++++--- src/LanguageServer/Test/GoToDefinitionTests.cs | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/LanguageServer/Impl/Sources/DocumentationSource.cs b/src/LanguageServer/Impl/Sources/DocumentationSource.cs index 17ea23396..bcebf6a71 100644 --- a/src/LanguageServer/Impl/Sources/DocumentationSource.cs +++ b/src/LanguageServer/Impl/Sources/DocumentationSource.cs @@ -13,7 +13,7 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. -using System.Collections.Generic; +using System; using System.Linq; using Microsoft.Python.Analysis; using Microsoft.Python.Analysis.Types; @@ -50,8 +50,9 @@ private string[] GetFunctionParameters(IPythonFunctionType ft, out int[] paramet var o = ft.Overloads[overloadIndex]; // TODO: display all? var skip = ft.IsStatic || ft.IsUnbound ? 0 : 1; - var parameters = new string[o.Parameters.Count - skip]; - parameterNameLengths = new int[o.Parameters.Count - skip]; + var count = Math.Max(0, o.Parameters.Count - skip); + var parameters = new string[count]; + parameterNameLengths = new int[count]; for (var i = skip; i < o.Parameters.Count; i++) { string paramString; var p = o.Parameters[i]; diff --git a/src/LanguageServer/Test/GoToDefinitionTests.cs b/src/LanguageServer/Test/GoToDefinitionTests.cs index f42f9a696..0e23cc904 100644 --- a/src/LanguageServer/Test/GoToDefinitionTests.cs +++ b/src/LanguageServer/Test/GoToDefinitionTests.cs @@ -332,6 +332,9 @@ def foo(self): var mainPath = TestData.GetTestSpecificUri("main.py"); var doc = rdt.OpenDocument(mainPath, code); + var analyzer = Services.GetService(); + await analyzer.WaitForCompleteAnalysisAsync(); + var analysis = await doc.GetAnalysisAsync(Timeout.Infinite); var ds = new DefinitionSource(Services); From acad202d5049cdb1e700740d482821892ac4f6b5 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Tue, 28 May 2019 12:27:13 -0700 Subject: [PATCH 26/82] Add options to keep data in memory --- .../Impl/Analyzer/Symbols/FunctionEvaluator.cs | 3 ++- .../Ast/Impl/Definitions/AnalysisOptions.cs | 13 +++++++++++++ .../Impl/Definitions/ServerSettings.cs | 16 ++++++++++++++++ src/LanguageServer/Impl/Implementation/Server.cs | 5 +++++ .../Impl/LanguageServer.Configuration.cs | 5 +++++ 5 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs b/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs index 6684bd412..00657ad83 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs @@ -80,7 +80,8 @@ public override void Evaluate() { // Return type from the annotation is sufficient for libraries and stubs, no need to walk the body. FunctionDefinition.Body?.Walk(this); // For libraries remove declared local function variables to free up some memory. - if (Module.ModuleType != ModuleType.User) { + var optionsProvider = Eval.Services.GetService(); + if (Module.ModuleType != ModuleType.User && optionsProvider?.Options.KeepLibraryLocalVariables != true) { ((VariableCollection)Eval.CurrentScope.Variables).Clear(); } } diff --git a/src/Analysis/Ast/Impl/Definitions/AnalysisOptions.cs b/src/Analysis/Ast/Impl/Definitions/AnalysisOptions.cs index d34c88998..36c4eb180 100644 --- a/src/Analysis/Ast/Impl/Definitions/AnalysisOptions.cs +++ b/src/Analysis/Ast/Impl/Definitions/AnalysisOptions.cs @@ -16,5 +16,18 @@ namespace Microsoft.Python.Analysis { public class AnalysisOptions { public bool LintingEnabled { get; set; } + + /// + /// Keep in memory information on local variables declared in + /// functions in libraries. Provides ability to navigate to + /// symbols used in function bodies in packages and libraries. + /// + public bool KeepLibraryLocalVariables { get; set; } + + /// + /// Keep in memory AST of library source code. May somewhat + /// improve performance when library code has to be re-analyzed. + /// + public bool KeepLibraryAst { get; set; } } } diff --git a/src/LanguageServer/Impl/Definitions/ServerSettings.cs b/src/LanguageServer/Impl/Definitions/ServerSettings.cs index 442538191..2f1c38d22 100644 --- a/src/LanguageServer/Impl/Definitions/ServerSettings.cs +++ b/src/LanguageServer/Impl/Definitions/ServerSettings.cs @@ -29,6 +29,22 @@ public class PythonAnalysisOptions { public string[] warnings { get; private set; } = Array.Empty(); public string[] information { get; private set; } = Array.Empty(); public string[] disabled { get; private set; } = Array.Empty(); + + public class AnalysisMemoryOptions { + /// + /// Keep in memory information on local variables declared in + /// functions in libraries. Provides ability to navigate to + /// symbols used in function bodies in packages and libraries. + /// + public bool keepLibraryLocalVariables; + + /// + /// Keep in memory AST of library source code. May somewhat + /// improve performance when library code has to be re-analyzed. + /// + public bool keepLibraryAst; + } + public AnalysisMemoryOptions memory; } public readonly PythonAnalysisOptions analysis = new PythonAnalysisOptions(); diff --git a/src/LanguageServer/Impl/Implementation/Server.cs b/src/LanguageServer/Impl/Implementation/Server.cs index a21c1c1ea..a69d25b87 100644 --- a/src/LanguageServer/Impl/Implementation/Server.cs +++ b/src/LanguageServer/Impl/Implementation/Server.cs @@ -212,6 +212,11 @@ private bool HandleConfigurationChanges(ServerSettings newSettings) { return true; } + if(newSettings.analysis?.memory?.keepLibraryAst != oldSettings.analysis?.memory?.keepLibraryAst || + newSettings.analysis?.memory?.keepLibraryLocalVariables != oldSettings.analysis?.memory?.keepLibraryLocalVariables) { + return true; + } + return false; } diff --git a/src/LanguageServer/Impl/LanguageServer.Configuration.cs b/src/LanguageServer/Impl/LanguageServer.Configuration.cs index 9f66b4f7b..180a8fb21 100644 --- a/src/LanguageServer/Impl/LanguageServer.Configuration.cs +++ b/src/LanguageServer/Impl/LanguageServer.Configuration.cs @@ -73,6 +73,11 @@ private void HandleDiagnosticsChanges(JToken pythonSection, LanguageServerSettin var linting = pythonSection["linting"]; HandleLintingOnOff(_services, GetSetting(linting, "enabled", true)); + + var memory = analysis["memory"]; + var optionsProvider = _services.GetService(); + optionsProvider.Options.KeepLibraryLocalVariables = GetSetting(memory, "keepLibraryLocalVariables", false); + optionsProvider.Options.KeepLibraryAst = GetSetting(memory, "keepLibraryAst", false); } internal static void HandleLintingOnOff(IServiceContainer services, bool linterEnabled) { From 86e36a634da7ca3861a71f9a3fe6627ad1c1ccaf Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Tue, 28 May 2019 14:59:43 -0700 Subject: [PATCH 27/82] Fix test --- src/Analysis/Ast/Test/ArgumentSetTests.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Analysis/Ast/Test/ArgumentSetTests.cs b/src/Analysis/Ast/Test/ArgumentSetTests.cs index 2f4bee636..3f242eea5 100644 --- a/src/Analysis/Ast/Test/ArgumentSetTests.cs +++ b/src/Analysis/Ast/Test/ArgumentSetTests.cs @@ -77,7 +77,9 @@ def f(a, b, c='str'): ... argSet.Arguments[1].Name.Should().Be("b"); argSet.Arguments[1].ValueExpression.Should().BeOfType().Which.Value.Should().Be(1); argSet.Arguments[2].Name.Should().Be("c"); - argSet.Arguments[2].ValueExpression.Should().BeOfType().Which.Value.Should().Be("str"); + argSet.Arguments[2].ValueExpression.Should().BeNull(); + argSet.Arguments[2].Value.Should().NotBeNull(); + argSet.Arguments[2].Value.Should().BeAssignableTo().Which.Should().HaveType(BuiltinTypeId.Str); argSet.ListArgument.Should().BeNull(); argSet.DictionaryArgument.Should().BeNull(); } From ba97e9f3bb2b7cca6aca3d3e527ba155020930a9 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Tue, 28 May 2019 15:41:06 -0700 Subject: [PATCH 28/82] Fix lambda parameters --- .../Evaluation/ExpressionEval.Callables.cs | 67 ++++++++++++++++++ .../Analyzer/Symbols/FunctionEvaluator.cs | 68 +------------------ 2 files changed, 69 insertions(+), 66 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs index 55b4a8d02..2ea8aa437 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs @@ -17,6 +17,7 @@ using System.Diagnostics; using System.Linq; using Microsoft.Python.Analysis.Documents; +using Microsoft.Python.Analysis.Extensions; using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; @@ -81,6 +82,7 @@ public IMember GetValueFromLambda(LambdaExpression expr) { var location = GetLocationOfName(fd); var ft = new PythonFunctionType(fd, null, location); var overload = new PythonFunctionOverload(ft, fd, location, expr.Function.ReturnAnnotation?.ToCodeString(Ast)); + overload.SetParameters(CreateFunctionParameters(null, ft, fd, false)); ft.AddOverload(overload); return ft; } @@ -312,5 +314,70 @@ private void LoadFunctionDependencyModules(IPythonFunctionType fn) { Services.GetService().EnqueueDocumentForAnalysis(Module, dependencies); } } + + public IReadOnlyList CreateFunctionParameters(IPythonClassType self, IPythonClassMember function, FunctionDefinition fd, bool declareVariables) { + // For class method no need to add extra parameters, but first parameter type should be the class. + // For static and unbound methods do not add or set anything. + // For regular bound methods add first parameter and set it to the class. + + var parameters = new List(); + var skip = 0; + if (self != null && function.HasClassFirstArgument()) { + var p0 = fd.Parameters.FirstOrDefault(); + if (p0 != null && !string.IsNullOrEmpty(p0.Name)) { + // Actual parameter type will be determined when method is invoked. + // The reason is that if method might be called on a derived class. + // Declare self or cls in this scope. + if (declareVariables) { + DeclareVariable(p0.Name, new PythonInstance(self), VariableSource.Declaration, p0.NameExpression); + } + // Set parameter info. + var pi = new ParameterInfo(Ast, p0, self, null, false); + parameters.Add(pi); + skip++; + } + } + + // Declare parameters in scope + IMember defaultValue = null; + for (var i = skip; i < fd.Parameters.Length; i++) { + var isGeneric = false; + var p = fd.Parameters[i]; + if (!string.IsNullOrEmpty(p.Name)) { + IPythonType paramType = null; + if (p.DefaultValue != null) { + defaultValue = GetValueFromExpression(p.DefaultValue); + // If parameter has default value, look for the annotation locally first + // since outer type may be getting redefined. Consider 's = None; def f(s: s = 123): ... + paramType = GetTypeFromAnnotation(p.Annotation, out isGeneric, LookupOptions.Local | LookupOptions.Builtins); + // Default value of None does not mean the parameter is None, just says it can be missing. + defaultValue = defaultValue.IsUnknown() || defaultValue.IsOfType(BuiltinTypeId.NoneType) ? null : defaultValue; + if (paramType == null && defaultValue != null) { + paramType = defaultValue.GetPythonType(); + } + } + // If all else fails, look up globally. + paramType = paramType ?? GetTypeFromAnnotation(p.Annotation, out isGeneric) ?? UnknownType; + var pi = new ParameterInfo(Ast, p, paramType, defaultValue, isGeneric); + if (declareVariables) { + DeclareParameter(p, pi); + } + parameters.Add(pi); + } + } + return parameters; + } + + private void DeclareParameter(Parameter p, ParameterInfo pi) { + IPythonType paramType; + // If type is known from annotation, use it. + if (pi != null && !pi.Type.IsUnknown() && !pi.Type.IsGenericParameter()) { + // TODO: technically generics may have constraints. Should we consider them? + paramType = pi.Type; + } else { + paramType = pi?.DefaultValue?.GetPythonType() ?? UnknownType; + } + DeclareVariable(p.Name, new PythonInstance(paramType), VariableSource.Declaration, p.NameExpression); + } } } diff --git a/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs b/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs index 96d8cc46e..73882535b 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs @@ -70,7 +70,8 @@ public override void Evaluate() { } } - DeclareParameters(!stub); + var parameters = Eval.CreateFunctionParameters(_self, _function, FunctionDefinition, !stub); + _overload.SetParameters(parameters); // Do process body of constructors since they may be declaring // variables that are later used to determine return type of other @@ -125,70 +126,5 @@ public override bool Walk(FunctionDefinition node) { } return false; } - - private void DeclareParameters(bool declareVariables) { - // For class method no need to add extra parameters, but first parameter type should be the class. - // For static and unbound methods do not add or set anything. - // For regular bound methods add first parameter and set it to the class. - - var parameters = new List(); - var skip = 0; - if (_self != null && _function.HasClassFirstArgument()) { - var p0 = FunctionDefinition.Parameters.FirstOrDefault(); - if (p0 != null && !string.IsNullOrEmpty(p0.Name)) { - // Actual parameter type will be determined when method is invoked. - // The reason is that if method might be called on a derived class. - // Declare self or cls in this scope. - if (declareVariables) { - Eval.DeclareVariable(p0.Name, new PythonInstance(_self), VariableSource.Declaration, p0.NameExpression); - } - // Set parameter info. - var pi = new ParameterInfo(Ast, p0, _self, null, false); - parameters.Add(pi); - skip++; - } - } - - // Declare parameters in scope - IMember defaultValue = null; - for (var i = skip; i < FunctionDefinition.Parameters.Length; i++) { - var isGeneric = false; - var p = FunctionDefinition.Parameters[i]; - if (!string.IsNullOrEmpty(p.Name)) { - IPythonType paramType = null; - if (p.DefaultValue != null) { - defaultValue = Eval.GetValueFromExpression(p.DefaultValue); - // If parameter has default value, look for the annotation locally first - // since outer type may be getting redefined. Consider 's = None; def f(s: s = 123): ... - paramType = Eval.GetTypeFromAnnotation(p.Annotation, out isGeneric, LookupOptions.Local | LookupOptions.Builtins); - // Default value of None does not mean the parameter is None, just says it can be missing. - defaultValue = defaultValue.IsUnknown() || defaultValue.IsOfType(BuiltinTypeId.NoneType) ? null : defaultValue; - if (paramType == null && defaultValue != null) { - paramType = defaultValue.GetPythonType(); - } - } - // If all else fails, look up globally. - paramType = paramType ?? Eval.GetTypeFromAnnotation(p.Annotation, out isGeneric) ?? Eval.UnknownType; - var pi = new ParameterInfo(Ast, p, paramType, defaultValue, isGeneric); - if (declareVariables) { - DeclareParameter(p, pi); - } - parameters.Add(pi); - } - } - _overload.SetParameters(parameters); - } - - private void DeclareParameter(Parameter p, ParameterInfo pi) { - IPythonType paramType; - // If type is known from annotation, use it. - if (pi != null && !pi.Type.IsUnknown() && !pi.Type.IsGenericParameter()) { - // TODO: technically generics may have constraints. Should we consider them? - paramType = pi.Type; - } else { - paramType = pi?.DefaultValue?.GetPythonType() ?? Eval.UnknownType; - } - Eval.DeclareVariable(p.Name, new PythonInstance(paramType), VariableSource.Declaration, p.NameExpression); - } } } From ffed87e7af7c609e9a37c7f9f5858578a1556a68 Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Tue, 28 May 2019 20:33:54 -0700 Subject: [PATCH 29/82] Fix argument set Fix global scope node --- .../Evaluation/ExpressionEval.Callables.cs | 2 ++ src/Analysis/Ast/Impl/Types/ArgumentSet.cs | 18 +++++++++++++++++- src/Analysis/Ast/Impl/Values/GlobalScope.cs | 2 +- src/Analysis/Ast/Test/ArgumentSetTests.cs | 4 +--- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs index 2ea8aa437..35e0df1be 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs @@ -363,6 +363,8 @@ public IReadOnlyList CreateFunctionParameters(IPythonClassType s DeclareParameter(p, pi); } parameters.Add(pi); + } else if (p.IsList || p.IsDictionary) { + parameters.Add(new ParameterInfo(Ast, p, null, null, false)); } } return parameters; diff --git a/src/Analysis/Ast/Impl/Types/ArgumentSet.cs b/src/Analysis/Ast/Impl/Types/ArgumentSet.cs index f014073da..6aa2b5038 100644 --- a/src/Analysis/Ast/Impl/Types/ArgumentSet.cs +++ b/src/Analysis/Ast/Impl/Types/ArgumentSet.cs @@ -15,6 +15,7 @@ // permissions and limitations under the License. using System.Collections.Generic; +using System.IO; using System.Linq; using Microsoft.Python.Analysis.Analyzer; using Microsoft.Python.Analysis.Analyzer.Evaluation; @@ -261,6 +262,7 @@ public ArgumentSet(IPythonFunctionType fn, int overloadIndex, IPythonInstance in } // Note that parameter default value expression is from the function definition AST // while actual argument values are from the calling file AST. + slot.ValueExpression = CreateExpression(parameter.Name, parameter.DefaultValueString); slot.Value = parameter.DefaultValue; slot.ValueIsDefault = true; } @@ -317,6 +319,20 @@ private IMember GetArgumentValue(Argument arg) { return Eval.GetValueFromExpression(arg.ValueExpression) ?? Eval.UnknownType; } + private Expression CreateExpression(string paramName, string defaultValue) { + if (string.IsNullOrEmpty(defaultValue)) { + return null; + } + using (var sr = new StringReader($"{paramName}={defaultValue}")) { + var parser = Parser.CreateParser(sr, Eval.Interpreter.LanguageVersion,ParserOptions.Default); + var ast = parser.ParseFile(); + if (ast.Body is SuiteStatement ste && ste.Statements.Count > 0 && ste.Statements[0] is AssignmentStatement a) { + return a.Right; + } + return null; + } + } + private sealed class Argument : IArgument { /// /// Argument name. @@ -349,7 +365,7 @@ private sealed class Argument : IArgument { /// /// Type of the argument, if annotated. /// - public IPythonType Type { get; internal set; } + public IPythonType Type { get; } /// /// AST node that defines the argument. diff --git a/src/Analysis/Ast/Impl/Values/GlobalScope.cs b/src/Analysis/Ast/Impl/Values/GlobalScope.cs index fbdddd602..699809d20 100644 --- a/src/Analysis/Ast/Impl/Values/GlobalScope.cs +++ b/src/Analysis/Ast/Impl/Values/GlobalScope.cs @@ -23,7 +23,7 @@ public GlobalScope(IPythonModule module): base(null, null, module) { DeclareBuiltinVariables(); } - public override ScopeStatement Node => Module.GetAstNode(this); + public override ScopeStatement Node => Module.GetAst(); private void DeclareBuiltinVariables() { if (Module.ModuleType != ModuleType.User) { diff --git a/src/Analysis/Ast/Test/ArgumentSetTests.cs b/src/Analysis/Ast/Test/ArgumentSetTests.cs index 3f242eea5..2f4bee636 100644 --- a/src/Analysis/Ast/Test/ArgumentSetTests.cs +++ b/src/Analysis/Ast/Test/ArgumentSetTests.cs @@ -77,9 +77,7 @@ def f(a, b, c='str'): ... argSet.Arguments[1].Name.Should().Be("b"); argSet.Arguments[1].ValueExpression.Should().BeOfType().Which.Value.Should().Be(1); argSet.Arguments[2].Name.Should().Be("c"); - argSet.Arguments[2].ValueExpression.Should().BeNull(); - argSet.Arguments[2].Value.Should().NotBeNull(); - argSet.Arguments[2].Value.Should().BeAssignableTo().Which.Should().HaveType(BuiltinTypeId.Str); + argSet.Arguments[2].ValueExpression.Should().BeOfType().Which.Value.Should().Be("str"); argSet.ListArgument.Should().BeNull(); argSet.DictionaryArgument.Should().BeNull(); } From 186a9c6ac1de0fde576e7da0c3df34f2f919b2e5 Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Tue, 28 May 2019 21:05:04 -0700 Subject: [PATCH 30/82] Fix overload doc --- src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs b/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs index 7b136035e..a0cb983da 100644 --- a/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs +++ b/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs @@ -51,6 +51,7 @@ internal sealed class PythonFunctionOverload : LocatedMember, IPythonFunctionOve public PythonFunctionOverload(IPythonClassMember cm, FunctionDefinition fd, Location location, string returnDocumentation) : this(cm.Name, location) { ClassMember = cm; + Documentation = fd.GetDocumentation(); cm.DeclaringModule.AddAstNode(this, fd); _returnDocumentation = returnDocumentation; } From 419669950e0f3f440776ea718ddaa7ce4a087f8e Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Tue, 28 May 2019 21:51:18 -0700 Subject: [PATCH 31/82] Fix stub merge errors --- src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs index 5d8fc92f3..7fdfbe3f6 100644 --- a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs +++ b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs @@ -233,7 +233,7 @@ private void MergeStub() { // from the library source of from the scraped module. foreach (var v in _stubAnalysis.GlobalScope.Variables) { var stubType = v.Value.GetPythonType(); - if (stubType.IsUnknown()) { + if (stubType.IsUnknown() || !_stubAnalysis.Document.Equals(stubType?.DeclaringModule)) { continue; } @@ -249,7 +249,11 @@ private void MergeStub() { foreach (var name in stubType.GetMemberNames()) { var stubMember = stubType.GetMember(name); var member = cls.GetMember(name); - + // Do not pick members from base classes since otherwise we may end up + // reassigning members of a different module or even of built-in types. + if (member is IPythonClassMember clsm && !cls.Equals(clsm.DeclaringType)) { + continue; + } // Get documentation from the current type, if any, since stubs // typically do not contain documentation while scraped code does. member?.GetPythonType()?.TransferDocumentationAndLocation(stubMember.GetPythonType()); From 93249d40e12e7973140d43035b3d749441d67943 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Wed, 29 May 2019 12:41:23 -0700 Subject: [PATCH 32/82] Fix async issues --- .../Impl/Analyzer/Definitions/IAnalyzable.cs | 3 +- .../Evaluation/ExpressionEval.Scopes.cs | 3 - .../Analyzer/Handlers/FromImportHandler.cs | 3 +- .../Ast/Impl/Analyzer/ModuleWalker.cs | 4 +- .../Impl/Analyzer/PythonAnalyzerSession.cs | 14 +--- .../Impl/Analyzer/Symbols/ClassEvaluator.cs | 2 +- .../Impl/Analyzer/Symbols/SymbolCollector.cs | 15 ++-- .../Ast/Impl/Extensions/AnalysisExtensions.cs | 2 +- .../Ast/Impl/Extensions/AstExtensions.cs | 2 +- src/Analysis/Ast/Impl/Modules/PythonModule.cs | 19 +++-- src/Analysis/Ast/Impl/Types/LocatedMember.cs | 2 + .../Ast/Impl/Values/Definitions/IScope.cs | 2 +- src/Analysis/Ast/Impl/Values/Scope.cs | 2 +- src/Parsing/Impl/Ast/PythonAst.cs | 77 ++++++++----------- 14 files changed, 68 insertions(+), 82 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/Definitions/IAnalyzable.cs b/src/Analysis/Ast/Impl/Analyzer/Definitions/IAnalyzable.cs index 8d4b9751d..bb1665b8d 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Definitions/IAnalyzable.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Definitions/IAnalyzable.cs @@ -26,7 +26,6 @@ internal interface IAnalyzable { /// /// Notifies document that its analysis is now complete. /// - /// Document analysis - void NotifyAnalysisComplete(IDocumentAnalysis analysis); + void NotifyAnalysisComplete(int version, ModuleWalker walker, bool isFinalPass); } } diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Scopes.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Scopes.cs index f332513d9..85cdcff5d 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Scopes.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Scopes.cs @@ -36,9 +36,6 @@ public T GetInScope(string name, IScope scope) where T : class, IMember public IMember GetInScope(string name) => GetInScope(name, CurrentScope); public T GetInScope(string name) where T : class, IMember => GetInScope(name, CurrentScope); - public void DeclareVariable(string name, IMember value, VariableSource source) - => DeclareVariable(name, value, source, default(Location)); - public void DeclareVariable(string name, IMember value, VariableSource source, IPythonModule module) => DeclareVariable(name, value, source, new Location(module, default)); diff --git a/src/Analysis/Ast/Impl/Analyzer/Handlers/FromImportHandler.cs b/src/Analysis/Ast/Impl/Analyzer/Handlers/FromImportHandler.cs index cba333e73..71c389b97 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Handlers/FromImportHandler.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Handlers/FromImportHandler.cs @@ -83,6 +83,7 @@ private void HandleModuleImportStar(PythonVariableModule variableModule) { // If __all__ is present, take it, otherwise declare all members from the module that do not begin with an underscore. var memberNames = variableModule.Analysis.StarImportMemberNames ?? variableModule.GetMemberNames().Where(s => !s.StartsWithOrdinal("_")); + var location = new Location(Module); foreach (var memberName in memberNames) { var member = variableModule.GetMember(memberName); @@ -98,7 +99,7 @@ private void HandleModuleImportStar(PythonVariableModule variableModule) { } var variable = variableModule.Analysis?.GlobalScope?.Variables[memberName]; - Eval.DeclareVariable(memberName, variable ?? member, VariableSource.Import); + Eval.DeclareVariable(memberName, variable ?? member, VariableSource.Import, location); } } diff --git a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs index 7fdfbe3f6..4b376fe91 100644 --- a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs +++ b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs @@ -233,7 +233,7 @@ private void MergeStub() { // from the library source of from the scraped module. foreach (var v in _stubAnalysis.GlobalScope.Variables) { var stubType = v.Value.GetPythonType(); - if (stubType.IsUnknown() || !_stubAnalysis.Document.Equals(stubType?.DeclaringModule)) { + if (stubType.IsUnknown()) { continue; } @@ -263,7 +263,7 @@ private void MergeStub() { // Re-declare variable with the data from the stub unless member is a module. // Modules members that are modules should remain as they are, i.e. os.path // should remain library with its own stub attached. - if (!stubType.IsUnknown() && !(stubType is IPythonModule)) { + if (!(stubType is IPythonModule)) { sourceType.TransferDocumentationAndLocation(stubType); // TODO: choose best type between the scrape and the stub. Stub probably should always win. var source = Eval.CurrentScope.Variables[v.Name]?.Source ?? VariableSource.Declaration; diff --git a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs index 831e9d9b6..5abdce573 100644 --- a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs +++ b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs @@ -336,8 +336,7 @@ private void AnalyzeEntry() { private void AnalyzeEntry(PythonAnalyzerEntry entry, IPythonModule module, int version, bool isFinalPass) { if (entry.PreviousAnalysis is LibraryAnalysis) { - _log?.Log(TraceEventType.Verbose, $"Request to re-analyze finalized {module.Name} ignored."); - return; + _log?.Log(TraceEventType.Verbose, $"Request to re-analyze finalized {module.Name}."); } // Now run the analysis. @@ -353,10 +352,8 @@ private void AnalyzeEntry(PythonAnalyzerEntry entry, IPythonModule module, int v walker.Complete(); _analyzerCancellationToken.ThrowIfCancellationRequested(); - var analysis = CreateAnalysis((IDocument)module, version, walker, isFinalPass); - - analyzable?.NotifyAnalysisComplete(analysis); - entry.TrySetAnalysis(analysis, version); + analyzable?.NotifyAnalysisComplete(version, walker, isFinalPass); + entry.TrySetAnalysis(module.Analysis, version); if (module.ModuleType == ModuleType.User) { var linterDiagnostics = _analyzer.LintModule(module); @@ -378,10 +375,5 @@ private enum State { Started = 1, Completed = 2 } - - private IDocumentAnalysis CreateAnalysis(IDocument document, int version, ModuleWalker walker, bool isFinalPass) - => document.ModuleType == ModuleType.Library && isFinalPass - ? new LibraryAnalysis(document, version, walker.Eval.Services, walker.GlobalScope, walker.StarImportMemberNames) - : (IDocumentAnalysis)new DocumentAnalysis(document, version, walker.GlobalScope, walker.Eval, walker.StarImportMemberNames); } } diff --git a/src/Analysis/Ast/Impl/Analyzer/Symbols/ClassEvaluator.cs b/src/Analysis/Ast/Impl/Analyzer/Symbols/ClassEvaluator.cs index 1e1e6a767..08a0d740d 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Symbols/ClassEvaluator.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Symbols/ClassEvaluator.cs @@ -64,7 +64,7 @@ public void EvaluateClass() { _class.SetBases(bases); // Declare __class__ variable in the scope. - Eval.DeclareVariable("__class__", _class, VariableSource.Declaration); + Eval.DeclareVariable("__class__", _class, VariableSource.Declaration, Eval.DefaultLocation); ProcessClassBody(); } diff --git a/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs b/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs index 55b322520..a5fafa899 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs @@ -54,7 +54,7 @@ public override bool Walk(ClassDefinition cd) { var classInfo = CreateClass(cd); // The variable is transient (non-user declared) hence it does not have location. // Class type is tracking locations for references and renaming. - _eval.DeclareVariable(cd.Name, classInfo, VariableSource.Declaration); + _eval.DeclareVariable(cd.Name, classInfo, VariableSource.Declaration, _eval.GetLocationOfName(cd)); _table.Add(new ClassEvaluator(_eval, cd)); // Open class scope _scopes.Push(_eval.OpenScope(_eval.Module, cd, out _)); @@ -108,7 +108,7 @@ private void AddFunction(FunctionDefinition fd, IPythonType declaringType) { existing = new PythonFunctionType(fd, declaringType, _eval.GetLocationOfName(fd)); // The variable is transient (non-user declared) hence it does not have location. // Function type is tracking locations for references and renaming. - _eval.DeclareVariable(fd.Name, existing, VariableSource.Declaration); + _eval.DeclareVariable(fd.Name, existing, VariableSource.Declaration, _eval.GetLocationOfName(fd)); } AddOverload(fd, existing, o => existing.AddOverload(o)); } @@ -165,14 +165,15 @@ private bool TryAddProperty(FunctionDefinition node, IPythonType declaringType) return false; } - private void AddProperty(FunctionDefinition node, IPythonType declaringType, bool isAbstract) { - if (!(_eval.LookupNameInScopes(node.Name, LookupOptions.Local) is PythonPropertyType existing)) { - existing = new PythonPropertyType(node, _eval.GetLocationOfName(node), declaringType, isAbstract); + private void AddProperty(FunctionDefinition fd, IPythonType declaringType, bool isAbstract) { + if (!(_eval.LookupNameInScopes(fd.Name, LookupOptions.Local) is PythonPropertyType existing)) { + var location = _eval.GetLocationOfName(fd); + existing = new PythonPropertyType(fd, location, declaringType, isAbstract); // The variable is transient (non-user declared) hence it does not have location. // Property type is tracking locations for references and renaming. - _eval.DeclareVariable(node.Name, existing, VariableSource.Declaration); + _eval.DeclareVariable(fd.Name, existing, VariableSource.Declaration, location); } - AddOverload(node, existing, o => existing.AddOverload(o)); + AddOverload(fd, existing, o => existing.AddOverload(o)); } private IMember GetMemberFromStub(string name) { diff --git a/src/Analysis/Ast/Impl/Extensions/AnalysisExtensions.cs b/src/Analysis/Ast/Impl/Extensions/AnalysisExtensions.cs index 1a2bf48bc..8be299581 100644 --- a/src/Analysis/Ast/Impl/Extensions/AnalysisExtensions.cs +++ b/src/Analysis/Ast/Impl/Extensions/AnalysisExtensions.cs @@ -55,7 +55,7 @@ private static PythonFunctionType GetOrCreateFunction(this IDocumentAnalysis ana if (!(analysis.GlobalScope.Variables[name]?.Value is PythonFunctionType f)) { f = PythonFunctionType.Specialize(name, analysis.Document, string.Empty); f.AddOverload(new PythonFunctionOverload(name, new Location(analysis.Document))); - analysis.GlobalScope.DeclareVariable(name, f, VariableSource.Declaration); + analysis.GlobalScope.DeclareVariable(name, f, VariableSource.Declaration, new Location(analysis.Document)); } return f; } diff --git a/src/Analysis/Ast/Impl/Extensions/AstExtensions.cs b/src/Analysis/Ast/Impl/Extensions/AstExtensions.cs index c4a220000..a1d2b5d8f 100644 --- a/src/Analysis/Ast/Impl/Extensions/AstExtensions.cs +++ b/src/Analysis/Ast/Impl/Extensions/AstExtensions.cs @@ -32,7 +32,7 @@ public static Expression FindExpression(this PythonAst ast, SourceLocation locat public static string GetDocumentation(this ScopeStatement node) { var docExpr = (node?.Body as SuiteStatement)?.Statements?.FirstOrDefault() as ExpressionStatement; var ce = docExpr?.Expression as ConstantExpression; - return ce?.Value as string; + return ce?.GetStringValue(); } public static bool IsInsideComment(this PythonAst ast, SourceLocation location) { diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.cs index 49d2b3525..f9f0901e8 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.cs @@ -372,7 +372,9 @@ public void NotifyAnalysisBegins() { lock (AnalysisLock) { if (Analysis is LibraryAnalysis) { var sw = Log != null ? Stopwatch.StartNew() : null; - _astMap[this] = RecreateAst(); + lock (AnalysisLock) { + _astMap[this] = RecreateAst(); + } sw?.Stop(); Log?.Log(TraceEventType.Verbose, $"Reloaded AST of {Name} in {sw?.Elapsed.TotalMilliseconds} ms"); } @@ -403,14 +405,14 @@ public void NotifyAnalysisBegins() { } } - public void NotifyAnalysisComplete(IDocumentAnalysis analysis) { + public void NotifyAnalysisComplete(int version, ModuleWalker walker, bool isFinalPass) { lock (AnalysisLock) { - if (analysis.Version < Analysis.Version) { + if (version < Analysis.Version) { return; } - Analysis = analysis; - GlobalScope = analysis.GlobalScope; + Analysis = CreateAnalysis(version, walker, isFinalPass); + GlobalScope = Analysis.GlobalScope; // Derived classes can override OnAnalysisComplete if they want // to perform additional actions on the completed analysis such @@ -425,7 +427,7 @@ public void NotifyAnalysisComplete(IDocumentAnalysis analysis) { // Do not report issues with libraries or stubs if (ModuleType == ModuleType.User) { - _diagnosticsService?.Replace(Uri, analysis.Diagnostics, DiagnosticSource.Analysis); + _diagnosticsService?.Replace(Uri, Analysis.Diagnostics, DiagnosticSource.Analysis); } NewAnalysis?.Invoke(this, EventArgs.Empty); @@ -569,6 +571,11 @@ private void RemoveReferencesInModule(IPythonModule module) { } } + private IDocumentAnalysis CreateAnalysis(int version, ModuleWalker walker, bool isFinalPass) + => ModuleType == ModuleType.Library && isFinalPass + ? new LibraryAnalysis(this, version, walker.Eval.Services, walker.GlobalScope, walker.StarImportMemberNames) + : (IDocumentAnalysis)new DocumentAnalysis(this, version, walker.GlobalScope, walker.Eval, walker.StarImportMemberNames); + private PythonAst RecreateAst() { lock (AnalysisLock) { ContentState = State.None; diff --git a/src/Analysis/Ast/Impl/Types/LocatedMember.cs b/src/Analysis/Ast/Impl/Types/LocatedMember.cs index d752e3f4f..8faef76c0 100644 --- a/src/Analysis/Ast/Impl/Types/LocatedMember.cs +++ b/src/Analysis/Ast/Impl/Types/LocatedMember.cs @@ -18,6 +18,7 @@ using System.Linq; using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Core; +using Microsoft.Python.Core.Diagnostics; namespace Microsoft.Python.Analysis.Types { internal abstract class LocatedMember : ILocatedMember { @@ -26,6 +27,7 @@ internal abstract class LocatedMember : ILocatedMember { protected LocatedMember(IPythonModule module) : this(new Location(module, default)) { } protected LocatedMember(Location location) { + Check.InvalidOperation(() => this is IPythonModule || location.Module != null, "Declaring module can only be null for modules."); Location = location; } diff --git a/src/Analysis/Ast/Impl/Values/Definitions/IScope.cs b/src/Analysis/Ast/Impl/Values/Definitions/IScope.cs index 08f9ec8f3..66233242c 100644 --- a/src/Analysis/Ast/Impl/Values/Definitions/IScope.cs +++ b/src/Analysis/Ast/Impl/Values/Definitions/IScope.cs @@ -85,7 +85,7 @@ public interface IScope { /// Variable value. /// Variable source. /// Variable name node location. - void DeclareVariable(string name, IMember value, VariableSource source, Location location = default); + void DeclareVariable(string name, IMember value, VariableSource source, Location location); /// /// Links variable from another module such as when it is imported. diff --git a/src/Analysis/Ast/Impl/Values/Scope.cs b/src/Analysis/Ast/Impl/Values/Scope.cs index d517c4457..5712f0235 100644 --- a/src/Analysis/Ast/Impl/Values/Scope.cs +++ b/src/Analysis/Ast/Impl/Values/Scope.cs @@ -73,7 +73,7 @@ public IEnumerable EnumerateTowardsGlobal { public IEnumerable EnumerateFromGlobal => EnumerateTowardsGlobal.Reverse(); - public void DeclareVariable(string name, IMember value, VariableSource source, Location location = default) + public void DeclareVariable(string name, IMember value, VariableSource source, Location location) => VariableCollection.DeclareVariable(name, value, source, location); public void LinkVariable(string name, IVariable v, Location location) diff --git a/src/Parsing/Impl/Ast/PythonAst.cs b/src/Parsing/Impl/Ast/PythonAst.cs index 8a01ebac5..70a669cf9 100644 --- a/src/Parsing/Impl/Ast/PythonAst.cs +++ b/src/Parsing/Impl/Ast/PythonAst.cs @@ -22,11 +22,11 @@ using Microsoft.Python.Core.Text; namespace Microsoft.Python.Parsing.Ast { - /// - /// Top-level ast for all Python code. Holds onto the body and the line mapping information. + /// Top-level ast for all Python code. Holds onto the body and the line mapping information. /// public sealed class PythonAst : ScopeStatement { + private readonly object _lock = new object(); private readonly Statement _body; private readonly Dictionary> _attributes = new Dictionary>(); @@ -94,68 +94,55 @@ public override async Task WalkAsync(PythonWalkerAsync walker, CancellationToken public PythonLanguageVersion LanguageVersion { get; } public void Reduce(Func filter) { - (Body as SuiteStatement)?.FilterStatements(filter); - _attributes?.Clear(); - Variables?.Clear(); - CommentLocations = Array.Empty(); - // DO keep NewLineLocations as they are required - // to calculate node positions for navigation; - base.Clear(); + lock (_lock) { + (Body as SuiteStatement)?.FilterStatements(filter); + _attributes?.Clear(); + Variables?.Clear(); + CommentLocations = Array.Empty(); + // DO keep NewLineLocations as they are required + // to calculate node positions for navigation; + base.Clear(); + } } public bool TryGetAttribute(Node node, object key, out object value) { - if (_attributes.TryGetValue(node, out var nodeAttrs)) { - return nodeAttrs.TryGetValue(key, out value); - } - value = null; - return false; - } + lock (_lock) { + if (_attributes.TryGetValue(node, out var nodeAttrs)) { + return nodeAttrs.TryGetValue(key, out value); + } - public void SetAttribute(Node node, object key, object value) { - if (!_attributes.TryGetValue(node, out var nodeAttrs)) { - nodeAttrs = _attributes[node] = new Dictionary(); + value = null; + return false; } - nodeAttrs[key] = value; } - /// - /// Copies attributes that apply to one node and makes them available for the other node. - /// - /// - /// - public void CopyAttributes(Node from, Node to) { - if (_attributes.TryGetValue(from, out var fromAttrs)) { - var toAttrs = new Dictionary(fromAttrs.Count); - foreach (var nodeAttr in fromAttrs) { - toAttrs[nodeAttr.Key] = nodeAttr.Value; + public void SetAttribute(Node node, object key, object value) { + lock (_lock) { + if (!_attributes.TryGetValue(node, out var nodeAttrs)) { + nodeAttrs = _attributes[node] = new Dictionary(); } - _attributes[to] = toAttrs; + nodeAttrs[key] = value; } } internal void SetAttributes(Dictionary> attributes) { - foreach (var nodeAttributes in attributes) { - var node = nodeAttributes.Key; - if (!_attributes.TryGetValue(node, out var existingNodeAttributes)) { - existingNodeAttributes = _attributes[node] = new Dictionary(nodeAttributes.Value.Count); - } - - foreach (var nodeAttr in nodeAttributes.Value) { - existingNodeAttributes[nodeAttr.Key] = nodeAttr.Value; + lock (_lock) { + foreach (var nodeAttributes in attributes) { + var node = nodeAttributes.Key; + if (!_attributes.TryGetValue(node, out var existingNodeAttributes)) { + existingNodeAttributes = _attributes[node] = new Dictionary(nodeAttributes.Value.Count); + } + + foreach (var nodeAttr in nodeAttributes.Value) { + existingNodeAttributes[nodeAttr.Key] = nodeAttr.Value; + } } } } public SourceLocation IndexToLocation(int index) => NewLineLocation.IndexToLocation(NewLineLocations, index); - public int LocationToIndex(SourceLocation location) => NewLineLocation.LocationToIndex(NewLineLocations, location, EndIndex); - /// - /// Length of the span (number of characters inside the span). - /// - public int GetSpanLength(SourceSpan span) => LocationToIndex(span.End) - LocationToIndex(span.Start); - - internal int GetLineEndFromPosition(int index) { var loc = IndexToLocation(index); if (loc.Line >= NewLineLocations.Length) { From 5e61392eed24cc8ad947d0c42eb5c833b1b97ae1 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Wed, 29 May 2019 16:12:43 -0700 Subject: [PATCH 33/82] Undo some changes --- src/Analysis/Ast/Impl/Analyzer/AnalysisWalker.cs | 2 +- .../Impl/Analyzer/Evaluation/ExpressionEval.Scopes.cs | 3 +++ .../Ast/Impl/Analyzer/Handlers/FromImportHandler.cs | 3 +-- src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs | 4 ++-- src/Analysis/Ast/Impl/Analyzer/Symbols/ClassEvaluator.cs | 2 +- .../Ast/Impl/Analyzer/Symbols/SymbolCollector.cs | 9 ++++----- src/Analysis/Ast/Impl/Extensions/AnalysisExtensions.cs | 2 +- src/Analysis/Ast/Impl/Types/LocatedMember.cs | 2 -- src/Analysis/Ast/Impl/Types/Location.cs | 2 +- src/Analysis/Ast/Impl/Values/Definitions/IScope.cs | 2 +- src/Analysis/Ast/Impl/Values/Scope.cs | 2 +- src/LanguageServer/Test/GoToDefinitionTests.cs | 7 +++++-- src/LanguageServer/Test/ReferencesTests.cs | 2 ++ 13 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/AnalysisWalker.cs b/src/Analysis/Ast/Impl/Analyzer/AnalysisWalker.cs index d3802e6d7..60cf40216 100644 --- a/src/Analysis/Ast/Impl/Analyzer/AnalysisWalker.cs +++ b/src/Analysis/Ast/Impl/Analyzer/AnalysisWalker.cs @@ -69,7 +69,7 @@ public override bool Walk(ExpressionStatement node) { return true; case CallExpression callex when callex.Target is MemberExpression mex && !string.IsNullOrEmpty(mex.Name): var t = Eval.GetValueFromExpression(mex.Target)?.GetPythonType(); - t?.GetMember(mex.Name).AddReference(Eval.GetLocationOfName(mex)); + t?.GetMember(mex.Name)?.AddReference(Eval.GetLocationOfName(mex)); return true; default: return base.Walk(node); diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Scopes.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Scopes.cs index 85cdcff5d..f332513d9 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Scopes.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Scopes.cs @@ -36,6 +36,9 @@ public T GetInScope(string name, IScope scope) where T : class, IMember public IMember GetInScope(string name) => GetInScope(name, CurrentScope); public T GetInScope(string name) where T : class, IMember => GetInScope(name, CurrentScope); + public void DeclareVariable(string name, IMember value, VariableSource source) + => DeclareVariable(name, value, source, default(Location)); + public void DeclareVariable(string name, IMember value, VariableSource source, IPythonModule module) => DeclareVariable(name, value, source, new Location(module, default)); diff --git a/src/Analysis/Ast/Impl/Analyzer/Handlers/FromImportHandler.cs b/src/Analysis/Ast/Impl/Analyzer/Handlers/FromImportHandler.cs index 71c389b97..cba333e73 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Handlers/FromImportHandler.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Handlers/FromImportHandler.cs @@ -83,7 +83,6 @@ private void HandleModuleImportStar(PythonVariableModule variableModule) { // If __all__ is present, take it, otherwise declare all members from the module that do not begin with an underscore. var memberNames = variableModule.Analysis.StarImportMemberNames ?? variableModule.GetMemberNames().Where(s => !s.StartsWithOrdinal("_")); - var location = new Location(Module); foreach (var memberName in memberNames) { var member = variableModule.GetMember(memberName); @@ -99,7 +98,7 @@ private void HandleModuleImportStar(PythonVariableModule variableModule) { } var variable = variableModule.Analysis?.GlobalScope?.Variables[memberName]; - Eval.DeclareVariable(memberName, variable ?? member, VariableSource.Import, location); + Eval.DeclareVariable(memberName, variable ?? member, VariableSource.Import); } } diff --git a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs index 4b376fe91..d51328645 100644 --- a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs +++ b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs @@ -251,7 +251,7 @@ private void MergeStub() { var member = cls.GetMember(name); // Do not pick members from base classes since otherwise we may end up // reassigning members of a different module or even of built-in types. - if (member is IPythonClassMember clsm && !cls.Equals(clsm.DeclaringType)) { + if (member is IPythonClassMember clsm && !cls.Name.EqualsOrdinal(clsm.DeclaringType?.Name)) { continue; } // Get documentation from the current type, if any, since stubs @@ -267,7 +267,7 @@ private void MergeStub() { sourceType.TransferDocumentationAndLocation(stubType); // TODO: choose best type between the scrape and the stub. Stub probably should always win. var source = Eval.CurrentScope.Variables[v.Name]?.Source ?? VariableSource.Declaration; - Eval.DeclareVariable(v.Name, v.Value, source, Module); + Eval.DeclareVariable(v.Name, v.Value, source); } } } diff --git a/src/Analysis/Ast/Impl/Analyzer/Symbols/ClassEvaluator.cs b/src/Analysis/Ast/Impl/Analyzer/Symbols/ClassEvaluator.cs index 08a0d740d..1e1e6a767 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Symbols/ClassEvaluator.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Symbols/ClassEvaluator.cs @@ -64,7 +64,7 @@ public void EvaluateClass() { _class.SetBases(bases); // Declare __class__ variable in the scope. - Eval.DeclareVariable("__class__", _class, VariableSource.Declaration, Eval.DefaultLocation); + Eval.DeclareVariable("__class__", _class, VariableSource.Declaration); ProcessClassBody(); } diff --git a/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs b/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs index a5fafa899..fe45a8fb9 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Symbols/SymbolCollector.cs @@ -54,7 +54,7 @@ public override bool Walk(ClassDefinition cd) { var classInfo = CreateClass(cd); // The variable is transient (non-user declared) hence it does not have location. // Class type is tracking locations for references and renaming. - _eval.DeclareVariable(cd.Name, classInfo, VariableSource.Declaration, _eval.GetLocationOfName(cd)); + _eval.DeclareVariable(cd.Name, classInfo, VariableSource.Declaration); _table.Add(new ClassEvaluator(_eval, cd)); // Open class scope _scopes.Push(_eval.OpenScope(_eval.Module, cd, out _)); @@ -108,7 +108,7 @@ private void AddFunction(FunctionDefinition fd, IPythonType declaringType) { existing = new PythonFunctionType(fd, declaringType, _eval.GetLocationOfName(fd)); // The variable is transient (non-user declared) hence it does not have location. // Function type is tracking locations for references and renaming. - _eval.DeclareVariable(fd.Name, existing, VariableSource.Declaration, _eval.GetLocationOfName(fd)); + _eval.DeclareVariable(fd.Name, existing, VariableSource.Declaration); } AddOverload(fd, existing, o => existing.AddOverload(o)); } @@ -167,11 +167,10 @@ private bool TryAddProperty(FunctionDefinition node, IPythonType declaringType) private void AddProperty(FunctionDefinition fd, IPythonType declaringType, bool isAbstract) { if (!(_eval.LookupNameInScopes(fd.Name, LookupOptions.Local) is PythonPropertyType existing)) { - var location = _eval.GetLocationOfName(fd); - existing = new PythonPropertyType(fd, location, declaringType, isAbstract); + existing = new PythonPropertyType(fd, _eval.GetLocationOfName(fd), declaringType, isAbstract); // The variable is transient (non-user declared) hence it does not have location. // Property type is tracking locations for references and renaming. - _eval.DeclareVariable(fd.Name, existing, VariableSource.Declaration, location); + _eval.DeclareVariable(fd.Name, existing, VariableSource.Declaration); } AddOverload(fd, existing, o => existing.AddOverload(o)); } diff --git a/src/Analysis/Ast/Impl/Extensions/AnalysisExtensions.cs b/src/Analysis/Ast/Impl/Extensions/AnalysisExtensions.cs index 8be299581..1a2bf48bc 100644 --- a/src/Analysis/Ast/Impl/Extensions/AnalysisExtensions.cs +++ b/src/Analysis/Ast/Impl/Extensions/AnalysisExtensions.cs @@ -55,7 +55,7 @@ private static PythonFunctionType GetOrCreateFunction(this IDocumentAnalysis ana if (!(analysis.GlobalScope.Variables[name]?.Value is PythonFunctionType f)) { f = PythonFunctionType.Specialize(name, analysis.Document, string.Empty); f.AddOverload(new PythonFunctionOverload(name, new Location(analysis.Document))); - analysis.GlobalScope.DeclareVariable(name, f, VariableSource.Declaration, new Location(analysis.Document)); + analysis.GlobalScope.DeclareVariable(name, f, VariableSource.Declaration); } return f; } diff --git a/src/Analysis/Ast/Impl/Types/LocatedMember.cs b/src/Analysis/Ast/Impl/Types/LocatedMember.cs index 8faef76c0..d752e3f4f 100644 --- a/src/Analysis/Ast/Impl/Types/LocatedMember.cs +++ b/src/Analysis/Ast/Impl/Types/LocatedMember.cs @@ -18,7 +18,6 @@ using System.Linq; using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Core; -using Microsoft.Python.Core.Diagnostics; namespace Microsoft.Python.Analysis.Types { internal abstract class LocatedMember : ILocatedMember { @@ -27,7 +26,6 @@ internal abstract class LocatedMember : ILocatedMember { protected LocatedMember(IPythonModule module) : this(new Location(module, default)) { } protected LocatedMember(Location location) { - Check.InvalidOperation(() => this is IPythonModule || location.Module != null, "Declaring module can only be null for modules."); Location = location; } diff --git a/src/Analysis/Ast/Impl/Types/Location.cs b/src/Analysis/Ast/Impl/Types/Location.cs index a7edb604d..dadb1d106 100644 --- a/src/Analysis/Ast/Impl/Types/Location.cs +++ b/src/Analysis/Ast/Impl/Types/Location.cs @@ -38,7 +38,7 @@ public LocationInfo LocationInfo { } } - public bool IsValid => Module != null; + public bool IsValid => Module != null && IndexSpan != default; public override bool Equals(object obj) => obj is Location other && other.Module == Module && other.IndexSpan == IndexSpan; diff --git a/src/Analysis/Ast/Impl/Values/Definitions/IScope.cs b/src/Analysis/Ast/Impl/Values/Definitions/IScope.cs index 66233242c..08f9ec8f3 100644 --- a/src/Analysis/Ast/Impl/Values/Definitions/IScope.cs +++ b/src/Analysis/Ast/Impl/Values/Definitions/IScope.cs @@ -85,7 +85,7 @@ public interface IScope { /// Variable value. /// Variable source. /// Variable name node location. - void DeclareVariable(string name, IMember value, VariableSource source, Location location); + void DeclareVariable(string name, IMember value, VariableSource source, Location location = default); /// /// Links variable from another module such as when it is imported. diff --git a/src/Analysis/Ast/Impl/Values/Scope.cs b/src/Analysis/Ast/Impl/Values/Scope.cs index 5712f0235..d517c4457 100644 --- a/src/Analysis/Ast/Impl/Values/Scope.cs +++ b/src/Analysis/Ast/Impl/Values/Scope.cs @@ -73,7 +73,7 @@ public IEnumerable EnumerateTowardsGlobal { public IEnumerable EnumerateFromGlobal => EnumerateTowardsGlobal.Reverse(); - public void DeclareVariable(string name, IMember value, VariableSource source, Location location) + public void DeclareVariable(string name, IMember value, VariableSource source, Location location = default) => VariableCollection.DeclareVariable(name, value, source, location); public void LinkVariable(string name, IVariable v, Location location) diff --git a/src/LanguageServer/Test/GoToDefinitionTests.cs b/src/LanguageServer/Test/GoToDefinitionTests.cs index 0e23cc904..1e2f53924 100644 --- a/src/LanguageServer/Test/GoToDefinitionTests.cs +++ b/src/LanguageServer/Test/GoToDefinitionTests.cs @@ -230,7 +230,9 @@ public async Task GotoRelativeImportInExplicitPackage() { rdt.OpenDocument(subpkgPath, string.Empty); var submod = rdt.OpenDocument(submodPath, "from .. import mod"); - var analysis = await submod.GetAnalysisAsync(-1); + await Services.GetService().WaitForCompleteAnalysisAsync(); + var analysis = await submod.GetAnalysisAsync(Timeout.Infinite); + var ds = new DefinitionSource(Services); var reference = ds.FindDefinition(analysis, new SourceLocation(1, 18), out _); reference.Should().NotBeNull(); @@ -250,7 +252,8 @@ public async Task GotoModuleSourceFromRelativeImport() { z = 1 def X(): ... "); - var analysis = await modA.GetAnalysisAsync(-1); + await Services.GetService().WaitForCompleteAnalysisAsync(); + var analysis = await modA.GetAnalysisAsync(Timeout.Infinite); var ds = new DefinitionSource(Services); var reference = ds.FindDefinition(analysis, new SourceLocation(1, 7), out _); diff --git a/src/LanguageServer/Test/ReferencesTests.cs b/src/LanguageServer/Test/ReferencesTests.cs index 2d2b23c2e..cd53d92f4 100644 --- a/src/LanguageServer/Test/ReferencesTests.cs +++ b/src/LanguageServer/Test/ReferencesTests.cs @@ -17,6 +17,7 @@ using System.IO; using System.Threading.Tasks; using FluentAssertions; +using Microsoft.Python.Analysis.Analyzer; using Microsoft.Python.Analysis.Documents; using Microsoft.Python.Core.Text; using Microsoft.Python.LanguageServer.Sources; @@ -368,6 +369,7 @@ import logging var rdt = Services.GetService(); var doc = rdt.OpenDocument(uri, code); + await Services.GetService().WaitForCompleteAnalysisAsync(); var analysis = await GetDocumentAnalysisAsync(doc); var rs = new ReferenceSource(Services); From 130b95dd48b18c534505e39e7cb1e10baf9c93e5 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Wed, 29 May 2019 16:32:22 -0700 Subject: [PATCH 34/82] Fix test --- src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs index d51328645..accdd872b 100644 --- a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs +++ b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs @@ -249,11 +249,6 @@ private void MergeStub() { foreach (var name in stubType.GetMemberNames()) { var stubMember = stubType.GetMember(name); var member = cls.GetMember(name); - // Do not pick members from base classes since otherwise we may end up - // reassigning members of a different module or even of built-in types. - if (member is IPythonClassMember clsm && !cls.Name.EqualsOrdinal(clsm.DeclaringType?.Name)) { - continue; - } // Get documentation from the current type, if any, since stubs // typically do not contain documentation while scraped code does. member?.GetPythonType()?.TransferDocumentationAndLocation(stubMember.GetPythonType()); From a6676f191cb5d1ec33967bc67261392acf58e9e6 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Thu, 30 May 2019 14:34:14 -0700 Subject: [PATCH 35/82] Fix race condition --- .../Analyzer/Evaluation/ExpressionEval.cs | 3 ++- src/Analysis/Ast/Impl/Modules/PythonModule.cs | 4 ++-- .../Resolution/ModuleResolutionBase.cs | 22 ++++--------------- src/Analysis/Ast/Impl/Types/Location.cs | 2 +- .../Impl/Sources/ReferenceSource.cs | 3 ++- 5 files changed, 11 insertions(+), 23 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs index 392dc1abe..e094e18e5 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs @@ -63,7 +63,8 @@ public ExpressionEval(IServiceContainer services, IPythonModule module, GlobalSc public LocationInfo GetLocationInfo(Node node) => node?.GetLocation(Module) ?? LocationInfo.Empty; public Location GetLocationOfName(Node node) { - if (node == null || (Module.ModuleType != ModuleType.User && Module.ModuleType != ModuleType.Library)) { + node = node ?? throw new ArgumentNullException(nameof(node)); + if (Module.ModuleType != ModuleType.User && Module.ModuleType != ModuleType.Library) { return DefaultLocation; } diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.cs index f9f0901e8..6b0d7f3a8 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.cs @@ -129,7 +129,7 @@ internal PythonModule(ModuleCreationOptions creationOptions, IServiceContainer s public virtual string Documentation { get { - _documentation = _documentation ?? GetAstNode(this)?.Documentation; + _documentation = _documentation ?? this.GetAst()?.Documentation; if (_documentation == null) { var m = GetMember("__doc__"); _documentation = m.TryGetConstant(out var s) ? s : string.Empty; @@ -250,7 +250,7 @@ public async Task GetAstAsync(CancellationToken cancellationToken = d } } cancellationToken.ThrowIfCancellationRequested(); - return GetAstNode(this); + return this.GetAst(); } public PythonAst GetAnyAst() => GetAstNode(this); diff --git a/src/Analysis/Ast/Impl/Modules/Resolution/ModuleResolutionBase.cs b/src/Analysis/Ast/Impl/Modules/Resolution/ModuleResolutionBase.cs index 2e7ac764d..1e952a1a9 100644 --- a/src/Analysis/Ast/Impl/Modules/Resolution/ModuleResolutionBase.cs +++ b/src/Analysis/Ast/Impl/Modules/Resolution/ModuleResolutionBase.cs @@ -80,7 +80,7 @@ public IReadOnlyCollection GetPackagesFromDirectory(string searchPath, C ).Select(mp => mp.ModuleName).Where(n => !string.IsNullOrEmpty(n)).TakeWhile(_ => !cancellationToken.IsCancellationRequested).ToList(); } - public IPythonModule GetImportedModule(string name) + public IPythonModule GetImportedModule(string name) => Modules.TryGetValue(name, out var moduleRef) ? moduleRef.Value : _interpreter.ModuleResolution.GetSpecializedModule(name); public IPythonModule GetOrLoadModule(string name) { @@ -97,7 +97,7 @@ public IPythonModule GetOrLoadModule(string name) { return moduleRef.GetOrCreate(name, this); } - public bool TryAddModulePath(in string path, in bool allowNonRooted, out string fullModuleName) + public bool TryAddModulePath(in string path, in bool allowNonRooted, out string fullModuleName) => PathResolver.TryAddModulePath(path, allowNonRooted, out fullModuleName); public ModulePath FindModule(string filePath) { @@ -122,13 +122,12 @@ protected void ReloadModulePaths(in IEnumerable rootPaths) { protected class ModuleRef { private readonly object _syncObj = new object(); private IPythonModule _module; - private bool _creating; public ModuleRef(IPythonModule module) { _module = module; } - public ModuleRef() {} + public ModuleRef() { } public IPythonModule Value { get { @@ -139,25 +138,12 @@ public IPythonModule Value { } public IPythonModule GetOrCreate(string name, ModuleResolutionBase mrb) { - var create = false; lock (_syncObj) { if (_module != null) { return _module; } - if (!_creating) { - create = true; - _creating = true; - } - } - - if (!create) { - return null; - } - - var module = mrb.CreateModule(name); - lock (_syncObj) { - _creating = false; + var module = mrb.CreateModule(name); _module = module; return module; } diff --git a/src/Analysis/Ast/Impl/Types/Location.cs b/src/Analysis/Ast/Impl/Types/Location.cs index dadb1d106..fd2275707 100644 --- a/src/Analysis/Ast/Impl/Types/Location.cs +++ b/src/Analysis/Ast/Impl/Types/Location.cs @@ -30,7 +30,7 @@ public Location(IPythonModule module, IndexSpan indexSpan) { public LocationInfo LocationInfo { get { - var ast = Module.GetAst(); + var ast = Module?.GetAst(); if (ast != null && !string.IsNullOrEmpty(Module?.FilePath) && Module?.Uri != null) { return new LocationInfo(Module.FilePath, Module.Uri, IndexSpan.ToSourceSpan(ast)); } diff --git a/src/LanguageServer/Impl/Sources/ReferenceSource.cs b/src/LanguageServer/Impl/Sources/ReferenceSource.cs index c302d91f3..009c7894f 100644 --- a/src/LanguageServer/Impl/Sources/ReferenceSource.cs +++ b/src/LanguageServer/Impl/Sources/ReferenceSource.cs @@ -20,6 +20,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Python.Analysis; +using Microsoft.Python.Analysis.Analyzer; using Microsoft.Python.Analysis.Documents; using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; @@ -129,7 +130,7 @@ private List ScanClosedFiles(string name, CancellationToken cancellationTok return files; } - private static async Task AnalyzeFiles(IModuleManagement moduleManagement, IEnumerable files, CancellationToken cancellationToken) { + private async Task AnalyzeFiles(IModuleManagement moduleManagement, IEnumerable files, CancellationToken cancellationToken) { var analysisTasks = new List(); foreach (var f in files) { if (moduleManagement.TryAddModulePath(f.ToAbsolutePath(), false, out var fullName)) { From 663dc8f628436e5bef4c846dc0188c2db917553b Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Tue, 4 Jun 2019 14:01:54 -0700 Subject: [PATCH 36/82] Partial --- .../Impl/Caching/Definitions/IClassData.cs | 26 ++++++++++++++++ .../Impl/Caching/Definitions/IFunctionData.cs | 23 ++++++++++++++ .../Impl/Caching/Definitions/IMemberData.cs | 27 +++++++++++++++++ .../IModuleDatabaseService.cs | 6 ++-- .../Caching/Definitions/IParameterData.cs | 30 +++++++++++++++++++ .../Impl/Caching/Definitions/IPropertyData.cs | 20 +++++++++++++ .../Impl/Caching/Definitions/IVariableData.cs | 21 +++++++++++++ .../Impl/Caching/Definitions/MemberType.cs | 27 +++++++++++++++++ .../{ => Definitions}/ModuleStorageState.cs | 0 .../Ast/Impl/Caching/Models/ClassData.cs | 23 ++++++++++++++ .../Impl/Caching/Models/FunctionAttributes.cs | 26 ++++++++++++++++ .../Ast/Impl/Caching/Models/FunctionData.cs | 22 ++++++++++++++ .../Ast/Impl/Caching/Models/MemberData.cs | 25 ++++++++++++++++ .../Ast/Impl/Caching/Models/ModuleData.cs | 25 ++++++++++++++++ .../Ast/Impl/Caching/Models/ParameterData.cs | 23 ++++++++++++++ .../Ast/Impl/Caching/Models/PropertyData.cs | 21 +++++++++++++ .../Ast/Impl/Caching/Models/VariableData.cs | 21 +++++++++++++ 17 files changed, 362 insertions(+), 4 deletions(-) create mode 100644 src/Analysis/Ast/Impl/Caching/Definitions/IClassData.cs create mode 100644 src/Analysis/Ast/Impl/Caching/Definitions/IFunctionData.cs create mode 100644 src/Analysis/Ast/Impl/Caching/Definitions/IMemberData.cs rename src/Analysis/Ast/Impl/Caching/{ => Definitions}/IModuleDatabaseService.cs (87%) create mode 100644 src/Analysis/Ast/Impl/Caching/Definitions/IParameterData.cs create mode 100644 src/Analysis/Ast/Impl/Caching/Definitions/IPropertyData.cs create mode 100644 src/Analysis/Ast/Impl/Caching/Definitions/IVariableData.cs create mode 100644 src/Analysis/Ast/Impl/Caching/Definitions/MemberType.cs rename src/Analysis/Ast/Impl/Caching/{ => Definitions}/ModuleStorageState.cs (100%) create mode 100644 src/Analysis/Ast/Impl/Caching/Models/ClassData.cs create mode 100644 src/Analysis/Ast/Impl/Caching/Models/FunctionAttributes.cs create mode 100644 src/Analysis/Ast/Impl/Caching/Models/FunctionData.cs create mode 100644 src/Analysis/Ast/Impl/Caching/Models/MemberData.cs create mode 100644 src/Analysis/Ast/Impl/Caching/Models/ModuleData.cs create mode 100644 src/Analysis/Ast/Impl/Caching/Models/ParameterData.cs create mode 100644 src/Analysis/Ast/Impl/Caching/Models/PropertyData.cs create mode 100644 src/Analysis/Ast/Impl/Caching/Models/VariableData.cs diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IClassData.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IClassData.cs new file mode 100644 index 000000000..7b1636522 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Definitions/IClassData.cs @@ -0,0 +1,26 @@ +// 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.Collections.Generic; +using Microsoft.Python.Analysis.Caching.Definitions; + +namespace Microsoft.Python.Analysis.Caching { + internal interface IClassData: IMemberData { + IEnumerable Bases { get; } + IEnumerable Methods { get; } + IEnumerable Properties { get; } + IEnumerable Fields { get; } + } +} diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IFunctionData.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IFunctionData.cs new file mode 100644 index 000000000..b3edb7f73 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Definitions/IFunctionData.cs @@ -0,0 +1,23 @@ +// 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.Collections.Generic; + +namespace Microsoft.Python.Analysis.Caching { + internal interface IFunctionData: IMemberData { + IEnumerable Parameters { get; } + IMemberData ReturnType { get; } + } +} diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IMemberData.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IMemberData.cs new file mode 100644 index 000000000..1f38ab8c5 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Definitions/IMemberData.cs @@ -0,0 +1,27 @@ +// 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.Collections.Generic; +using Microsoft.Python.Analysis.Types; + +namespace Microsoft.Python.Analysis.Caching { + /// + /// Represents persistent data about member. + /// + internal interface IMemberData { + string Name { get; } + MemberType MemberType { get; } + } +} diff --git a/src/Analysis/Ast/Impl/Caching/IModuleDatabaseService.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs similarity index 87% rename from src/Analysis/Ast/Impl/Caching/IModuleDatabaseService.cs rename to src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs index 3603c9284..4593aa67c 100644 --- a/src/Analysis/Ast/Impl/Caching/IModuleDatabaseService.cs +++ b/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs @@ -13,8 +13,6 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. -using Microsoft.Python.Analysis.Types; - namespace Microsoft.Python.Analysis.Caching { internal interface IModuleDatabaseService { /// @@ -24,13 +22,13 @@ internal interface IModuleDatabaseService { /// Module unique id. /// Python module. /// Module storage state - ModuleStorageState TryGetModule(string uniqueId, out IPythonModule module); + ModuleStorageState TryGetModuleData(string uniqueId, out IMemberData module); /// /// Writes module data to the database. /// /// Module unique id. /// Module analysis. - void StoreModule(string uniqueId, IDocumentAnalysis analysis); + void StoreModuleData(string uniqueId, IDocumentAnalysis analysis); } } diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IParameterData.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IParameterData.cs new file mode 100644 index 000000000..fa9e87761 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Definitions/IParameterData.cs @@ -0,0 +1,30 @@ +// 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. + +namespace Microsoft.Python.Analysis.Caching { + public enum ParameterKind { + Normal, + List, + Dictionary, + KeywordOnly + } + + internal interface IParameterData { + string Name { get; } + string Type { get; } + string DefaultValue { get; } + ParameterKind Kind { get; } + } +} diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IPropertyData.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IPropertyData.cs new file mode 100644 index 000000000..0da74ba63 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Definitions/IPropertyData.cs @@ -0,0 +1,20 @@ +// 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. + +namespace Microsoft.Python.Analysis.Caching { + internal interface IPropertyData: IMemberData { + IMemberData ReturnType { get; } + } +} diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IVariableData.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IVariableData.cs new file mode 100644 index 000000000..e34746f17 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Definitions/IVariableData.cs @@ -0,0 +1,21 @@ +// 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. + +namespace Microsoft.Python.Analysis.Caching.Definitions { + internal interface IVariableData { + string Name { get; } + string Type { get; } + } +} diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/MemberType.cs b/src/Analysis/Ast/Impl/Caching/Definitions/MemberType.cs new file mode 100644 index 000000000..e227c5a05 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Definitions/MemberType.cs @@ -0,0 +1,27 @@ +// 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. + +namespace Microsoft.Python.Analysis.Caching { + /// + /// Defines what type of object the member represents. + /// + internal enum MemberType { + Module, + Class, + Function, + Property, + Variable + } +} diff --git a/src/Analysis/Ast/Impl/Caching/ModuleStorageState.cs b/src/Analysis/Ast/Impl/Caching/Definitions/ModuleStorageState.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/ModuleStorageState.cs rename to src/Analysis/Ast/Impl/Caching/Definitions/ModuleStorageState.cs diff --git a/src/Analysis/Ast/Impl/Caching/Models/ClassData.cs b/src/Analysis/Ast/Impl/Caching/Models/ClassData.cs new file mode 100644 index 000000000..daf87f8ff --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Models/ClassData.cs @@ -0,0 +1,23 @@ +// 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. + +namespace Microsoft.Python.Analysis.Caching.Models { + internal sealed class ClassData: MemberData { + public string[] Bases { get; set; } + public string[] Methods { get; set; } + public string[] Properties { get; set; } + public string[] Fields { get; set; } + } +} diff --git a/src/Analysis/Ast/Impl/Caching/Models/FunctionAttributes.cs b/src/Analysis/Ast/Impl/Caching/Models/FunctionAttributes.cs new file mode 100644 index 000000000..1c0f3da74 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Models/FunctionAttributes.cs @@ -0,0 +1,26 @@ +// 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; + +namespace Microsoft.Python.Analysis.Caching.Models { + [Flags] + internal enum FunctionAttributes { + Normal, + Abstract, + Static, + ClassMethod + } +} diff --git a/src/Analysis/Ast/Impl/Caching/Models/FunctionData.cs b/src/Analysis/Ast/Impl/Caching/Models/FunctionData.cs new file mode 100644 index 000000000..fd7697ae6 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Models/FunctionData.cs @@ -0,0 +1,22 @@ +// 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. + +namespace Microsoft.Python.Analysis.Caching.Models { + internal sealed class FunctionData: MemberData { + public ParameterData[] Parameters { get; set; } + public string ReturnType { get; set; } + public FunctionAttributes Attributes { get; set; } + } +} diff --git a/src/Analysis/Ast/Impl/Caching/Models/MemberData.cs b/src/Analysis/Ast/Impl/Caching/Models/MemberData.cs new file mode 100644 index 000000000..c55e92089 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Models/MemberData.cs @@ -0,0 +1,25 @@ +// 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. + +namespace Microsoft.Python.Analysis.Caching.Models { + /// + /// Represents persistent data about member. + /// + internal abstract class MemberData { + public string Id { get; set; } + public string Name { get; set; } + public MemberType MemberType { get; set; } + } +} diff --git a/src/Analysis/Ast/Impl/Caching/Models/ModuleData.cs b/src/Analysis/Ast/Impl/Caching/Models/ModuleData.cs new file mode 100644 index 000000000..15722ab90 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Models/ModuleData.cs @@ -0,0 +1,25 @@ +// 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; + +namespace Microsoft.Python.Analysis.Caching.Models { + [Serializable] + internal sealed class ModuleData : MemberData { + public string[] Variables { get; set; } + public string[] Functions { get; set; } + public string[] Classes { get; set; } + } +} diff --git a/src/Analysis/Ast/Impl/Caching/Models/ParameterData.cs b/src/Analysis/Ast/Impl/Caching/Models/ParameterData.cs new file mode 100644 index 000000000..a07529ba4 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Models/ParameterData.cs @@ -0,0 +1,23 @@ +// 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. + +namespace Microsoft.Python.Analysis.Caching.Models { + internal sealed class ParameterData: IParameterData { + public string Name { get; set; } + public string Type { get; set; } + public string DefaultValue { get; set; } + public ParameterKind Kind { get; set; } + } +} diff --git a/src/Analysis/Ast/Impl/Caching/Models/PropertyData.cs b/src/Analysis/Ast/Impl/Caching/Models/PropertyData.cs new file mode 100644 index 000000000..5d01d6774 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Models/PropertyData.cs @@ -0,0 +1,21 @@ +// 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. + +namespace Microsoft.Python.Analysis.Caching.Models { + internal sealed class PropertyData: MemberData { + public string ReturnType { get; set; } + public FunctionAttributes Attributes { get; set; } + } +} diff --git a/src/Analysis/Ast/Impl/Caching/Models/VariableData.cs b/src/Analysis/Ast/Impl/Caching/Models/VariableData.cs new file mode 100644 index 000000000..4b339d66b --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Models/VariableData.cs @@ -0,0 +1,21 @@ +// 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. + +namespace Microsoft.Python.Analysis.Caching.Models { + internal sealed class VariableData { + public string Name { get; set; } + public string Type { get; set; } + } +} From 86544a690c8be3e56023e2f4dfd8486154563b33 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Tue, 4 Jun 2019 15:48:20 -0700 Subject: [PATCH 37/82] Models and views --- .../Definitions/IModuleDatabaseService.cs | 2 +- .../Models/{ClassData.cs => ClassModel.cs} | 3 +- .../{FunctionData.cs => FunctionModel.cs} | 4 +-- .../Models/{MemberData.cs => MemberModel.cs} | 2 +- .../Models/{ModuleData.cs => ModuleModel.cs} | 2 +- .../{ParameterData.cs => ParameterModel.cs} | 2 +- .../{PropertyData.cs => PropertyModel.cs} | 2 +- .../TypeVarModel.cs} | 7 ++--- .../{VariableData.cs => VariableModel.cs} | 3 +- .../Definitions/IClassView.cs} | 12 +++---- .../Definitions/IFunctionView.cs} | 6 ++-- .../Definitions/IMemberView.cs} | 5 ++- .../Caching/Views/Definitions/IModuleView.cs | 24 ++++++++++++++ .../Definitions/IParameterView.cs} | 2 +- .../Definitions/IPropertyView.cs} | 4 +-- .../Caching/Views/Definitions/ITypeVarView.cs | 22 +++++++++++++ .../Views/Definitions/IVariableView.cs | 22 +++++++++++++ .../{ => Views}/Definitions/MemberType.cs | 0 .../Ast/Impl/Caching/Views/MemberView.cs | 29 +++++++++++++++++ .../Ast/Impl/Caching/Views/VariableView.cs | 31 +++++++++++++++++++ 20 files changed, 155 insertions(+), 29 deletions(-) rename src/Analysis/Ast/Impl/Caching/Models/{ClassData.cs => ClassModel.cs} (89%) rename src/Analysis/Ast/Impl/Caching/Models/{FunctionData.cs => FunctionModel.cs} (88%) rename src/Analysis/Ast/Impl/Caching/Models/{MemberData.cs => MemberModel.cs} (95%) rename src/Analysis/Ast/Impl/Caching/Models/{ModuleData.cs => ModuleModel.cs} (94%) rename src/Analysis/Ast/Impl/Caching/Models/{ParameterData.cs => ParameterModel.cs} (94%) rename src/Analysis/Ast/Impl/Caching/Models/{PropertyData.cs => PropertyModel.cs} (93%) rename src/Analysis/Ast/Impl/Caching/{Definitions/IVariableData.cs => Models/TypeVarModel.cs} (81%) rename src/Analysis/Ast/Impl/Caching/Models/{VariableData.cs => VariableModel.cs} (90%) rename src/Analysis/Ast/Impl/Caching/{Definitions/IClassData.cs => Views/Definitions/IClassView.cs} (71%) rename src/Analysis/Ast/Impl/Caching/{Definitions/IFunctionData.cs => Views/Definitions/IFunctionView.cs} (84%) rename src/Analysis/Ast/Impl/Caching/{Definitions/IMemberData.cs => Views/Definitions/IMemberView.cs} (85%) create mode 100644 src/Analysis/Ast/Impl/Caching/Views/Definitions/IModuleView.cs rename src/Analysis/Ast/Impl/Caching/{Definitions/IParameterData.cs => Views/Definitions/IParameterView.cs} (96%) rename src/Analysis/Ast/Impl/Caching/{Definitions/IPropertyData.cs => Views/Definitions/IPropertyView.cs} (88%) create mode 100644 src/Analysis/Ast/Impl/Caching/Views/Definitions/ITypeVarView.cs create mode 100644 src/Analysis/Ast/Impl/Caching/Views/Definitions/IVariableView.cs rename src/Analysis/Ast/Impl/Caching/{ => Views}/Definitions/MemberType.cs (100%) create mode 100644 src/Analysis/Ast/Impl/Caching/Views/MemberView.cs create mode 100644 src/Analysis/Ast/Impl/Caching/Views/VariableView.cs diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs index 4593aa67c..b8ec092f5 100644 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs +++ b/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs @@ -22,7 +22,7 @@ internal interface IModuleDatabaseService { /// Module unique id. /// Python module. /// Module storage state - ModuleStorageState TryGetModuleData(string uniqueId, out IMemberData module); + ModuleStorageState TryGetModuleData(string uniqueId, out IModuleView module); /// /// Writes module data to the database. diff --git a/src/Analysis/Ast/Impl/Caching/Models/ClassData.cs b/src/Analysis/Ast/Impl/Caching/Models/ClassModel.cs similarity index 89% rename from src/Analysis/Ast/Impl/Caching/Models/ClassData.cs rename to src/Analysis/Ast/Impl/Caching/Models/ClassModel.cs index daf87f8ff..1d2e15ce5 100644 --- a/src/Analysis/Ast/Impl/Caching/Models/ClassData.cs +++ b/src/Analysis/Ast/Impl/Caching/Models/ClassModel.cs @@ -14,10 +14,11 @@ // permissions and limitations under the License. namespace Microsoft.Python.Analysis.Caching.Models { - internal sealed class ClassData: MemberData { + internal sealed class ClassModel: MemberModel { public string[] Bases { get; set; } public string[] Methods { get; set; } public string[] Properties { get; set; } public string[] Fields { get; set; } + public string[] GenericParameters { get; set; } } } diff --git a/src/Analysis/Ast/Impl/Caching/Models/FunctionData.cs b/src/Analysis/Ast/Impl/Caching/Models/FunctionModel.cs similarity index 88% rename from src/Analysis/Ast/Impl/Caching/Models/FunctionData.cs rename to src/Analysis/Ast/Impl/Caching/Models/FunctionModel.cs index fd7697ae6..5b65a3544 100644 --- a/src/Analysis/Ast/Impl/Caching/Models/FunctionData.cs +++ b/src/Analysis/Ast/Impl/Caching/Models/FunctionModel.cs @@ -14,8 +14,8 @@ // permissions and limitations under the License. namespace Microsoft.Python.Analysis.Caching.Models { - internal sealed class FunctionData: MemberData { - public ParameterData[] Parameters { get; set; } + internal sealed class FunctionModel: MemberModel { + public ParameterModel[] Parameters { get; set; } public string ReturnType { get; set; } public FunctionAttributes Attributes { get; set; } } diff --git a/src/Analysis/Ast/Impl/Caching/Models/MemberData.cs b/src/Analysis/Ast/Impl/Caching/Models/MemberModel.cs similarity index 95% rename from src/Analysis/Ast/Impl/Caching/Models/MemberData.cs rename to src/Analysis/Ast/Impl/Caching/Models/MemberModel.cs index c55e92089..c9b8d2a83 100644 --- a/src/Analysis/Ast/Impl/Caching/Models/MemberData.cs +++ b/src/Analysis/Ast/Impl/Caching/Models/MemberModel.cs @@ -17,7 +17,7 @@ namespace Microsoft.Python.Analysis.Caching.Models { /// /// Represents persistent data about member. /// - internal abstract class MemberData { + internal abstract class MemberModel { public string Id { get; set; } public string Name { get; set; } public MemberType MemberType { get; set; } diff --git a/src/Analysis/Ast/Impl/Caching/Models/ModuleData.cs b/src/Analysis/Ast/Impl/Caching/Models/ModuleModel.cs similarity index 94% rename from src/Analysis/Ast/Impl/Caching/Models/ModuleData.cs rename to src/Analysis/Ast/Impl/Caching/Models/ModuleModel.cs index 15722ab90..1f9f78ac2 100644 --- a/src/Analysis/Ast/Impl/Caching/Models/ModuleData.cs +++ b/src/Analysis/Ast/Impl/Caching/Models/ModuleModel.cs @@ -17,7 +17,7 @@ namespace Microsoft.Python.Analysis.Caching.Models { [Serializable] - internal sealed class ModuleData : MemberData { + internal sealed class ModuleModel : MemberModel { public string[] Variables { get; set; } public string[] Functions { get; set; } public string[] Classes { get; set; } diff --git a/src/Analysis/Ast/Impl/Caching/Models/ParameterData.cs b/src/Analysis/Ast/Impl/Caching/Models/ParameterModel.cs similarity index 94% rename from src/Analysis/Ast/Impl/Caching/Models/ParameterData.cs rename to src/Analysis/Ast/Impl/Caching/Models/ParameterModel.cs index a07529ba4..3b9f9a7d4 100644 --- a/src/Analysis/Ast/Impl/Caching/Models/ParameterData.cs +++ b/src/Analysis/Ast/Impl/Caching/Models/ParameterModel.cs @@ -14,7 +14,7 @@ // permissions and limitations under the License. namespace Microsoft.Python.Analysis.Caching.Models { - internal sealed class ParameterData: IParameterData { + internal sealed class ParameterModel { public string Name { get; set; } public string Type { get; set; } public string DefaultValue { get; set; } diff --git a/src/Analysis/Ast/Impl/Caching/Models/PropertyData.cs b/src/Analysis/Ast/Impl/Caching/Models/PropertyModel.cs similarity index 93% rename from src/Analysis/Ast/Impl/Caching/Models/PropertyData.cs rename to src/Analysis/Ast/Impl/Caching/Models/PropertyModel.cs index 5d01d6774..b57e33c88 100644 --- a/src/Analysis/Ast/Impl/Caching/Models/PropertyData.cs +++ b/src/Analysis/Ast/Impl/Caching/Models/PropertyModel.cs @@ -14,7 +14,7 @@ // permissions and limitations under the License. namespace Microsoft.Python.Analysis.Caching.Models { - internal sealed class PropertyData: MemberData { + internal sealed class PropertyModel: MemberModel { public string ReturnType { get; set; } public FunctionAttributes Attributes { get; set; } } diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IVariableData.cs b/src/Analysis/Ast/Impl/Caching/Models/TypeVarModel.cs similarity index 81% rename from src/Analysis/Ast/Impl/Caching/Definitions/IVariableData.cs rename to src/Analysis/Ast/Impl/Caching/Models/TypeVarModel.cs index e34746f17..40fde3bd6 100644 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IVariableData.cs +++ b/src/Analysis/Ast/Impl/Caching/Models/TypeVarModel.cs @@ -13,9 +13,8 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. -namespace Microsoft.Python.Analysis.Caching.Definitions { - internal interface IVariableData { - string Name { get; } - string Type { get; } +namespace Microsoft.Python.Analysis.Caching.Models { + internal sealed class TypeVarModel: MemberModel { + public string[] Constraints { get; set; } } } diff --git a/src/Analysis/Ast/Impl/Caching/Models/VariableData.cs b/src/Analysis/Ast/Impl/Caching/Models/VariableModel.cs similarity index 90% rename from src/Analysis/Ast/Impl/Caching/Models/VariableData.cs rename to src/Analysis/Ast/Impl/Caching/Models/VariableModel.cs index 4b339d66b..ea46da77d 100644 --- a/src/Analysis/Ast/Impl/Caching/Models/VariableData.cs +++ b/src/Analysis/Ast/Impl/Caching/Models/VariableModel.cs @@ -14,8 +14,7 @@ // permissions and limitations under the License. namespace Microsoft.Python.Analysis.Caching.Models { - internal sealed class VariableData { - public string Name { get; set; } + internal sealed class VariableModel: MemberModel { public string Type { get; set; } } } diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IClassData.cs b/src/Analysis/Ast/Impl/Caching/Views/Definitions/IClassView.cs similarity index 71% rename from src/Analysis/Ast/Impl/Caching/Definitions/IClassData.cs rename to src/Analysis/Ast/Impl/Caching/Views/Definitions/IClassView.cs index 7b1636522..94c850726 100644 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IClassData.cs +++ b/src/Analysis/Ast/Impl/Caching/Views/Definitions/IClassView.cs @@ -14,13 +14,13 @@ // permissions and limitations under the License. using System.Collections.Generic; -using Microsoft.Python.Analysis.Caching.Definitions; namespace Microsoft.Python.Analysis.Caching { - internal interface IClassData: IMemberData { - IEnumerable Bases { get; } - IEnumerable Methods { get; } - IEnumerable Properties { get; } - IEnumerable Fields { get; } + internal interface IClassView: IMemberView { + IEnumerable Bases { get; } + IEnumerable Methods { get; } + IEnumerable Properties { get; } + IEnumerable Fields { get; } + IEnumerable GenericParameters { get; } } } diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IFunctionData.cs b/src/Analysis/Ast/Impl/Caching/Views/Definitions/IFunctionView.cs similarity index 84% rename from src/Analysis/Ast/Impl/Caching/Definitions/IFunctionData.cs rename to src/Analysis/Ast/Impl/Caching/Views/Definitions/IFunctionView.cs index b3edb7f73..dd878565c 100644 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IFunctionData.cs +++ b/src/Analysis/Ast/Impl/Caching/Views/Definitions/IFunctionView.cs @@ -16,8 +16,8 @@ using System.Collections.Generic; namespace Microsoft.Python.Analysis.Caching { - internal interface IFunctionData: IMemberData { - IEnumerable Parameters { get; } - IMemberData ReturnType { get; } + internal interface IFunctionView: IMemberView { + IEnumerable Parameters { get; } + IMemberView ReturnType { get; } } } diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IMemberData.cs b/src/Analysis/Ast/Impl/Caching/Views/Definitions/IMemberView.cs similarity index 85% rename from src/Analysis/Ast/Impl/Caching/Definitions/IMemberData.cs rename to src/Analysis/Ast/Impl/Caching/Views/Definitions/IMemberView.cs index 1f38ab8c5..f782316ec 100644 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IMemberData.cs +++ b/src/Analysis/Ast/Impl/Caching/Views/Definitions/IMemberView.cs @@ -13,14 +13,13 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. -using System.Collections.Generic; using Microsoft.Python.Analysis.Types; namespace Microsoft.Python.Analysis.Caching { /// - /// Represents persistent data about member. + /// Represents view on member persistent data. /// - internal interface IMemberData { + internal interface IMemberView { string Name { get; } MemberType MemberType { get; } } diff --git a/src/Analysis/Ast/Impl/Caching/Views/Definitions/IModuleView.cs b/src/Analysis/Ast/Impl/Caching/Views/Definitions/IModuleView.cs new file mode 100644 index 000000000..8eb6a9585 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Views/Definitions/IModuleView.cs @@ -0,0 +1,24 @@ +// 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.Collections.Generic; + +namespace Microsoft.Python.Analysis.Caching { + internal interface IModuleView: IMemberView { + IEnumerable Variables { get;} + IEnumerable Functions { get; } + IEnumerable Classes { get; } + } +} diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IParameterData.cs b/src/Analysis/Ast/Impl/Caching/Views/Definitions/IParameterView.cs similarity index 96% rename from src/Analysis/Ast/Impl/Caching/Definitions/IParameterData.cs rename to src/Analysis/Ast/Impl/Caching/Views/Definitions/IParameterView.cs index fa9e87761..c3126f6e8 100644 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IParameterData.cs +++ b/src/Analysis/Ast/Impl/Caching/Views/Definitions/IParameterView.cs @@ -21,7 +21,7 @@ public enum ParameterKind { KeywordOnly } - internal interface IParameterData { + internal interface IParameterView { string Name { get; } string Type { get; } string DefaultValue { get; } diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IPropertyData.cs b/src/Analysis/Ast/Impl/Caching/Views/Definitions/IPropertyView.cs similarity index 88% rename from src/Analysis/Ast/Impl/Caching/Definitions/IPropertyData.cs rename to src/Analysis/Ast/Impl/Caching/Views/Definitions/IPropertyView.cs index 0da74ba63..dea254626 100644 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IPropertyData.cs +++ b/src/Analysis/Ast/Impl/Caching/Views/Definitions/IPropertyView.cs @@ -14,7 +14,7 @@ // permissions and limitations under the License. namespace Microsoft.Python.Analysis.Caching { - internal interface IPropertyData: IMemberData { - IMemberData ReturnType { get; } + internal interface IPropertyView : IMemberView { + IMemberView ReturnType { get; } } } diff --git a/src/Analysis/Ast/Impl/Caching/Views/Definitions/ITypeVarView.cs b/src/Analysis/Ast/Impl/Caching/Views/Definitions/ITypeVarView.cs new file mode 100644 index 000000000..0f68b0b05 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Views/Definitions/ITypeVarView.cs @@ -0,0 +1,22 @@ +// 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.Collections.Generic; + +namespace Microsoft.Python.Analysis.Caching { + internal interface ITypeVarView : IMemberView { + IEnumerable Constraints { get; } + } +} diff --git a/src/Analysis/Ast/Impl/Caching/Views/Definitions/IVariableView.cs b/src/Analysis/Ast/Impl/Caching/Views/Definitions/IVariableView.cs new file mode 100644 index 000000000..4ee1c94ef --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Views/Definitions/IVariableView.cs @@ -0,0 +1,22 @@ +// 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 Microsoft.Python.Analysis.Types; + +namespace Microsoft.Python.Analysis.Caching { + internal interface IVariableView: IMemberView { + IMember Type { get; } + } +} diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/MemberType.cs b/src/Analysis/Ast/Impl/Caching/Views/Definitions/MemberType.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Definitions/MemberType.cs rename to src/Analysis/Ast/Impl/Caching/Views/Definitions/MemberType.cs diff --git a/src/Analysis/Ast/Impl/Caching/Views/MemberView.cs b/src/Analysis/Ast/Impl/Caching/Views/MemberView.cs new file mode 100644 index 000000000..4f2c8ad63 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Views/MemberView.cs @@ -0,0 +1,29 @@ +// 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 Microsoft.Python.Analysis.Caching.Models; + +namespace Microsoft.Python.Analysis.Caching.Views { + internal class MemberView: IMemberView { + private readonly MemberModel _model; + + public MemberView(MemberModel model) { + _model = model; + } + + public string Name => _model.Name; + public MemberType MemberType => _model.MemberType; + } +} diff --git a/src/Analysis/Ast/Impl/Caching/Views/VariableView.cs b/src/Analysis/Ast/Impl/Caching/Views/VariableView.cs new file mode 100644 index 000000000..6db70f1b0 --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Views/VariableView.cs @@ -0,0 +1,31 @@ +// 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 Microsoft.Python.Analysis.Caching.Models; +using Microsoft.Python.Analysis.Types; + +namespace Microsoft.Python.Analysis.Caching.Views { + internal sealed class VariableView : IVariableView { + private readonly VariableModel _model; + + public VariableView(VariableModel model) { + _model = model; + } + + public IMember Type { get; } + public string Name => _model.Name; + public MemberType MemberType => MemberType.Variable; + } +} From 90318e91c8270e1725eb9490bb847dee1dc937ff Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Tue, 4 Jun 2019 16:15:31 -0700 Subject: [PATCH 38/82] Restore log null checks --- .../Impl/Analyzer/PythonAnalyzerSession.cs | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs index 5d9290f6c..c0e9215f0 100644 --- a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs +++ b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs @@ -14,7 +14,6 @@ // permissions and limitations under the License. using System; -using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Runtime; @@ -22,7 +21,6 @@ using System.Threading.Tasks; using Microsoft.Python.Analysis.Dependencies; using Microsoft.Python.Analysis.Diagnostics; -using Microsoft.Python.Analysis.Documents; using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Core; @@ -147,7 +145,7 @@ private async Task StartAsync() { if (!isCanceled) { _progress.ReportRemaining(remaining); - if(isFinal) { + if (isFinal) { ActivityTracker.EndTracking(); (_analyzer as PythonAnalyzer)?.RaiseAnalysisComplete(ActivityTracker.ModuleCount, ActivityTracker.MillisecondsElapsed); _log?.Log(TraceEventType.Verbose, $"Analysis complete: {ActivityTracker.ModuleCount} modules in { ActivityTracker.MillisecondsElapsed} ms."); @@ -172,7 +170,7 @@ private static void LogResults(ILogger logger, double elapsed, int originalRemai if (logger == null) { return; } - + if (remaining == 0) { logger.Log(TraceEventType.Verbose, $"Analysis version {version} of {originalRemaining} entries has been completed in {elapsed} ms."); } else if (remaining < originalRemaining) { @@ -337,14 +335,23 @@ private void AnalyzeEntry(PythonAnalyzerEntry entry, IPythonModule module, int v } } - private void LogCompleted(IPythonModule module, Stopwatch stopWatch, TimeSpan startTime) - => _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) completed in {(stopWatch.Elapsed - startTime).TotalMilliseconds} ms."); + private void LogCompleted(IPythonModule module, Stopwatch stopWatch, TimeSpan startTime) { + if (_log != null) { + _log.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) completed in {(stopWatch.Elapsed - startTime).TotalMilliseconds} ms."); + } + } - private void LogCanceled(IPythonModule module) - => _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) canceled."); + private void LogCanceled(IPythonModule module) { + if (_log != null) { + _log.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) canceled."); + } + } - private void LogException(IPythonModule module, Exception exception) - => _log?.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) failed. Exception message: {exception.Message}."); + private void LogException(IPythonModule module, Exception exception) { + if (_log != null) { + _log.Log(TraceEventType.Verbose, $"Analysis of {module.Name}({module.ModuleType}) failed. Exception message: {exception.Message}."); + } + } private enum State { NotStarted = 0, From a02c6f32a4f504fce8625f353289c80c3c431ca9 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Tue, 4 Jun 2019 16:45:07 -0700 Subject: [PATCH 39/82] Fix merge conflict --- .../Analyzer/Symbols/FunctionEvaluator.cs | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs b/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs index 164a36612..847bbc000 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs @@ -52,7 +52,9 @@ public override void Evaluate() { using (Eval.OpenScope(_function.DeclaringModule, FunctionDefinition, out _)) { var returnType = TryDetermineReturnValue(); - DeclareParameters(!stub); + + var parameters = Eval.CreateFunctionParameters(_self, _function, FunctionDefinition, !stub); + _overload.SetParameters(parameters); // Do process body of constructors since they may be declaring // variables that are later used to determine return type of other @@ -71,6 +73,30 @@ public override void Evaluate() { Result = _function; } + private IPythonType TryDetermineReturnValue() { + var annotationType = Eval.GetTypeFromAnnotation(FunctionDefinition.ReturnAnnotation); + if (!annotationType.IsUnknown()) { + // Annotations are typically types while actually functions return + // instances unless specifically annotated to a type such as Type[T]. + var t = annotationType.CreateInstance(annotationType.Name, ArgumentSet.Empty); + // If instance could not be created, such as when return type is List[T] and + // type of T is not yet known, just use the type. + var instance = t.IsUnknown() ? annotationType : t; + _overload.SetReturnValue(instance, true); _overload.SetReturnValue(instance, true); + } else { + // Check if function is a generator + var suite = FunctionDefinition.Body as SuiteStatement; + var yieldExpr = suite?.Statements.OfType().Select(s => s.Expression as YieldExpression).ExcludeDefault().FirstOrDefault(); + if (yieldExpr != null) { + // Function return is an iterator + var yieldValue = Eval.GetValueFromExpression(yieldExpr.Expression) ?? Eval.UnknownType; + var returnValue = new PythonGenerator(Eval.Interpreter, yieldValue); + _overload.SetReturnValue(returnValue, true); + } + } + return annotationType; + } + public override bool Walk(AssignmentStatement node) { var value = Eval.GetValueFromExpression(node.Right) ?? Eval.UnknownType; foreach (var lhs in node.Left) { From 57358ebb5320bcd8e160ae1d107323e1929f6baf Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Wed, 5 Jun 2019 08:48:00 -0700 Subject: [PATCH 40/82] Fix merge issue --- .../Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs index 35e0df1be..adf17e852 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs @@ -341,11 +341,10 @@ public IReadOnlyList CreateFunctionParameters(IPythonClassType s // Declare parameters in scope IMember defaultValue = null; for (var i = skip; i < fd.Parameters.Length; i++) { - var isGeneric = false; var p = fd.Parameters[i]; if (!string.IsNullOrEmpty(p.Name)) { - IPythonType paramType = null; - if (p.DefaultValue != null) { + var paramType = GetTypeFromAnnotation(p.Annotation, out var isGeneric) ?? UnknownType; + if (paramType.IsUnknown() && p.DefaultValue != null) { defaultValue = GetValueFromExpression(p.DefaultValue); // If parameter has default value, look for the annotation locally first // since outer type may be getting redefined. Consider 's = None; def f(s: s = 123): ... @@ -357,7 +356,6 @@ public IReadOnlyList CreateFunctionParameters(IPythonClassType s } } // If all else fails, look up globally. - paramType = paramType ?? GetTypeFromAnnotation(p.Annotation, out isGeneric) ?? UnknownType; var pi = new ParameterInfo(Ast, p, paramType, defaultValue, isGeneric); if (declareVariables) { DeclareParameter(p, pi); From 6ceb9b817fb9c8dcf64af228bd3151eec4b18b99 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Thu, 6 Jun 2019 11:40:02 -0700 Subject: [PATCH 41/82] Null check --- src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs b/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs index 39287f71a..0e5f90a51 100644 --- a/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs +++ b/src/Analysis/Ast/Impl/Types/PythonFunctionOverload.cs @@ -142,8 +142,10 @@ private IMember GetSpecificReturnType(IPythonClassType selfClassType, IArgumentS case IGenericType gt when args != null: // -> CLASS[T] on standalone function (i.e. -> List[T]). var typeArgs = ExpressionEval.GetTypeArgumentsFromParameters(this, args); - Debug.Assert(typeArgs != null); - return gt.CreateSpecificType(typeArgs); + if (typeArgs != null) { + return gt.CreateSpecificType(typeArgs); + } + break; } return StaticReturnValue; From 478ce3731b10362c731c1383efccb4304afc9bd1 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Thu, 6 Jun 2019 12:58:46 -0700 Subject: [PATCH 42/82] Partial --- .../Ast/Impl/Analyzer/PythonAnalyzer.cs | 4 +- src/Analysis/Ast/Impl/Caching/CacheFolders.cs | 39 ++++++--------- .../Definitions/ICacheFolderService.cs | 21 ++++++++ .../{Views => }/Definitions/IClassView.cs | 0 .../{Views => }/Definitions/IFunctionView.cs | 0 .../{Views => }/Definitions/IMemberView.cs | 0 .../{Views => }/Definitions/IModuleView.cs | 0 .../{Views => }/Definitions/IParameterView.cs | 0 .../{Views => }/Definitions/IPropertyView.cs | 0 .../{Views => }/Definitions/ITypeVarView.cs | 0 .../{Views => }/Definitions/IVariableView.cs | 0 .../{Views => }/Definitions/MemberType.cs | 0 src/Analysis/Ast/Impl/Caching/StubCache.cs | 10 ++-- .../Ast/Impl/Properties/AssemblyInfo.cs | 1 + src/Caching/Impl/AnalysisWriter.cs | 49 +++++++++++++++++++ .../Microsoft.Python.Analysis.Caching.csproj | 33 +++++++++++++ .../Impl}/Models/ClassModel.cs | 0 .../Impl}/Models/FunctionAttributes.cs | 0 .../Impl}/Models/FunctionModel.cs | 0 .../Impl}/Models/MemberModel.cs | 0 .../Impl}/Models/ModuleModel.cs | 0 .../Impl}/Models/ParameterModel.cs | 0 .../Impl}/Models/PropertyModel.cs | 0 .../Impl}/Models/TypeVarModel.cs | 0 .../Impl}/Models/VariableModel.cs | 0 src/Caching/Impl/Properties/AssemblyInfo.cs | 19 +++++++ .../Impl}/Views/MemberView.cs | 0 .../Impl}/Views/VariableView.cs | 0 src/PLS.sln | 11 ++++- 29 files changed, 157 insertions(+), 30 deletions(-) create mode 100644 src/Analysis/Ast/Impl/Caching/Definitions/ICacheFolderService.cs rename src/Analysis/Ast/Impl/Caching/{Views => }/Definitions/IClassView.cs (100%) rename src/Analysis/Ast/Impl/Caching/{Views => }/Definitions/IFunctionView.cs (100%) rename src/Analysis/Ast/Impl/Caching/{Views => }/Definitions/IMemberView.cs (100%) rename src/Analysis/Ast/Impl/Caching/{Views => }/Definitions/IModuleView.cs (100%) rename src/Analysis/Ast/Impl/Caching/{Views => }/Definitions/IParameterView.cs (100%) rename src/Analysis/Ast/Impl/Caching/{Views => }/Definitions/IPropertyView.cs (100%) rename src/Analysis/Ast/Impl/Caching/{Views => }/Definitions/ITypeVarView.cs (100%) rename src/Analysis/Ast/Impl/Caching/{Views => }/Definitions/IVariableView.cs (100%) rename src/Analysis/Ast/Impl/Caching/{Views => }/Definitions/MemberType.cs (100%) create mode 100644 src/Caching/Impl/AnalysisWriter.cs create mode 100644 src/Caching/Impl/Microsoft.Python.Analysis.Caching.csproj rename src/{Analysis/Ast/Impl/Caching => Caching/Impl}/Models/ClassModel.cs (100%) rename src/{Analysis/Ast/Impl/Caching => Caching/Impl}/Models/FunctionAttributes.cs (100%) rename src/{Analysis/Ast/Impl/Caching => Caching/Impl}/Models/FunctionModel.cs (100%) rename src/{Analysis/Ast/Impl/Caching => Caching/Impl}/Models/MemberModel.cs (100%) rename src/{Analysis/Ast/Impl/Caching => Caching/Impl}/Models/ModuleModel.cs (100%) rename src/{Analysis/Ast/Impl/Caching => Caching/Impl}/Models/ParameterModel.cs (100%) rename src/{Analysis/Ast/Impl/Caching => Caching/Impl}/Models/PropertyModel.cs (100%) rename src/{Analysis/Ast/Impl/Caching => Caching/Impl}/Models/TypeVarModel.cs (100%) rename src/{Analysis/Ast/Impl/Caching => Caching/Impl}/Models/VariableModel.cs (100%) create mode 100644 src/Caching/Impl/Properties/AssemblyInfo.cs rename src/{Analysis/Ast/Impl/Caching => Caching/Impl}/Views/MemberView.cs (100%) rename src/{Analysis/Ast/Impl/Caching => Caching/Impl}/Views/VariableView.cs (100%) diff --git a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzer.cs b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzer.cs index 0f3c037fc..d04f03978 100644 --- a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzer.cs +++ b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzer.cs @@ -56,7 +56,9 @@ public PythonAnalyzer(IServiceManager services, string cacheFolderPath = null) { _startNextSession = StartNextSession; _progress = new ProgressReporter(services.GetService()); - _services.AddService(new StubCache(_services, cacheFolderPath)); + + _services.AddService(new CacheFolderService(_services, cacheFolderPath)); + _services.AddService(new StubCache(_services)); } public void Dispose() { diff --git a/src/Analysis/Ast/Impl/Caching/CacheFolders.cs b/src/Analysis/Ast/Impl/Caching/CacheFolders.cs index 6d07bc75a..cfe84dc03 100644 --- a/src/Analysis/Ast/Impl/Caching/CacheFolders.cs +++ b/src/Analysis/Ast/Impl/Caching/CacheFolders.cs @@ -24,21 +24,25 @@ using Microsoft.Python.Core.OS; namespace Microsoft.Python.Analysis.Caching { - internal static class CacheFolders { - public static string GetCacheFilePath(string root, string moduleName, string content, IFileSystem fs) { - // Folder for all module versions and variants - // {root}/module_name/content_hash.pyi - var folder = Path.Combine(root, moduleName); - - var filePath = Path.Combine(root, folder, $"{FileNameFromContent(content)}.pyi"); - if (fs.StringComparison == StringComparison.Ordinal) { - filePath = filePath.ToLowerInvariant(); - } + internal sealed class CacheFolderService: ICacheFolderService { + private readonly IServiceContainer _services; + + public CacheFolderService(IServiceContainer services, string cacheRootFolder) { + _services = services; + CacheFolder = cacheRootFolder ?? GetCacheFolder(services); + } - return filePath; + public string CacheFolder { get; } + + public string GetFileNameFromContent(string content) { + // File name depends on the content so we can distinguish between different versions. + var hash = SHA256.Create(); + return Convert + .ToBase64String(hash.ComputeHash(new UTF8Encoding(false).GetBytes(content))) + .Replace('/', '_').Replace('+', '-'); } - public static string GetCacheFolder(IServiceContainer services) { + private static string GetCacheFolder(IServiceContainer services) { var platform = services.GetService(); var logger = services.GetService(); @@ -95,17 +99,6 @@ public static string GetCacheFolder(IServiceContainer services) { return cachePath; } - public static string FileNameFromContent(string content) { - // File name depends on the content so we can distinguish between different versions. - var hash = SHA256.Create(); - return Convert - .ToBase64String(hash.ComputeHash(new UTF8Encoding(false).GetBytes(content))) - .Replace('/', '_').Replace('+', '-'); - } - - public static string GetAnalysisCacheFilePath(string analysisRootFolder, string moduleName, string content, IFileSystem fs) - => GetCacheFilePath(analysisRootFolder, moduleName, content, fs); - private static bool CheckPathRooted(string varName, string path, ILogger logger) { if (!string.IsNullOrWhiteSpace(path) && Path.IsPathRooted(path)) { return true; diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/ICacheFolderService.cs b/src/Analysis/Ast/Impl/Caching/Definitions/ICacheFolderService.cs new file mode 100644 index 000000000..acbe31f5d --- /dev/null +++ b/src/Analysis/Ast/Impl/Caching/Definitions/ICacheFolderService.cs @@ -0,0 +1,21 @@ +// 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. + +namespace Microsoft.Python.Analysis.Caching { + public interface ICacheFolderService { + string CacheFolder { get; } + string GetFileNameFromContent(string content); + } +} diff --git a/src/Analysis/Ast/Impl/Caching/Views/Definitions/IClassView.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IClassView.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Views/Definitions/IClassView.cs rename to src/Analysis/Ast/Impl/Caching/Definitions/IClassView.cs diff --git a/src/Analysis/Ast/Impl/Caching/Views/Definitions/IFunctionView.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IFunctionView.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Views/Definitions/IFunctionView.cs rename to src/Analysis/Ast/Impl/Caching/Definitions/IFunctionView.cs diff --git a/src/Analysis/Ast/Impl/Caching/Views/Definitions/IMemberView.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IMemberView.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Views/Definitions/IMemberView.cs rename to src/Analysis/Ast/Impl/Caching/Definitions/IMemberView.cs diff --git a/src/Analysis/Ast/Impl/Caching/Views/Definitions/IModuleView.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IModuleView.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Views/Definitions/IModuleView.cs rename to src/Analysis/Ast/Impl/Caching/Definitions/IModuleView.cs diff --git a/src/Analysis/Ast/Impl/Caching/Views/Definitions/IParameterView.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IParameterView.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Views/Definitions/IParameterView.cs rename to src/Analysis/Ast/Impl/Caching/Definitions/IParameterView.cs diff --git a/src/Analysis/Ast/Impl/Caching/Views/Definitions/IPropertyView.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IPropertyView.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Views/Definitions/IPropertyView.cs rename to src/Analysis/Ast/Impl/Caching/Definitions/IPropertyView.cs diff --git a/src/Analysis/Ast/Impl/Caching/Views/Definitions/ITypeVarView.cs b/src/Analysis/Ast/Impl/Caching/Definitions/ITypeVarView.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Views/Definitions/ITypeVarView.cs rename to src/Analysis/Ast/Impl/Caching/Definitions/ITypeVarView.cs diff --git a/src/Analysis/Ast/Impl/Caching/Views/Definitions/IVariableView.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IVariableView.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Views/Definitions/IVariableView.cs rename to src/Analysis/Ast/Impl/Caching/Definitions/IVariableView.cs diff --git a/src/Analysis/Ast/Impl/Caching/Views/Definitions/MemberType.cs b/src/Analysis/Ast/Impl/Caching/Definitions/MemberType.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Views/Definitions/MemberType.cs rename to src/Analysis/Ast/Impl/Caching/Definitions/MemberType.cs diff --git a/src/Analysis/Ast/Impl/Caching/StubCache.cs b/src/Analysis/Ast/Impl/Caching/StubCache.cs index ef91a1963..f8ec6239a 100644 --- a/src/Analysis/Ast/Impl/Caching/StubCache.cs +++ b/src/Analysis/Ast/Impl/Caching/StubCache.cs @@ -27,13 +27,15 @@ internal sealed class StubCache : IStubCache { private readonly IFileSystem _fs; private readonly ILogger _log; + private readonly ICacheFolderService _cfs; - public StubCache(IServiceContainer services, string cacheRootFolder = null) { + public StubCache(IServiceContainer services) { _fs = services.GetService(); _log = services.GetService(); + _cfs = services.GetService(); - cacheRootFolder = cacheRootFolder ?? CacheFolders.GetCacheFolder(services); - StubCacheFolder = Path.Combine(cacheRootFolder, $"stubs.v{_stubCacheFormatVersion}"); + _cfs = services.GetService(); + StubCacheFolder = Path.Combine(_cfs.CacheFolder, $"stubs.v{_stubCacheFormatVersion}"); } public string StubCacheFolder { get; } @@ -58,7 +60,7 @@ public string GetCacheFilePath(string filePath) { dir = dir.ToLowerInvariant(); } - var dirHash = CacheFolders.FileNameFromContent(dir); + var dirHash = _cfs.GetFileNameFromContent(dir); var stubFile = Path.Combine(StubCacheFolder, Path.Combine(dirHash, name)); return Path.ChangeExtension(stubFile, ".pyi"); } diff --git a/src/Analysis/Ast/Impl/Properties/AssemblyInfo.cs b/src/Analysis/Ast/Impl/Properties/AssemblyInfo.cs index 52c4e3665..b7b07d6de 100644 --- a/src/Analysis/Ast/Impl/Properties/AssemblyInfo.cs +++ b/src/Analysis/Ast/Impl/Properties/AssemblyInfo.cs @@ -15,5 +15,6 @@ using System.Runtime.CompilerServices; +[assembly: InternalsVisibleTo("Microsoft.Python.Analysis.Caching, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("Microsoft.Python.Analysis.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("Microsoft.Python.LanguageServer.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] diff --git a/src/Caching/Impl/AnalysisWriter.cs b/src/Caching/Impl/AnalysisWriter.cs new file mode 100644 index 000000000..c96b14766 --- /dev/null +++ b/src/Caching/Impl/AnalysisWriter.cs @@ -0,0 +1,49 @@ +// 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.IO; +using LiteDB; +using Microsoft.Python.Analysis.Analyzer; +using Microsoft.Python.Analysis.Caching.Models; +using Microsoft.Python.Core; + +namespace Microsoft.Python.Analysis.Caching { + internal sealed class AnalysisWriter { + private readonly IServiceContainer _services; + + public AnalysisWriter(IServiceContainer services) { + _services = services; + } + + public void StoreModuleAnalysis(string moduleId, IDocumentAnalysis analysis) { + if(!(analysis is DocumentAnalysis)) { + return; + } + + var cfs = _services.GetService(); + using (var db = new LiteDatabase(Path.Combine(cfs.CacheFolder, "Analysis.db"))) { + var modules = db.GetCollection("modules"); + var md = + } + } + + private void WriteModule(IDocumentAnalysis analysis) { + foreach(var v in analysis.GlobalScope.Variables.Where) { + var t = v.Value.GetType(); + switch(Values.t) + } + } + } +} diff --git a/src/Caching/Impl/Microsoft.Python.Analysis.Caching.csproj b/src/Caching/Impl/Microsoft.Python.Analysis.Caching.csproj new file mode 100644 index 000000000..c2d9cc03b --- /dev/null +++ b/src/Caching/Impl/Microsoft.Python.Analysis.Caching.csproj @@ -0,0 +1,33 @@ + + + netstandard2.0 + Microsoft.Python.Analysis.Caching + Microsoft.Python.Analysis.Caching + + + + 1701;1702;$(NoWarn) + 7.2 + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + + + + + + + + + + diff --git a/src/Analysis/Ast/Impl/Caching/Models/ClassModel.cs b/src/Caching/Impl/Models/ClassModel.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Models/ClassModel.cs rename to src/Caching/Impl/Models/ClassModel.cs diff --git a/src/Analysis/Ast/Impl/Caching/Models/FunctionAttributes.cs b/src/Caching/Impl/Models/FunctionAttributes.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Models/FunctionAttributes.cs rename to src/Caching/Impl/Models/FunctionAttributes.cs diff --git a/src/Analysis/Ast/Impl/Caching/Models/FunctionModel.cs b/src/Caching/Impl/Models/FunctionModel.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Models/FunctionModel.cs rename to src/Caching/Impl/Models/FunctionModel.cs diff --git a/src/Analysis/Ast/Impl/Caching/Models/MemberModel.cs b/src/Caching/Impl/Models/MemberModel.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Models/MemberModel.cs rename to src/Caching/Impl/Models/MemberModel.cs diff --git a/src/Analysis/Ast/Impl/Caching/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Models/ModuleModel.cs rename to src/Caching/Impl/Models/ModuleModel.cs diff --git a/src/Analysis/Ast/Impl/Caching/Models/ParameterModel.cs b/src/Caching/Impl/Models/ParameterModel.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Models/ParameterModel.cs rename to src/Caching/Impl/Models/ParameterModel.cs diff --git a/src/Analysis/Ast/Impl/Caching/Models/PropertyModel.cs b/src/Caching/Impl/Models/PropertyModel.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Models/PropertyModel.cs rename to src/Caching/Impl/Models/PropertyModel.cs diff --git a/src/Analysis/Ast/Impl/Caching/Models/TypeVarModel.cs b/src/Caching/Impl/Models/TypeVarModel.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Models/TypeVarModel.cs rename to src/Caching/Impl/Models/TypeVarModel.cs diff --git a/src/Analysis/Ast/Impl/Caching/Models/VariableModel.cs b/src/Caching/Impl/Models/VariableModel.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Models/VariableModel.cs rename to src/Caching/Impl/Models/VariableModel.cs diff --git a/src/Caching/Impl/Properties/AssemblyInfo.cs b/src/Caching/Impl/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..52c4e3665 --- /dev/null +++ b/src/Caching/Impl/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +// 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.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Microsoft.Python.Analysis.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +[assembly: InternalsVisibleTo("Microsoft.Python.LanguageServer.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] diff --git a/src/Analysis/Ast/Impl/Caching/Views/MemberView.cs b/src/Caching/Impl/Views/MemberView.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Views/MemberView.cs rename to src/Caching/Impl/Views/MemberView.cs diff --git a/src/Analysis/Ast/Impl/Caching/Views/VariableView.cs b/src/Caching/Impl/Views/VariableView.cs similarity index 100% rename from src/Analysis/Ast/Impl/Caching/Views/VariableView.cs rename to src/Caching/Impl/Views/VariableView.cs diff --git a/src/PLS.sln b/src/PLS.sln index d19e7a2d0..1a730fb07 100644 --- a/src/PLS.sln +++ b/src/PLS.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27929.0 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29003.217 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Python.LanguageServer", "LanguageServer\Impl\Microsoft.Python.LanguageServer.csproj", "{4E648207-0C9F-45DB-AA30-84BCDAFE698D}" EndProject @@ -27,6 +27,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Python.Analysis.T EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Python.LanguageServer.Tests", "LanguageServer\Test\Microsoft.Python.LanguageServer.Tests.csproj", "{3BAB87E1-79FD-45D1-8564-CAF87D4D16CA}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Python.Analysis.Caching", "Caching\Impl\Microsoft.Python.Analysis.Caching.csproj", "{42BD3C80-3E57-4847-8142-84F6B682EA8D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -73,6 +75,10 @@ Global {3BAB87E1-79FD-45D1-8564-CAF87D4D16CA}.Debug|Any CPU.Build.0 = Debug|Any CPU {3BAB87E1-79FD-45D1-8564-CAF87D4D16CA}.Release|Any CPU.ActiveCfg = Release|Any CPU {3BAB87E1-79FD-45D1-8564-CAF87D4D16CA}.Release|Any CPU.Build.0 = Release|Any CPU + {42BD3C80-3E57-4847-8142-84F6B682EA8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {42BD3C80-3E57-4847-8142-84F6B682EA8D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {42BD3C80-3E57-4847-8142-84F6B682EA8D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {42BD3C80-3E57-4847-8142-84F6B682EA8D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -88,6 +94,7 @@ Global {2C8DE250-41F4-4FC5-A661-76E2A4172891} = {C465393D-145E-4695-A7DB-AF55951BD533} {D8D85896-5DB0-4FA6-B744-910A272C39F9} = {80AA38A1-3E82-4B87-BB21-FDEDD2CC87E6} {3BAB87E1-79FD-45D1-8564-CAF87D4D16CA} = {80AA38A1-3E82-4B87-BB21-FDEDD2CC87E6} + {42BD3C80-3E57-4847-8142-84F6B682EA8D} = {C465393D-145E-4695-A7DB-AF55951BD533} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {ABC12ED7-0EC8-4219-8A14-A058F7942D92} From cb46e682aab63ff548c58cfac45d9ceaf485f093 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Thu, 6 Jun 2019 14:14:39 -0700 Subject: [PATCH 43/82] Partial --- .../Extensions/QualifiedNameExtensions.cs | 27 --------- src/Caching/Impl/AnalysisWriter.cs | 59 +++++++++++++++++-- src/Caching/Impl/Models/MemberModel.cs | 2 - src/Caching/Impl/Models/ModuleModel.cs | 7 ++- src/Caching/Impl/Models/VariableModel.cs | 2 +- 5 files changed, 60 insertions(+), 37 deletions(-) delete mode 100644 src/Analysis/Ast/Impl/Extensions/QualifiedNameExtensions.cs diff --git a/src/Analysis/Ast/Impl/Extensions/QualifiedNameExtensions.cs b/src/Analysis/Ast/Impl/Extensions/QualifiedNameExtensions.cs deleted file mode 100644 index 09e7d64a3..000000000 --- a/src/Analysis/Ast/Impl/Extensions/QualifiedNameExtensions.cs +++ /dev/null @@ -1,27 +0,0 @@ -// 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.Collections.Generic; - -namespace Microsoft.Python.Analysis { - internal static class QualifiedNameExtensions { - public static string CombineNames(this KeyValuePair qualifiedNamePair, string sep = ".") { - if (string.IsNullOrEmpty(qualifiedNamePair.Key)) { - return qualifiedNamePair.Value; - } - return qualifiedNamePair.Key + sep + qualifiedNamePair.Value; - } - } -} diff --git a/src/Caching/Impl/AnalysisWriter.cs b/src/Caching/Impl/AnalysisWriter.cs index c96b14766..8cefb7e70 100644 --- a/src/Caching/Impl/AnalysisWriter.cs +++ b/src/Caching/Impl/AnalysisWriter.cs @@ -13,10 +13,14 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. +using System.Collections.Generic; using System.IO; +using System.Runtime.InteropServices.ComTypes; using LiteDB; using Microsoft.Python.Analysis.Analyzer; using Microsoft.Python.Analysis.Caching.Models; +using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Analysis.Values; using Microsoft.Python.Core; namespace Microsoft.Python.Analysis.Caching { @@ -39,11 +43,58 @@ public void StoreModuleAnalysis(string moduleId, IDocumentAnalysis analysis) { } } - private void WriteModule(IDocumentAnalysis analysis) { - foreach(var v in analysis.GlobalScope.Variables.Where) { - var t = v.Value.GetType(); - switch(Values.t) + private void WriteModule(LiteDatabase db, string moduleId, IDocumentAnalysis analysis) { + var variables = new List(); + var functions = new List(); + foreach (var v in analysis.GlobalScope.Variables) { + var t = v.Value.GetPythonType(); + // If variable is declaration and has location, then it is a user-defined variable. + if(v.Source == VariableSource.Declaration && v.Location.IsValid) { + var vm = new VariableModel { + Name = v.Name, + Type = !t.IsUnknown() ? GetTypeQualifiedName(t) : string.Empty + }; + variables.Add(vm); + } + + if(v.Source == VariableSource.Declaration && !v.Location.IsValid) { + // Typically class or a function + if(t is IPythonFunctionType ft) { + + } + } + } + + var variableCollection = db.GetCollection(GetVariableCollectionName(moduleId)); + variableCollection.Update(variables); + } + + private string GetVariableCollectionName(string moduleId) => $"{moduleId}.variables"; + private string GetClassesCollectionName(string moduleId) => $"{moduleId}.classes"; + private string GetFunctionsCollectionName(string moduleId) => $"{moduleId}.functions"; + private string GetTypeVarCollectionName(string moduleId) => $"{moduleId}.typeVars"; + + // TODO: fix per https://github.com/microsoft/python-language-server/issues/1177 + private string GetModuleUniqueId(IPythonModule module) => module.Name; + + private string GetTypeQualifiedName(IPythonType t) { + var moduleId = GetModuleUniqueId(t.DeclaringModule); + switch (t) { + case IPythonClassMember cm when cm.DeclaringType != null: + return $"{moduleId}.{GetClassMemberQualifiedName(cm)}"; + default: + return $"{moduleId}.{t.Name}"; + } + } + + private static string GetClassMemberQualifiedName(IPythonClassMember cm) { + var s = new Stack(); + s.Push(cm.Name); + for (var p = cm.DeclaringType as IPythonClassMember; p != null; p = p.DeclaringType as IPythonClassMember) { + s.Push(p.Name); } + return string.Join(".", s); } } } + diff --git a/src/Caching/Impl/Models/MemberModel.cs b/src/Caching/Impl/Models/MemberModel.cs index c9b8d2a83..5060e19da 100644 --- a/src/Caching/Impl/Models/MemberModel.cs +++ b/src/Caching/Impl/Models/MemberModel.cs @@ -18,8 +18,6 @@ namespace Microsoft.Python.Analysis.Caching.Models { /// Represents persistent data about member. /// internal abstract class MemberModel { - public string Id { get; set; } public string Name { get; set; } - public MemberType MemberType { get; set; } } } diff --git a/src/Caching/Impl/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs index 1f9f78ac2..97f9b27d9 100644 --- a/src/Caching/Impl/Models/ModuleModel.cs +++ b/src/Caching/Impl/Models/ModuleModel.cs @@ -18,8 +18,9 @@ namespace Microsoft.Python.Analysis.Caching.Models { [Serializable] internal sealed class ModuleModel : MemberModel { - public string[] Variables { get; set; } - public string[] Functions { get; set; } - public string[] Classes { get; set; } + public VariableModel[] Variables { get; set; } + public FunctionModel[] Functions { get; set; } + public ClassModel[] Classes { get; set; } + public TypeVarModel[] TypeVars { get; set; } } } diff --git a/src/Caching/Impl/Models/VariableModel.cs b/src/Caching/Impl/Models/VariableModel.cs index ea46da77d..dfbb65729 100644 --- a/src/Caching/Impl/Models/VariableModel.cs +++ b/src/Caching/Impl/Models/VariableModel.cs @@ -14,7 +14,7 @@ // permissions and limitations under the License. namespace Microsoft.Python.Analysis.Caching.Models { - internal sealed class VariableModel: MemberModel { + internal sealed class VariableModel : MemberModel { public string Type { get; set; } } } From ef2981c9c9b6e4cb4472099b4a71c0ac42a780c7 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Thu, 6 Jun 2019 14:46:10 -0700 Subject: [PATCH 44/82] Partial --- src/Caching/Impl/AnalysisWriter.cs | 69 ++++++++++++++++++++++-- src/Caching/Impl/Models/FunctionModel.cs | 3 +- src/Caching/Impl/Models/OverloadModel.cs | 21 ++++++++ 3 files changed, 86 insertions(+), 7 deletions(-) create mode 100644 src/Caching/Impl/Models/OverloadModel.cs diff --git a/src/Caching/Impl/AnalysisWriter.cs b/src/Caching/Impl/AnalysisWriter.cs index 8cefb7e70..1809f1b50 100644 --- a/src/Caching/Impl/AnalysisWriter.cs +++ b/src/Caching/Impl/AnalysisWriter.cs @@ -15,6 +15,7 @@ using System.Collections.Generic; using System.IO; +using System.Linq; using System.Runtime.InteropServices.ComTypes; using LiteDB; using Microsoft.Python.Analysis.Analyzer; @@ -46,27 +47,85 @@ public void StoreModuleAnalysis(string moduleId, IDocumentAnalysis analysis) { private void WriteModule(LiteDatabase db, string moduleId, IDocumentAnalysis analysis) { var variables = new List(); var functions = new List(); + var classes = new List(); + foreach (var v in analysis.GlobalScope.Variables) { var t = v.Value.GetPythonType(); // If variable is declaration and has location, then it is a user-defined variable. if(v.Source == VariableSource.Declaration && v.Location.IsValid) { - var vm = new VariableModel { + variables.Add(new VariableModel { Name = v.Name, Type = !t.IsUnknown() ? GetTypeQualifiedName(t) : string.Empty - }; - variables.Add(vm); + }); } if(v.Source == VariableSource.Declaration && !v.Location.IsValid) { - // Typically class or a function - if(t is IPythonFunctionType ft) { + switch (t) { + // Typically class or a function + case IPythonFunctionType ft: { + functions.Add(new FunctionModel { + Name = ft.Name, + }); + break; + } + case IPythonClassType cls: { + classes.Add(new ClassModel { + Name = cls.Name, + }); + break; + } } } } var variableCollection = db.GetCollection(GetVariableCollectionName(moduleId)); variableCollection.Update(variables); + + var functionCollection = db.GetCollection(GetFunctionsCollectionName(moduleId)); + functionCollection.Update(functions); + + var classesCollection = db.GetCollection(GetClassesCollectionName(moduleId)); + classesCollection.Update(classes); + } + + private FunctionModel GetFunctionModel(IPythonFunctionType ft) { + return new FunctionModel { + Name = ft.Name, + Overloads = ft.Overloads.Select(GetOverloadModel).ToArray() + // TODO: attributes + }; + } + + private OverloadModel GetOverloadModel(IPythonFunctionOverload o) { + return new OverloadModel { + Parameters = o.Parameters.Select(p => new ParameterModel { + Name = p.Name, + Type = GetTypeQualifiedName(p.Type), + Kind = GetParameterKind(p.Kind), + DefaultValue = GetTypeQualifiedName(p.DefaultValue), + }).ToArray(), + ReturnType = GetTypeQualifiedName(o.StaticReturnValue) + }; + } + + private ClassModel GetClassModel(IPythonClassType cls) { + return new ClassModel { + Name = cls.Name, + Bases = cls.Bases.OfType().Select(GetTypeQualifiedName).ToArray(), + }; + } + + private static ParameterKind GetParameterKind(Parsing.Ast.ParameterKind p) { + switch(p) { + case Parsing.Ast.ParameterKind.KeywordOnly: + return ParameterKind.KeywordOnly; + case Parsing.Ast.ParameterKind.List: + return ParameterKind.List; + case Parsing.Ast.ParameterKind.Dictionary: + return ParameterKind.Dictionary; + } + return ParameterKind.Normal; } private string GetVariableCollectionName(string moduleId) => $"{moduleId}.variables"; diff --git a/src/Caching/Impl/Models/FunctionModel.cs b/src/Caching/Impl/Models/FunctionModel.cs index 5b65a3544..a66c83295 100644 --- a/src/Caching/Impl/Models/FunctionModel.cs +++ b/src/Caching/Impl/Models/FunctionModel.cs @@ -15,8 +15,7 @@ namespace Microsoft.Python.Analysis.Caching.Models { internal sealed class FunctionModel: MemberModel { - public ParameterModel[] Parameters { get; set; } - public string ReturnType { get; set; } + public OverloadModel[] Overloads { get; set; } public FunctionAttributes Attributes { get; set; } } } diff --git a/src/Caching/Impl/Models/OverloadModel.cs b/src/Caching/Impl/Models/OverloadModel.cs new file mode 100644 index 000000000..1f0014eef --- /dev/null +++ b/src/Caching/Impl/Models/OverloadModel.cs @@ -0,0 +1,21 @@ +// 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. + +namespace Microsoft.Python.Analysis.Caching.Models { + internal sealed class OverloadModel { + public ParameterModel[] Parameters { get; set; } + public string ReturnType { get; set; } + } +} From 2164ad5b56a823dd7a11ebad27c3d9538420fbf1 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Thu, 6 Jun 2019 15:49:27 -0700 Subject: [PATCH 45/82] Fix test --- .../Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs | 7 +++---- src/Analysis/Ast/Impl/Types/ParameterInfo.cs | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs index adf17e852..38346a6e0 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs @@ -339,13 +339,12 @@ public IReadOnlyList CreateFunctionParameters(IPythonClassType s } // Declare parameters in scope - IMember defaultValue = null; for (var i = skip; i < fd.Parameters.Length; i++) { var p = fd.Parameters[i]; if (!string.IsNullOrEmpty(p.Name)) { + var defaultValue = GetValueFromExpression(p.DefaultValue); var paramType = GetTypeFromAnnotation(p.Annotation, out var isGeneric) ?? UnknownType; - if (paramType.IsUnknown() && p.DefaultValue != null) { - defaultValue = GetValueFromExpression(p.DefaultValue); + if (paramType.IsUnknown()) { // If parameter has default value, look for the annotation locally first // since outer type may be getting redefined. Consider 's = None; def f(s: s = 123): ... paramType = GetTypeFromAnnotation(p.Annotation, out isGeneric, LookupOptions.Local | LookupOptions.Builtins); @@ -356,7 +355,7 @@ public IReadOnlyList CreateFunctionParameters(IPythonClassType s } } // If all else fails, look up globally. - var pi = new ParameterInfo(Ast, p, paramType, defaultValue, isGeneric); + var pi = new ParameterInfo(Ast, p, paramType, defaultValue, isGeneric | paramType.IsGeneric()); if (declareVariables) { DeclareParameter(p, pi); } diff --git a/src/Analysis/Ast/Impl/Types/ParameterInfo.cs b/src/Analysis/Ast/Impl/Types/ParameterInfo.cs index 15b0a04c0..07f5a5e5b 100644 --- a/src/Analysis/Ast/Impl/Types/ParameterInfo.cs +++ b/src/Analysis/Ast/Impl/Types/ParameterInfo.cs @@ -14,7 +14,6 @@ // permissions and limitations under the License. using System; -using Microsoft.Python.Core.Text; using Microsoft.Python.Parsing.Ast; namespace Microsoft.Python.Analysis.Types { From 319c416dc8129c58de9225c4ec87a0165ba4b586 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Thu, 6 Jun 2019 16:19:49 -0700 Subject: [PATCH 46/82] Partial --- .../Impl/Caching/Definitions/MemberType.cs | 2 +- src/Caching/Impl/AnalysisWriter.cs | 25 +++++++++++------- src/Caching/Impl/Models/ModuleModel.cs | 26 ------------------- src/Caching/Impl/Views/MemberView.cs | 19 ++++++++++++-- 4 files changed, 33 insertions(+), 39 deletions(-) delete mode 100644 src/Caching/Impl/Models/ModuleModel.cs diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/MemberType.cs b/src/Analysis/Ast/Impl/Caching/Definitions/MemberType.cs index e227c5a05..0a9541ada 100644 --- a/src/Analysis/Ast/Impl/Caching/Definitions/MemberType.cs +++ b/src/Analysis/Ast/Impl/Caching/Definitions/MemberType.cs @@ -18,7 +18,7 @@ namespace Microsoft.Python.Analysis.Caching { /// Defines what type of object the member represents. /// internal enum MemberType { - Module, + Unknown, Class, Function, Property, diff --git a/src/Caching/Impl/AnalysisWriter.cs b/src/Caching/Impl/AnalysisWriter.cs index 1809f1b50..672b07cfb 100644 --- a/src/Caching/Impl/AnalysisWriter.cs +++ b/src/Caching/Impl/AnalysisWriter.cs @@ -16,7 +16,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Runtime.InteropServices.ComTypes; using LiteDB; using Microsoft.Python.Analysis.Analyzer; using Microsoft.Python.Analysis.Caching.Models; @@ -39,8 +38,7 @@ public void StoreModuleAnalysis(string moduleId, IDocumentAnalysis analysis) { var cfs = _services.GetService(); using (var db = new LiteDatabase(Path.Combine(cfs.CacheFolder, "Analysis.db"))) { - var modules = db.GetCollection("modules"); - var md = + WriteModule(db, moduleId, analysis); } } @@ -55,7 +53,7 @@ private void WriteModule(LiteDatabase db, string moduleId, IDocumentAnalysis ana if(v.Source == VariableSource.Declaration && v.Location.IsValid) { variables.Add(new VariableModel { Name = v.Name, - Type = !t.IsUnknown() ? GetTypeQualifiedName(t) : string.Empty + Type = GetQualifiedName(v.Value) }); } @@ -101,18 +99,18 @@ private OverloadModel GetOverloadModel(IPythonFunctionOverload o) { return new OverloadModel { Parameters = o.Parameters.Select(p => new ParameterModel { Name = p.Name, - Type = GetTypeQualifiedName(p.Type), + Type = GetQualifiedName(p.Type), Kind = GetParameterKind(p.Kind), - DefaultValue = GetTypeQualifiedName(p.DefaultValue), + DefaultValue = GetQualifiedName(p.DefaultValue), }).ToArray(), - ReturnType = GetTypeQualifiedName(o.StaticReturnValue) + ReturnType = GetQualifiedName(o.StaticReturnValue) }; } private ClassModel GetClassModel(IPythonClassType cls) { return new ClassModel { Name = cls.Name, - Bases = cls.Bases.OfType().Select(GetTypeQualifiedName).ToArray(), + Bases = cls.Bases.OfType().Select(GetQualifiedName).ToArray(), }; } @@ -136,9 +134,16 @@ private static ParameterKind GetParameterKind(Parsing.Ast.ParameterKind p) { // TODO: fix per https://github.com/microsoft/python-language-server/issues/1177 private string GetModuleUniqueId(IPythonModule module) => module.Name; - private string GetTypeQualifiedName(IPythonType t) { + private string GetQualifiedName(IMember m) { + var t = m.GetPythonType(); + if(t.IsUnknown()) { + return string.Empty; + } + var moduleId = GetModuleUniqueId(t.DeclaringModule); - switch (t) { + switch (m) { + case IPythonInstance _: + return $"i:{GetQualifiedName(t)}"; case IPythonClassMember cm when cm.DeclaringType != null: return $"{moduleId}.{GetClassMemberQualifiedName(cm)}"; default: diff --git a/src/Caching/Impl/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs deleted file mode 100644 index 97f9b27d9..000000000 --- a/src/Caching/Impl/Models/ModuleModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -// 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; - -namespace Microsoft.Python.Analysis.Caching.Models { - [Serializable] - internal sealed class ModuleModel : MemberModel { - public VariableModel[] Variables { get; set; } - public FunctionModel[] Functions { get; set; } - public ClassModel[] Classes { get; set; } - public TypeVarModel[] TypeVars { get; set; } - } -} diff --git a/src/Caching/Impl/Views/MemberView.cs b/src/Caching/Impl/Views/MemberView.cs index 4f2c8ad63..9dcd88804 100644 --- a/src/Caching/Impl/Views/MemberView.cs +++ b/src/Caching/Impl/Views/MemberView.cs @@ -16,7 +16,7 @@ using Microsoft.Python.Analysis.Caching.Models; namespace Microsoft.Python.Analysis.Caching.Views { - internal class MemberView: IMemberView { + internal class MemberView : IMemberView { private readonly MemberModel _model; public MemberView(MemberModel model) { @@ -24,6 +24,21 @@ public MemberView(MemberModel model) { } public string Name => _model.Name; - public MemberType MemberType => _model.MemberType; + + public MemberType MemberType { + get { + switch(_model) { + case VariableModel _: + return MemberType.Variable; + case ClassModel _: + return MemberType.Class; + case FunctionModel _: + return MemberType.Function; + case PropertyModel _: + return MemberType.Property; + } + return MemberType.Unknown; + } + } } } From 86b0ee6a7e1712da9abc619a8e5c46973fd3838c Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Fri, 7 Jun 2019 10:16:08 -0700 Subject: [PATCH 47/82] Partial --- .../Impl/Caching/Definitions/IMemberView.cs | 1 - .../Impl/Caching/Definitions/MemberType.cs | 27 --- .../Types/Definitions/IPythonClassMember.cs | 2 +- .../Types/Definitions/IPythonPropertyType.cs | 5 + .../Ast/Impl/Types/PythonPropertyType.cs | 18 +- src/Caching/Impl/AnalysisWriter.cs | 164 ------------------ src/Caching/Impl/Models/ClassModel.cs | 52 +++++- src/Caching/Impl/Models/FunctionModel.cs | 40 ++++- src/Caching/Impl/Models/MemberModel.cs | 23 --- src/Caching/Impl/Models/PropertyModel.cs | 13 +- src/Caching/Impl/Models/TypeVarModel.cs | 3 +- src/Caching/Impl/Models/VariableModel.cs | 23 ++- src/Caching/Impl/TypeNames.cs | 51 ++++++ src/Caching/Impl/Views/MemberView.cs | 44 ----- src/Caching/Impl/Views/VariableView.cs | 1 - src/Caching/Impl/Writers/AnalysisWriter.cs | 42 +++++ src/Caching/Impl/Writers/ModuleWriter.cs | 66 +++++++ 17 files changed, 301 insertions(+), 274 deletions(-) delete mode 100644 src/Analysis/Ast/Impl/Caching/Definitions/MemberType.cs delete mode 100644 src/Caching/Impl/AnalysisWriter.cs delete mode 100644 src/Caching/Impl/Models/MemberModel.cs create mode 100644 src/Caching/Impl/TypeNames.cs delete mode 100644 src/Caching/Impl/Views/MemberView.cs create mode 100644 src/Caching/Impl/Writers/AnalysisWriter.cs create mode 100644 src/Caching/Impl/Writers/ModuleWriter.cs diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IMemberView.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IMemberView.cs index f782316ec..1eb45142d 100644 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IMemberView.cs +++ b/src/Analysis/Ast/Impl/Caching/Definitions/IMemberView.cs @@ -21,6 +21,5 @@ namespace Microsoft.Python.Analysis.Caching { /// internal interface IMemberView { string Name { get; } - MemberType MemberType { get; } } } diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/MemberType.cs b/src/Analysis/Ast/Impl/Caching/Definitions/MemberType.cs deleted file mode 100644 index 0a9541ada..000000000 --- a/src/Analysis/Ast/Impl/Caching/Definitions/MemberType.cs +++ /dev/null @@ -1,27 +0,0 @@ -// 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. - -namespace Microsoft.Python.Analysis.Caching { - /// - /// Defines what type of object the member represents. - /// - internal enum MemberType { - Unknown, - Class, - Function, - Property, - Variable - } -} diff --git a/src/Analysis/Ast/Impl/Types/Definitions/IPythonClassMember.cs b/src/Analysis/Ast/Impl/Types/Definitions/IPythonClassMember.cs index 2f95d489a..9ea3e402f 100644 --- a/src/Analysis/Ast/Impl/Types/Definitions/IPythonClassMember.cs +++ b/src/Analysis/Ast/Impl/Types/Definitions/IPythonClassMember.cs @@ -17,7 +17,7 @@ namespace Microsoft.Python.Analysis.Types { /// /// Represents member of a class. /// - public interface IPythonClassMember : IPythonType, ILocatedMember { + public interface IPythonClassMember : IPythonType { IPythonType DeclaringType { get; } } } diff --git a/src/Analysis/Ast/Impl/Types/Definitions/IPythonPropertyType.cs b/src/Analysis/Ast/Impl/Types/Definitions/IPythonPropertyType.cs index 20fc3c932..badcecb6b 100644 --- a/src/Analysis/Ast/Impl/Types/Definitions/IPythonPropertyType.cs +++ b/src/Analysis/Ast/Impl/Types/Definitions/IPythonPropertyType.cs @@ -34,5 +34,10 @@ public interface IPythonPropertyType : IPythonClassMember { /// True if the property is read-only. /// bool IsReadOnly { get; } + + /// + /// Property return type. + /// + IMember ReturnType { get; } } } diff --git a/src/Analysis/Ast/Impl/Types/PythonPropertyType.cs b/src/Analysis/Ast/Impl/Types/PythonPropertyType.cs index f10078945..850fd5e0f 100644 --- a/src/Analysis/Ast/Impl/Types/PythonPropertyType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonPropertyType.cs @@ -33,21 +33,31 @@ public PythonPropertyType(string name, Location location, IPythonType declaringT } #region IPythonType + public override PythonMemberType MemberType => PythonMemberType.Property; + #endregion #region IPythonPropertyType + public FunctionDefinition FunctionDefinition => DeclaringModule.GetAstNode(this); public override bool IsAbstract { get; } public bool IsReadOnly => true; public IPythonType DeclaringType { get; } - public string Description - => Type == null ? Resources.PropertyOfUnknownType : Resources.PropertyOfType.FormatUI(Type.Name); + + public string Description { + get { + var typeName = ReturnType?.GetPythonType()?.Name; + return typeName != null ? Resources.PropertyOfType.FormatUI(typeName) : Resources.PropertyOfUnknownType; + } + } + public override IMember Call(IPythonInstance instance, string memberName, IArgumentSet args) - => _getter.Call(args, instance?.GetPythonType() ?? DeclaringType); + => _getter.Call(args, instance?.GetPythonType() ?? DeclaringType); + + public IMember ReturnType => _getter?.Call(ArgumentSet.Empty, DeclaringType); #endregion internal void AddOverload(IPythonFunctionOverload overload) => _getter = _getter ?? overload; - private IPythonType Type => _getter?.Call(ArgumentSet.Empty, DeclaringType)?.GetPythonType(); } } diff --git a/src/Caching/Impl/AnalysisWriter.cs b/src/Caching/Impl/AnalysisWriter.cs deleted file mode 100644 index 672b07cfb..000000000 --- a/src/Caching/Impl/AnalysisWriter.cs +++ /dev/null @@ -1,164 +0,0 @@ -// 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.Collections.Generic; -using System.IO; -using System.Linq; -using LiteDB; -using Microsoft.Python.Analysis.Analyzer; -using Microsoft.Python.Analysis.Caching.Models; -using Microsoft.Python.Analysis.Types; -using Microsoft.Python.Analysis.Values; -using Microsoft.Python.Core; - -namespace Microsoft.Python.Analysis.Caching { - internal sealed class AnalysisWriter { - private readonly IServiceContainer _services; - - public AnalysisWriter(IServiceContainer services) { - _services = services; - } - - public void StoreModuleAnalysis(string moduleId, IDocumentAnalysis analysis) { - if(!(analysis is DocumentAnalysis)) { - return; - } - - var cfs = _services.GetService(); - using (var db = new LiteDatabase(Path.Combine(cfs.CacheFolder, "Analysis.db"))) { - WriteModule(db, moduleId, analysis); - } - } - - private void WriteModule(LiteDatabase db, string moduleId, IDocumentAnalysis analysis) { - var variables = new List(); - var functions = new List(); - var classes = new List(); - - foreach (var v in analysis.GlobalScope.Variables) { - var t = v.Value.GetPythonType(); - // If variable is declaration and has location, then it is a user-defined variable. - if(v.Source == VariableSource.Declaration && v.Location.IsValid) { - variables.Add(new VariableModel { - Name = v.Name, - Type = GetQualifiedName(v.Value) - }); - } - - if(v.Source == VariableSource.Declaration && !v.Location.IsValid) { - switch (t) { - // Typically class or a function - case IPythonFunctionType ft: { - functions.Add(new FunctionModel { - Name = ft.Name, - }); - break; - } - - case IPythonClassType cls: { - classes.Add(new ClassModel { - Name = cls.Name, - }); - break; - } - } - } - } - - var variableCollection = db.GetCollection(GetVariableCollectionName(moduleId)); - variableCollection.Update(variables); - - var functionCollection = db.GetCollection(GetFunctionsCollectionName(moduleId)); - functionCollection.Update(functions); - - var classesCollection = db.GetCollection(GetClassesCollectionName(moduleId)); - classesCollection.Update(classes); - } - - private FunctionModel GetFunctionModel(IPythonFunctionType ft) { - return new FunctionModel { - Name = ft.Name, - Overloads = ft.Overloads.Select(GetOverloadModel).ToArray() - // TODO: attributes - }; - } - - private OverloadModel GetOverloadModel(IPythonFunctionOverload o) { - return new OverloadModel { - Parameters = o.Parameters.Select(p => new ParameterModel { - Name = p.Name, - Type = GetQualifiedName(p.Type), - Kind = GetParameterKind(p.Kind), - DefaultValue = GetQualifiedName(p.DefaultValue), - }).ToArray(), - ReturnType = GetQualifiedName(o.StaticReturnValue) - }; - } - - private ClassModel GetClassModel(IPythonClassType cls) { - return new ClassModel { - Name = cls.Name, - Bases = cls.Bases.OfType().Select(GetQualifiedName).ToArray(), - }; - } - - private static ParameterKind GetParameterKind(Parsing.Ast.ParameterKind p) { - switch(p) { - case Parsing.Ast.ParameterKind.KeywordOnly: - return ParameterKind.KeywordOnly; - case Parsing.Ast.ParameterKind.List: - return ParameterKind.List; - case Parsing.Ast.ParameterKind.Dictionary: - return ParameterKind.Dictionary; - } - return ParameterKind.Normal; - } - - private string GetVariableCollectionName(string moduleId) => $"{moduleId}.variables"; - private string GetClassesCollectionName(string moduleId) => $"{moduleId}.classes"; - private string GetFunctionsCollectionName(string moduleId) => $"{moduleId}.functions"; - private string GetTypeVarCollectionName(string moduleId) => $"{moduleId}.typeVars"; - - // TODO: fix per https://github.com/microsoft/python-language-server/issues/1177 - private string GetModuleUniqueId(IPythonModule module) => module.Name; - - private string GetQualifiedName(IMember m) { - var t = m.GetPythonType(); - if(t.IsUnknown()) { - return string.Empty; - } - - var moduleId = GetModuleUniqueId(t.DeclaringModule); - switch (m) { - case IPythonInstance _: - return $"i:{GetQualifiedName(t)}"; - case IPythonClassMember cm when cm.DeclaringType != null: - return $"{moduleId}.{GetClassMemberQualifiedName(cm)}"; - default: - return $"{moduleId}.{t.Name}"; - } - } - - private static string GetClassMemberQualifiedName(IPythonClassMember cm) { - var s = new Stack(); - s.Push(cm.Name); - for (var p = cm.DeclaringType as IPythonClassMember; p != null; p = p.DeclaringType as IPythonClassMember) { - s.Push(p.Name); - } - return string.Join(".", s); - } - } -} - diff --git a/src/Caching/Impl/Models/ClassModel.cs b/src/Caching/Impl/Models/ClassModel.cs index 1d2e15ce5..275eed03e 100644 --- a/src/Caching/Impl/Models/ClassModel.cs +++ b/src/Caching/Impl/Models/ClassModel.cs @@ -13,12 +13,56 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. +using System.Collections.Generic; +using System.Linq; +using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Analysis.Values; + namespace Microsoft.Python.Analysis.Caching.Models { - internal sealed class ClassModel: MemberModel { + internal sealed class ClassModel { + public string Name { get; set; } public string[] Bases { get; set; } - public string[] Methods { get; set; } - public string[] Properties { get; set; } - public string[] Fields { get; set; } + public FunctionModel[] Methods { get; set; } + public PropertyModel[] Properties { get; set; } + public VariableModel[] Fields { get; set; } public string[] GenericParameters { get; set; } + public ClassModel[] InnerClasses { get; set; } + + public static ClassModel FromType(IPythonClassType cls) { + var methods = new List(); + var properties = new List(); + var fields = new List(); + var innerClasses = new List(); + + foreach (var name in cls.GetMemberNames()) { + var m = cls.GetMember(name); + switch (m) { + case IPythonClassType ct: + innerClasses.Add(FromType(ct)); + break; + case IPythonFunctionType ft: + methods.Add(FunctionModel.FromType(ft)); + break; + case IPythonPropertyType prop: + properties.Add(PropertyModel.FromType(prop)); + break; + case IPythonInstance inst: + fields.Add(VariableModel.FromInstance(name, inst)); + break; + case IPythonType t: + fields.Add(VariableModel.FromType(name, t)); + break; + } + } + + return new ClassModel { + Name = cls.Name, + Bases = cls.Bases.OfType().Select(t => t.GetQualifiedName()).ToArray(), + Methods = methods.ToArray(), + Properties = properties.ToArray(), + Fields = fields.ToArray(), + InnerClasses = innerClasses.ToArray() + }; + } } } diff --git a/src/Caching/Impl/Models/FunctionModel.cs b/src/Caching/Impl/Models/FunctionModel.cs index a66c83295..4c198a49a 100644 --- a/src/Caching/Impl/Models/FunctionModel.cs +++ b/src/Caching/Impl/Models/FunctionModel.cs @@ -13,9 +13,47 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. +using System.Linq; +using Microsoft.Python.Analysis.Types; + namespace Microsoft.Python.Analysis.Caching.Models { - internal sealed class FunctionModel: MemberModel { + internal sealed class FunctionModel { + public string Name { get; set; } public OverloadModel[] Overloads { get; set; } public FunctionAttributes Attributes { get; set; } + public string[] Classes { get; set; } + public string[] Functions { get; set; } + + public static FunctionModel FromType(IPythonFunctionType ft) { + return new FunctionModel { + Name = ft.Name, + Overloads = ft.Overloads.Select(FromOverload).ToArray() + // TODO: attributes, inner functions and inner classes. + }; + } + + private static OverloadModel FromOverload(IPythonFunctionOverload o) { + return new OverloadModel { + Parameters = o.Parameters.Select(p => new ParameterModel { + Name = p.Name, + Type = p.Type.GetQualifiedName(), + Kind = GetParameterKind(p.Kind), + DefaultValue = p.DefaultValue.GetQualifiedName(), + }).ToArray(), + ReturnType = o.StaticReturnValue.GetQualifiedName() + }; + } + + private static ParameterKind GetParameterKind(Parsing.Ast.ParameterKind p) { + switch (p) { + case Parsing.Ast.ParameterKind.KeywordOnly: + return ParameterKind.KeywordOnly; + case Parsing.Ast.ParameterKind.List: + return ParameterKind.List; + case Parsing.Ast.ParameterKind.Dictionary: + return ParameterKind.Dictionary; + } + return ParameterKind.Normal; + } } } diff --git a/src/Caching/Impl/Models/MemberModel.cs b/src/Caching/Impl/Models/MemberModel.cs deleted file mode 100644 index 5060e19da..000000000 --- a/src/Caching/Impl/Models/MemberModel.cs +++ /dev/null @@ -1,23 +0,0 @@ -// 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. - -namespace Microsoft.Python.Analysis.Caching.Models { - /// - /// Represents persistent data about member. - /// - internal abstract class MemberModel { - public string Name { get; set; } - } -} diff --git a/src/Caching/Impl/Models/PropertyModel.cs b/src/Caching/Impl/Models/PropertyModel.cs index b57e33c88..cf1d079ab 100644 --- a/src/Caching/Impl/Models/PropertyModel.cs +++ b/src/Caching/Impl/Models/PropertyModel.cs @@ -13,9 +13,20 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. +using Microsoft.Python.Analysis.Types; + namespace Microsoft.Python.Analysis.Caching.Models { - internal sealed class PropertyModel: MemberModel { + internal sealed class PropertyModel { + public string Name { get; set; } public string ReturnType { get; set; } public FunctionAttributes Attributes { get; set; } + + public static PropertyModel FromType(IPythonPropertyType prop) { + return new PropertyModel { + Name = prop.Name, + ReturnType = prop.ReturnType.GetQualifiedName(), + // TODO: attributes. + }; + } } } diff --git a/src/Caching/Impl/Models/TypeVarModel.cs b/src/Caching/Impl/Models/TypeVarModel.cs index 40fde3bd6..1d82b3ae3 100644 --- a/src/Caching/Impl/Models/TypeVarModel.cs +++ b/src/Caching/Impl/Models/TypeVarModel.cs @@ -14,7 +14,8 @@ // permissions and limitations under the License. namespace Microsoft.Python.Analysis.Caching.Models { - internal sealed class TypeVarModel: MemberModel { + internal sealed class TypeVarModel { + public string Name { get; set; } public string[] Constraints { get; set; } } } diff --git a/src/Caching/Impl/Models/VariableModel.cs b/src/Caching/Impl/Models/VariableModel.cs index dfbb65729..6f0c9c965 100644 --- a/src/Caching/Impl/Models/VariableModel.cs +++ b/src/Caching/Impl/Models/VariableModel.cs @@ -13,8 +13,27 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. +using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Analysis.Values; + namespace Microsoft.Python.Analysis.Caching.Models { - internal sealed class VariableModel : MemberModel { - public string Type { get; set; } + internal sealed class VariableModel { + public string Name { get; set; } + public string Value { get; set; } + + public static VariableModel FromVariable(IVariable v) => new VariableModel { + Name = v.Name, + Value = v.Value.GetQualifiedName() + }; + + public static VariableModel FromInstance(string name, IPythonInstance inst) => new VariableModel { + Name = name, + Value = inst.GetQualifiedName() + }; + + public static VariableModel FromType(string name, IPythonType t) => new VariableModel { + Name = name, + Value = t.GetQualifiedName() + }; } } diff --git a/src/Caching/Impl/TypeNames.cs b/src/Caching/Impl/TypeNames.cs new file mode 100644 index 000000000..018c850bd --- /dev/null +++ b/src/Caching/Impl/TypeNames.cs @@ -0,0 +1,51 @@ +// 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.Collections.Generic; +using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Analysis.Values; + +namespace Microsoft.Python.Analysis.Caching { + internal static class TypeNames { + public static string GetQualifiedName(this IMember m) { + var t = m.GetPythonType(); + if (t.IsUnknown()) { + return string.Empty; + } + + var moduleId = t.DeclaringModule.GetUniqueId(); + switch (m) { + case IPythonInstance _: + return $"i:{GetQualifiedName(t)}"; + case IPythonClassMember cm when cm.DeclaringType != null: + return $"{moduleId}.{cm.GetQualifiedName()}"; + default: + return $"{moduleId}.{t.Name}"; + } + } + + private static string GetQualifiedName(this IPythonClassMember cm) { + var s = new Stack(); + s.Push(cm.Name); + for (var p = cm.DeclaringType as IPythonClassMember; p != null; p = p.DeclaringType as IPythonClassMember) { + s.Push(p.Name); + } + return string.Join(".", s); + } + + // TODO: fix per https://github.com/microsoft/python-language-server/issues/1177 + private static string GetUniqueId(this IPythonModule module) => module.Name; + } +} diff --git a/src/Caching/Impl/Views/MemberView.cs b/src/Caching/Impl/Views/MemberView.cs deleted file mode 100644 index 9dcd88804..000000000 --- a/src/Caching/Impl/Views/MemberView.cs +++ /dev/null @@ -1,44 +0,0 @@ -// 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 Microsoft.Python.Analysis.Caching.Models; - -namespace Microsoft.Python.Analysis.Caching.Views { - internal class MemberView : IMemberView { - private readonly MemberModel _model; - - public MemberView(MemberModel model) { - _model = model; - } - - public string Name => _model.Name; - - public MemberType MemberType { - get { - switch(_model) { - case VariableModel _: - return MemberType.Variable; - case ClassModel _: - return MemberType.Class; - case FunctionModel _: - return MemberType.Function; - case PropertyModel _: - return MemberType.Property; - } - return MemberType.Unknown; - } - } - } -} diff --git a/src/Caching/Impl/Views/VariableView.cs b/src/Caching/Impl/Views/VariableView.cs index 6db70f1b0..6f2dbe020 100644 --- a/src/Caching/Impl/Views/VariableView.cs +++ b/src/Caching/Impl/Views/VariableView.cs @@ -26,6 +26,5 @@ public VariableView(VariableModel model) { public IMember Type { get; } public string Name => _model.Name; - public MemberType MemberType => MemberType.Variable; } } diff --git a/src/Caching/Impl/Writers/AnalysisWriter.cs b/src/Caching/Impl/Writers/AnalysisWriter.cs new file mode 100644 index 000000000..9ce3e320c --- /dev/null +++ b/src/Caching/Impl/Writers/AnalysisWriter.cs @@ -0,0 +1,42 @@ +// 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.IO; +using LiteDB; +using Microsoft.Python.Analysis.Analyzer; +using Microsoft.Python.Core; + +namespace Microsoft.Python.Analysis.Caching.Writers { + internal sealed class AnalysisWriter { + private readonly IServiceContainer _services; + + public AnalysisWriter(IServiceContainer services) { + _services = services; + } + + public void StoreModuleAnalysis(string moduleId, IDocumentAnalysis analysis) { + if(!(analysis is DocumentAnalysis)) { + return; + } + + var cfs = _services.GetService(); + using (var db = new LiteDatabase(Path.Combine(cfs.CacheFolder, "Analysis.db"))) { + var mw = new ModuleWriter(); + mw.WriteModule(db, moduleId, analysis); + } + } + } +} + diff --git a/src/Caching/Impl/Writers/ModuleWriter.cs b/src/Caching/Impl/Writers/ModuleWriter.cs new file mode 100644 index 000000000..92d79e585 --- /dev/null +++ b/src/Caching/Impl/Writers/ModuleWriter.cs @@ -0,0 +1,66 @@ +// 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.Collections.Generic; +using LiteDB; +using Microsoft.Python.Analysis.Caching.Models; +using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Analysis.Values; + +namespace Microsoft.Python.Analysis.Caching.Writers { + internal sealed class ModuleWriter { + public void WriteModule(LiteDatabase db, string moduleId, IDocumentAnalysis analysis) { + var variables = new List(); + var functions = new List(); + var classes = new List(); + + foreach (var v in analysis.GlobalScope.Variables) { + var t = v.Value.GetPythonType(); + // If variable is declaration and has location, then it is a user-defined variable. + if (v.Source == VariableSource.Declaration && v.Location.IsValid) { + variables.Add(VariableModel.FromVariable(v)); + } + + if (v.Source == VariableSource.Declaration && !v.Location.IsValid) { + switch (t) { + // Typically class or a function + case IPythonFunctionType ft: { + functions.Add(FunctionModel.FromType(ft)); + break; + } + + case IPythonClassType cls: { + classes.Add(ClassModel.FromType(cls)); + break; + } + } + } + } + + var variableCollection = db.GetCollection($"{moduleId}.variables"); + variableCollection.Update(variables); + + var functionCollection = db.GetCollection($"{moduleId}.functions"); + functionCollection.Update(functions); + + var classesCollection = db.GetCollection($"{moduleId}.classes"); + classesCollection.Update(classes); + } + + // TODO: fix per https://github.com/microsoft/python-language-server/issues/1177 + private string GetModuleUniqueId(IPythonModule module) => module.Name; + + } +} From 1670c9db7dadfff1fc7ab781a35765658bac58dd Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Fri, 7 Jun 2019 11:05:29 -0700 Subject: [PATCH 48/82] First test --- src/Caching/Impl/Models/ModuleModel.cs | 64 ++++++++++++++++++ src/Caching/Impl/Properties/AssemblyInfo.cs | 3 +- src/Caching/Impl/TypeNames.cs | 4 +- src/Caching/Impl/Writers/ModuleWriter.cs | 44 +------------ src/Caching/Test/AssemblySetup.cs | 34 ++++++++++ src/Caching/Test/BasicTests.cs | 66 +++++++++++++++++++ .../FluentAssertions/AssertionsFactory.cs | 32 +++++++++ ...osoft.Python.Analysis.Caching.Tests.csproj | 40 +++++++++++ src/PLS.sln | 7 ++ 9 files changed, 250 insertions(+), 44 deletions(-) create mode 100644 src/Caching/Impl/Models/ModuleModel.cs create mode 100644 src/Caching/Test/AssemblySetup.cs create mode 100644 src/Caching/Test/BasicTests.cs create mode 100644 src/Caching/Test/FluentAssertions/AssertionsFactory.cs create mode 100644 src/Caching/Test/Microsoft.Python.Analysis.Caching.Tests.csproj diff --git a/src/Caching/Impl/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs new file mode 100644 index 000000000..444d72798 --- /dev/null +++ b/src/Caching/Impl/Models/ModuleModel.cs @@ -0,0 +1,64 @@ +// 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.Collections.Generic; +using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Analysis.Values; + +namespace Microsoft.Python.Analysis.Caching.Models { + internal sealed class ModuleModel { + public string Name { get; set; } + public FunctionModel[] Functions { get; set; } + public VariableModel[] Variables { get; set; } + public ClassModel[] Classes { get; set; } + // TODO: TypeVars, ... + + public static ModuleModel FromAnalysis(IDocumentAnalysis analysis) { + var variables = new List(); + var functions = new List(); + var classes = new List(); + + foreach (var v in analysis.GlobalScope.Variables) { + var t = v.Value.GetPythonType(); + // If variable is declaration and has location, then it is a user-defined variable. + if (v.Source == VariableSource.Declaration && v.Location.IsValid) { + variables.Add(VariableModel.FromVariable(v)); + } + + if (v.Source == VariableSource.Declaration && !v.Location.IsValid) { + switch (t) { + // Typically class or a function + case IPythonFunctionType ft: { + functions.Add(FunctionModel.FromType(ft)); + break; + } + + case IPythonClassType cls: { + classes.Add(ClassModel.FromType(cls)); + break; + } + } + } + } + + return new ModuleModel { + Name = analysis.Document.GetQualifiedName(), + Functions = functions.ToArray(), + Variables = variables.ToArray(), + Classes = classes.ToArray() + }; + } + } +} diff --git a/src/Caching/Impl/Properties/AssemblyInfo.cs b/src/Caching/Impl/Properties/AssemblyInfo.cs index 52c4e3665..9d32fae0c 100644 --- a/src/Caching/Impl/Properties/AssemblyInfo.cs +++ b/src/Caching/Impl/Properties/AssemblyInfo.cs @@ -15,5 +15,4 @@ using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("Microsoft.Python.Analysis.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] -[assembly: InternalsVisibleTo("Microsoft.Python.LanguageServer.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +[assembly: InternalsVisibleTo("Microsoft.Python.Analysis.Caching.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] diff --git a/src/Caching/Impl/TypeNames.cs b/src/Caching/Impl/TypeNames.cs index 018c850bd..dce2e9d8c 100644 --- a/src/Caching/Impl/TypeNames.cs +++ b/src/Caching/Impl/TypeNames.cs @@ -25,8 +25,10 @@ public static string GetQualifiedName(this IMember m) { return string.Empty; } - var moduleId = t.DeclaringModule.GetUniqueId(); + var moduleId = t.DeclaringModule?.GetUniqueId(); switch (m) { + case IPythonModule mod: + return mod.GetUniqueId(); case IPythonInstance _: return $"i:{GetQualifiedName(t)}"; case IPythonClassMember cm when cm.DeclaringType != null: diff --git a/src/Caching/Impl/Writers/ModuleWriter.cs b/src/Caching/Impl/Writers/ModuleWriter.cs index 92d79e585..300981cfa 100644 --- a/src/Caching/Impl/Writers/ModuleWriter.cs +++ b/src/Caching/Impl/Writers/ModuleWriter.cs @@ -13,54 +13,16 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. -using System.Collections.Generic; using LiteDB; using Microsoft.Python.Analysis.Caching.Models; -using Microsoft.Python.Analysis.Types; -using Microsoft.Python.Analysis.Values; namespace Microsoft.Python.Analysis.Caching.Writers { internal sealed class ModuleWriter { public void WriteModule(LiteDatabase db, string moduleId, IDocumentAnalysis analysis) { - var variables = new List(); - var functions = new List(); - var classes = new List(); + var model = ModuleModel.FromAnalysis(analysis); - foreach (var v in analysis.GlobalScope.Variables) { - var t = v.Value.GetPythonType(); - // If variable is declaration and has location, then it is a user-defined variable. - if (v.Source == VariableSource.Declaration && v.Location.IsValid) { - variables.Add(VariableModel.FromVariable(v)); - } - - if (v.Source == VariableSource.Declaration && !v.Location.IsValid) { - switch (t) { - // Typically class or a function - case IPythonFunctionType ft: { - functions.Add(FunctionModel.FromType(ft)); - break; - } - - case IPythonClassType cls: { - classes.Add(ClassModel.FromType(cls)); - break; - } - } - } - } - - var variableCollection = db.GetCollection($"{moduleId}.variables"); - variableCollection.Update(variables); - - var functionCollection = db.GetCollection($"{moduleId}.functions"); - functionCollection.Update(functions); - - var classesCollection = db.GetCollection($"{moduleId}.classes"); - classesCollection.Update(classes); + var moduleCollection = db.GetCollection("modules"); + moduleCollection.Update(model); } - - // TODO: fix per https://github.com/microsoft/python-language-server/issues/1177 - private string GetModuleUniqueId(IPythonModule module) => module.Name; - } } diff --git a/src/Caching/Test/AssemblySetup.cs b/src/Caching/Test/AssemblySetup.cs new file mode 100644 index 000000000..4e92972b6 --- /dev/null +++ b/src/Caching/Test/AssemblySetup.cs @@ -0,0 +1,34 @@ +// 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 Microsoft.Python.Core.Testing; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TestUtilities; + +namespace Microsoft.Python.Analysis.Caching.Tests { + [TestClass] + public sealed class AssemblySetup { + [AssemblyInitialize] + public static void Initialize(TestContext testContext) => AnalysisTestEnvironment.Initialize(); + + private class AnalysisTestEnvironment : TestEnvironmentImpl, ITestEnvironment { + public static void Initialize() { + var instance = new AnalysisTestEnvironment(); + Instance = instance; + TestEnvironment.Current = instance; + } + } + } +} diff --git a/src/Caching/Test/BasicTests.cs b/src/Caching/Test/BasicTests.cs new file mode 100644 index 000000000..47aaafa06 --- /dev/null +++ b/src/Caching/Test/BasicTests.cs @@ -0,0 +1,66 @@ +// 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.IO; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Python.Analysis.Caching.Models; +using Microsoft.Python.Analysis.Tests; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Newtonsoft.Json; +using TestUtilities; + +namespace Microsoft.Python.Analysis.Caching.Tests { + [TestClass] + public class BasicTests : AnalysisTestBase { + public TestContext TestContext { get; set; } + + [TestInitialize] + public void TestInitialize() + => TestEnvironmentImpl.TestInitialize($"{TestContext.FullyQualifiedTestClassName}.{TestContext.TestName}"); + + [TestCleanup] + public void Cleanup() => TestEnvironmentImpl.TestCleanup(); + + [TestMethod, Priority(0)] + public async Task SmokeTest() { + const string code = @" +x = 'str' + +class C: + x: int + def __init__(self): + self.y = 1 + + def method(self): + return func() + +def func(): + return 2.0 + +c = C() +"; + var analysis = await GetAnalysisAsync(code); + var model = ModuleModel.FromAnalysis(analysis); + + var sb = new StringBuilder(); + using (var sw = new StringWriter(sb)) { + var js = new JsonSerializer(); + js.Serialize(sw, model); + } + var json = sb.ToString(); + } + } +} diff --git a/src/Caching/Test/FluentAssertions/AssertionsFactory.cs b/src/Caching/Test/FluentAssertions/AssertionsFactory.cs new file mode 100644 index 000000000..beea908f7 --- /dev/null +++ b/src/Caching/Test/FluentAssertions/AssertionsFactory.cs @@ -0,0 +1,32 @@ +// 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.Diagnostics.CodeAnalysis; +using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Analysis.Values; +using Microsoft.Python.Core.Text; + +namespace Microsoft.Python.Analysis.Tests.FluentAssertions { + [ExcludeFromCodeCoverage] + internal static class AssertionsFactory { + public static DocumentAnalysisAssertions Should(this IDocumentAnalysis analysis) => new DocumentAnalysisAssertions(analysis); + public static VariableAssertions Should(this IVariable v) => new VariableAssertions(v); + + public static RangeAssertions Should(this Range? range) => new RangeAssertions(range); + + public static SourceSpanAssertions Should(this SourceSpan span) => new SourceSpanAssertions(span); + public static SourceSpanAssertions Should(this SourceSpan? span) => new SourceSpanAssertions(span.Value); + } +} diff --git a/src/Caching/Test/Microsoft.Python.Analysis.Caching.Tests.csproj b/src/Caching/Test/Microsoft.Python.Analysis.Caching.Tests.csproj new file mode 100644 index 000000000..7ed05925e --- /dev/null +++ b/src/Caching/Test/Microsoft.Python.Analysis.Caching.Tests.csproj @@ -0,0 +1,40 @@ + + + netcoreapp2.2 + Microsoft.Python.Analysis.Caching.Tests + Microsoft.Python.Analysis.Caching.Tests + + + + 1701;1702$(NoWarn) + 7.2 + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + + + + + + + + + + + diff --git a/src/PLS.sln b/src/PLS.sln index 1a730fb07..2bceb6b86 100644 --- a/src/PLS.sln +++ b/src/PLS.sln @@ -29,6 +29,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Python.LanguageSe EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Python.Analysis.Caching", "Caching\Impl\Microsoft.Python.Analysis.Caching.csproj", "{42BD3C80-3E57-4847-8142-84F6B682EA8D}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Python.Analysis.Caching.Tests", "Caching\Test\Microsoft.Python.Analysis.Caching.Tests.csproj", "{40CD3A74-B0B6-4A37-AE65-5B203C38D0E2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -79,6 +81,10 @@ Global {42BD3C80-3E57-4847-8142-84F6B682EA8D}.Debug|Any CPU.Build.0 = Debug|Any CPU {42BD3C80-3E57-4847-8142-84F6B682EA8D}.Release|Any CPU.ActiveCfg = Release|Any CPU {42BD3C80-3E57-4847-8142-84F6B682EA8D}.Release|Any CPU.Build.0 = Release|Any CPU + {40CD3A74-B0B6-4A37-AE65-5B203C38D0E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {40CD3A74-B0B6-4A37-AE65-5B203C38D0E2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {40CD3A74-B0B6-4A37-AE65-5B203C38D0E2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {40CD3A74-B0B6-4A37-AE65-5B203C38D0E2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -95,6 +101,7 @@ Global {D8D85896-5DB0-4FA6-B744-910A272C39F9} = {80AA38A1-3E82-4B87-BB21-FDEDD2CC87E6} {3BAB87E1-79FD-45D1-8564-CAF87D4D16CA} = {80AA38A1-3E82-4B87-BB21-FDEDD2CC87E6} {42BD3C80-3E57-4847-8142-84F6B682EA8D} = {C465393D-145E-4695-A7DB-AF55951BD533} + {40CD3A74-B0B6-4A37-AE65-5B203C38D0E2} = {80AA38A1-3E82-4B87-BB21-FDEDD2CC87E6} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {ABC12ED7-0EC8-4219-8A14-A058F7942D92} From ab69cfdd31c3e9be5ee969b202d4a4ed0d9417b8 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Fri, 7 Jun 2019 12:47:34 -0700 Subject: [PATCH 49/82] Baseline comparison --- src/Caching/Impl/Models/ClassModel.cs | 12 +- src/Caching/Impl/TypeNames.cs | 7 +- src/Caching/Test/AnalysisCachingTestBase.cs | 46 +++++++ src/Caching/Test/BasicTests.cs | 17 +-- src/Caching/Test/Files/SmokeTest.json | 88 +++++++++++++ ...osoft.Python.Analysis.Caching.Tests.csproj | 3 + src/UnitTests/Core/Impl/Baseline.cs | 124 ++++++++++++++++++ 7 files changed, 283 insertions(+), 14 deletions(-) create mode 100644 src/Caching/Test/AnalysisCachingTestBase.cs create mode 100644 src/Caching/Test/Files/SmokeTest.json create mode 100644 src/UnitTests/Core/Impl/Baseline.cs diff --git a/src/Caching/Impl/Models/ClassModel.cs b/src/Caching/Impl/Models/ClassModel.cs index 275eed03e..bee98b593 100644 --- a/src/Caching/Impl/Models/ClassModel.cs +++ b/src/Caching/Impl/Models/ClassModel.cs @@ -34,10 +34,20 @@ public static ClassModel FromType(IPythonClassType cls) { var fields = new List(); var innerClasses = new List(); - foreach (var name in cls.GetMemberNames()) { + // Skip certain members in order to avoid infinite recursion. + foreach (var name in cls.GetMemberNames().Except(new [] {"__base__", "__bases__", "__class__", "mro" })) { var m = cls.GetMember(name); + + // Only take members from this class, skip members from bases. + if(m is IPythonClassMember cm && !cls.Equals(cm.DeclaringType)) { + continue; + } + switch (m) { case IPythonClassType ct: + if(!ct.DeclaringModule.Equals(cls.DeclaringModule)) { + continue; + } innerClasses.Add(FromType(ct)); break; case IPythonFunctionType ft: diff --git a/src/Caching/Impl/TypeNames.cs b/src/Caching/Impl/TypeNames.cs index dce2e9d8c..dc0bdab4e 100644 --- a/src/Caching/Impl/TypeNames.cs +++ b/src/Caching/Impl/TypeNames.cs @@ -33,9 +33,12 @@ public static string GetQualifiedName(this IMember m) { return $"i:{GetQualifiedName(t)}"; case IPythonClassMember cm when cm.DeclaringType != null: return $"{moduleId}.{cm.GetQualifiedName()}"; - default: - return $"{moduleId}.{t.Name}"; + case IPythonType pt: + return $"{moduleId}.{pt.Name}"; + case null: + break; } + return string.Empty; } private static string GetQualifiedName(this IPythonClassMember cm) { diff --git a/src/Caching/Test/AnalysisCachingTestBase.cs b/src/Caching/Test/AnalysisCachingTestBase.cs new file mode 100644 index 000000000..208d5fb84 --- /dev/null +++ b/src/Caching/Test/AnalysisCachingTestBase.cs @@ -0,0 +1,46 @@ +// 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.IO; +using System.Reflection; +using System.Text; +using Microsoft.Python.Analysis.Tests; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Newtonsoft.Json; +using TestUtilities; + +namespace Microsoft.Python.Analysis.Caching.Tests { + public abstract class AnalysisCachingTestBase: AnalysisTestBase { + protected string ToJson(object model) { + var sb = new StringBuilder(); + using (var sw = new StringWriter(sb)) + using (var jw = new JsonTextWriter(sw)) { + jw.Formatting = Formatting.Indented; + var js = new JsonSerializer(); + js.Serialize(jw, model); + } + return sb.ToString(); + } + + protected string BaselineFilesFolder { + get { + var testAssembly = Assembly.GetExecutingAssembly().GetAssemblyPath(); + var outDirectory = Path.GetDirectoryName(testAssembly); + return Path.GetFullPath(Path.Combine(outDirectory, "..", "..", "..", "src", "Caching", "Test", "Files")); + } + } + + } +} diff --git a/src/Caching/Test/BasicTests.cs b/src/Caching/Test/BasicTests.cs index 47aaafa06..8b224d1b3 100644 --- a/src/Caching/Test/BasicTests.cs +++ b/src/Caching/Test/BasicTests.cs @@ -14,17 +14,15 @@ // permissions and limitations under the License. using System.IO; -using System.Text; +using System.Reflection; using System.Threading.Tasks; using Microsoft.Python.Analysis.Caching.Models; -using Microsoft.Python.Analysis.Tests; using Microsoft.VisualStudio.TestTools.UnitTesting; -using Newtonsoft.Json; using TestUtilities; namespace Microsoft.Python.Analysis.Caching.Tests { [TestClass] - public class BasicTests : AnalysisTestBase { + public class BasicTests : AnalysisCachingTestBase { public TestContext TestContext { get; set; } [TestInitialize] @@ -34,6 +32,8 @@ public void TestInitialize() [TestCleanup] public void Cleanup() => TestEnvironmentImpl.TestCleanup(); + private string BaselineFileName => Path.ChangeExtension(Path.Combine(BaselineFilesFolder, TestContext.TestName), "json"); + [TestMethod, Priority(0)] public async Task SmokeTest() { const string code = @" @@ -54,13 +54,8 @@ def func(): "; var analysis = await GetAnalysisAsync(code); var model = ModuleModel.FromAnalysis(analysis); - - var sb = new StringBuilder(); - using (var sw = new StringWriter(sb)) { - var js = new JsonSerializer(); - js.Serialize(sw, model); - } - var json = sb.ToString(); + var json = ToJson(model); + Baseline.CompareToFile(BaselineFileName, json); } } } diff --git a/src/Caching/Test/Files/SmokeTest.json b/src/Caching/Test/Files/SmokeTest.json new file mode 100644 index 000000000..977ef3c0f --- /dev/null +++ b/src/Caching/Test/Files/SmokeTest.json @@ -0,0 +1,88 @@ +{ + "Name": "module", + "Functions": [ + { + "Name": "func", + "Overloads": [ + { + "Parameters": [], + "ReturnType": "i:builtins.float" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + } + ], + "Variables": [ + { + "Name": "x", + "Value": "i:builtins.str" + }, + { + "Name": "c", + "Value": "i:module.C" + } + ], + "Classes": [ + { + "Name": "C", + "Bases": [ + "builtins.object" + ], + "Methods": [ + { + "Name": "__init__", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "module.C", + "DefaultValue": "", + "Kind": 0 + } + ], + "ReturnType": "" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "method", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "module.C", + "DefaultValue": "", + "Kind": 0 + } + ], + "ReturnType": "i:builtins.float" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + } + ], + "Properties": [], + "Fields": [ + { + "Name": "x", + "Value": "i:builtins.int" + }, + { + "Name": "y", + "Value": "i:builtins.int" + } + ], + "GenericParameters": null, + "InnerClasses": [] + } + ] +} \ No newline at end of file diff --git a/src/Caching/Test/Microsoft.Python.Analysis.Caching.Tests.csproj b/src/Caching/Test/Microsoft.Python.Analysis.Caching.Tests.csproj index 7ed05925e..328ba5ed3 100644 --- a/src/Caching/Test/Microsoft.Python.Analysis.Caching.Tests.csproj +++ b/src/Caching/Test/Microsoft.Python.Analysis.Caching.Tests.csproj @@ -35,6 +35,9 @@ + + + diff --git a/src/UnitTests/Core/Impl/Baseline.cs b/src/UnitTests/Core/Impl/Baseline.cs new file mode 100644 index 000000000..71d3bb5e8 --- /dev/null +++ b/src/UnitTests/Core/Impl/Baseline.cs @@ -0,0 +1,124 @@ +// 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.Diagnostics.CodeAnalysis; +using System.IO; +using System.Text; +using FluentAssertions; + +namespace TestUtilities { + [ExcludeFromCodeCoverage] + public static class Baseline { + public static string CompareStrings(string expected, string actual) { + var result = new StringBuilder(); + + var length = Math.Min(expected.Length, actual.Length); + for (var i = 0; i < length; i++) { + if (expected[i] != actual[i]) { + result.AppendLine(FormattableString.Invariant($"Position: {i}: expected: '{expected[i]}', actual '{actual[i]}'")); + if (i > 6 && i < length - 6) { + result.Append(FormattableString.Invariant($"Context: {expected.Substring(i - 6, 12)} -> {actual.Substring(i - 6, 12)}")); + } + break; + } + + } + + if (expected.Length != actual.Length) { + result.Append(FormattableString.Invariant($"\r\nLength different. Expected: '{expected.Length}' , actual '{actual.Length}'")); + } + + return result.ToString(); + } + + public static void CompareStringLines(string expected, string actual) { + var line = CompareLines(expected, actual, out var baseLine, out var actualLine, out var index); + line.Should().Be(0, $@"there should be no difference at line {line} + Expected:{baseLine.Trim()} + Actual:{actualLine.Trim()} + Difference at position {index}{Environment.NewLine}"); + } + + public static int CompareLines(string expected, string actual, out string expectedLine, out string actualLine, out int index, bool ignoreCase = false) { + var actualReader = new StringReader(actual); + var expectedReader = new StringReader(expected); + + var lineNum = 1; + index = 0; + + for (; ; lineNum++) { + expectedLine = expectedReader.ReadLine(); + actualLine = actualReader.ReadLine(); + + if (expectedLine == null || actualLine == null) { + break; + } + + var minLength = Math.Min(expectedLine.Length, actualLine.Length); + for (var i = 0; i < minLength; i++) { + var act = actualLine[i]; + var exp = expectedLine[i]; + + if (ignoreCase) { + act = char.ToLowerInvariant(act); + exp = char.ToLowerInvariant(exp); + } + + if (act != exp) { + index = i + 1; + return lineNum; + } + } + + if (expectedLine.Length != actualLine.Length) { + index = minLength + 1; + return lineNum; + } + } + + if (expectedLine == null && actualLine == null) { + expectedLine = string.Empty; + actualLine = string.Empty; + + return 0; + } + + return lineNum; + } + + public static void CompareToFile(string baselineFile, string actual, bool regenerateBaseline = false, bool ignoreCase = false) { + if (regenerateBaseline) { + if (File.Exists(baselineFile)) { + File.SetAttributes(baselineFile, FileAttributes.Normal); + } + + File.WriteAllText(baselineFile, actual.Trim()); + return; + } + + actual = actual.Trim(); + var expected = File.ReadAllText(baselineFile).Trim(); + var line = CompareLines(expected, actual, out var baseLine, out var actualLine, out var index, ignoreCase); + line.Should().Be(0, + $@"there should be no difference at line {line} + Expected:{baseLine.Trim()} + Actual:{actualLine.Trim()} + BaselineFile:{Path.GetFileName(baselineFile)} + Difference at {index}{Environment.NewLine}" + ); + } + } +} From e00c197d2ce341dfb4fd6f01e87f17d757b2ee04 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Fri, 7 Jun 2019 14:20:59 -0700 Subject: [PATCH 50/82] Builtins --- .../Impl/Caching/Definitions/IClassView.cs | 26 - .../Impl/Caching/Definitions/IFunctionView.cs | 23 - .../Impl/Caching/Definitions/IMemberView.cs | 25 - .../Definitions/IModuleDatabaseService.cs | 4 +- .../Impl/Caching/Definitions/IModuleView.cs | 24 - .../Caching/Definitions/IParameterView.cs | 30 - .../Impl/Caching/Definitions/IPropertyView.cs | 20 - .../Impl/Caching/Definitions/IVariableView.cs | 22 - .../Ast/Impl/Caching/PythonDbModule.cs | 27 - src/Caching/Impl/Models/ClassModel.cs | 84 +- src/Caching/Impl/Models/FunctionModel.cs | 14 +- src/Caching/Impl/Models/ParameterModel.cs | 2 + src/Caching/Impl/PythonDbModule.cs | 58 + .../Impl/Readers/ModuleReader.cs} | 8 +- src/Caching/Impl/TypeNames.cs | 4 +- src/Caching/Impl/Views/VariableView.cs | 30 - src/Caching/Test/BasicTests.cs | 9 +- src/Caching/Test/Files/Builtins.json | 2847 +++++++++++++++++ 18 files changed, 2979 insertions(+), 278 deletions(-) delete mode 100644 src/Analysis/Ast/Impl/Caching/Definitions/IClassView.cs delete mode 100644 src/Analysis/Ast/Impl/Caching/Definitions/IFunctionView.cs delete mode 100644 src/Analysis/Ast/Impl/Caching/Definitions/IMemberView.cs delete mode 100644 src/Analysis/Ast/Impl/Caching/Definitions/IModuleView.cs delete mode 100644 src/Analysis/Ast/Impl/Caching/Definitions/IParameterView.cs delete mode 100644 src/Analysis/Ast/Impl/Caching/Definitions/IPropertyView.cs delete mode 100644 src/Analysis/Ast/Impl/Caching/Definitions/IVariableView.cs delete mode 100644 src/Analysis/Ast/Impl/Caching/PythonDbModule.cs create mode 100644 src/Caching/Impl/PythonDbModule.cs rename src/{Analysis/Ast/Impl/Caching/Definitions/ITypeVarView.cs => Caching/Impl/Readers/ModuleReader.cs} (82%) delete mode 100644 src/Caching/Impl/Views/VariableView.cs create mode 100644 src/Caching/Test/Files/Builtins.json diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IClassView.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IClassView.cs deleted file mode 100644 index 94c850726..000000000 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IClassView.cs +++ /dev/null @@ -1,26 +0,0 @@ -// 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.Collections.Generic; - -namespace Microsoft.Python.Analysis.Caching { - internal interface IClassView: IMemberView { - IEnumerable Bases { get; } - IEnumerable Methods { get; } - IEnumerable Properties { get; } - IEnumerable Fields { get; } - IEnumerable GenericParameters { get; } - } -} diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IFunctionView.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IFunctionView.cs deleted file mode 100644 index dd878565c..000000000 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IFunctionView.cs +++ /dev/null @@ -1,23 +0,0 @@ -// 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.Collections.Generic; - -namespace Microsoft.Python.Analysis.Caching { - internal interface IFunctionView: IMemberView { - IEnumerable Parameters { get; } - IMemberView ReturnType { get; } - } -} diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IMemberView.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IMemberView.cs deleted file mode 100644 index 1eb45142d..000000000 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IMemberView.cs +++ /dev/null @@ -1,25 +0,0 @@ -// 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 Microsoft.Python.Analysis.Types; - -namespace Microsoft.Python.Analysis.Caching { - /// - /// Represents view on member persistent data. - /// - internal interface IMemberView { - string Name { get; } - } -} diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs index b8ec092f5..4d1f61f42 100644 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs +++ b/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs @@ -13,6 +13,8 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. +using Microsoft.Python.Analysis.Types; + namespace Microsoft.Python.Analysis.Caching { internal interface IModuleDatabaseService { /// @@ -22,7 +24,7 @@ internal interface IModuleDatabaseService { /// Module unique id. /// Python module. /// Module storage state - ModuleStorageState TryGetModuleData(string uniqueId, out IModuleView module); + ModuleStorageState TryGetModuleData(string uniqueId, out IPythonModule module); /// /// Writes module data to the database. diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IModuleView.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IModuleView.cs deleted file mode 100644 index 8eb6a9585..000000000 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IModuleView.cs +++ /dev/null @@ -1,24 +0,0 @@ -// 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.Collections.Generic; - -namespace Microsoft.Python.Analysis.Caching { - internal interface IModuleView: IMemberView { - IEnumerable Variables { get;} - IEnumerable Functions { get; } - IEnumerable Classes { get; } - } -} diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IParameterView.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IParameterView.cs deleted file mode 100644 index c3126f6e8..000000000 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IParameterView.cs +++ /dev/null @@ -1,30 +0,0 @@ -// 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. - -namespace Microsoft.Python.Analysis.Caching { - public enum ParameterKind { - Normal, - List, - Dictionary, - KeywordOnly - } - - internal interface IParameterView { - string Name { get; } - string Type { get; } - string DefaultValue { get; } - ParameterKind Kind { get; } - } -} diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IPropertyView.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IPropertyView.cs deleted file mode 100644 index dea254626..000000000 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IPropertyView.cs +++ /dev/null @@ -1,20 +0,0 @@ -// 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. - -namespace Microsoft.Python.Analysis.Caching { - internal interface IPropertyView : IMemberView { - IMemberView ReturnType { get; } - } -} diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IVariableView.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IVariableView.cs deleted file mode 100644 index 4ee1c94ef..000000000 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IVariableView.cs +++ /dev/null @@ -1,22 +0,0 @@ -// 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 Microsoft.Python.Analysis.Types; - -namespace Microsoft.Python.Analysis.Caching { - internal interface IVariableView: IMemberView { - IMember Type { get; } - } -} diff --git a/src/Analysis/Ast/Impl/Caching/PythonDbModule.cs b/src/Analysis/Ast/Impl/Caching/PythonDbModule.cs deleted file mode 100644 index dd4469141..000000000 --- a/src/Analysis/Ast/Impl/Caching/PythonDbModule.cs +++ /dev/null @@ -1,27 +0,0 @@ -// 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 Microsoft.Python.Analysis.Modules; -using Microsoft.Python.Core; - -namespace Microsoft.Python.Analysis.Caching { - internal sealed class PythonDbModule : SpecializedModule { - public PythonDbModule(string name, string modulePath, IServiceContainer services) - : base(name, modulePath, services) { - } - - protected override string LoadContent() => string.Empty; - } -} diff --git a/src/Caching/Impl/Models/ClassModel.cs b/src/Caching/Impl/Models/ClassModel.cs index bee98b593..6d37b5ad5 100644 --- a/src/Caching/Impl/Models/ClassModel.cs +++ b/src/Caching/Impl/Models/ClassModel.cs @@ -13,8 +13,10 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. +using System.Collections; using System.Collections.Generic; using System.Linq; +using System.Runtime.CompilerServices; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; @@ -28,51 +30,71 @@ internal sealed class ClassModel { public string[] GenericParameters { get; set; } public ClassModel[] InnerClasses { get; set; } - public static ClassModel FromType(IPythonClassType cls) { + private readonly Stack _processing = new Stack(); + + public static ClassModel FromType(IPythonClassType cls) => new ClassModel(cls); + + private ClassModel(IPythonClassType cls) { var methods = new List(); var properties = new List(); var fields = new List(); var innerClasses = new List(); // Skip certain members in order to avoid infinite recursion. - foreach (var name in cls.GetMemberNames().Except(new [] {"__base__", "__bases__", "__class__", "mro" })) { + foreach (var name in cls.GetMemberNames().Except(new[] { "__base__", "__bases__", "__class__", "mro" })) { var m = cls.GetMember(name); - + // Only take members from this class, skip members from bases. - if(m is IPythonClassMember cm && !cls.Equals(cm.DeclaringType)) { + if (m is IPythonClassMember cm && !cls.Equals(cm.DeclaringType)) { continue; } - switch (m) { - case IPythonClassType ct: - if(!ct.DeclaringModule.Equals(cls.DeclaringModule)) { - continue; - } - innerClasses.Add(FromType(ct)); - break; - case IPythonFunctionType ft: - methods.Add(FunctionModel.FromType(ft)); - break; - case IPythonPropertyType prop: - properties.Add(PropertyModel.FromType(prop)); - break; - case IPythonInstance inst: - fields.Add(VariableModel.FromInstance(name, inst)); - break; - case IPythonType t: - fields.Add(VariableModel.FromType(name, t)); - break; + if (!Push(m)) { + continue; + } + try { + switch (m) { + case IPythonClassType ct: + if (!ct.DeclaringModule.Equals(cls.DeclaringModule)) { + continue; + } + innerClasses.Add(FromType(ct)); + break; + case IPythonFunctionType ft: + methods.Add(FunctionModel.FromType(ft)); + break; + case IPythonPropertyType prop: + properties.Add(PropertyModel.FromType(prop)); + break; + case IPythonInstance inst: + fields.Add(VariableModel.FromInstance(name, inst)); + break; + case IPythonType t: + fields.Add(VariableModel.FromType(name, t)); + break; + } + } finally { + Pop(); } } - return new ClassModel { - Name = cls.Name, - Bases = cls.Bases.OfType().Select(t => t.GetQualifiedName()).ToArray(), - Methods = methods.ToArray(), - Properties = properties.ToArray(), - Fields = fields.ToArray(), - InnerClasses = innerClasses.ToArray() - }; + Name = cls.Name; + Bases = cls.Bases.OfType().Select(t => t.GetQualifiedName()).ToArray(); + Methods = methods.ToArray(); + Properties = properties.ToArray(); + Fields = fields.ToArray(); + InnerClasses = innerClasses.ToArray(); + } + + #region Reentrancy guards + private bool Push(IMember t) { + if (_processing.Contains(t)) { + return false; + } + _processing.Push(t); + return false; } + private void Pop() => _processing.Pop(); + #endregion } } diff --git a/src/Caching/Impl/Models/FunctionModel.cs b/src/Caching/Impl/Models/FunctionModel.cs index 4c198a49a..ccc4a869e 100644 --- a/src/Caching/Impl/Models/FunctionModel.cs +++ b/src/Caching/Impl/Models/FunctionModel.cs @@ -37,23 +37,11 @@ private static OverloadModel FromOverload(IPythonFunctionOverload o) { Parameters = o.Parameters.Select(p => new ParameterModel { Name = p.Name, Type = p.Type.GetQualifiedName(), - Kind = GetParameterKind(p.Kind), + Kind = p.Kind, DefaultValue = p.DefaultValue.GetQualifiedName(), }).ToArray(), ReturnType = o.StaticReturnValue.GetQualifiedName() }; } - - private static ParameterKind GetParameterKind(Parsing.Ast.ParameterKind p) { - switch (p) { - case Parsing.Ast.ParameterKind.KeywordOnly: - return ParameterKind.KeywordOnly; - case Parsing.Ast.ParameterKind.List: - return ParameterKind.List; - case Parsing.Ast.ParameterKind.Dictionary: - return ParameterKind.Dictionary; - } - return ParameterKind.Normal; - } } } diff --git a/src/Caching/Impl/Models/ParameterModel.cs b/src/Caching/Impl/Models/ParameterModel.cs index 3b9f9a7d4..6006b385b 100644 --- a/src/Caching/Impl/Models/ParameterModel.cs +++ b/src/Caching/Impl/Models/ParameterModel.cs @@ -13,6 +13,8 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. +using Microsoft.Python.Parsing.Ast; + namespace Microsoft.Python.Analysis.Caching.Models { internal sealed class ParameterModel { public string Name { get; set; } diff --git a/src/Caching/Impl/PythonDbModule.cs b/src/Caching/Impl/PythonDbModule.cs new file mode 100644 index 000000000..7b7eab015 --- /dev/null +++ b/src/Caching/Impl/PythonDbModule.cs @@ -0,0 +1,58 @@ +// 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.Collections.Generic; +using System.Linq; +using Microsoft.Python.Analysis.Analyzer; +using Microsoft.Python.Analysis.Caching.Models; +using Microsoft.Python.Analysis.Modules; +using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Analysis.Values; +using Microsoft.Python.Core; + +namespace Microsoft.Python.Analysis.Caching { + internal sealed class PythonDbModule : SpecializedModule { + private readonly ModuleModel _model; + private readonly IMember _unknownType; + + public PythonDbModule(ModuleModel model, IServiceContainer services) + : base(model.Name, string.Empty, services) { + _model = model; + _unknownType = services.GetService().UnknownType; + } + + protected override string LoadContent() => string.Empty; + + public override IEnumerable GetMemberNames() { + var classes = _model.Classes.Select(c => c.Name); + var functions = _model.Functions.Select(c => c.Name); + var variables = _model.Variables.Select(c => c.Name); + return classes.Concat(functions).Concat(variables); + } + + public override IMember GetMember(string name) { + var v = _model.Variables.FirstOrDefault(c => c.Name == name); + if(v != null) { + return new Variable(name, Construct(v.Value), VariableSource.Declaration, new Location(this)); + } + + return _unknownType; + } + + private IMember Construct(string qualifiedName) { + return null; + } + } +} diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/ITypeVarView.cs b/src/Caching/Impl/Readers/ModuleReader.cs similarity index 82% rename from src/Analysis/Ast/Impl/Caching/Definitions/ITypeVarView.cs rename to src/Caching/Impl/Readers/ModuleReader.cs index 0f68b0b05..3c11b3d83 100644 --- a/src/Analysis/Ast/Impl/Caching/Definitions/ITypeVarView.cs +++ b/src/Caching/Impl/Readers/ModuleReader.cs @@ -13,10 +13,12 @@ // 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.Text; + +namespace Microsoft.Python.Analysis.Caching.Readers { + internal sealed class ModuleReader { -namespace Microsoft.Python.Analysis.Caching { - internal interface ITypeVarView : IMemberView { - IEnumerable Constraints { get; } } } diff --git a/src/Caching/Impl/TypeNames.cs b/src/Caching/Impl/TypeNames.cs index dc0bdab4e..507c0137a 100644 --- a/src/Caching/Impl/TypeNames.cs +++ b/src/Caching/Impl/TypeNames.cs @@ -22,7 +22,7 @@ internal static class TypeNames { public static string GetQualifiedName(this IMember m) { var t = m.GetPythonType(); if (t.IsUnknown()) { - return string.Empty; + return null; } var moduleId = t.DeclaringModule?.GetUniqueId(); @@ -38,7 +38,7 @@ public static string GetQualifiedName(this IMember m) { case null: break; } - return string.Empty; + return null; } private static string GetQualifiedName(this IPythonClassMember cm) { diff --git a/src/Caching/Impl/Views/VariableView.cs b/src/Caching/Impl/Views/VariableView.cs deleted file mode 100644 index 6f2dbe020..000000000 --- a/src/Caching/Impl/Views/VariableView.cs +++ /dev/null @@ -1,30 +0,0 @@ -// 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 Microsoft.Python.Analysis.Caching.Models; -using Microsoft.Python.Analysis.Types; - -namespace Microsoft.Python.Analysis.Caching.Views { - internal sealed class VariableView : IVariableView { - private readonly VariableModel _model; - - public VariableView(VariableModel model) { - _model = model; - } - - public IMember Type { get; } - public string Name => _model.Name; - } -} diff --git a/src/Caching/Test/BasicTests.cs b/src/Caching/Test/BasicTests.cs index 8b224d1b3..7ad12a1ab 100644 --- a/src/Caching/Test/BasicTests.cs +++ b/src/Caching/Test/BasicTests.cs @@ -14,7 +14,6 @@ // permissions and limitations under the License. using System.IO; -using System.Reflection; using System.Threading.Tasks; using Microsoft.Python.Analysis.Caching.Models; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -57,5 +56,13 @@ def func(): var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); } + + [TestMethod, Priority(0)] + public async Task Builtins() { + var analysis = await GetAnalysisAsync(string.Empty); + var model = ModuleModel.FromAnalysis(analysis.Document.Interpreter.ModuleResolution.BuiltinsModule.Analysis); + var json = ToJson(model); + Baseline.CompareToFile(BaselineFileName, json); + } } } diff --git a/src/Caching/Test/Files/Builtins.json b/src/Caching/Test/Files/Builtins.json new file mode 100644 index 000000000..516d793e0 --- /dev/null +++ b/src/Caching/Test/Files/Builtins.json @@ -0,0 +1,2847 @@ +{ + "Name": "builtins", + "Functions": [ + { + "Name": "type", + "Overloads": [ + { + "Parameters": [], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "__build_class__", + "Overloads": [ + { + "Parameters": [ + { + "Name": "func", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "bases", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "metaclass", + "Type": null, + "DefaultValue": null, + "Kind": 3 + }, + { + "Name": "kwds", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "__import__", + "Overloads": [ + { + "Parameters": [ + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "globals", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "locals", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "fromlist", + "Type": "builtins.tuple", + "DefaultValue": "i:builtins.tuple", + "Kind": 0 + }, + { + "Name": "level", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "abs", + "Overloads": [ + { + "Parameters": [ + { + "Name": "x", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "all", + "Overloads": [ + { + "Parameters": [ + { + "Name": "iterable", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "any", + "Overloads": [ + { + "Parameters": [ + { + "Name": "iterable", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "ascii", + "Overloads": [ + { + "Parameters": [ + { + "Name": "obj", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "bin", + "Overloads": [ + { + "Parameters": [ + { + "Name": "number", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "breakpoint", + "Overloads": [ + { + "Parameters": [ + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kws", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "callable", + "Overloads": [ + { + "Parameters": [ + { + "Name": "obj", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "chr", + "Overloads": [ + { + "Parameters": [ + { + "Name": "i", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "compile", + "Overloads": [ + { + "Parameters": [ + { + "Name": "source", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "filename", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "mode", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "flags", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "dont_inherit", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "optimize", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "copyright", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "credits", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "delattr", + "Overloads": [ + { + "Parameters": [ + { + "Name": "obj", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "dir", + "Overloads": [ + { + "Parameters": [ + { + "Name": "object", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:builtins.list" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "divmod", + "Overloads": [ + { + "Parameters": [ + { + "Name": "x", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "y", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:builtins.tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "eval", + "Overloads": [ + { + "Parameters": [ + { + "Name": "source", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "globals", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "locals", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "builtins.object" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "exec", + "Overloads": [ + { + "Parameters": [ + { + "Name": "source", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "globals", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "locals", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "exit", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "code", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "format", + "Overloads": [ + { + "Parameters": [ + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "format_spec", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "getattr", + "Overloads": [ + { + "Parameters": [ + { + "Name": "object", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "default", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "globals", + "Overloads": [ + { + "Parameters": [], + "ReturnType": "i:builtins.dict" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "hasattr", + "Overloads": [ + { + "Parameters": [ + { + "Name": "obj", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "hash", + "Overloads": [ + { + "Parameters": [ + { + "Name": "obj", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "help", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwds", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "hex", + "Overloads": [ + { + "Parameters": [ + { + "Name": "number", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "id", + "Overloads": [ + { + "Parameters": [ + { + "Name": "obj", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "input", + "Overloads": [ + { + "Parameters": [ + { + "Name": "prompt", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "isinstance", + "Overloads": [ + { + "Parameters": [ + { + "Name": "obj", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "class_or_tuple", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "builtins.bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "issubclass", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "class_or_tuple", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "builtins.bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "iter", + "Overloads": [ + { + "Parameters": [ + { + "Name": "callable", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sentinel", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "len", + "Overloads": [ + { + "Parameters": [ + { + "Name": "obj", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "builtins.int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "license", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "locals", + "Overloads": [ + { + "Parameters": [], + "ReturnType": "i:builtins.dict" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "max", + "Overloads": [ + { + "Parameters": [ + { + "Name": "iterable", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "default", + "Type": null, + "DefaultValue": null, + "Kind": 3 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 3 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "min", + "Overloads": [ + { + "Parameters": [ + { + "Name": "iterable", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "default", + "Type": null, + "DefaultValue": null, + "Kind": 3 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 3 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "next", + "Overloads": [ + { + "Parameters": [ + { + "Name": "iterator", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "default", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "oct", + "Overloads": [ + { + "Parameters": [ + { + "Name": "number", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "open", + "Overloads": [ + { + "Parameters": [ + { + "Name": "file", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "mode", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "buffering", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "encoding", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "errors", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "newline", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "closefd", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "opener", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "ord", + "Overloads": [ + { + "Parameters": [ + { + "Name": "c", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "builtins.int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "pow", + "Overloads": [ + { + "Parameters": [ + { + "Name": "x", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "y", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "z", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "print", + "Overloads": [ + { + "Parameters": [], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "quit", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "code", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "range", + "Overloads": [ + { + "Parameters": [], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "repr", + "Overloads": [ + { + "Parameters": [ + { + "Name": "obj", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "round", + "Overloads": [ + { + "Parameters": [ + { + "Name": "number", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "ndigits", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "setattr", + "Overloads": [ + { + "Parameters": [ + { + "Name": "obj", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "sorted", + "Overloads": [ + { + "Parameters": [ + { + "Name": "iterable", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:builtins.list" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "sum", + "Overloads": [ + { + "Parameters": [ + { + "Name": "iterable", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "vars", + "Overloads": [ + { + "Parameters": [ + { + "Name": "object", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:builtins.dict" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + }, + { + "Name": "cmp", + "Overloads": [ + { + "Parameters": [], + "ReturnType": "builtins.int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null + } + ], + "Variables": [], + "Classes": [ + { + "Name": "NotImplementedType", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "__Unknown__", + "Bases": [], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "__NoneType__", + "Bases": [], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "object", + "Bases": [], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "int", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "bool", + "Bases": [ + "builtins.int" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "float", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "complex", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "tuple", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "list", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "dict", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "set", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "frozenset", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "bytes", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "bytes_iterator", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "str", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "str_iterator", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "module", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "function", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "wrapper_descriptor", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "builtin_function_or_method", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "generator", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "property", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "classmethod", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "staticmethod", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "...", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "tuple_iterator", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "list_iterator", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "dict_keys", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "dict_values", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "dict_items", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "set_iterator", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "callable_iterator", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "ArithmeticError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "AssertionError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "AttributeError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "BaseException", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "BlockingIOError", + "Bases": [ + "builtins.OSError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "BrokenPipeError", + "Bases": [ + "builtins.ConnectionError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "BufferError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "BytesWarning", + "Bases": [ + "builtins.Warning" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "ChildProcessError", + "Bases": [ + "builtins.OSError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "ConnectionAbortedError", + "Bases": [ + "builtins.ConnectionError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "ConnectionError", + "Bases": [ + "builtins.OSError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "ConnectionRefusedError", + "Bases": [ + "builtins.ConnectionError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "ConnectionResetError", + "Bases": [ + "builtins.ConnectionError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "DeprecationWarning", + "Bases": [ + "builtins.Warning" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "EOFError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "Exception", + "Bases": [ + "builtins.BaseException" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "FileExistsError", + "Bases": [ + "builtins.OSError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "FileNotFoundError", + "Bases": [ + "builtins.OSError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "FloatingPointError", + "Bases": [ + "builtins.ArithmeticError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "FutureWarning", + "Bases": [ + "builtins.Warning" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "GeneratorExit", + "Bases": [ + "builtins.BaseException" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "ImportError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "ImportWarning", + "Bases": [ + "builtins.Warning" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "IndentationError", + "Bases": [ + "builtins.SyntaxError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "IndexError", + "Bases": [ + "builtins.LookupError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "InterruptedError", + "Bases": [ + "builtins.OSError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "IsADirectoryError", + "Bases": [ + "builtins.OSError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "KeyError", + "Bases": [ + "builtins.LookupError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "KeyboardInterrupt", + "Bases": [ + "builtins.BaseException" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "LookupError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "MemoryError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "ModuleNotFoundError", + "Bases": [ + "builtins.ImportError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "NameError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "NotADirectoryError", + "Bases": [ + "builtins.OSError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "NotImplementedError", + "Bases": [ + "builtins.RuntimeError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "OSError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "OverflowError", + "Bases": [ + "builtins.ArithmeticError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "PendingDeprecationWarning", + "Bases": [ + "builtins.Warning" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "PermissionError", + "Bases": [ + "builtins.OSError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "ProcessLookupError", + "Bases": [ + "builtins.OSError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "RecursionError", + "Bases": [ + "builtins.RuntimeError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "ReferenceError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "ResourceWarning", + "Bases": [ + "builtins.Warning" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "RuntimeError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "RuntimeWarning", + "Bases": [ + "builtins.Warning" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "StopAsyncIteration", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "StopIteration", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "SyntaxError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "SyntaxWarning", + "Bases": [ + "builtins.Warning" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "SystemError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "SystemExit", + "Bases": [ + "builtins.BaseException" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "TabError", + "Bases": [ + "builtins.IndentationError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "TimeoutError", + "Bases": [ + "builtins.OSError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "TypeError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "UnboundLocalError", + "Bases": [ + "builtins.NameError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "UnicodeDecodeError", + "Bases": [ + "builtins.UnicodeError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "UnicodeEncodeError", + "Bases": [ + "builtins.UnicodeError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "UnicodeError", + "Bases": [ + "builtins.ValueError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "UnicodeTranslateError", + "Bases": [ + "builtins.UnicodeError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "UnicodeWarning", + "Bases": [ + "builtins.Warning" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "UserWarning", + "Bases": [ + "builtins.Warning" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "ValueError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "Warning", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "ZeroDivisionError", + "Bases": [ + "builtins.ArithmeticError" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "bytearray", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "enumerate", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "filter", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "map", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "memoryview", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "reversed", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "slice", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "super", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "zip", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "object", + "Bases": [], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "type", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "int", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "bool", + "Bases": [ + "builtins.int" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "int", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "float", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "complex", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "tuple", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "list", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "dict", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "set", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "frozenset", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "bytes", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "bytes_iterator", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "str", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "str_iterator", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "str", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "str_iterator", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "module", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "function", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "wrapper_descriptor", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "builtin_function_or_method", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "generator", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "property", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "classmethod", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "staticmethod", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "...", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "tuple_iterator", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "list_iterator", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "dict_keys", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "dict_values", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "dict_items", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "set_iterator", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "callable_iterator", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "...", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "OSError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "OSError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "NotImplementedType", + "Bases": [ + "builtins.object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + }, + { + "Name": "OSError", + "Bases": [ + "builtins.Exception" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [] + } + ] +} \ No newline at end of file From 4e1657c2ac4dbbbdc63b62cb640b8b1924f52a12 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Fri, 7 Jun 2019 15:39:07 -0700 Subject: [PATCH 51/82] Partial --- src/Analysis/Ast/Impl/Modules/PythonModule.cs | 2 +- .../Impl/Types/Definitions/IPythonModule.cs | 4 +- src/Caching/Impl/Models/FunctionModel.cs | 3 +- src/Caching/Impl/Models/MemberModel.cs | 21 ++++++++ src/Caching/Impl/Models/ModuleModel.cs | 3 +- src/Caching/Impl/Models/PropertyModel.cs | 3 +- src/Caching/Impl/PythonDbModule.cs | 54 ++++++++++++++++++- 7 files changed, 79 insertions(+), 11 deletions(-) create mode 100644 src/Caching/Impl/Models/MemberModel.cs diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.cs index 4907c28f2..a02da1053 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.cs @@ -192,7 +192,7 @@ public virtual IEnumerable GetMemberNames() { /// /// Global cope of the module. /// - public IGlobalScope GlobalScope { get; private set; } + public virtual IGlobalScope GlobalScope { get; private set; } /// /// If module is a stub points to the primary module. diff --git a/src/Analysis/Ast/Impl/Types/Definitions/IPythonModule.cs b/src/Analysis/Ast/Impl/Types/Definitions/IPythonModule.cs index ae86bc87f..d9363c723 100644 --- a/src/Analysis/Ast/Impl/Types/Definitions/IPythonModule.cs +++ b/src/Analysis/Ast/Impl/Types/Definitions/IPythonModule.cs @@ -13,8 +13,6 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. -using System.Threading; -using System.Threading.Tasks; using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Values; @@ -22,7 +20,7 @@ namespace Microsoft.Python.Analysis.Types { /// /// Represents a Python module. /// - public interface IPythonModule : IPythonType, IPythonFile, ILocatedMember { + public interface IPythonModule : IPythonType, IPythonFile { /// /// Module analysis. /// diff --git a/src/Caching/Impl/Models/FunctionModel.cs b/src/Caching/Impl/Models/FunctionModel.cs index ccc4a869e..93dccfb52 100644 --- a/src/Caching/Impl/Models/FunctionModel.cs +++ b/src/Caching/Impl/Models/FunctionModel.cs @@ -17,8 +17,7 @@ using Microsoft.Python.Analysis.Types; namespace Microsoft.Python.Analysis.Caching.Models { - internal sealed class FunctionModel { - public string Name { get; set; } + internal sealed class FunctionModel: MemberModel { public OverloadModel[] Overloads { get; set; } public FunctionAttributes Attributes { get; set; } public string[] Classes { get; set; } diff --git a/src/Caching/Impl/Models/MemberModel.cs b/src/Caching/Impl/Models/MemberModel.cs new file mode 100644 index 000000000..841e2cea1 --- /dev/null +++ b/src/Caching/Impl/Models/MemberModel.cs @@ -0,0 +1,21 @@ +// 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. + +namespace Microsoft.Python.Analysis.Caching.Models { + internal abstract class MemberModel { + public string Name { get; set; } + public string Documentation { get; set; } + } +} diff --git a/src/Caching/Impl/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs index 444d72798..33ba8f344 100644 --- a/src/Caching/Impl/Models/ModuleModel.cs +++ b/src/Caching/Impl/Models/ModuleModel.cs @@ -18,8 +18,7 @@ using Microsoft.Python.Analysis.Values; namespace Microsoft.Python.Analysis.Caching.Models { - internal sealed class ModuleModel { - public string Name { get; set; } + internal sealed class ModuleModel: MemberModel { public FunctionModel[] Functions { get; set; } public VariableModel[] Variables { get; set; } public ClassModel[] Classes { get; set; } diff --git a/src/Caching/Impl/Models/PropertyModel.cs b/src/Caching/Impl/Models/PropertyModel.cs index cf1d079ab..2566f36fc 100644 --- a/src/Caching/Impl/Models/PropertyModel.cs +++ b/src/Caching/Impl/Models/PropertyModel.cs @@ -16,8 +16,7 @@ using Microsoft.Python.Analysis.Types; namespace Microsoft.Python.Analysis.Caching.Models { - internal sealed class PropertyModel { - public string Name { get; set; } + internal sealed class PropertyModel: MemberModel { public string ReturnType { get; set; } public FunctionAttributes Attributes { get; set; } diff --git a/src/Caching/Impl/PythonDbModule.cs b/src/Caching/Impl/PythonDbModule.cs index 7b7eab015..acb2f0efb 100644 --- a/src/Caching/Impl/PythonDbModule.cs +++ b/src/Caching/Impl/PythonDbModule.cs @@ -13,14 +13,15 @@ // 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; using Microsoft.Python.Analysis.Caching.Models; using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; using Microsoft.Python.Core; +using Microsoft.Python.Parsing.Ast; namespace Microsoft.Python.Analysis.Caching { internal sealed class PythonDbModule : SpecializedModule { @@ -47,12 +48,63 @@ public override IMember GetMember(string name) { if(v != null) { return new Variable(name, Construct(v.Value), VariableSource.Declaration, new Location(this)); } + var v = _model.Variables.FirstOrDefault(c => c.Name == name); + if (v != null) { + return new Variable(name, Construct(v.Value), VariableSource.Declaration, new Location(this)); + } return _unknownType; } + public override IGlobalScope GlobalScope => base.GlobalScope; + private IMember Construct(string qualifiedName) { + var components = Split(qualifiedName, out var moduleName, out var isInstance); return null; } + + private string[] Split(string qualifiedName, out string moduleName, out bool isInstance) { + isInstance = qualifiedName.StartsWith("i:"); + qualifiedName = isInstance ? qualifiedName.Substring(2) : qualifiedName; + var components = qualifiedName.Split('.'); + moduleName = components.Length > 0 ? components[0] : null; + return components.Length > 0 ? components.Skip(1).ToArray() : Array.Empty(); + } + + private sealed class GlobalScope : IGlobalScope { + private readonly ModuleModel _model; + private readonly VariableCollection _variables = new VariableCollection(); + public GlobalScope(ModuleModel model, IPythonModule module) { + _model = model; + Module = module; + + foreach (var v in model.Variables) { + _variables.DeclareVariable(v.Name, Construct(v.Value), VariableSource.Declaration, new Location(module)); + } + foreach (var c in model.Classes) { + _variables.DeclareVariable(c.Name, Construct(c), VariableSource.Declaration, new Location(module)); + } + foreach (var f in model.Functions) { + _variables.DeclareVariable(f.Name, Construct(f), VariableSource.Declaration, new Location(module)); + } + // TODO: classes and functions + // TODO: default variables + } + + public string Name => _model.Name; + public ScopeStatement Node => null; + public IScope OuterScope => null; + public IReadOnlyList Children => Array.Empty(); + public IEnumerable EnumerateTowardsGlobal => Enumerable.Empty(); + public IEnumerable EnumerateFromGlobal => Enumerable.Empty(); + public IVariableCollection Variables => _variables; + public IVariableCollection NonLocals => VariableCollection.Empty; + public IVariableCollection Globals => VariableCollection.Empty; + public IPythonModule Module { get; } + IGlobalScope IScope.GlobalScope => this; + + public void DeclareVariable(string name, IMember value, VariableSource source, Location location = default) { } + public void LinkVariable(string name, IVariable v, Location location) => throw new NotImplementedException() { }; + } } } From ade00f4f0b1a1405a733f11e232e23c586cc6c95 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Mon, 10 Jun 2019 16:35:35 -0700 Subject: [PATCH 52/82] Type fixes --- .../Evaluation/ExpressionEval.Collections.cs | 14 +- .../Evaluation/ExpressionEval.Operators.cs | 4 +- .../Analyzer/Evaluation/ExpressionEval.cs | 1 + .../Ast/Impl/Analyzer/ModuleWalker.cs | 4 +- src/Analysis/Ast/Impl/Caching/CacheFolders.cs | 9 +- .../Impl/Extensions/ArgumentSetExtensions.cs | 3 +- .../Ast/Impl/Modules/BuiltinsPythonModule.cs | 2 + .../Modules/CompiledBuiltinPythonModule.cs | 2 + .../Ast/Impl/Modules/CompiledPythonModule.cs | 2 +- .../Modules/Definitions/IModuleManagement.cs | 1 + .../Impl/Modules/Definitions/ModuleType.cs | 3 - .../Ast/Impl/Modules/PythonModule.Analysis.cs | 111 ++++++ .../Ast/Impl/Modules/PythonModule.Ast.cs | 182 +++++++++ .../Ast/Impl/Modules/PythonModule.Content.cs | 87 ++++ .../Modules/PythonModule.Documentation.cs | 76 ++++ .../Ast/Impl/Modules/PythonModule.Id.cs | 63 +++ src/Analysis/Ast/Impl/Modules/PythonModule.cs | 373 +----------------- .../Ast/Impl/Modules/PythonVariableModule.cs | 3 +- .../Ast/Impl/Modules/SentinelModule.cs | 2 + .../Ast/Impl/Modules/SpecializedModule.cs | 1 + .../Ast/Impl/Modules/StubPythonModule.cs | 2 + .../BuiltinsSpecializations.cs | 4 +- .../Typing/Types/TypingDictionaryType.cs | 4 +- .../Typing/Types/TypingIteratorType.cs | 4 +- .../Typing/Types/TypingListType.cs | 6 +- .../Typing/Types/TypingTupleType.cs | 2 +- .../Types/Collections/PythonCollectionType.cs | 32 +- .../Types/Collections/PythonDictionaryType.cs | 4 +- .../Types/Collections/PythonIteratorType.cs | 6 +- .../Impl/Types/Definitions/IPythonModule.cs | 19 +- .../Ast/Impl/Types/PythonClassType.cs | 11 +- .../Values/Collections/PythonCollection.cs | 2 +- .../Values/Collections/PythonDictionary.cs | 26 +- .../Collections/PythonInstanceIterator.cs | 2 +- .../Values/Collections/PythonTypeIterator.cs | 2 +- .../Impl/Interpreter/LibraryType.cs} | 22 +- .../Impl/Interpreter/PythonLibraryPath.cs | 70 ++-- src/Caching/Impl/Models/ClassModel.cs | 6 +- src/Caching/Impl/Models/FunctionModel.cs | 1 + src/Caching/Impl/Models/ModuleModel.cs | 1 + src/Caching/Impl/Models/PropertyModel.cs | 1 + src/Caching/Impl/PythonDbModule.cs | 25 +- src/Caching/Impl/TypeNames.cs | 7 +- src/Caching/Test/BasicTests.cs | 9 + 44 files changed, 726 insertions(+), 485 deletions(-) create mode 100644 src/Analysis/Ast/Impl/Modules/PythonModule.Analysis.cs create mode 100644 src/Analysis/Ast/Impl/Modules/PythonModule.Ast.cs create mode 100644 src/Analysis/Ast/Impl/Modules/PythonModule.Content.cs create mode 100644 src/Analysis/Ast/Impl/Modules/PythonModule.Documentation.cs create mode 100644 src/Analysis/Ast/Impl/Modules/PythonModule.Id.cs rename src/Analysis/{Ast/Impl/Types/Definitions/IPythonFile.cs => Core/Impl/Interpreter/LibraryType.cs} (64%) diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Collections.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Collections.cs index a7469f05a..267ea35f5 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Collections.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Collections.cs @@ -62,7 +62,7 @@ public IMember GetValueFromList(ListExpression expression) { var value = GetValueFromExpression(item) ?? UnknownType; contents.Add(value); } - return PythonCollectionType.CreateList(Module.Interpreter, contents, exact: expression.Items.Count <= MaxCollectionSize); + return PythonCollectionType.CreateList(Module, contents, exact: expression.Items.Count <= MaxCollectionSize); } public IMember GetValueFromDictionary(DictionaryExpression expression) { @@ -72,7 +72,7 @@ public IMember GetValueFromDictionary(DictionaryExpression expression) { var value = GetValueFromExpression(item.SliceStop) ?? UnknownType; contents[key] = value; } - return new PythonDictionary(Interpreter, contents, exact: expression.Items.Count <= MaxCollectionSize); + return new PythonDictionary(Module, contents, exact: expression.Items.Count <= MaxCollectionSize); } private IMember GetValueFromTuple(TupleExpression expression) { @@ -81,7 +81,7 @@ private IMember GetValueFromTuple(TupleExpression expression) { var value = GetValueFromExpression(item) ?? UnknownType; contents.Add(value); } - return PythonCollectionType.CreateTuple(Module.Interpreter, contents, exact: expression.Items.Count <= MaxCollectionSize); + return PythonCollectionType.CreateTuple(Module, contents, exact: expression.Items.Count <= MaxCollectionSize); } public IMember GetValueFromSet(SetExpression expression) { @@ -90,7 +90,7 @@ public IMember GetValueFromSet(SetExpression expression) { var value = GetValueFromExpression(item) ?? UnknownType; contents.Add(value); } - return PythonCollectionType.CreateSet(Interpreter, contents, exact: expression.Items.Count <= MaxCollectionSize); + return PythonCollectionType.CreateSet(Module, contents, exact: expression.Items.Count <= MaxCollectionSize); } public IMember GetValueFromGenerator(GeneratorExpression expression) { @@ -110,14 +110,14 @@ public IMember GetValueFromComprehension(Comprehension node) { switch (node) { case ListComprehension lc: var v1 = GetValueFromExpression(lc.Item) ?? UnknownType; - return PythonCollectionType.CreateList(Interpreter, new[] { v1 }); + return PythonCollectionType.CreateList(Module, new[] { v1 }); case SetComprehension sc: var v2 = GetValueFromExpression(sc.Item) ?? UnknownType; - return PythonCollectionType.CreateSet(Interpreter, new[] { v2 }); + return PythonCollectionType.CreateSet(Module, new[] { v2 }); case DictionaryComprehension dc: var k = GetValueFromExpression(dc.Key) ?? UnknownType; var v = GetValueFromExpression(dc.Value) ?? UnknownType; - return new PythonDictionary(new PythonDictionaryType(Interpreter), new Dictionary { { k, v } }); + return new PythonDictionary(new PythonDictionaryType(Interpreter.ModuleResolution.BuiltinsModule), new Dictionary { { k, v } }); } return UnknownType; diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Operators.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Operators.cs index b9676e19b..16f89c794 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Operators.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Operators.cs @@ -106,9 +106,9 @@ private IMember GetValueFromBinaryOp(Expression expr) { switch (leftTypeId) { case BuiltinTypeId.List: - return PythonCollectionType.CreateConcatenatedList(Module.Interpreter, lc, rc); + return PythonCollectionType.CreateConcatenatedList(Module, lc, rc); case BuiltinTypeId.Tuple: - return PythonCollectionType.CreateConcatenatedTuple(Module.Interpreter, lc, rc); + return PythonCollectionType.CreateConcatenatedTuple(Module, lc, rc); } } diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs index e094e18e5..82e48e264 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.cs @@ -59,6 +59,7 @@ public ExpressionEval(IServiceContainer services, IPythonModule module, GlobalSc public ModuleSymbolTable SymbolTable { get; } = new ModuleSymbolTable(); public IPythonType UnknownType => Interpreter.UnknownType; public Location DefaultLocation { get; } + public IPythonModule BuiltinsModule => Interpreter.ModuleResolution.BuiltinsModule; public LocationInfo GetLocationInfo(Node node) => node?.GetLocation(Module) ?? LocationInfo.Empty; diff --git a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs index 2463dfc03..78722d851 100644 --- a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs +++ b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs @@ -107,7 +107,7 @@ private void HandleAllAppendExtend(CallExpression node) { IPythonCollection values = null; switch (me.Name) { case "append": - values = PythonCollectionType.CreateList(Module.Interpreter, new List { v }, exact: true); + values = PythonCollectionType.CreateList(Module, new List { v }, exact: true); break; case "extend": values = v as IPythonCollection; @@ -129,7 +129,7 @@ private void ExtendAll(Node location, IPythonCollection values) { } var all = scope.Variables[AllVariableName]?.Value as IPythonCollection; - var list = PythonCollectionType.CreateConcatenatedList(Module.Interpreter, all, values); + var list = PythonCollectionType.CreateConcatenatedList(Module, all, values); var source = list.IsGeneric() ? VariableSource.Generic : VariableSource.Declaration; Eval.DeclareVariable(AllVariableName, list, source, location); diff --git a/src/Analysis/Ast/Impl/Caching/CacheFolders.cs b/src/Analysis/Ast/Impl/Caching/CacheFolders.cs index cfe84dc03..36d5f8b91 100644 --- a/src/Analysis/Ast/Impl/Caching/CacheFolders.cs +++ b/src/Analysis/Ast/Impl/Caching/CacheFolders.cs @@ -36,10 +36,11 @@ public CacheFolderService(IServiceContainer services, string cacheRootFolder) { public string GetFileNameFromContent(string content) { // File name depends on the content so we can distinguish between different versions. - var hash = SHA256.Create(); - return Convert - .ToBase64String(hash.ComputeHash(new UTF8Encoding(false).GetBytes(content))) - .Replace('/', '_').Replace('+', '-'); + using (var hash = SHA256.Create()) { + return Convert + .ToBase64String(hash.ComputeHash(new UTF8Encoding(false).GetBytes(content))) + .Replace('/', '_').Replace('+', '-'); + } } private static string GetCacheFolder(IServiceContainer services) { diff --git a/src/Analysis/Ast/Impl/Extensions/ArgumentSetExtensions.cs b/src/Analysis/Ast/Impl/Extensions/ArgumentSetExtensions.cs index bd2cdf0d4..3b565d4e1 100644 --- a/src/Analysis/Ast/Impl/Extensions/ArgumentSetExtensions.cs +++ b/src/Analysis/Ast/Impl/Extensions/ArgumentSetExtensions.cs @@ -15,6 +15,7 @@ using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using Microsoft.Python.Analysis.Analyzer.Evaluation; using Microsoft.Python.Analysis.Types; @@ -57,7 +58,7 @@ internal static void DeclareParametersInScope(this IArgumentSet args, Expression } if (args.ListArgument != null && !string.IsNullOrEmpty(args.ListArgument.Name)) { - var type = new PythonCollectionType(null, BuiltinTypeId.List, eval.Interpreter, false); + var type = new PythonCollectionType(null, BuiltinTypeId.List, eval.BuiltinsModule, false); var list = new PythonCollection(type, args.ListArgument.Values); eval.DeclareVariable(args.ListArgument.Name, list, VariableSource.Declaration, args.ListArgument.Location); } diff --git a/src/Analysis/Ast/Impl/Modules/BuiltinsPythonModule.cs b/src/Analysis/Ast/Impl/Modules/BuiltinsPythonModule.cs index f792b565f..b1e6806af 100644 --- a/src/Analysis/Ast/Impl/Modules/BuiltinsPythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/BuiltinsPythonModule.cs @@ -36,6 +36,8 @@ internal sealed class BuiltinsPythonModule : CompiledPythonModule, IBuiltinsPyth public BuiltinsPythonModule(string moduleName, string filePath, IServiceContainer services) : base(moduleName, ModuleType.Builtins, filePath, null, services) { } // TODO: builtins stub + public override string UniqueId => $"{Name}({Interpreter.Configuration.Version})"; + public override IMember GetMember(string name) => _hiddenNames.Contains(name) ? null : base.GetMember(name); public IMember GetAnyMember(string name) => base.GetMember(name); diff --git a/src/Analysis/Ast/Impl/Modules/CompiledBuiltinPythonModule.cs b/src/Analysis/Ast/Impl/Modules/CompiledBuiltinPythonModule.cs index e020e7b26..693c82545 100644 --- a/src/Analysis/Ast/Impl/Modules/CompiledBuiltinPythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/CompiledBuiltinPythonModule.cs @@ -26,6 +26,8 @@ internal sealed class CompiledBuiltinPythonModule : CompiledPythonModule { public CompiledBuiltinPythonModule(string moduleName, IPythonModule stub, IServiceContainer services) : base(moduleName, ModuleType.CompiledBuiltin, MakeFakeFilePath(moduleName, services), stub, services) { } + public override string UniqueId => $"{Name}({Interpreter.Configuration.Version})"; + protected override string[] GetScrapeArguments(IPythonInterpreter interpreter) => !InstallPath.TryGetFile("scrape_module.py", out var sm) ? null : new [] { "-W", "ignore", "-B", "-E", sm, "-u8", Name }; diff --git a/src/Analysis/Ast/Impl/Modules/CompiledPythonModule.cs b/src/Analysis/Ast/Impl/Modules/CompiledPythonModule.cs index 913a872d4..1335a8ccf 100644 --- a/src/Analysis/Ast/Impl/Modules/CompiledPythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/CompiledPythonModule.cs @@ -93,7 +93,7 @@ private string ScrapeModule() { try { using (var process = new Process()) { process.StartInfo = startInfo; - process.ErrorDataReceived += new DataReceivedEventHandler((s, e) => { }); + process.ErrorDataReceived += (s, e) => { }; process.Start(); process.BeginErrorReadLine(); diff --git a/src/Analysis/Ast/Impl/Modules/Definitions/IModuleManagement.cs b/src/Analysis/Ast/Impl/Modules/Definitions/IModuleManagement.cs index 4fbc1922e..fa7b260fa 100644 --- a/src/Analysis/Ast/Impl/Modules/Definitions/IModuleManagement.cs +++ b/src/Analysis/Ast/Impl/Modules/Definitions/IModuleManagement.cs @@ -14,6 +14,7 @@ // permissions and limitations under the License. using System; +using System.Collections; using System.Collections.Generic; using System.Threading; using Microsoft.Python.Analysis.Caching; diff --git a/src/Analysis/Ast/Impl/Modules/Definitions/ModuleType.cs b/src/Analysis/Ast/Impl/Modules/Definitions/ModuleType.cs index b017e0708..64ab06683 100644 --- a/src/Analysis/Ast/Impl/Modules/Definitions/ModuleType.cs +++ b/src/Analysis/Ast/Impl/Modules/Definitions/ModuleType.cs @@ -13,10 +13,7 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. -using System; - namespace Microsoft.Python.Analysis.Modules { - [Flags] public enum ModuleType { /// /// Module is user file in the workspace. diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.Analysis.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.Analysis.cs new file mode 100644 index 000000000..a346e78f5 --- /dev/null +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.Analysis.cs @@ -0,0 +1,111 @@ +// 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.Diagnostics; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Python.Analysis.Analyzer; +using Microsoft.Python.Analysis.Diagnostics; +using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Analysis.Values; +using Microsoft.Python.Core; + +namespace Microsoft.Python.Analysis.Modules { + /// + /// Primary base for all modules and user documents. Provides access + /// to AST and the module analysis. + /// + [DebuggerDisplay("{Name} : {ModuleType}")] + internal partial class PythonModule { + public void NotifyAnalysisBegins() { + lock (AnalysisLock) { + if (Analysis is LibraryAnalysis) { + var sw = Log != null ? Stopwatch.StartNew() : null; + lock (AnalysisLock) { + _astMap[this] = RecreateAst(); + } + sw?.Stop(); + Log?.Log(TraceEventType.Verbose, $"Reloaded AST of {Name} in {sw?.Elapsed.TotalMilliseconds} ms"); + } + + if (_updated) { + _updated = false; + // In all variables find those imported, then traverse imported modules + // and remove references to this module. If variable refers to a module, + // recurse into module but only process global scope. + + if (GlobalScope == null) { + return; + } + + // TODO: Figure out where the nulls below are coming from. + var importedVariables = ((IScope)GlobalScope) + .TraverseDepthFirst(c => c?.Children ?? Enumerable.Empty()) + .SelectMany(s => s?.Variables ?? VariableCollection.Empty) + .Where(v => v?.Source == VariableSource.Import); + + foreach (var v in importedVariables) { + v.RemoveReferences(this); + if (v.Value is IPythonModule module) { + RemoveReferencesInModule(module); + } + } + } + } + } + + public void NotifyAnalysisComplete(int version, ModuleWalker walker, bool isFinalPass) { + lock (AnalysisLock) { + if (version < Analysis.Version) { + return; + } + + Analysis = CreateAnalysis(version, walker, isFinalPass); + GlobalScope = Analysis.GlobalScope; + + // Derived classes can override OnAnalysisComplete if they want + // to perform additional actions on the completed analysis such + // as declare additional variables, etc. + OnAnalysisComplete(); + ContentState = State.Analyzed; + + if (ModuleType != ModuleType.User) { + _buffer.Reset(_buffer.Version, string.Empty); + } + } + + // Do not report issues with libraries or stubs + if (ModuleType == ModuleType.User) { + _diagnosticsService?.Replace(Uri, Analysis.Diagnostics, DiagnosticSource.Analysis); + } + + NewAnalysis?.Invoke(this, EventArgs.Empty); + } + + protected virtual void OnAnalysisComplete() { } + + public IDocumentAnalysis GetAnyAnalysis() => Analysis; + + public Task GetAnalysisAsync(int waitTime = 200, CancellationToken cancellationToken = default) + => Services.GetService().GetAnalysisAsync(this, waitTime, cancellationToken); + + private IDocumentAnalysis CreateAnalysis(int version, ModuleWalker walker, bool isFinalPass) + => ModuleType == ModuleType.Library && isFinalPass + ? new LibraryAnalysis(this, version, walker.Eval.Services, walker.GlobalScope, walker.StarImportMemberNames) + : (IDocumentAnalysis)new DocumentAnalysis(this, version, walker.GlobalScope, walker.Eval, walker.StarImportMemberNames); + } +} diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.Ast.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.Ast.cs new file mode 100644 index 000000000..08b69fd28 --- /dev/null +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.Ast.cs @@ -0,0 +1,182 @@ +// 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.Diagnostics; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Python.Analysis.Analyzer; +using Microsoft.Python.Analysis.Diagnostics; +using Microsoft.Python.Core.Text; +using Microsoft.Python.Parsing; +using Microsoft.Python.Parsing.Ast; + +namespace Microsoft.Python.Analysis.Modules { + internal partial class PythonModule { + #region Parsing + /// + /// Returns document parse tree. + /// + public async Task GetAstAsync(CancellationToken cancellationToken = default) { + Task t = null; + while (true) { + lock (AnalysisLock) { + if (t == _parsingTask) { + break; + } + cancellationToken.ThrowIfCancellationRequested(); + t = _parsingTask; + } + try { + await (t ?? Task.CompletedTask); + break; + } catch (OperationCanceledException) { + // Parsing as canceled, try next task. + } + } + cancellationToken.ThrowIfCancellationRequested(); + return this.GetAst(); + } + + public PythonAst GetAnyAst() => GetAstNode(this); + + /// + /// Provides collection of parsing errors, if any. + /// + public IEnumerable GetParseErrors() => _parseErrors.ToArray(); + + private void Parse() { + _parseCts?.Cancel(); + _parseCts = new CancellationTokenSource(); + + _linkedParseCts?.Dispose(); + _linkedParseCts = CancellationTokenSource.CreateLinkedTokenSource(_disposeToken.CancellationToken, _parseCts.Token); + + ContentState = State.Parsing; + _parsingTask = Task.Run(() => Parse(_linkedParseCts.Token), _linkedParseCts.Token); + } + + private void Parse(CancellationToken cancellationToken) { + CollectingErrorSink sink = null; + int version; + Parser parser; + + //Log?.Log(TraceEventType.Verbose, $"Parse begins: {Name}"); + + lock (AnalysisLock) { + version = _buffer.Version; + var options = new ParserOptions { + StubFile = FilePath != null && Path.GetExtension(FilePath).Equals(".pyi", FileSystem.StringComparison) + }; + if (ModuleType == ModuleType.User) { + sink = new CollectingErrorSink(); + options.ErrorSink = sink; + } + parser = Parser.CreateParser(new StringReader(_buffer.Text), Interpreter.LanguageVersion, options); + } + + var ast = parser.ParseFile(Uri); + + //Log?.Log(TraceEventType.Verbose, $"Parse complete: {Name}"); + + lock (AnalysisLock) { + cancellationToken.ThrowIfCancellationRequested(); + if (version != _buffer.Version) { + throw new OperationCanceledException(); + } + + // Stored nodes are no longer valid. + _astMap.Clear(); + _astMap[this] = ast; + + _parseErrors = sink?.Diagnostics ?? Array.Empty(); + + // Do not report issues with libraries or stubs + if (sink != null) { + _diagnosticsService?.Replace(Uri, _parseErrors, DiagnosticSource.Parser); + } + + ContentState = State.Parsed; + Analysis = new EmptyAnalysis(Services, this); + } + + NewAst?.Invoke(this, EventArgs.Empty); + + if (ContentState < State.Analyzing) { + ContentState = State.Analyzing; + + var analyzer = Services.GetService(); + analyzer.EnqueueDocumentForAnalysis(this, version); + } + + lock (AnalysisLock) { + _parsingTask = null; + } + } + + private class CollectingErrorSink : ErrorSink { + private readonly List _diagnostics = new List(); + + public IReadOnlyList Diagnostics => _diagnostics; + public override void Add(string message, SourceSpan span, int errorCode, Severity severity) + => _diagnostics.Add(new DiagnosticsEntry(message, span, $"parser-{errorCode}", severity, DiagnosticSource.Parser)); + } + #endregion + + #region IAstNodeContainer + public T GetAstNode(object o) where T : Node { + lock (AnalysisLock) { + return _astMap.TryGetValue(o, out var n) ? (T)n : null; + } + } + + public void AddAstNode(object o, Node n) { + lock (AnalysisLock) { + Debug.Assert(!_astMap.ContainsKey(o) || _astMap[o] == n); + _astMap[o] = n; + } + } + + public void ClearAst() { + lock (AnalysisLock) { + if (ModuleType != ModuleType.User) { + _astMap.Clear(); + } + } + } + public void ClearContent() { + lock (AnalysisLock) { + if (ModuleType != ModuleType.User) { + _buffer.Reset(_buffer.Version, string.Empty); + } + } + } + #endregion + + private PythonAst RecreateAst() { + lock (AnalysisLock) { + ContentState = State.None; + LoadContent(); + var parser = Parser.CreateParser(new StringReader(_buffer.Text), Interpreter.LanguageVersion, ParserOptions.Default); + var ast = parser.ParseFile(Uri); + ContentState = State.Parsed; + return ast; + } + } + } +} diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.Content.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.Content.cs new file mode 100644 index 000000000..911f604f8 --- /dev/null +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.Content.cs @@ -0,0 +1,87 @@ +// 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.IO; +using System.Threading; +using Microsoft.Python.Analysis.Analyzer; +using Microsoft.Python.Analysis.Documents; +using Microsoft.Python.Core.IO; + +namespace Microsoft.Python.Analysis.Modules { + internal partial class PythonModule { + public void Update(IEnumerable changes) { + lock (AnalysisLock) { + _parseCts?.Cancel(); + _parseCts = new CancellationTokenSource(); + + _linkedParseCts?.Dispose(); + _linkedParseCts = CancellationTokenSource.CreateLinkedTokenSource(_disposeToken.CancellationToken, _parseCts.Token); + + _buffer.Update(changes); + _updated = true; + + Parse(); + } + + Services.GetService().InvalidateAnalysis(this); + } + + public void Reset(string content) { + lock (AnalysisLock) { + if (content != Content) { + ContentState = State.None; + InitializeContent(content, _buffer.Version + 1); + } + } + + Services.GetService().InvalidateAnalysis(this); + } + + protected virtual string LoadContent() { + if (ContentState < State.Loading) { + ContentState = State.Loading; + try { + var code = FileSystem.ReadTextWithRetry(FilePath); + ContentState = State.Loaded; + return code; + } catch (IOException) { } catch (UnauthorizedAccessException) { } + } + return null; // Keep content as null so module can be loaded later. + } + + private void InitializeContent(string content, int version) { + lock (AnalysisLock) { + LoadContent(content, version); + + var startParse = ContentState < State.Parsing && (_parsingTask == null || version > 0); + if (startParse) { + Parse(); + } + } + } + + private void LoadContent(string content, int version) { + if (ContentState < State.Loading) { + try { + content = content ?? LoadContent(); + _buffer.Reset(version, content); + ContentState = State.Loaded; + } catch (IOException) { } catch (UnauthorizedAccessException) { } + } + } + } +} diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.Documentation.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.Documentation.cs new file mode 100644 index 000000000..121fd1320 --- /dev/null +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.Documentation.cs @@ -0,0 +1,76 @@ +// 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.IO; +using System.Linq; +using System.Text; +using Microsoft.Python.Core; + +namespace Microsoft.Python.Analysis.Modules { + /// + /// Primary base for all modules and user documents. Provides access + /// to AST and the module analysis. + /// + internal partial class PythonModule { + private string TryGetDocFromModuleInitFile() { + if (string.IsNullOrEmpty(FilePath) || !FileSystem.FileExists(FilePath)) { + return string.Empty; + } + + try { + using (var sr = new StreamReader(FilePath)) { + string quote = null; + string line; + while (true) { + line = sr.ReadLine()?.Trim(); + if (line == null) { + break; + } + if (line.Length == 0 || line.StartsWithOrdinal("#")) { + continue; + } + if (line.StartsWithOrdinal("\"\"\"") || line.StartsWithOrdinal("r\"\"\"")) { + quote = "\"\"\""; + } else if (line.StartsWithOrdinal("'''") || line.StartsWithOrdinal("r'''")) { + quote = "'''"; + } + break; + } + + if (line != null && quote != null) { + // Check if it is a single-liner, but do distinguish from """ + // Also, handle quadruple+ quotes. + line = line.Trim(); + line = line.All(c => c == quote[0]) ? quote : line; + if (line.EndsWithOrdinal(quote) && line.IndexOf(quote, StringComparison.Ordinal) < line.LastIndexOf(quote, StringComparison.Ordinal)) { + return line.Substring(quote.Length, line.Length - 2 * quote.Length).Trim(); + } + var sb = new StringBuilder(); + while (true) { + line = sr.ReadLine(); + if (line == null || line.EndsWithOrdinal(quote)) { + break; + } + sb.AppendLine(line); + } + return sb.ToString(); + } + } + } catch (IOException) { } catch (UnauthorizedAccessException) { } + return string.Empty; + } + } +} diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.Id.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.Id.cs new file mode 100644 index 000000000..df2990b8e --- /dev/null +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.Id.cs @@ -0,0 +1,63 @@ +// 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.IO; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using Microsoft.Python.Analysis.Core.Interpreter; +using Microsoft.Python.Core.IO; + +namespace Microsoft.Python.Analysis.Modules { + internal partial class PythonModule { + private string CalculateUniqueId() { + var sitePackagesPath = PythonLibraryPath.GetSitePackagesPath(Interpreter.Configuration); + if (FileSystem.IsPathUnderRoot(sitePackagesPath, FilePath)) { + // If module is in site-packages and is versioned, then unique id = name + version + interpreter version. + // Example: 'lxml' and 'lxml-4.2.5.dist-info'. + var moduleFolder = Path.GetDirectoryName(Path.GetDirectoryName(FilePath)); + var folders = FileSystem + .GetFileSystemEntries(moduleFolder, "*-*.dist-info", SearchOption.TopDirectoryOnly) + .Where(p => p.StartsWith(Name, StringComparison.OrdinalIgnoreCase)) // Module name can be capitalized differently. + .ToArray(); + if (folders.Length == 2) { + return Path.GetFileNameWithoutExtension(folders[1]); + } + } + + var standardLibraryPath = PythonLibraryPath.GetStandardLibraryPath(Interpreter.Configuration); + if (FileSystem.IsPathUnderRoot(standardLibraryPath, FilePath)) { + // If module is a standard library, unique id is its name + interpreter version. + return $"{Name}({Interpreter.Configuration.Version})"; + } + + // If all else fails, hash the entire content. + return $"{Name}.{HashModuleContent(Path.GetDirectoryName(FilePath))}"; + } + + private string HashModuleContent(string moduleFolder) { + // TODO: consider async? What about *.pyd? + using (var sha256 = SHA256.Create()) { + var bytes = FileSystem + .GetFileSystemEntries(moduleFolder, "*.py", SearchOption.AllDirectories) + .Select(p => sha256.ComputeHash(new UTF8Encoding(false).GetBytes(FileSystem.ReadTextWithRetry(p)))) + .Aggregate((b1, b2) => b1.Zip(b2, (x1, x2) => (byte)(x1 ^ x2)).ToArray()); + + return Convert.ToBase64String(bytes).Replace('/', '_').Replace('+', '-'); + } + } + } +} diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.cs index a02da1053..18a88cef3 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.cs @@ -16,9 +16,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.IO; using System.Linq; -using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.Python.Analysis.Analyzer; @@ -32,8 +30,6 @@ using Microsoft.Python.Core.Disposables; using Microsoft.Python.Core.IO; using Microsoft.Python.Core.Logging; -using Microsoft.Python.Core.Text; -using Microsoft.Python.Parsing; using Microsoft.Python.Parsing.Ast; namespace Microsoft.Python.Analysis.Modules { @@ -42,7 +38,7 @@ namespace Microsoft.Python.Analysis.Modules { /// to AST and the module analysis. /// [DebuggerDisplay("{Name} : {ModuleType}")] - internal class PythonModule : LocatedMember, IDocument, IAnalyzable, IEquatable, IAstNodeContainer { + internal partial class PythonModule : LocatedMember, IDocument, IAnalyzable, IEquatable, IAstNodeContainer { private enum State { None, Loading, @@ -64,6 +60,7 @@ private enum State { private CancellationTokenSource _linkedParseCts; // combined with 'dispose' cts private Task _parsingTask; private bool _updated; + private string _uniqueId; protected ILogger Log { get; } protected IFileSystem FileSystem { get; } @@ -173,12 +170,9 @@ public virtual IEnumerable GetMemberNames() { public override LocationInfo Definition => new LocationInfo(Uri.ToAbsolutePath(), Uri, 0, 0); #endregion - #region IPythonFile + #region IPythonModule public virtual string FilePath { get; } public virtual Uri Uri { get; } - #endregion - - #region IPythonModule public IDocumentAnalysis Analysis { get; private set; } public IPythonInterpreter Interpreter { get; } @@ -200,6 +194,20 @@ public virtual IEnumerable GetMemberNames() { /// wants to see library code and not a stub. /// public IPythonModule PrimaryModule { get; private set; } + + /// + /// Unique identifier of the module. Derives from module type, + /// library type, version (if available) and the installation path. + /// + public virtual string UniqueId { + get { + if (string.IsNullOrEmpty(FilePath) || ModuleType == ModuleType.User || ModuleType == ModuleType.Stub) { + return string.Empty; + } + return string.IsNullOrEmpty(_uniqueId) ? (_uniqueId = CalculateUniqueId()) : _uniqueId; + } + } + #endregion #region IDisposable @@ -238,341 +246,10 @@ protected virtual void Dispose(bool disposing) { public string Content => _buffer.Text; #endregion - #region Parsing - /// - /// Returns document parse tree. - /// - public async Task GetAstAsync(CancellationToken cancellationToken = default) { - Task t = null; - while (true) { - lock (AnalysisLock) { - if (t == _parsingTask) { - break; - } - cancellationToken.ThrowIfCancellationRequested(); - t = _parsingTask; - } - try { - await (t ?? Task.CompletedTask); - break; - } catch (OperationCanceledException) { - // Parsing as canceled, try next task. - } - } - cancellationToken.ThrowIfCancellationRequested(); - return this.GetAst(); - } - - public PythonAst GetAnyAst() => GetAstNode(this); - - /// - /// Provides collection of parsing errors, if any. - /// - public IEnumerable GetParseErrors() => _parseErrors.ToArray(); - - public void Update(IEnumerable changes) { - lock (AnalysisLock) { - _parseCts?.Cancel(); - _parseCts = new CancellationTokenSource(); - - _linkedParseCts?.Dispose(); - _linkedParseCts = CancellationTokenSource.CreateLinkedTokenSource(_disposeToken.CancellationToken, _parseCts.Token); - - _buffer.Update(changes); - _updated = true; - - Parse(); - } - - Services.GetService().InvalidateAnalysis(this); - } - - public void Reset(string content) { - lock (AnalysisLock) { - if (content != Content) { - ContentState = State.None; - InitializeContent(content, _buffer.Version + 1); - } - } - - Services.GetService().InvalidateAnalysis(this); - } - - private void Parse() { - _parseCts?.Cancel(); - _parseCts = new CancellationTokenSource(); - - _linkedParseCts?.Dispose(); - _linkedParseCts = CancellationTokenSource.CreateLinkedTokenSource(_disposeToken.CancellationToken, _parseCts.Token); - - ContentState = State.Parsing; - _parsingTask = Task.Run(() => Parse(_linkedParseCts.Token), _linkedParseCts.Token); - } - - private void Parse(CancellationToken cancellationToken) { - CollectingErrorSink sink = null; - int version; - Parser parser; - - //Log?.Log(TraceEventType.Verbose, $"Parse begins: {Name}"); - - lock (AnalysisLock) { - version = _buffer.Version; - var options = new ParserOptions { - StubFile = FilePath != null && Path.GetExtension(FilePath).Equals(".pyi", FileSystem.StringComparison) - }; - if (ModuleType == ModuleType.User) { - sink = new CollectingErrorSink(); - options.ErrorSink = sink; - } - parser = Parser.CreateParser(new StringReader(_buffer.Text), Interpreter.LanguageVersion, options); - } - - var ast = parser.ParseFile(Uri); - - //Log?.Log(TraceEventType.Verbose, $"Parse complete: {Name}"); - - lock (AnalysisLock) { - cancellationToken.ThrowIfCancellationRequested(); - if (version != _buffer.Version) { - throw new OperationCanceledException(); - } - - // Stored nodes are no longer valid. - _astMap.Clear(); - _astMap[this] = ast; - - _parseErrors = sink?.Diagnostics ?? Array.Empty(); - - // Do not report issues with libraries or stubs - if (sink != null) { - _diagnosticsService?.Replace(Uri, _parseErrors, DiagnosticSource.Parser); - } - - ContentState = State.Parsed; - Analysis = new EmptyAnalysis(Services, this); - } - - NewAst?.Invoke(this, EventArgs.Empty); - - if (ContentState < State.Analyzing) { - ContentState = State.Analyzing; - - var analyzer = Services.GetService(); - analyzer.EnqueueDocumentForAnalysis(this, version); - } - - lock (AnalysisLock) { - _parsingTask = null; - } - } - - private class CollectingErrorSink : ErrorSink { - private readonly List _diagnostics = new List(); - - public IReadOnlyList Diagnostics => _diagnostics; - public override void Add(string message, SourceSpan span, int errorCode, Severity severity) - => _diagnostics.Add(new DiagnosticsEntry(message, span, $"parser-{errorCode}", severity, DiagnosticSource.Parser)); - } - #endregion - - #region IAnalyzable - - public void NotifyAnalysisBegins() { - lock (AnalysisLock) { - if (Analysis is LibraryAnalysis) { - var sw = Log != null ? Stopwatch.StartNew() : null; - lock (AnalysisLock) { - _astMap[this] = RecreateAst(); - } - sw?.Stop(); - Log?.Log(TraceEventType.Verbose, $"Reloaded AST of {Name} in {sw?.Elapsed.TotalMilliseconds} ms"); - } - - if (_updated) { - _updated = false; - // In all variables find those imported, then traverse imported modules - // and remove references to this module. If variable refers to a module, - // recurse into module but only process global scope. - - if (GlobalScope == null) { - return; - } - - // TODO: Figure out where the nulls below are coming from. - var importedVariables = ((IScope)GlobalScope) - .TraverseDepthFirst(c => c?.Children ?? Enumerable.Empty()) - .SelectMany(s => s?.Variables ?? VariableCollection.Empty) - .Where(v => v?.Source == VariableSource.Import); - - foreach (var v in importedVariables) { - v.RemoveReferences(this); - if (v.Value is IPythonModule module) { - RemoveReferencesInModule(module); - } - } - } - } - } - - public void NotifyAnalysisComplete(int version, ModuleWalker walker, bool isFinalPass) { - lock (AnalysisLock) { - if (version < Analysis.Version) { - return; - } - - Analysis = CreateAnalysis(version, walker, isFinalPass); - GlobalScope = Analysis.GlobalScope; - - // Derived classes can override OnAnalysisComplete if they want - // to perform additional actions on the completed analysis such - // as declare additional variables, etc. - OnAnalysisComplete(); - ContentState = State.Analyzed; - - if (ModuleType != ModuleType.User) { - _buffer.Reset(_buffer.Version, string.Empty); - } - } - - // Do not report issues with libraries or stubs - if (ModuleType == ModuleType.User) { - _diagnosticsService?.Replace(Uri, Analysis.Diagnostics, DiagnosticSource.Analysis); - } - - NewAnalysis?.Invoke(this, EventArgs.Empty); - } - - protected virtual void OnAnalysisComplete() { } - #endregion - #region IEquatable public bool Equals(IPythonModule other) => Name.Equals(other?.Name) && FilePath.Equals(other?.FilePath); #endregion - #region IAstNodeContainer - public T GetAstNode(object o) where T : Node { - lock (AnalysisLock) { - return _astMap.TryGetValue(o, out var n) ? (T)n : null; - } - } - - public void AddAstNode(object o, Node n) { - lock (AnalysisLock) { - Debug.Assert(!_astMap.ContainsKey(o) || _astMap[o] == n); - _astMap[o] = n; - } - } - - public void ClearAst() { - lock (AnalysisLock) { - if (ModuleType != ModuleType.User) { - _astMap.Clear(); - } - } - } - public void ClearContent() { - lock (AnalysisLock) { - if (ModuleType != ModuleType.User) { - _buffer.Reset(_buffer.Version, string.Empty); - } - } - } - #endregion - - #region Analysis - public IDocumentAnalysis GetAnyAnalysis() => Analysis; - - public Task GetAnalysisAsync(int waitTime = 200, CancellationToken cancellationToken = default) - => Services.GetService().GetAnalysisAsync(this, waitTime, cancellationToken); - - #endregion - - #region Content management - protected virtual string LoadContent() { - if (ContentState < State.Loading) { - ContentState = State.Loading; - try { - var code = FileSystem.ReadTextWithRetry(FilePath); - ContentState = State.Loaded; - return code; - } catch (IOException) { } catch (UnauthorizedAccessException) { } - } - return null; // Keep content as null so module can be loaded later. - } - - private void InitializeContent(string content, int version) { - lock (AnalysisLock) { - LoadContent(content, version); - - var startParse = ContentState < State.Parsing && (_parsingTask == null || version > 0); - if (startParse) { - Parse(); - } - } - } - - private void LoadContent(string content, int version) { - if (ContentState < State.Loading) { - try { - content = content ?? LoadContent(); - _buffer.Reset(version, content); - ContentState = State.Loaded; - } catch (IOException) { } catch (UnauthorizedAccessException) { } - } - } - #endregion - - #region Documentation - private string TryGetDocFromModuleInitFile() { - if (string.IsNullOrEmpty(FilePath) || !FileSystem.FileExists(FilePath)) { - return string.Empty; - } - - try { - using (var sr = new StreamReader(FilePath)) { - string quote = null; - string line; - while (true) { - line = sr.ReadLine()?.Trim(); - if (line == null) { - break; - } - if (line.Length == 0 || line.StartsWithOrdinal("#")) { - continue; - } - if (line.StartsWithOrdinal("\"\"\"") || line.StartsWithOrdinal("r\"\"\"")) { - quote = "\"\"\""; - } else if (line.StartsWithOrdinal("'''") || line.StartsWithOrdinal("r'''")) { - quote = "'''"; - } - break; - } - - if (line != null && quote != null) { - // Check if it is a single-liner, but do distinguish from """ - // Also, handle quadruple+ quotes. - line = line.Trim(); - line = line.All(c => c == quote[0]) ? quote : line; - if (line.EndsWithOrdinal(quote) && line.IndexOf(quote, StringComparison.Ordinal) < line.LastIndexOf(quote, StringComparison.Ordinal)) { - return line.Substring(quote.Length, line.Length - 2 * quote.Length).Trim(); - } - var sb = new StringBuilder(); - while (true) { - line = sr.ReadLine(); - if (line == null || line.EndsWithOrdinal(quote)) { - break; - } - sb.AppendLine(line); - } - return sb.ToString(); - } - } - } catch (IOException) { } catch (UnauthorizedAccessException) { } - return string.Empty; - } - #endregion - private void RemoveReferencesInModule(IPythonModule module) { if (module.GlobalScope?.Variables != null) { foreach (var v in module.GlobalScope.Variables) { @@ -580,21 +257,5 @@ private void RemoveReferencesInModule(IPythonModule module) { } } } - - private IDocumentAnalysis CreateAnalysis(int version, ModuleWalker walker, bool isFinalPass) - => ModuleType == ModuleType.Library && isFinalPass - ? new LibraryAnalysis(this, version, walker.Eval.Services, walker.GlobalScope, walker.StarImportMemberNames) - : (IDocumentAnalysis)new DocumentAnalysis(this, version, walker.GlobalScope, walker.Eval, walker.StarImportMemberNames); - - private PythonAst RecreateAst() { - lock (AnalysisLock) { - ContentState = State.None; - LoadContent(); - var parser = Parser.CreateParser(new StringReader(_buffer.Text), Interpreter.LanguageVersion, ParserOptions.Default); - var ast = parser.ParseFile(Uri); - ContentState = State.Parsed; - return ast; - } - } } } diff --git a/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs b/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs index 471c25e45..639eecf0d 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs @@ -16,8 +16,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; using Microsoft.Python.Core; @@ -31,6 +29,7 @@ namespace Microsoft.Python.Analysis.Modules { internal sealed class PythonVariableModule : LocatedMember, IPythonModule, IEquatable { private readonly Dictionary _children = new Dictionary(); + public string UniqueId => $"{nameof(PythonVariableModule)}.{Name}"; // TODO: re-work. public string Name { get; } public IPythonModule Module { get; } public IPythonInterpreter Interpreter { get; } diff --git a/src/Analysis/Ast/Impl/Modules/SentinelModule.cs b/src/Analysis/Ast/Impl/Modules/SentinelModule.cs index 9eca1e39e..41b56edd9 100644 --- a/src/Analysis/Ast/Impl/Modules/SentinelModule.cs +++ b/src/Analysis/Ast/Impl/Modules/SentinelModule.cs @@ -19,5 +19,7 @@ namespace Microsoft.Python.Analysis.Modules { internal sealed class SentinelModule : PythonModule { public SentinelModule(string name, IServiceContainer services) : base(name, ModuleType.Unresolved, services) { } + + public override string UniqueId => "unresolved"; } } diff --git a/src/Analysis/Ast/Impl/Modules/SpecializedModule.cs b/src/Analysis/Ast/Impl/Modules/SpecializedModule.cs index 0e3e5fbcb..bb8a31bff 100644 --- a/src/Analysis/Ast/Impl/Modules/SpecializedModule.cs +++ b/src/Analysis/Ast/Impl/Modules/SpecializedModule.cs @@ -33,6 +33,7 @@ internal abstract class SpecializedModule : PythonModule { protected SpecializedModule(string name, string modulePath, IServiceContainer services) : base(name, modulePath, ModuleType.Specialized, null, services) { } + public override string UniqueId => Name; protected override string LoadContent() { // Exceptions are handled in the base return FileSystem.FileExists(FilePath) ? FileSystem.ReadTextWithRetry(FilePath) : string.Empty; diff --git a/src/Analysis/Ast/Impl/Modules/StubPythonModule.cs b/src/Analysis/Ast/Impl/Modules/StubPythonModule.cs index 83fa0ffbe..cb3277086 100644 --- a/src/Analysis/Ast/Impl/Modules/StubPythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/StubPythonModule.cs @@ -29,6 +29,8 @@ public StubPythonModule(string moduleName, string stubPath, bool isTypeshed, ISe IsTypeshed = isTypeshed; } + public override string UniqueId => PrimaryModule.UniqueId; + protected override string LoadContent() { // Exceptions are handled in the base return FileSystem.FileExists(FilePath) ? FileSystem.ReadTextWithRetry(FilePath) : string.Empty; diff --git a/src/Analysis/Ast/Impl/Specializations/BuiltinsSpecializations.cs b/src/Analysis/Ast/Impl/Specializations/BuiltinsSpecializations.cs index 1b29df047..54c905ed3 100644 --- a/src/Analysis/Ast/Impl/Specializations/BuiltinsSpecializations.cs +++ b/src/Analysis/Ast/Impl/Specializations/BuiltinsSpecializations.cs @@ -48,7 +48,7 @@ public static IMember Iterator(IPythonModule module, IPythonFunctionOverload ove } public static IMember List(IPythonInterpreter interpreter, IPythonFunctionOverload overload, IArgumentSet argSet) - => PythonCollectionType.CreateList(interpreter, argSet); + => PythonCollectionType.CreateList(interpreter.ModuleResolution.BuiltinsModule, argSet); public static IMember ListOfStrings(IPythonModule module, IPythonFunctionOverload overload, IArgumentSet argSet) { var type = new TypingListType("List", module.Interpreter.GetBuiltinType(BuiltinTypeId.Str), module.Interpreter, false); @@ -78,7 +78,7 @@ public static IMember __iter__(IPythonInterpreter interpreter, BuiltinTypeId con public static IMember Range(IPythonModule module, IPythonFunctionOverload overload, IArgumentSet argSet) { var args = argSet.Values(); if (args.Count > 0) { - var type = new PythonCollectionType(null, BuiltinTypeId.List, module.Interpreter, false); + var type = new PythonCollectionType(null, BuiltinTypeId.List, module.Interpreter.ModuleResolution.BuiltinsModule, false); return new PythonCollection(type, new[] { args[0] }); } return null; diff --git a/src/Analysis/Ast/Impl/Specializations/Typing/Types/TypingDictionaryType.cs b/src/Analysis/Ast/Impl/Specializations/Typing/Types/TypingDictionaryType.cs index 0f618e96c..494bee9d2 100644 --- a/src/Analysis/Ast/Impl/Specializations/Typing/Types/TypingDictionaryType.cs +++ b/src/Analysis/Ast/Impl/Specializations/Typing/Types/TypingDictionaryType.cs @@ -31,10 +31,10 @@ internal class TypingDictionaryType : PythonDictionaryType, ITypingDictionaryTyp /// Type name (Dict, Mapping, ...) /// Type of dictionary keys. /// Type of dictionary values. - /// Python interpreter + /// Python interpreter. /// Tells if collection is mutable (Dict) or not (Mapping) public TypingDictionaryType(string name, IPythonType keyType, IPythonType valueType, IPythonInterpreter interpreter, bool isMutable) - : base(interpreter, isMutable) { + : base(interpreter.ModuleResolution.GetSpecializedModule("typing"), isMutable) { KeyType = keyType; ValueType = valueType; Name = $"{name}[{keyType.Name}, {valueType.Name}]"; diff --git a/src/Analysis/Ast/Impl/Specializations/Typing/Types/TypingIteratorType.cs b/src/Analysis/Ast/Impl/Specializations/Typing/Types/TypingIteratorType.cs index 81762ac42..fa721e862 100644 --- a/src/Analysis/Ast/Impl/Specializations/Typing/Types/TypingIteratorType.cs +++ b/src/Analysis/Ast/Impl/Specializations/Typing/Types/TypingIteratorType.cs @@ -30,7 +30,7 @@ internal sealed class TypingIteratorType : PythonIteratorType, ITypingIteratorTy /// track items in the collection, it repeats the same item endlessly. /// public TypingIteratorType(IPythonType itemType, BuiltinTypeId iteratorType, IPythonInterpreter interpreter) - : base(iteratorType, interpreter) { + : base(iteratorType, interpreter.ModuleResolution.GetSpecializedModule("typing")) { ItemTypes = new[] { itemType }; Repeat = true; Name = $"Iterator[{itemType.Name}]"; @@ -41,7 +41,7 @@ public TypingIteratorType(IPythonType itemType, BuiltinTypeId iteratorType, IPyt /// The iterator goes along declared items types and stops when there are no more types. /// public TypingIteratorType(IReadOnlyList itemTypes, BuiltinTypeId iteratorType, IPythonInterpreter interpreter) - : base(iteratorType, interpreter) { + : base(iteratorType, interpreter.ModuleResolution.GetSpecializedModule("typing")) { ItemTypes = itemTypes; Name = $"Iterator[{CodeFormatter.FormatSequence(string.Empty, '(', itemTypes)}]"; } diff --git a/src/Analysis/Ast/Impl/Specializations/Typing/Types/TypingListType.cs b/src/Analysis/Ast/Impl/Specializations/Typing/Types/TypingListType.cs index 818ed2aa4..00694d3a0 100644 --- a/src/Analysis/Ast/Impl/Specializations/Typing/Types/TypingListType.cs +++ b/src/Analysis/Ast/Impl/Specializations/Typing/Types/TypingListType.cs @@ -25,7 +25,7 @@ internal class TypingListType : PythonCollectionType, ITypingListType { /// /// Type name. /// List item type. - /// Python interpreter + /// Python interpreter. /// Tells of list represents a mutable collection. /// If true, type will append item type names to the base type name. public TypingListType(string typeName, IPythonType itemType, IPythonInterpreter interpreter, bool isMutable, bool formatName = true) @@ -37,11 +37,11 @@ public TypingListType(string typeName, IPythonType itemType, IPythonInterpreter /// Type name. /// Collection type id. Can be used when list is used to simulate other collections, like a set. /// List item type. - /// Python interpreter + /// Python interpreter. /// Tells of list represents a mutable collection. /// If true, type will append item type names to the base type name. public TypingListType(string typeName, BuiltinTypeId typeId, IPythonType itemType, IPythonInterpreter interpreter, bool isMutable, bool formatName = true) - : base(null, typeId, interpreter, isMutable) { + : base(null, typeId, interpreter.ModuleResolution.GetSpecializedModule("typing"), isMutable) { ItemType = itemType; Name = formatName ? $"{typeName}[{itemType.Name}]" : typeName; } diff --git a/src/Analysis/Ast/Impl/Specializations/Typing/Types/TypingTupleType.cs b/src/Analysis/Ast/Impl/Specializations/Typing/Types/TypingTupleType.cs index 3fda6b0f4..064391d3c 100644 --- a/src/Analysis/Ast/Impl/Specializations/Typing/Types/TypingTupleType.cs +++ b/src/Analysis/Ast/Impl/Specializations/Typing/Types/TypingTupleType.cs @@ -30,7 +30,7 @@ internal class TypingTupleType : PythonCollectionType, ITypingTupleType { /// Tuple item types. /// Python interpreter. public TypingTupleType(IReadOnlyList itemTypes, IPythonInterpreter interpreter) - : base(null, BuiltinTypeId.Tuple, interpreter, false) { + : base(null, BuiltinTypeId.Tuple, interpreter.ModuleResolution.GetSpecializedModule("typing"), false) { ItemTypes = itemTypes; Name = CodeFormatter.FormatSequence("Tuple", '[', itemTypes); } diff --git a/src/Analysis/Ast/Impl/Types/Collections/PythonCollectionType.cs b/src/Analysis/Ast/Impl/Types/Collections/PythonCollectionType.cs index 313367a1a..41b3ddd83 100644 --- a/src/Analysis/Ast/Impl/Types/Collections/PythonCollectionType.cs +++ b/src/Analysis/Ast/Impl/Types/Collections/PythonCollectionType.cs @@ -32,17 +32,17 @@ internal class PythonCollectionType : PythonTypeWrapper, IPythonCollectionType { /// /// Iterable type name. If null, name of the type id will be used. /// Collection type id, such as . - /// Python interpreter. + /// Declaring module. /// Indicates if collection is mutable (like list) or immutable (like tuple). public PythonCollectionType( string typeName, BuiltinTypeId collectionTypeId, - IPythonInterpreter interpreter, + IPythonModule declaringModule, bool isMutable - ) : base(collectionTypeId, interpreter.ModuleResolution.BuiltinsModule) { + ) : base(collectionTypeId, declaringModule) { _typeName = typeName; TypeId = collectionTypeId; - IteratorType = new PythonIteratorType(collectionTypeId.GetIteratorTypeId(), interpreter); + IteratorType = new PythonIteratorType(collectionTypeId.GetIteratorTypeId(), declaringModule); IsMutable = isMutable; } @@ -83,7 +83,7 @@ public override IMember Index(IPythonInstance instance, object index) #endregion - public static IPythonCollection CreateList(IPythonInterpreter interpreter, IArgumentSet args) { + public static IPythonCollection CreateList(IPythonModule declaringModule, IArgumentSet args) { var exact = true; IReadOnlyList contents; if (args.Arguments.Count > 1) { @@ -94,33 +94,33 @@ public static IPythonCollection CreateList(IPythonInterpreter interpreter, IArgu } else { contents = args.ListArgument?.Values; } - return CreateList(interpreter, contents ?? Array.Empty(), exact: exact); + return CreateList(declaringModule, contents ?? Array.Empty(), exact: exact); } - public static IPythonCollection CreateList(IPythonInterpreter interpreter, IReadOnlyList contents, bool flatten = true, bool exact = false) { - var collectionType = new PythonCollectionType(null, BuiltinTypeId.List, interpreter, true); + public static IPythonCollection CreateList(IPythonModule declaringModule, IReadOnlyList contents, bool flatten = true, bool exact = false) { + var collectionType = new PythonCollectionType(null, BuiltinTypeId.List, declaringModule, true); return new PythonCollection(collectionType, contents, flatten, exact: exact); } - public static IPythonCollection CreateConcatenatedList(IPythonInterpreter interpreter, params IPythonCollection[] many) { + public static IPythonCollection CreateConcatenatedList(IPythonModule declaringModule, params IPythonCollection[] many) { var exact = many?.All(c => c != null && c.IsExact) ?? false; var contents = many?.ExcludeDefault().Select(c => c.Contents).SelectMany().ToList() ?? new List(); - return CreateList(interpreter, contents, false, exact: exact); + return CreateList(declaringModule, contents, false, exact: exact); } - public static IPythonCollection CreateTuple(IPythonInterpreter interpreter, IReadOnlyList contents, bool exact = false) { - var collectionType = new PythonCollectionType(null, BuiltinTypeId.Tuple, interpreter, false); + public static IPythonCollection CreateTuple(IPythonModule declaringModule, IReadOnlyList contents, bool exact = false) { + var collectionType = new PythonCollectionType(null, BuiltinTypeId.Tuple, declaringModule, false); return new PythonCollection(collectionType, contents, exact: exact); } - public static IPythonCollection CreateConcatenatedTuple(IPythonInterpreter interpreter, params IPythonCollection[] many) { + public static IPythonCollection CreateConcatenatedTuple(IPythonModule declaringModule, params IPythonCollection[] many) { var exact = many?.All(c => c != null && c.IsExact) ?? false; var contents = many?.ExcludeDefault().Select(c => c.Contents).SelectMany().ToList() ?? new List(); - return CreateTuple(interpreter, contents, exact: exact); + return CreateTuple(declaringModule, contents, exact: exact); } - public static IPythonCollection CreateSet(IPythonInterpreter interpreter, IReadOnlyList contents, bool flatten = true, bool exact = false) { - var collectionType = new PythonCollectionType(null, BuiltinTypeId.Set, interpreter, true); + public static IPythonCollection CreateSet(IPythonModule declaringModule, IReadOnlyList contents, bool flatten = true, bool exact = false) { + var collectionType = new PythonCollectionType(null, BuiltinTypeId.Set, declaringModule, true); return new PythonCollection(collectionType, contents, flatten, exact: exact); } diff --git a/src/Analysis/Ast/Impl/Types/Collections/PythonDictionaryType.cs b/src/Analysis/Ast/Impl/Types/Collections/PythonDictionaryType.cs index e012e4b3a..855339441 100644 --- a/src/Analysis/Ast/Impl/Types/Collections/PythonDictionaryType.cs +++ b/src/Analysis/Ast/Impl/Types/Collections/PythonDictionaryType.cs @@ -19,8 +19,8 @@ namespace Microsoft.Python.Analysis.Types.Collections { internal class PythonDictionaryType : PythonCollectionType { - public PythonDictionaryType(IPythonInterpreter interpreter, bool isMutable = true) - : base(null, BuiltinTypeId.Dict, interpreter, isMutable) { + public PythonDictionaryType(IPythonModule declaringModule, bool isMutable = true) + : base(null, BuiltinTypeId.Dict, declaringModule, isMutable) { } public override IMember CreateInstance(string typeName, IArgumentSet args) { diff --git a/src/Analysis/Ast/Impl/Types/Collections/PythonIteratorType.cs b/src/Analysis/Ast/Impl/Types/Collections/PythonIteratorType.cs index 865cebae9..67f5df3b8 100644 --- a/src/Analysis/Ast/Impl/Types/Collections/PythonIteratorType.cs +++ b/src/Analysis/Ast/Impl/Types/Collections/PythonIteratorType.cs @@ -26,9 +26,9 @@ internal class PythonIteratorType : PythonTypeWrapper, IPythonIteratorType { /// Creates type info for an iterator. /// /// Iterator type id, such as . - /// Python interpreter - public PythonIteratorType(BuiltinTypeId typeId, IPythonInterpreter interpreter) - : base(typeId, interpreter.ModuleResolution.BuiltinsModule) { + /// Declaring module. + public PythonIteratorType(BuiltinTypeId typeId, IPythonModule declaringModule) + : base(typeId, declaringModule) { TypeId = typeId; } diff --git a/src/Analysis/Ast/Impl/Types/Definitions/IPythonModule.cs b/src/Analysis/Ast/Impl/Types/Definitions/IPythonModule.cs index d9363c723..605eda82a 100644 --- a/src/Analysis/Ast/Impl/Types/Definitions/IPythonModule.cs +++ b/src/Analysis/Ast/Impl/Types/Definitions/IPythonModule.cs @@ -13,6 +13,7 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. +using System; using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Values; @@ -20,7 +21,23 @@ namespace Microsoft.Python.Analysis.Types { /// /// Represents a Python module. /// - public interface IPythonModule : IPythonType, IPythonFile { + public interface IPythonModule : IPythonType { + /// + /// Unique identifier of the module. Derives from module type, + /// library type, version (if available) and the installation path. + /// + string UniqueId { get; } + + /// + /// File path to the module. + /// + string FilePath { get; } + + /// + /// Module URI. + /// + Uri Uri { get; } + /// /// Module analysis. /// diff --git a/src/Analysis/Ast/Impl/Types/PythonClassType.cs b/src/Analysis/Ast/Impl/Types/PythonClassType.cs index 850cf4893..b3e2de521 100644 --- a/src/Analysis/Ast/Impl/Types/PythonClassType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonClassType.cs @@ -76,7 +76,7 @@ public override IMember GetMember(string name) { switch (name) { case "__mro__": case "mro": - return is3x ? PythonCollectionType.CreateList(DeclaringModule.Interpreter, Mro) : UnknownType; + return is3x ? PythonCollectionType.CreateList(DeclaringModule.Interpreter.ModuleResolution.BuiltinsModule, Mro) : UnknownType; case "__dict__": return is3x ? DeclaringModule.Interpreter.GetBuiltinType(BuiltinTypeId.Dict) : UnknownType; case @"__weakref__": @@ -132,18 +132,19 @@ public override string Documentation { // Constructor call public override IMember CreateInstance(string typeName, IArgumentSet args) { + var builtins = DeclaringModule.Interpreter.ModuleResolution.BuiltinsModule; // Specializations switch (typeName) { case "list": - return PythonCollectionType.CreateList(DeclaringModule.Interpreter, args); + return PythonCollectionType.CreateList(builtins, args); case "dict": { // self, then contents var contents = args.Values().Skip(1).FirstOrDefault(); - return new PythonDictionary(DeclaringModule.Interpreter, contents); + return new PythonDictionary(builtins, contents); } case "tuple": { var contents = args.Values(); - return PythonCollectionType.CreateTuple(DeclaringModule.Interpreter, contents); + return PythonCollectionType.CreateTuple(builtins, contents); } } return new PythonInstance(this); @@ -212,7 +213,7 @@ internal void SetBases(IEnumerable bases) { return; } - AddMember("__bases__", PythonCollectionType.CreateList(DeclaringModule.Interpreter, _bases), true); + AddMember("__bases__", PythonCollectionType.CreateList(DeclaringModule.Interpreter.ModuleResolution.BuiltinsModule, _bases), true); } /// diff --git a/src/Analysis/Ast/Impl/Values/Collections/PythonCollection.cs b/src/Analysis/Ast/Impl/Values/Collections/PythonCollection.cs index fb25819c9..5598bb4b3 100644 --- a/src/Analysis/Ast/Impl/Values/Collections/PythonCollection.cs +++ b/src/Analysis/Ast/Impl/Values/Collections/PythonCollection.cs @@ -25,7 +25,7 @@ internal class PythonCollection : PythonInstance, IPythonCollection { /// Collection type. /// Contents of the collection (typically elements from the initialization). /// If true and contents is a single element - /// True if the contents are an exact representation of the collection contents. + /// True if the contents are an exact representation of the collection contents. /// and is a sequence, the sequence elements are copied rather than creating /// a sequence of sequences with a single element. public PythonCollection( diff --git a/src/Analysis/Ast/Impl/Values/Collections/PythonDictionary.cs b/src/Analysis/Ast/Impl/Values/Collections/PythonDictionary.cs index 53d9fef35..8f653fecb 100644 --- a/src/Analysis/Ast/Impl/Values/Collections/PythonDictionary.cs +++ b/src/Analysis/Ast/Impl/Values/Collections/PythonDictionary.cs @@ -26,37 +26,37 @@ namespace Microsoft.Python.Analysis.Values.Collections { /// internal class PythonDictionary : PythonCollection, IPythonDictionary { private readonly Dictionary _contents = new Dictionary(new KeyComparer()); - private readonly IPythonInterpreter _interpreter; + private readonly IPythonModule _declaringModule; public PythonDictionary(PythonDictionaryType dictType, IReadOnlyDictionary contents, bool exact = false) : base(dictType, contents.Keys.ToArray(), exact: exact) { foreach (var kvp in contents) { _contents[kvp.Key] = kvp.Value; } - _interpreter = dictType.DeclaringModule.Interpreter; + _declaringModule = dictType.DeclaringModule; } - public PythonDictionary(IPythonInterpreter interpreter, IMember contents, bool exact = false) : - base(new PythonDictionaryType(interpreter), Array.Empty(), exact: exact) { + public PythonDictionary(IPythonModule declaringModule, IMember contents, bool exact = false) : + base(new PythonDictionaryType(declaringModule), Array.Empty(), exact: exact) { if (contents is IPythonDictionary dict) { foreach (var key in dict.Keys) { _contents[key] = dict[key]; } Contents = _contents.Keys.ToArray(); } - _interpreter = interpreter; + _declaringModule = declaringModule; } - public PythonDictionary(IPythonInterpreter interpreter, IReadOnlyDictionary contents, bool exact = false) : - this(new PythonDictionaryType(interpreter), contents, exact: exact) { - _interpreter = interpreter; + public PythonDictionary(IPythonModule declaringModule, IReadOnlyDictionary contents, bool exact = false) : + this(new PythonDictionaryType(declaringModule), contents, exact: exact) { + _declaringModule = declaringModule; } public IEnumerable Keys => _contents.Keys.ToArray(); public IEnumerable Values => _contents.Values.ToArray(); public IReadOnlyList Items - => _contents.Select(kvp => PythonCollectionType.CreateTuple(Type.DeclaringModule.Interpreter, new[] { kvp.Key, kvp.Value })).ToArray(); + => _contents.Select(kvp => PythonCollectionType.CreateTuple(Type.DeclaringModule.Interpreter.ModuleResolution.BuiltinsModule, new[] { kvp.Key, kvp.Value })).ToArray(); public IMember this[IMember key] => _contents.TryGetValue(key, out var value) ? value : UnknownType; @@ -70,7 +70,7 @@ public override IMember Call(string memberName, IArgumentSet args) { // Specializations switch (memberName) { case @"get": - return args.Arguments.Count > 1 ? Index(args.Arguments[1].Value) : _interpreter.UnknownType; + return args.Arguments.Count > 1 ? Index(args.Arguments[1].Value) : _declaringModule.Interpreter.UnknownType; case @"items": return CreateList(Items); case @"keys": @@ -84,15 +84,15 @@ public override IMember Call(string memberName, IArgumentSet args) { case @"iteritems": return CreateList(Items).GetIterator(); case @"pop": - return Values.FirstOrDefault() ?? _interpreter.UnknownType; + return Values.FirstOrDefault() ?? _declaringModule.Interpreter.UnknownType; case @"popitem": - return Items.Count > 0 ? Items[0] as IMember : _interpreter.UnknownType; + return Items.Count > 0 ? Items[0] as IMember : _declaringModule.Interpreter.UnknownType; } return base.Call(memberName, args); } private IPythonCollection CreateList(IReadOnlyList items) - => PythonCollectionType.CreateList(Type.DeclaringModule.Interpreter, items, false); + => PythonCollectionType.CreateList(Type.DeclaringModule.Interpreter.ModuleResolution.BuiltinsModule, items, false); private sealed class KeyComparer : IEqualityComparer { public bool Equals(IMember x, IMember y) { diff --git a/src/Analysis/Ast/Impl/Values/Collections/PythonInstanceIterator.cs b/src/Analysis/Ast/Impl/Values/Collections/PythonInstanceIterator.cs index 9dbdafffe..53ec70cb4 100644 --- a/src/Analysis/Ast/Impl/Values/Collections/PythonInstanceIterator.cs +++ b/src/Analysis/Ast/Impl/Values/Collections/PythonInstanceIterator.cs @@ -25,7 +25,7 @@ internal sealed class PythonInstanceIterator : PythonInstance, IPythonIterator { private readonly IPythonFunctionType __next__; public PythonInstanceIterator(IMember instance, IPythonInterpreter interpreter) - : base(new PythonIteratorType(BuiltinTypeId.SetIterator, interpreter)) { + : base(new PythonIteratorType(BuiltinTypeId.SetIterator, interpreter.ModuleResolution.BuiltinsModule)) { __next__ = instance.GetPythonType().GetMember(@"__next__") as IPythonFunctionType; } diff --git a/src/Analysis/Ast/Impl/Values/Collections/PythonTypeIterator.cs b/src/Analysis/Ast/Impl/Values/Collections/PythonTypeIterator.cs index 05bf9fa76..e901a292e 100644 --- a/src/Analysis/Ast/Impl/Values/Collections/PythonTypeIterator.cs +++ b/src/Analysis/Ast/Impl/Values/Collections/PythonTypeIterator.cs @@ -20,7 +20,7 @@ namespace Microsoft.Python.Analysis.Values.Collections { internal sealed class PythonTypeIterator : PythonInstance, IPythonIterator { private readonly BuiltinTypeId _contentType; public PythonTypeIterator(BuiltinTypeId iteratorType, BuiltinTypeId contentType, IPythonInterpreter interpreter) - : base(new PythonIteratorType(iteratorType, interpreter)) { + : base(new PythonIteratorType(iteratorType, interpreter.ModuleResolution.BuiltinsModule)) { _contentType = contentType; } diff --git a/src/Analysis/Ast/Impl/Types/Definitions/IPythonFile.cs b/src/Analysis/Core/Impl/Interpreter/LibraryType.cs similarity index 64% rename from src/Analysis/Ast/Impl/Types/Definitions/IPythonFile.cs rename to src/Analysis/Core/Impl/Interpreter/LibraryType.cs index 897c7bf48..851ec7d29 100644 --- a/src/Analysis/Ast/Impl/Types/Definitions/IPythonFile.cs +++ b/src/Analysis/Core/Impl/Interpreter/LibraryType.cs @@ -13,18 +13,26 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. -using System; +namespace Microsoft.Python.Analysis.Core.Interpreter { + public enum LibraryType { + /// + /// Module is not a library. + /// + None, + + /// + /// Library is part of the standard Python installation. + /// + Standard, -namespace Microsoft.Python.Analysis.Types { - public interface IPythonFile { /// - /// File path to the module. + /// Library is installed in site-packages. /// - string FilePath { get; } + SitePackages, /// - /// Module URI. + /// Other type of library. /// - Uri Uri { get; } + Other } } diff --git a/src/Analysis/Core/Impl/Interpreter/PythonLibraryPath.cs b/src/Analysis/Core/Impl/Interpreter/PythonLibraryPath.cs index cb9eecb27..d95e35cf1 100644 --- a/src/Analysis/Core/Impl/Interpreter/PythonLibraryPath.cs +++ b/src/Analysis/Core/Impl/Interpreter/PythonLibraryPath.cs @@ -18,7 +18,6 @@ using System.Diagnostics; using System.IO; using System.Linq; -using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; @@ -35,34 +34,42 @@ public sealed class PythonLibraryPath { @"(?[^|]+)\|(?stdlib)?\|(?[^|]+)?" ); - public PythonLibraryPath(string path, bool isStandardLibrary, string modulePrefix) { + public PythonLibraryPath(string path, LibraryType libraryType, string modulePrefix) { Path = path; - IsStandardLibrary = isStandardLibrary; + LibraryType = libraryType; _modulePrefix = modulePrefix; } public string Path { get; } - - public bool IsStandardLibrary { get; } + public LibraryType LibraryType { get; } public string ModulePrefix => _modulePrefix ?? string.Empty; public override string ToString() - => "{0}|{1}|{2}".FormatInvariant(Path, IsStandardLibrary ? "stdlib" : "", _modulePrefix ?? ""); + => "{0}|{1}|{2}".FormatInvariant(Path, LibraryType == LibraryType.Standard ? "stdlib" : "", _modulePrefix ?? string.Empty); - public static PythonLibraryPath Parse(string s) { + public static PythonLibraryPath FromLibraryPath(string s, IFileSystem fs, string standardLibraryPath) { if (string.IsNullOrEmpty(s)) { - throw new ArgumentNullException("source"); + throw new ArgumentNullException(nameof(s)); } var m = ParseRegex.Match(s); if (!m.Success || !m.Groups["path"].Success) { throw new FormatException(); } - + + var libraryType = LibraryType.Other; + var sitePackagesPath = GetSitePackagesPath(standardLibraryPath); + var path = m.Groups["path"].Value; + if (m.Groups["stdlib"].Success) { + libraryType = LibraryType.Standard; + } else if(fs.IsPathUnderRoot(sitePackagesPath, path)) { + libraryType = LibraryType.SitePackages; + } + return new PythonLibraryPath( m.Groups["path"].Value, - m.Groups["stdlib"].Success, + libraryType, m.Groups["prefix"].Success ? m.Groups["prefix"].Value : null ); } @@ -71,25 +78,24 @@ public static PythonLibraryPath Parse(string s) { /// Gets the default set of search paths based on the path to the root /// of the standard library. /// - /// Root of the standard library. + /// Root of the standard library. /// A list of search paths for the interpreter. - /// New in 2.2, moved in 3.3 - public static List GetDefaultSearchPaths(string library) { + public static List GetDefaultSearchPaths(string standardLibraryPath) { var result = new List(); - if (!Directory.Exists(library)) { + if (!Directory.Exists(standardLibraryPath)) { return result; } - result.Add(new PythonLibraryPath(library, true, null)); + result.Add(new PythonLibraryPath(standardLibraryPath, LibraryType.Standard, null)); - var sitePackages = IOPath.Combine(library, "site-packages"); + var sitePackages = GetSitePackagesPath(standardLibraryPath); if (!Directory.Exists(sitePackages)) { return result; } - result.Add(new PythonLibraryPath(sitePackages, false, null)); + result.Add(new PythonLibraryPath(sitePackages, LibraryType.SitePackages, null)); result.AddRange(ModulePath.ExpandPathFiles(sitePackages) - .Select(p => new PythonLibraryPath(p, false, null)) + .Select(p => new PythonLibraryPath(p, LibraryType.SitePackages, null)) ); return result; @@ -101,7 +107,7 @@ public static List GetDefaultSearchPaths(string library) { public static async Task> GetSearchPathsAsync(InterpreterConfiguration config, IFileSystem fs, IProcessServices ps, CancellationToken cancellationToken = default) { for (int retries = 5; retries > 0; --retries) { try { - return await GetSearchPathsFromInterpreterAsync(config.InterpreterPath, fs, ps, cancellationToken); + return await GetSearchPathsFromInterpreterAsync(config, fs, ps, cancellationToken); } catch (InvalidOperationException) { // Failed to get paths break; @@ -111,23 +117,34 @@ public static async Task> GetSearchPathsAsync(Interpret } } - var ospy = PathUtils.FindFile(config.LibraryPath, "os.py"); - if (!string.IsNullOrEmpty(ospy)) { - return GetDefaultSearchPaths(IOPath.GetDirectoryName(ospy)); + var standardLibraryPath = GetStandardLibraryPath(config); + if (!string.IsNullOrEmpty(standardLibraryPath)) { + return GetDefaultSearchPaths(standardLibraryPath); } return Array.Empty(); } + public static string GetStandardLibraryPath(InterpreterConfiguration config) { + var ospy = PathUtils.FindFile(config.LibraryPath, "os.py"); + return !string.IsNullOrEmpty(ospy) ? IOPath.GetDirectoryName(ospy) : string.Empty; + } + + public static string GetSitePackagesPath(InterpreterConfiguration config) + => GetSitePackagesPath(GetStandardLibraryPath(config)); + + public static string GetSitePackagesPath(string standardLibraryPath) + => !string.IsNullOrEmpty(standardLibraryPath) ? IOPath.Combine(standardLibraryPath, "site-packages") : string.Empty; + /// /// Gets the set of search paths by running the interpreter. /// - /// Path to the interpreter. + /// Interpreter configuration. /// File system services. /// Process services. /// Cancellation token. /// A list of search paths for the interpreter. - public static async Task> GetSearchPathsFromInterpreterAsync(string interpreter, IFileSystem fs, IProcessServices ps, CancellationToken cancellationToken = default) { + public static async Task> GetSearchPathsFromInterpreterAsync(InterpreterConfiguration config, IFileSystem fs, IProcessServices ps, CancellationToken cancellationToken = default) { // sys.path will include the working directory, so we make an empty // path that we can filter out later var tempWorkingDir = IOPath.Combine(IOPath.GetTempPath(), IOPath.GetRandomFileName()); @@ -139,7 +156,7 @@ public static async Task> GetSearchPathsFromInterpreterA File.Copy(srcGetSearchPaths, getSearchPaths); var startInfo = new ProcessStartInfo( - interpreter, + config.InterpreterPath, new[] { "-S", "-E", getSearchPaths }.AsQuotedArguments() ) { WorkingDirectory = tempWorkingDir, @@ -152,12 +169,13 @@ public static async Task> GetSearchPathsFromInterpreterA try { var output = await ps.ExecuteAndCaptureOutputAsync(startInfo, cancellationToken); + var standardLibraryPath = GetSitePackagesPath(config); return output.Split(new [] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).Select(s => { if (s.PathStartsWith(tempWorkingDir)) { return null; } try { - return Parse(s); + return FromLibraryPath(s, fs, standardLibraryPath); } catch (ArgumentException) { Debug.Fail("Invalid search path: " + (s ?? "")); return null; diff --git a/src/Caching/Impl/Models/ClassModel.cs b/src/Caching/Impl/Models/ClassModel.cs index 6d37b5ad5..aafbdea7d 100644 --- a/src/Caching/Impl/Models/ClassModel.cs +++ b/src/Caching/Impl/Models/ClassModel.cs @@ -13,16 +13,13 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. -using System.Collections; using System.Collections.Generic; using System.Linq; -using System.Runtime.CompilerServices; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; namespace Microsoft.Python.Analysis.Caching.Models { - internal sealed class ClassModel { - public string Name { get; set; } + internal sealed class ClassModel: MemberModel { public string[] Bases { get; set; } public FunctionModel[] Methods { get; set; } public PropertyModel[] Properties { get; set; } @@ -79,6 +76,7 @@ private ClassModel(IPythonClassType cls) { } Name = cls.Name; + Documentation = cls.Documentation; Bases = cls.Bases.OfType().Select(t => t.GetQualifiedName()).ToArray(); Methods = methods.ToArray(); Properties = properties.ToArray(); diff --git a/src/Caching/Impl/Models/FunctionModel.cs b/src/Caching/Impl/Models/FunctionModel.cs index 93dccfb52..cbb37bc1e 100644 --- a/src/Caching/Impl/Models/FunctionModel.cs +++ b/src/Caching/Impl/Models/FunctionModel.cs @@ -26,6 +26,7 @@ internal sealed class FunctionModel: MemberModel { public static FunctionModel FromType(IPythonFunctionType ft) { return new FunctionModel { Name = ft.Name, + Documentation = ft.Documentation, Overloads = ft.Overloads.Select(FromOverload).ToArray() // TODO: attributes, inner functions and inner classes. }; diff --git a/src/Caching/Impl/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs index 33ba8f344..bf9cca545 100644 --- a/src/Caching/Impl/Models/ModuleModel.cs +++ b/src/Caching/Impl/Models/ModuleModel.cs @@ -54,6 +54,7 @@ public static ModuleModel FromAnalysis(IDocumentAnalysis analysis) { return new ModuleModel { Name = analysis.Document.GetQualifiedName(), + Documentation = analysis.Document.Documentation, Functions = functions.ToArray(), Variables = variables.ToArray(), Classes = classes.ToArray() diff --git a/src/Caching/Impl/Models/PropertyModel.cs b/src/Caching/Impl/Models/PropertyModel.cs index 2566f36fc..c4930919a 100644 --- a/src/Caching/Impl/Models/PropertyModel.cs +++ b/src/Caching/Impl/Models/PropertyModel.cs @@ -23,6 +23,7 @@ internal sealed class PropertyModel: MemberModel { public static PropertyModel FromType(IPythonPropertyType prop) { return new PropertyModel { Name = prop.Name, + Documentation = prop.Documentation, ReturnType = prop.ReturnType.GetQualifiedName(), // TODO: attributes. }; diff --git a/src/Caching/Impl/PythonDbModule.cs b/src/Caching/Impl/PythonDbModule.cs index acb2f0efb..5e6bc5cb6 100644 --- a/src/Caching/Impl/PythonDbModule.cs +++ b/src/Caching/Impl/PythonDbModule.cs @@ -48,7 +48,7 @@ public override IMember GetMember(string name) { if(v != null) { return new Variable(name, Construct(v.Value), VariableSource.Declaration, new Location(this)); } - var v = _model.Variables.FirstOrDefault(c => c.Name == name); + v = _model.Variables.FirstOrDefault(c => c.Name == name); if (v != null) { return new Variable(name, Construct(v.Value), VariableSource.Declaration, new Location(this)); } @@ -71,22 +71,23 @@ private string[] Split(string qualifiedName, out string moduleName, out bool isI return components.Length > 0 ? components.Skip(1).ToArray() : Array.Empty(); } - private sealed class GlobalScope : IGlobalScope { + private sealed class GlobalScopeImpl : IGlobalScope { private readonly ModuleModel _model; private readonly VariableCollection _variables = new VariableCollection(); - public GlobalScope(ModuleModel model, IPythonModule module) { + + public GlobalScopeImpl(ModuleModel model, IPythonModule module) { _model = model; Module = module; - foreach (var v in model.Variables) { - _variables.DeclareVariable(v.Name, Construct(v.Value), VariableSource.Declaration, new Location(module)); - } - foreach (var c in model.Classes) { - _variables.DeclareVariable(c.Name, Construct(c), VariableSource.Declaration, new Location(module)); - } - foreach (var f in model.Functions) { - _variables.DeclareVariable(f.Name, Construct(f), VariableSource.Declaration, new Location(module)); - } + //foreach (var v in model.Variables) { + // _variables.DeclareVariable(v.Name, Construct(v.Value), VariableSource.Declaration, new Location(module)); + //} + //foreach (var c in model.Classes) { + // _variables.DeclareVariable(c.Name, Construct(c), VariableSource.Declaration, new Location(module)); + //} + //foreach (var f in model.Functions) { + // _variables.DeclareVariable(f.Name, Construct(f), VariableSource.Declaration, new Location(module)); + //} // TODO: classes and functions // TODO: default variables } diff --git a/src/Caching/Impl/TypeNames.cs b/src/Caching/Impl/TypeNames.cs index 507c0137a..6e0d1d960 100644 --- a/src/Caching/Impl/TypeNames.cs +++ b/src/Caching/Impl/TypeNames.cs @@ -25,10 +25,10 @@ public static string GetQualifiedName(this IMember m) { return null; } - var moduleId = t.DeclaringModule?.GetUniqueId(); + var moduleId = t.DeclaringModule.UniqueId; switch (m) { case IPythonModule mod: - return mod.GetUniqueId(); + return mod.UniqueId; case IPythonInstance _: return $"i:{GetQualifiedName(t)}"; case IPythonClassMember cm when cm.DeclaringType != null: @@ -49,8 +49,5 @@ private static string GetQualifiedName(this IPythonClassMember cm) { } return string.Join(".", s); } - - // TODO: fix per https://github.com/microsoft/python-language-server/issues/1177 - private static string GetUniqueId(this IPythonModule module) => module.Name; } } diff --git a/src/Caching/Test/BasicTests.cs b/src/Caching/Test/BasicTests.cs index 7ad12a1ab..55d5ae58f 100644 --- a/src/Caching/Test/BasicTests.cs +++ b/src/Caching/Test/BasicTests.cs @@ -64,5 +64,14 @@ public async Task Builtins() { var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); } + + [TestMethod, Priority(0)] + public async Task Sys() { + var analysis = await GetAnalysisAsync("import sys"); + var sys = analysis.Document.Interpreter.ModuleResolution.GetImportedModule("sys"); + var model = ModuleModel.FromAnalysis(sys.Analysis); + var json = ToJson(model); + Baseline.CompareToFile(BaselineFileName, json); + } } } From e2fc2212ad4fd0e82940bfe9db474771b50a578a Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Tue, 11 Jun 2019 12:05:02 -0700 Subject: [PATCH 53/82] Fix type names, part I --- src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs | 4 ++++ .../Ast/Impl/Extensions/PythonTypeExtensions.cs | 10 ++++++++-- src/Caching/Impl/Models/ModuleModel.cs | 7 ++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs index 78722d851..12929e458 100644 --- a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs +++ b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs @@ -245,6 +245,10 @@ private void MergeStub() { if (!IsStubBetterType(sourceType, stubType)) { continue;; } + if (sourceType == null || !sourceType.DeclaringModule.Equals(_stubAnalysis.Document)) { + // Only handle members declared in this module. + continue; + } // If types are the classes, merge members. // Otherwise, replace type from one from the stub. diff --git a/src/Analysis/Ast/Impl/Extensions/PythonTypeExtensions.cs b/src/Analysis/Ast/Impl/Extensions/PythonTypeExtensions.cs index 185f549bf..557cc9515 100644 --- a/src/Analysis/Ast/Impl/Extensions/PythonTypeExtensions.cs +++ b/src/Analysis/Ast/Impl/Extensions/PythonTypeExtensions.cs @@ -13,6 +13,7 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. +using System.Diagnostics; using Microsoft.Python.Analysis.Specializations.Typing; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Core; @@ -22,7 +23,7 @@ public static class PythonTypeExtensions { public static bool IsUnknown(this IPythonType value) => value == null || (value.TypeId == BuiltinTypeId.Unknown && value.MemberType == PythonMemberType.Unknown && value.Name.Equals("Unknown")); - public static bool IsGenericParameter(this IPythonType value) + public static bool IsGenericParameter(this IPythonType value) => value is IGenericTypeDefinition; public static bool IsGeneric(this IPythonType value) @@ -34,11 +35,16 @@ public static void TransferDocumentationAndLocation(this IPythonType s, IPythonT if (!string.IsNullOrEmpty(documentation)) { dst.SetDocumentation(documentation); } + + var srcModule = src.Location.Module; + var dstModule = dst.Location.Module; + Debug.Assert(srcModule.Equals(dstModule) || + (dstModule.ModuleType == Modules.ModuleType.Stub && dstModule.PrimaryModule.Equals(srcModule))); dst.Location = src.Location; } } public static bool IsConstructor(this IPythonClassMember m) - => m.Name.EqualsOrdinal("__init__") || m.Name.EqualsOrdinal("__new__"); + => m.Name.EqualsOrdinal("__init__") || m.Name.EqualsOrdinal("__new__"); } } diff --git a/src/Caching/Impl/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs index bf9cca545..c86165b57 100644 --- a/src/Caching/Impl/Models/ModuleModel.cs +++ b/src/Caching/Impl/Models/ModuleModel.cs @@ -14,6 +14,7 @@ // permissions and limitations under the License. using System.Collections.Generic; +using System.Linq; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; @@ -29,7 +30,7 @@ public static ModuleModel FromAnalysis(IDocumentAnalysis analysis) { var functions = new List(); var classes = new List(); - foreach (var v in analysis.GlobalScope.Variables) { + foreach (var v in analysis.GlobalScope.Variables.Where(v => v.Source == VariableSource.Declaration)) { var t = v.Value.GetPythonType(); // If variable is declaration and has location, then it is a user-defined variable. if (v.Source == VariableSource.Declaration && v.Location.IsValid) { @@ -39,12 +40,12 @@ public static ModuleModel FromAnalysis(IDocumentAnalysis analysis) { if (v.Source == VariableSource.Declaration && !v.Location.IsValid) { switch (t) { // Typically class or a function - case IPythonFunctionType ft: { + case IPythonFunctionType ft when ft.DeclaringModule.Equals(analysis.Document): { functions.Add(FunctionModel.FromType(ft)); break; } - case IPythonClassType cls: { + case IPythonClassType cls when cls.DeclaringModule.Equals(analysis.Document): { classes.Add(ClassModel.FromType(cls)); break; } From aaf40bb8f2d1a21eb9a907a7c4f5bc677f8b2c3c Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Tue, 11 Jun 2019 12:53:33 -0700 Subject: [PATCH 54/82] Qualified name --- .../Ast/Impl/Modules/BuiltinsPythonModule.cs | 2 +- src/Analysis/Ast/Impl/Modules/PythonModule.cs | 2 + .../Ast/Impl/Modules/PythonVariableModule.cs | 2 +- .../Ast/Impl/Modules/StubPythonModule.cs | 2 +- .../Specializations/Typing/Types/AnyType.cs | 1 + .../Typing/Types/GenericType.cs | 1 + .../Typing/Values/TypingType.cs | 2 + .../Impl/Types/Definitions/IPythonModule.cs | 6 - .../Ast/Impl/Types/Definitions/IPythonType.cs | 5 + src/Analysis/Ast/Impl/Types/PythonType.cs | 1 + .../Ast/Impl/Types/PythonTypeWrapper.cs | 2 +- .../Ast/Impl/Types/PythonUnionType.cs | 10 +- src/Caching/Impl/Models/ModuleModel.cs | 26 +- src/Caching/Impl/TypeNames.cs | 28 +- src/Caching/Test/Files/Builtins.json | 1300 ++++++++++------- src/Caching/Test/Files/SmokeTest.json | 73 +- src/Caching/Test/Files/Sys.json | 846 +++++++++++ 17 files changed, 1652 insertions(+), 657 deletions(-) create mode 100644 src/Caching/Test/Files/Sys.json diff --git a/src/Analysis/Ast/Impl/Modules/BuiltinsPythonModule.cs b/src/Analysis/Ast/Impl/Modules/BuiltinsPythonModule.cs index b1e6806af..e1243d913 100644 --- a/src/Analysis/Ast/Impl/Modules/BuiltinsPythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/BuiltinsPythonModule.cs @@ -36,7 +36,7 @@ internal sealed class BuiltinsPythonModule : CompiledPythonModule, IBuiltinsPyth public BuiltinsPythonModule(string moduleName, string filePath, IServiceContainer services) : base(moduleName, ModuleType.Builtins, filePath, null, services) { } // TODO: builtins stub - public override string UniqueId => $"{Name}({Interpreter.Configuration.Version})"; + public override string QualifiedName => $"{Name}({Interpreter.Configuration.Version})"; public override IMember GetMember(string name) => _hiddenNames.Contains(name) ? null : base.GetMember(name); diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.cs index 18a88cef3..bbeca665f 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.cs @@ -114,6 +114,8 @@ internal PythonModule(ModuleCreationOptions creationOptions, IServiceContainer s #region IPythonType public string Name { get; } + public virtual string QualifiedName => Name; + public BuiltinTypeId TypeId => BuiltinTypeId.Module; public bool IsBuiltin => true; public bool IsAbstract => false; diff --git a/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs b/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs index 639eecf0d..f3d3e5973 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs @@ -29,8 +29,8 @@ namespace Microsoft.Python.Analysis.Modules { internal sealed class PythonVariableModule : LocatedMember, IPythonModule, IEquatable { private readonly Dictionary _children = new Dictionary(); - public string UniqueId => $"{nameof(PythonVariableModule)}.{Name}"; // TODO: re-work. public string Name { get; } + public string QualifiedName => $"{nameof(PythonVariableModule)}.{Name}"; // TODO: re-work. public IPythonModule Module { get; } public IPythonInterpreter Interpreter { get; } diff --git a/src/Analysis/Ast/Impl/Modules/StubPythonModule.cs b/src/Analysis/Ast/Impl/Modules/StubPythonModule.cs index cb3277086..907572b14 100644 --- a/src/Analysis/Ast/Impl/Modules/StubPythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/StubPythonModule.cs @@ -29,7 +29,7 @@ public StubPythonModule(string moduleName, string stubPath, bool isTypeshed, ISe IsTypeshed = isTypeshed; } - public override string UniqueId => PrimaryModule.UniqueId; + public override string QualifiedName => PrimaryModule.QualifiedName; protected override string LoadContent() { // Exceptions are handled in the base diff --git a/src/Analysis/Ast/Impl/Specializations/Typing/Types/AnyType.cs b/src/Analysis/Ast/Impl/Specializations/Typing/Types/AnyType.cs index d1e5f9e0e..1ded666cf 100644 --- a/src/Analysis/Ast/Impl/Specializations/Typing/Types/AnyType.cs +++ b/src/Analysis/Ast/Impl/Specializations/Typing/Types/AnyType.cs @@ -24,6 +24,7 @@ public AnyType(IPythonModule declaringModule) : base(declaringModule) { } public override PythonMemberType MemberType => PythonMemberType.Class; public string Name => "Any"; + public string QualifiedName => $"{DeclaringModule.QualifiedName}.{Name}"; public BuiltinTypeId TypeId => BuiltinTypeId.Type; public string Documentation => Name; public bool IsBuiltin => false; diff --git a/src/Analysis/Ast/Impl/Specializations/Typing/Types/GenericType.cs b/src/Analysis/Ast/Impl/Specializations/Typing/Types/GenericType.cs index df9d14a97..61c71c24a 100644 --- a/src/Analysis/Ast/Impl/Specializations/Typing/Types/GenericType.cs +++ b/src/Analysis/Ast/Impl/Specializations/Typing/Types/GenericType.cs @@ -80,6 +80,7 @@ public IPythonType CreateSpecificType(IReadOnlyList typeArguments) #region IPythonType public string Name { get; } + public string QualifiedName => $"{DeclaringModule.QualifiedName}.{Name}"; public IMember GetMember(string name) => null; public IEnumerable GetMemberNames() => Enumerable.Empty(); public BuiltinTypeId TypeId { get; } = BuiltinTypeId.Unknown; diff --git a/src/Analysis/Ast/Impl/Specializations/Typing/Values/TypingType.cs b/src/Analysis/Ast/Impl/Specializations/Typing/Values/TypingType.cs index 387dcdbd2..480c1da54 100644 --- a/src/Analysis/Ast/Impl/Specializations/Typing/Values/TypingType.cs +++ b/src/Analysis/Ast/Impl/Specializations/Typing/Values/TypingType.cs @@ -28,10 +28,12 @@ internal sealed class TypingType : LocatedMember, IPythonType { public TypingType(IPythonModule declaringModule, IPythonType type): base(declaringModule) { _type = type ?? throw new ArgumentNullException(nameof(type)); Name = $"Type[{_type.Name}]"; + QualifiedName = $"{DeclaringModule.QualifiedName}.Type[{_type.QualifiedName}]"; } public override PythonMemberType MemberType => PythonMemberType.Class; public string Name { get; } + public string QualifiedName { get; } public BuiltinTypeId TypeId => BuiltinTypeId.Type; public string Documentation => Name; public bool IsBuiltin => false; diff --git a/src/Analysis/Ast/Impl/Types/Definitions/IPythonModule.cs b/src/Analysis/Ast/Impl/Types/Definitions/IPythonModule.cs index 605eda82a..2c12d9f9a 100644 --- a/src/Analysis/Ast/Impl/Types/Definitions/IPythonModule.cs +++ b/src/Analysis/Ast/Impl/Types/Definitions/IPythonModule.cs @@ -22,12 +22,6 @@ namespace Microsoft.Python.Analysis.Types { /// Represents a Python module. /// public interface IPythonModule : IPythonType { - /// - /// Unique identifier of the module. Derives from module type, - /// library type, version (if available) and the installation path. - /// - string UniqueId { get; } - /// /// File path to the module. /// diff --git a/src/Analysis/Ast/Impl/Types/Definitions/IPythonType.cs b/src/Analysis/Ast/Impl/Types/Definitions/IPythonType.cs index 2f3cb2aa0..a71590175 100644 --- a/src/Analysis/Ast/Impl/Types/Definitions/IPythonType.cs +++ b/src/Analysis/Ast/Impl/Types/Definitions/IPythonType.cs @@ -25,6 +25,11 @@ public interface IPythonType : ILocatedMember, IMemberContainer { /// string Name { get; } + /// + /// Fully qualified type name. Used for analysis persistence. + /// + string QualifiedName { get; } + /// /// Indicates built-in type id such as 'int' or 'str' /// or 'type' for user-defined entities. diff --git a/src/Analysis/Ast/Impl/Types/PythonType.cs b/src/Analysis/Ast/Impl/Types/PythonType.cs index 27c8ffaff..2999b633d 100644 --- a/src/Analysis/Ast/Impl/Types/PythonType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonType.cs @@ -56,6 +56,7 @@ private PythonType(string name, Location location, BuiltinTypeId typeId) : base( #region IPythonType public virtual string Name => TypeId == BuiltinTypeId.Ellipsis ? "..." : _name; + public virtual string QualifiedName => $"{DeclaringModule.QualifiedName}.{(TypeId == BuiltinTypeId.Ellipsis ? "ellipsis" : Name)}"; public virtual string Documentation { get; private set; } public virtual BuiltinTypeId TypeId => _typeId; public bool IsBuiltin => DeclaringModule == null || DeclaringModule is IBuiltinsPythonModule; diff --git a/src/Analysis/Ast/Impl/Types/PythonTypeWrapper.cs b/src/Analysis/Ast/Impl/Types/PythonTypeWrapper.cs index 8058317cc..bb8c14e8b 100644 --- a/src/Analysis/Ast/Impl/Types/PythonTypeWrapper.cs +++ b/src/Analysis/Ast/Impl/Types/PythonTypeWrapper.cs @@ -16,7 +16,6 @@ using System; using System.Collections.Generic; using Microsoft.Python.Analysis.Values; -using Microsoft.Python.Core.Text; namespace Microsoft.Python.Analysis.Types { /// @@ -57,6 +56,7 @@ public PythonTypeWrapper(BuiltinTypeId builtinTypeId, IPythonModule declaringMod #region IPythonType public virtual string Name => InnerType.Name; + public virtual string QualifiedName => InnerType.QualifiedName; public IPythonModule DeclaringModule { get; } public virtual string Documentation => InnerType.Documentation; public virtual BuiltinTypeId TypeId => InnerType.TypeId; diff --git a/src/Analysis/Ast/Impl/Types/PythonUnionType.cs b/src/Analysis/Ast/Impl/Types/PythonUnionType.cs index c5f83c75f..eedaa82f1 100644 --- a/src/Analysis/Ast/Impl/Types/PythonUnionType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonUnionType.cs @@ -42,11 +42,11 @@ private PythonUnionType(IPythonType x, IPythonType y) : base(x.DeclaringModule) #region IPythonType public string Name { - get { - lock (_lock) { - return CodeFormatter.FormatSequence("Union", '[', _types.ToArray()); - } - } + get { lock (_lock) { return CodeFormatter.FormatSequence("Union", '[', _types.ToArray()); } } + } + + public string QualifiedName { + get { lock (_lock) { return CodeFormatter.FormatSequence("Union", '[', _types.Select(t => t.QualifiedName).ToArray()); } } } public override IPythonModule DeclaringModule { diff --git a/src/Caching/Impl/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs index c86165b57..2ad59eec8 100644 --- a/src/Caching/Impl/Models/ModuleModel.cs +++ b/src/Caching/Impl/Models/ModuleModel.cs @@ -19,7 +19,7 @@ using Microsoft.Python.Analysis.Values; namespace Microsoft.Python.Analysis.Caching.Models { - internal sealed class ModuleModel: MemberModel { + internal sealed class ModuleModel : MemberModel { public FunctionModel[] Functions { get; set; } public VariableModel[] Variables { get; set; } public ClassModel[] Classes { get; set; } @@ -33,23 +33,17 @@ public static ModuleModel FromAnalysis(IDocumentAnalysis analysis) { foreach (var v in analysis.GlobalScope.Variables.Where(v => v.Source == VariableSource.Declaration)) { var t = v.Value.GetPythonType(); // If variable is declaration and has location, then it is a user-defined variable. - if (v.Source == VariableSource.Declaration && v.Location.IsValid) { + if (v.Location.IsValid) { variables.Add(VariableModel.FromVariable(v)); + continue; } - - if (v.Source == VariableSource.Declaration && !v.Location.IsValid) { - switch (t) { - // Typically class or a function - case IPythonFunctionType ft when ft.DeclaringModule.Equals(analysis.Document): { - functions.Add(FunctionModel.FromType(ft)); - break; - } - - case IPythonClassType cls when cls.DeclaringModule.Equals(analysis.Document): { - classes.Add(ClassModel.FromType(cls)); - break; - } - } + switch (t) { + case IPythonFunctionType ft when ft.DeclaringModule.Equals(analysis.Document): + functions.Add(FunctionModel.FromType(ft)); + break; + case IPythonClassType cls when cls.DeclaringModule.Equals(analysis.Document): + classes.Add(ClassModel.FromType(cls)); + break; } } diff --git a/src/Caching/Impl/TypeNames.cs b/src/Caching/Impl/TypeNames.cs index 6e0d1d960..da9720b53 100644 --- a/src/Caching/Impl/TypeNames.cs +++ b/src/Caching/Impl/TypeNames.cs @@ -14,6 +14,7 @@ // permissions and limitations under the License. using System.Collections.Generic; +using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; @@ -21,22 +22,17 @@ namespace Microsoft.Python.Analysis.Caching { internal static class TypeNames { public static string GetQualifiedName(this IMember m) { var t = m.GetPythonType(); - if (t.IsUnknown()) { - return null; - } - - var moduleId = t.DeclaringModule.UniqueId; - switch (m) { - case IPythonModule mod: - return mod.UniqueId; - case IPythonInstance _: - return $"i:{GetQualifiedName(t)}"; - case IPythonClassMember cm when cm.DeclaringType != null: - return $"{moduleId}.{cm.GetQualifiedName()}"; - case IPythonType pt: - return $"{moduleId}.{pt.Name}"; - case null: - break; + if (!t.IsUnknown()) { + switch (m) { + case IPythonInstance _: + return $"i:{GetQualifiedName(t)}"; + case IPythonType pt when pt.DeclaringModule.ModuleType == ModuleType.Builtins: + return pt.Name; + case IPythonType pt: + return pt.QualifiedName; + case null: + break; + } } return null; } diff --git a/src/Caching/Test/Files/Builtins.json b/src/Caching/Test/Files/Builtins.json index 516d793e0..318ed56bc 100644 --- a/src/Caching/Test/Files/Builtins.json +++ b/src/Caching/Test/Files/Builtins.json @@ -1,8 +1,6 @@ { - "Name": "builtins", "Functions": [ { - "Name": "type", "Overloads": [ { "Parameters": [], @@ -11,10 +9,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "type", + "Documentation": "" }, { - "Name": "__build_class__", "Overloads": [ { "Parameters": [ @@ -54,10 +53,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "__build_class__", + "Documentation": "__build_class__(func, name, *bases, metaclass=None, **kwds) -> class\n\nInternal helper function used by the class statement." }, { - "Name": "__import__", "Overloads": [ { "Parameters": [ @@ -81,8 +81,8 @@ }, { "Name": "fromlist", - "Type": "builtins.tuple", - "DefaultValue": "i:builtins.tuple", + "Type": "tuple", + "DefaultValue": "i:tuple", "Kind": 0 }, { @@ -97,10 +97,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "__import__", + "Documentation": "__import__(name, globals=None, locals=None, fromlist=(), level=0) -> module\n\nImport a module. Because this function is meant for use by the Python\ninterpreter and not for general use, it is better to use\nimportlib.import_module() to programmatically import a module.\n\nThe globals argument is only used to determine the context;\nthey are not modified. The locals argument is unused. The fromlist\nshould be a list of names to emulate ``from name import ...'', or an\nempty list to emulate ``import name''.\nWhen importing a module from a package, note that __import__('A.B', ...)\nreturns package A when fromlist is empty, but its submodule B when\nfromlist is not empty. The level argument is used to determine whether to\nperform absolute or relative imports: 0 is absolute, while a positive number\nis the number of parent directories to search relative to the current module." }, { - "Name": "abs", "Overloads": [ { "Parameters": [ @@ -116,10 +117,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "abs", + "Documentation": "Return the absolute value of the argument." }, { - "Name": "all", "Overloads": [ { "Parameters": [ @@ -135,10 +137,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "all", + "Documentation": "Return True if bool(x) is True for all values x in the iterable.\n\nIf the iterable is empty, return True." }, { - "Name": "any", "Overloads": [ { "Parameters": [ @@ -154,10 +157,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "any", + "Documentation": "Return True if bool(x) is True for any x in the iterable.\n\nIf the iterable is empty, return False." }, { - "Name": "ascii", "Overloads": [ { "Parameters": [ @@ -173,10 +177,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "ascii", + "Documentation": "Return an ASCII-only representation of an object.\n\nAs repr(), return a string containing a printable representation of an\nobject, but escape the non-ASCII characters in the string returned by\nrepr() using \\\\x, \\\\u or \\\\U escapes. This generates a string similar\nto that returned by repr() in Python 2." }, { - "Name": "bin", "Overloads": [ { "Parameters": [ @@ -192,10 +197,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "bin", + "Documentation": "Return the binary representation of an integer.\n\n >>> bin(2796202)\n '0b1010101010101010101010'" }, { - "Name": "breakpoint", "Overloads": [ { "Parameters": [ @@ -217,10 +223,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "breakpoint", + "Documentation": "breakpoint(*args, **kws)\n\nCall sys.breakpointhook(*args, **kws). sys.breakpointhook() must accept\nwhatever arguments are passed.\n\nBy default, this drops you into the pdb debugger." }, { - "Name": "callable", "Overloads": [ { "Parameters": [ @@ -236,10 +243,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "callable", + "Documentation": "Return whether the object is callable (i.e., some kind of function).\n\nNote that classes are callable, as are instances of classes with a\n__call__() method." }, { - "Name": "chr", "Overloads": [ { "Parameters": [ @@ -255,10 +263,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "chr", + "Documentation": "Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff." }, { - "Name": "compile", "Overloads": [ { "Parameters": [ @@ -304,10 +313,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "compile", + "Documentation": "Compile source into a code object that can be executed by exec() or eval().\n\nThe source code may represent a Python module, statement or expression.\nThe filename will be used for run-time error messages.\nThe mode must be 'exec' to compile a module, 'single' to compile a\nsingle (interactive) statement, or 'eval' to compile an expression.\nThe flags argument, if present, controls which future statements influence\nthe compilation of the code.\nThe dont_inherit argument, if true, stops the compilation inheriting\nthe effects of any future statements in effect in the code calling\ncompile; if absent or false these statements do influence the compilation,\nin addition to any features explicitly specified." }, { - "Name": "copyright", "Overloads": [ { "Parameters": [ @@ -323,10 +333,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "copyright", + "Documentation": "interactive prompt objects for printing the license text, a list of\n contributors and the copyright notice." }, { - "Name": "credits", "Overloads": [ { "Parameters": [ @@ -342,10 +353,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "credits", + "Documentation": "interactive prompt objects for printing the license text, a list of\n contributors and the copyright notice." }, { - "Name": "delattr", "Overloads": [ { "Parameters": [ @@ -367,10 +379,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "delattr", + "Documentation": "Deletes the named attribute from the given object.\n\ndelattr(x, 'y') is equivalent to ``del x.y''" }, { - "Name": "dir", "Overloads": [ { "Parameters": [ @@ -381,15 +394,16 @@ "Kind": 0 } ], - "ReturnType": "i:builtins.list" + "ReturnType": "i:list" } ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "dir", + "Documentation": "dir([object]) -> list of strings\n\nIf called without an argument, return the names in the current scope.\nElse, return an alphabetized list of names comprising (some of) the attributes\nof the given object, and of attributes reachable from it.\nIf the object supplies a method named __dir__, it will be used; otherwise\nthe default dir() logic is used and returns:\n for a module object: the module's attributes.\n for a class object: its attributes, and recursively the attributes\n of its bases.\n for any other object: its attributes, its class's attributes, and\n recursively the attributes of its class's base classes." }, { - "Name": "divmod", "Overloads": [ { "Parameters": [ @@ -406,15 +420,16 @@ "Kind": 0 } ], - "ReturnType": "i:builtins.tuple" + "ReturnType": "i:tuple" } ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "divmod", + "Documentation": "Return the tuple (x//y, x%y). Invariant: div*y + mod == x." }, { - "Name": "eval", "Overloads": [ { "Parameters": [ @@ -437,15 +452,16 @@ "Kind": 0 } ], - "ReturnType": "builtins.object" + "ReturnType": "object" } ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "eval", + "Documentation": "Evaluate the given source in the context of globals and locals.\n\nThe source may be a string representing a Python expression\nor a code object as returned by compile().\nThe globals must be a dictionary and locals can be any mapping,\ndefaulting to the current globals and locals.\nIf only globals is given, locals defaults to it." }, { - "Name": "exec", "Overloads": [ { "Parameters": [ @@ -473,10 +489,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "exec", + "Documentation": "Execute the given source in the context of globals and locals.\n\nThe source may be a string representing one or more Python statements\nor a code object as returned by compile().\nThe globals must be a dictionary and locals can be any mapping,\ndefaulting to the current globals and locals.\nIf only globals is given, locals defaults to it." }, { - "Name": "exit", "Overloads": [ { "Parameters": [ @@ -498,10 +515,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "exit", + "Documentation": null }, { - "Name": "format", "Overloads": [ { "Parameters": [ @@ -523,10 +541,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "format", + "Documentation": "Return value.__format__(format_spec)\n\nformat_spec defaults to the empty string.\nSee the Format Specification Mini-Language section of help('FORMATTING') for\ndetails." }, { - "Name": "getattr", "Overloads": [ { "Parameters": [ @@ -554,22 +573,24 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "getattr", + "Documentation": "getattr(object, name[, default]) -> value\n\nGet a named attribute from an object; getattr(x, 'y') is equivalent to x.y.\nWhen a default argument is given, it is returned when the attribute doesn't\nexist; without it, an exception is raised in that case." }, { - "Name": "globals", "Overloads": [ { "Parameters": [], - "ReturnType": "i:builtins.dict" + "ReturnType": "i:dict" } ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "globals", + "Documentation": "Return the dictionary containing the current scope's global variables.\n\nNOTE: Updates to this dictionary *will* affect name lookups in the current\nglobal scope and vice-versa." }, { - "Name": "hasattr", "Overloads": [ { "Parameters": [ @@ -591,10 +612,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "hasattr", + "Documentation": "Return whether the object has an attribute with the given name.\n\nThis is done by calling getattr(obj, name) and catching AttributeError." }, { - "Name": "hash", "Overloads": [ { "Parameters": [ @@ -610,10 +632,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "hash", + "Documentation": "Return the hash value for the given object.\n\nTwo objects that compare equal must also have the same hash value, but the\nreverse is not necessarily true." }, { - "Name": "help", "Overloads": [ { "Parameters": [ @@ -641,10 +664,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "help", + "Documentation": "Define the builtin 'help'.\n\n This is a wrapper around pydoc.help that provides a helpful message\n when 'help' is typed at the Python interactive prompt.\n\n Calling help() at the Python prompt starts an interactive help session.\n Calling help(thing) prints help for the python object 'thing'.\n " }, { - "Name": "hex", "Overloads": [ { "Parameters": [ @@ -660,10 +684,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "hex", + "Documentation": "Return the hexadecimal representation of an integer.\n\n >>> hex(12648430)\n '0xc0ffee'" }, { - "Name": "id", "Overloads": [ { "Parameters": [ @@ -679,10 +704,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "id", + "Documentation": "Return the identity of an object.\n\nThis is guaranteed to be unique among simultaneously existing objects.\n(CPython uses the object's memory address.)" }, { - "Name": "input", "Overloads": [ { "Parameters": [ @@ -698,10 +724,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "input", + "Documentation": "Read a string from standard input. The trailing newline is stripped.\n\nThe prompt string, if given, is printed to standard output without a\ntrailing newline before reading input.\n\nIf the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.\nOn *nix systems, readline is used if available." }, { - "Name": "isinstance", "Overloads": [ { "Parameters": [ @@ -718,15 +745,16 @@ "Kind": 0 } ], - "ReturnType": "builtins.bool" + "ReturnType": "bool" } ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "isinstance", + "Documentation": "Return whether an object is an instance of a class or of a subclass thereof.\n\nA tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the target to\ncheck against. This is equivalent to ``isinstance(x, A) or isinstance(x, B)\nor ...`` etc." }, { - "Name": "issubclass", "Overloads": [ { "Parameters": [ @@ -743,15 +771,16 @@ "Kind": 0 } ], - "ReturnType": "builtins.bool" + "ReturnType": "bool" } ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "issubclass", + "Documentation": "Return whether 'cls' is a derived from another class or is the same class.\n\nA tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the target to\ncheck against. This is equivalent to ``issubclass(x, A) or issubclass(x, B)\nor ...`` etc." }, { - "Name": "iter", "Overloads": [ { "Parameters": [ @@ -773,10 +802,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "iter", + "Documentation": "iter(iterable) -> iterator\niter(callable, sentinel) -> iterator\n\nGet an iterator from an object. In the first form, the argument must\nsupply its own iterator, or be a sequence.\nIn the second form, the callable is called until it returns the sentinel." }, { - "Name": "len", "Overloads": [ { "Parameters": [ @@ -787,15 +817,16 @@ "Kind": 0 } ], - "ReturnType": "builtins.int" + "ReturnType": "int" } ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "len", + "Documentation": "Return the number of items in a container." }, { - "Name": "license", "Overloads": [ { "Parameters": [ @@ -811,22 +842,24 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "license", + "Documentation": "interactive prompt objects for printing the license text, a list of\n contributors and the copyright notice." }, { - "Name": "locals", "Overloads": [ { "Parameters": [], - "ReturnType": "i:builtins.dict" + "ReturnType": "i:dict" } ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "locals", + "Documentation": "Return a dictionary containing the current scope's local variables.\n\nNOTE: Whether or not updates to this dictionary will affect name lookups in\nthe local scope and vice-versa is *implementation dependent* and not\ncovered by any backwards compatibility guarantees." }, { - "Name": "max", "Overloads": [ { "Parameters": [ @@ -860,10 +893,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "max", + "Documentation": "max(iterable, *[, default=obj, key=func]) -> value\nmax(arg1, arg2, *args, *[, key=func]) -> value\n\nWith a single iterable argument, return its biggest item. The\ndefault keyword-only argument specifies an object to return if\nthe provided iterable is empty.\nWith two or more arguments, return the largest argument." }, { - "Name": "min", "Overloads": [ { "Parameters": [ @@ -897,10 +931,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "min", + "Documentation": "min(iterable, *[, default=obj, key=func]) -> value\nmin(arg1, arg2, *args, *[, key=func]) -> value\n\nWith a single iterable argument, return its smallest item. The\ndefault keyword-only argument specifies an object to return if\nthe provided iterable is empty.\nWith two or more arguments, return the smallest argument." }, { - "Name": "next", "Overloads": [ { "Parameters": [ @@ -922,10 +957,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "next", + "Documentation": "next(iterator[, default])\n\nReturn the next item from the iterator. If default is given and the iterator\nis exhausted, it is returned instead of raising StopIteration." }, { - "Name": "oct", "Overloads": [ { "Parameters": [ @@ -941,10 +977,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "oct", + "Documentation": "Return the octal representation of an integer.\n\n >>> oct(342391)\n '0o1234567'" }, { - "Name": "open", "Overloads": [ { "Parameters": [ @@ -1002,10 +1039,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "open", + "Documentation": "Open file and return a stream. Raise OSError upon failure.\n\nfile is either a text or byte string giving the name (and the path\nif the file isn't in the current working directory) of the file to\nbe opened or an integer file descriptor of the file to be\nwrapped. (If a file descriptor is given, it is closed when the\nreturned I/O object is closed, unless closefd is set to False.)\n\nmode is an optional string that specifies the mode in which the file\nis opened. It defaults to 'r' which means open for reading in text\nmode. Other common values are 'w' for writing (truncating the file if\nit already exists), 'x' for creating and writing to a new file, and\n'a' for appending (which on some Unix systems, means that all writes\nappend to the end of the file regardless of the current seek position).\nIn text mode, if encoding is not specified the encoding used is platform\ndependent: locale.getpreferredencoding(False) is called to get the\ncurrent locale encoding. (For reading and writing raw bytes use binary\nmode and leave encoding unspecified.) The available modes are:\n\n========= ===============================================================\nCharacter Meaning\n--------- ---------------------------------------------------------------\n'r' open for reading (default)\n'w' open for writing, truncating the file first\n'x' create a new file and open it for writing\n'a' open for writing, appending to the end of the file if it exists\n'b' binary mode\n't' text mode (default)\n'+' open a disk file for updating (reading and writing)\n'U' universal newline mode (deprecated)\n========= ===============================================================\n\nThe default mode is 'rt' (open for reading text). For binary random\naccess, the mode 'w+b' opens and truncates the file to 0 bytes, while\n'r+b' opens the file without truncation. The 'x' mode implies 'w' and\nraises an `FileExistsError` if the file already exists.\n\nPython distinguishes between files opened in binary and text modes,\neven when the underlying operating system doesn't. Files opened in\nbinary mode (appending 'b' to the mode argument) return contents as\nbytes objects without any decoding. In text mode (the default, or when\n't' is appended to the mode argument), the contents of the file are\nreturned as strings, the bytes having been first decoded using a\nplatform-dependent encoding or using the specified encoding if given.\n\n'U' mode is deprecated and will raise an exception in future versions\nof Python. It has no effect in Python 3. Use newline to control\nuniversal newlines mode.\n\nbuffering is an optional integer used to set the buffering policy.\nPass 0 to switch buffering off (only allowed in binary mode), 1 to select\nline buffering (only usable in text mode), and an integer > 1 to indicate\nthe size of a fixed-size chunk buffer. When no buffering argument is\ngiven, the default buffering policy works as follows:\n\n* Binary files are buffered in fixed-size chunks; the size of the buffer\n is chosen using a heuristic trying to determine the underlying device's\n \"block size\" and falling back on `io.DEFAULT_BUFFER_SIZE`.\n On many systems, the buffer will typically be 4096 or 8192 bytes long.\n\n* \"Interactive\" text files (files for which isatty() returns True)\n use line buffering. Other text files use the policy described above\n for binary files.\n\nencoding is the name of the encoding used to decode or encode the\nfile. This should only be used in text mode. The default encoding is\nplatform dependent, but any encoding supported by Python can be\npassed. See the codecs module for the list of supported encodings.\n\nerrors is an optional string that specifies how encoding errors are to\nbe handled---this argument should not be used in binary mode. Pass\n'strict' to raise a ValueError exception if there is an encoding error\n(the default of None has the same effect), or pass 'ignore' to ignore\nerrors. (Note that ignoring encoding errors can lead to data loss.)\nSee the documentation for codecs.register or run 'help(codecs.Codec)'\nfor a list of the permitted encoding error strings.\n\nnewline controls how universal newlines works (it only applies to text\nmode). It can be None, '', '\\n', '\\r', and '\\r\\n'. It works as\nfollows:\n\n* On input, if newline is None, universal newlines mode is\n enabled. Lines in the input can end in '\\n', '\\r', or '\\r\\n', and\n these are translated into '\\n' before being returned to the\n caller. If it is '', universal newline mode is enabled, but line\n endings are returned to the caller untranslated. If it has any of\n the other legal values, input lines are only terminated by the given\n string, and the line ending is returned to the caller untranslated.\n\n* On output, if newline is None, any '\\n' characters written are\n translated to the system default line separator, os.linesep. If\n newline is '' or '\\n', no translation takes place. If newline is any\n of the other legal values, any '\\n' characters written are translated\n to the given string.\n\nIf closefd is False, the underlying file descriptor will be kept open\nwhen the file is closed. This does not work when a file name is given\nand must be True in that case.\n\nA custom opener can be used by passing a callable as *opener*. The\nunderlying file descriptor for the file object is then obtained by\ncalling *opener* with (*file*, *flags*). *opener* must return an open\nfile descriptor (passing os.open as *opener* results in functionality\nsimilar to passing None).\n\nopen() returns a file object whose type depends on the mode, and\nthrough which the standard file operations such as reading and writing\nare performed. When open() is used to open a file in a text mode ('w',\n'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open\na file in a binary mode, the returned class varies: in read binary\nmode, it returns a BufferedReader; in write binary and append binary\nmodes, it returns a BufferedWriter, and in read/write mode, it returns\na BufferedRandom.\n\nIt is also possible to use a string or bytearray as a file for both\nreading and writing. For strings StringIO can be used like a file\nopened in a text mode, and for bytes a BytesIO can be used like a file\nopened in a binary mode." }, { - "Name": "ord", "Overloads": [ { "Parameters": [ @@ -1016,15 +1054,16 @@ "Kind": 0 } ], - "ReturnType": "builtins.int" + "ReturnType": "int" } ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "ord", + "Documentation": "Return the Unicode code point for a one-character string." }, { - "Name": "pow", "Overloads": [ { "Parameters": [ @@ -1052,10 +1091,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "pow", + "Documentation": "Equivalent to x**y (with two arguments) or x**y % z (with three arguments)\n\nSome types, such as ints, are able to use a more efficient algorithm when\ninvoked using the three argument form." }, { - "Name": "print", "Overloads": [ { "Parameters": [], @@ -1064,10 +1104,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "print", + "Documentation": "print(value, ..., sep=' ', end='\\n', file=sys.stdout, flush=False)\n\nPrints the values to a stream, or to sys.stdout by default.\nOptional keyword arguments:\nfile: a file-like object (stream); defaults to the current sys.stdout.\nsep: string inserted between values, default a space.\nend: string appended after the last value, default a newline.\nflush: whether to forcibly flush the stream." }, { - "Name": "quit", "Overloads": [ { "Parameters": [ @@ -1089,10 +1130,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "quit", + "Documentation": null }, { - "Name": "range", "Overloads": [ { "Parameters": [], @@ -1101,10 +1143,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "range", + "Documentation": "" }, { - "Name": "repr", "Overloads": [ { "Parameters": [ @@ -1120,10 +1163,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "repr", + "Documentation": "Return the canonical string representation of the object.\n\nFor many object types, including most builtins, eval(repr(obj)) == obj." }, { - "Name": "round", "Overloads": [ { "Parameters": [ @@ -1145,10 +1189,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "round", + "Documentation": "Round a number to a given precision in decimal digits.\n\nThe return value is an integer if ndigits is omitted or None. Otherwise\nthe return value has the same type as the number. ndigits may be negative." }, { - "Name": "setattr", "Overloads": [ { "Parameters": [ @@ -1176,10 +1221,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "setattr", + "Documentation": "Sets the named attribute on the given object to the specified value.\n\nsetattr(x, 'y', v) is equivalent to ``x.y = v''" }, { - "Name": "sorted", "Overloads": [ { "Parameters": [ @@ -1190,15 +1236,16 @@ "Kind": 0 } ], - "ReturnType": "i:builtins.list" + "ReturnType": "i:list" } ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "sorted", + "Documentation": "Return a new list containing all items from the iterable in ascending order.\n\nA custom key function can be supplied to customize the sort order, and the\nreverse flag can be set to request the result in descending order." }, { - "Name": "sum", "Overloads": [ { "Parameters": [ @@ -1220,10 +1267,11 @@ ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "sum", + "Documentation": "Return the sum of a 'start' value (default: 0) plus an iterable of numbers\n\nWhen the iterable is empty, return the start value.\nThis function is intended specifically for use with numeric values and may\nreject non-numeric types." }, { - "Name": "vars", "Overloads": [ { "Parameters": [ @@ -1234,1614 +1282,1764 @@ "Kind": 0 } ], - "ReturnType": "i:builtins.dict" + "ReturnType": "i:dict" } ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "vars", + "Documentation": "vars([object]) -> dictionary\n\nWithout arguments, equivalent to locals().\nWith an argument, equivalent to object.__dict__." }, { - "Name": "cmp", "Overloads": [ { "Parameters": [], - "ReturnType": "builtins.int" + "ReturnType": "int" } ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "cmp", + "Documentation": "" } ], "Variables": [], "Classes": [ { - "Name": "NotImplementedType", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "NotImplementedType", + "Documentation": null }, { - "Name": "__Unknown__", "Bases": [], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "__Unknown__", + "Documentation": "" }, { - "Name": "__NoneType__", "Bases": [], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "__NoneType__", + "Documentation": "the type of the None object" }, { - "Name": "object", "Bases": [], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "object", + "Documentation": "The most base type" }, { - "Name": "int", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "int", + "Documentation": "int([x]) -> integer\nint(x, base=10) -> integer\n\nConvert a number or string to an integer, or return 0 if no arguments\nare given. If x is a number, return x.__int__(). For floating point\nnumbers, this truncates towards zero.\n\nIf x is not a number or if base is given, then x must be a string,\nbytes, or bytearray instance representing an integer literal in the\ngiven base. The literal can be preceded by '+' or '-' and be surrounded\nby whitespace. The base defaults to 10. Valid bases are 0 and 2-36.\nBase 0 means to interpret the base from the string as an integer literal.\n>>> int('0b100', base=0)\n4" }, { - "Name": "bool", "Bases": [ - "builtins.int" + "int" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "bool", + "Documentation": "bool(x) -> bool\n\nReturns True when the argument x is true, False otherwise.\nThe builtins True and False are the only two instances of the class bool.\nThe class bool is a subclass of the class int, and cannot be subclassed." }, { - "Name": "float", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "float", + "Documentation": "Convert a string or number to a floating point number, if possible." }, { - "Name": "complex", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "complex", + "Documentation": "Create a complex number from a real part and an optional imaginary part.\n\nThis is equivalent to (real + imag*1j) where imag defaults to 0." }, { - "Name": "tuple", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "tuple", + "Documentation": "Built-in immutable sequence.\n\nIf no argument is given, the constructor returns an empty tuple.\nIf iterable is specified the tuple is initialized from iterable's items.\n\nIf the argument is a tuple, the return value is the same object." }, { - "Name": "list", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "list", + "Documentation": "Built-in mutable sequence.\n\nIf no argument is given, the constructor creates a new empty list.\nThe argument must be an iterable if specified." }, { - "Name": "dict", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "dict", + "Documentation": "dict() -> new empty dictionary\ndict(mapping) -> new dictionary initialized from a mapping object's\n (key, value) pairs\ndict(iterable) -> new dictionary initialized as if via:\n d = {}\n for k, v in iterable:\n d[k] = v\ndict(**kwargs) -> new dictionary initialized with the name=value pairs\n in the keyword argument list. For example: dict(one=1, two=2)" }, { - "Name": "set", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "set", + "Documentation": "set() -> new empty set object\nset(iterable) -> new set object\n\nBuild an unordered collection of unique elements." }, { - "Name": "frozenset", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "frozenset", + "Documentation": "frozenset() -> empty frozenset object\nfrozenset(iterable) -> frozenset object\n\nBuild an immutable unordered collection of unique elements." }, { - "Name": "bytes", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "bytes", + "Documentation": "bytes(iterable_of_ints) -> bytes\nbytes(string, encoding[, errors]) -> bytes\nbytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer\nbytes(int) -> bytes object of size given by the parameter initialized with null bytes\nbytes() -> empty bytes object\n\nConstruct an immutable array of bytes from:\n - an iterable yielding integers in range(256)\n - a text string encoded using the specified encoding\n - any object implementing the buffer API.\n - an integer" }, { - "Name": "bytes_iterator", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "bytes_iterator", + "Documentation": null }, { - "Name": "str", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "str", + "Documentation": "str(object='') -> str\nstr(bytes_or_buffer[, encoding[, errors]]) -> str\n\nCreate a new string object from the given object. If encoding or\nerrors is specified, then the object must expose a data buffer\nthat will be decoded using the given encoding and error handler.\nOtherwise, returns the result of object.__str__() (if defined)\nor repr(object).\nencoding defaults to sys.getdefaultencoding().\nerrors defaults to 'strict'." }, { - "Name": "str_iterator", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "str_iterator", + "Documentation": null }, { - "Name": "module", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "module", + "Documentation": "Create a module object.\n\nThe name must be a string; the optional doc argument can have any type." }, { - "Name": "function", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "function", + "Documentation": "Create a function object.\n\n code\n a code object\n globals\n the globals dictionary\n name\n a string that overrides the name from the code object\n argdefs\n a tuple that specifies the default argument values\n closure\n a tuple that supplies the bindings for free variables" }, { - "Name": "wrapper_descriptor", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "wrapper_descriptor", + "Documentation": null }, { - "Name": "builtin_function_or_method", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "builtin_function_or_method", + "Documentation": null }, { - "Name": "generator", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "generator", + "Documentation": null }, { - "Name": "property", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "property", + "Documentation": "Property attribute.\n\n fget\n function to be used for getting an attribute value\n fset\n function to be used for setting an attribute value\n fdel\n function to be used for del'ing an attribute\n doc\n docstring\n\nTypical use is to define a managed attribute x:\n\nclass C(object):\n def getx(self): return self._x\n def setx(self, value): self._x = value\n def delx(self): del self._x\n x = property(getx, setx, delx, \"I'm the 'x' property.\")\n\nDecorators make defining new properties or modifying existing ones easy:\n\nclass C(object):\n @property\n def x(self):\n \"I am the 'x' property.\"\n return self._x\n @x.setter\n def x(self, value):\n self._x = value\n @x.deleter\n def x(self):\n del self._x" }, { - "Name": "classmethod", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "classmethod", + "Documentation": "classmethod(function) -> method\n\nConvert a function to be a class method.\n\nA class method receives the class as implicit first argument,\njust like an instance method receives the instance.\nTo declare a class method, use this idiom:\n\n class C:\n @classmethod\n def f(cls, arg1, arg2, ...):\n ...\n\nIt can be called either on the class (e.g. C.f()) or on an instance\n(e.g. C().f()). The instance is ignored except for its class.\nIf a class method is called for a derived class, the derived class\nobject is passed as the implied first argument.\n\nClass methods are different than C++ or Java static methods.\nIf you want those, see the staticmethod builtin." }, { - "Name": "staticmethod", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "staticmethod", + "Documentation": "staticmethod(function) -> method\n\nConvert a function to be a static method.\n\nA static method does not receive an implicit first argument.\nTo declare a static method, use this idiom:\n\n class C:\n @staticmethod\n def f(arg1, arg2, ...):\n ...\n\nIt can be called either on the class (e.g. C.f()) or on an instance\n(e.g. C().f()). The instance is ignored except for its class.\n\nStatic methods in Python are similar to those found in Java or C++.\nFor a more advanced concept, see the classmethod builtin." }, { - "Name": "...", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "...", + "Documentation": null }, { - "Name": "tuple_iterator", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "tuple_iterator", + "Documentation": null }, { - "Name": "list_iterator", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "list_iterator", + "Documentation": null }, { - "Name": "dict_keys", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "dict_keys", + "Documentation": null }, { - "Name": "dict_values", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "dict_values", + "Documentation": null }, { - "Name": "dict_items", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "dict_items", + "Documentation": null }, { - "Name": "set_iterator", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "set_iterator", + "Documentation": null }, { - "Name": "callable_iterator", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "callable_iterator", + "Documentation": null }, { - "Name": "ArithmeticError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "ArithmeticError", + "Documentation": "Base class for arithmetic errors." }, { - "Name": "AssertionError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "AssertionError", + "Documentation": "Assertion failed." }, { - "Name": "AttributeError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "AttributeError", + "Documentation": "Attribute not found." }, { - "Name": "BaseException", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "BaseException", + "Documentation": "Common base class for all exceptions" }, { - "Name": "BlockingIOError", "Bases": [ - "builtins.OSError" + "OSError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "BlockingIOError", + "Documentation": "I/O operation would block." }, { - "Name": "BrokenPipeError", "Bases": [ - "builtins.ConnectionError" + "ConnectionError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "BrokenPipeError", + "Documentation": "Broken pipe." }, { - "Name": "BufferError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "BufferError", + "Documentation": "Buffer error." }, { - "Name": "BytesWarning", "Bases": [ - "builtins.Warning" + "Warning" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "BytesWarning", + "Documentation": "Base class for warnings about bytes and buffer related problems, mostly\nrelated to conversion from str or comparing to str." }, { - "Name": "ChildProcessError", "Bases": [ - "builtins.OSError" + "OSError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "ChildProcessError", + "Documentation": "Child process error." }, { - "Name": "ConnectionAbortedError", "Bases": [ - "builtins.ConnectionError" + "ConnectionError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "ConnectionAbortedError", + "Documentation": "Connection aborted." }, { - "Name": "ConnectionError", "Bases": [ - "builtins.OSError" + "OSError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "ConnectionError", + "Documentation": "Connection error." }, { - "Name": "ConnectionRefusedError", "Bases": [ - "builtins.ConnectionError" + "ConnectionError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "ConnectionRefusedError", + "Documentation": "Connection refused." }, { - "Name": "ConnectionResetError", "Bases": [ - "builtins.ConnectionError" + "ConnectionError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "ConnectionResetError", + "Documentation": "Connection reset." }, { - "Name": "DeprecationWarning", "Bases": [ - "builtins.Warning" + "Warning" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "DeprecationWarning", + "Documentation": "Base class for warnings about deprecated features." }, { - "Name": "EOFError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "EOFError", + "Documentation": "Read beyond end of file." }, { - "Name": "Exception", "Bases": [ - "builtins.BaseException" + "BaseException" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "Exception", + "Documentation": "Common base class for all non-exit exceptions." }, { - "Name": "FileExistsError", "Bases": [ - "builtins.OSError" + "OSError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "FileExistsError", + "Documentation": "File already exists." }, { - "Name": "FileNotFoundError", "Bases": [ - "builtins.OSError" + "OSError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "FileNotFoundError", + "Documentation": "File not found." }, { - "Name": "FloatingPointError", "Bases": [ - "builtins.ArithmeticError" + "ArithmeticError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "FloatingPointError", + "Documentation": "Floating point operation failed." }, { - "Name": "FutureWarning", "Bases": [ - "builtins.Warning" + "Warning" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "FutureWarning", + "Documentation": "Base class for warnings about constructs that will change semantically\nin the future." }, { - "Name": "GeneratorExit", "Bases": [ - "builtins.BaseException" + "BaseException" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "GeneratorExit", + "Documentation": "Request that a generator exit." }, { - "Name": "ImportError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "ImportError", + "Documentation": "Import can't find module, or can't find name in module." }, { - "Name": "ImportWarning", "Bases": [ - "builtins.Warning" + "Warning" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "ImportWarning", + "Documentation": "Base class for warnings about probable mistakes in module imports" }, { - "Name": "IndentationError", "Bases": [ - "builtins.SyntaxError" + "SyntaxError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "IndentationError", + "Documentation": "Improper indentation." }, { - "Name": "IndexError", "Bases": [ - "builtins.LookupError" + "LookupError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "IndexError", + "Documentation": "Sequence index out of range." }, { - "Name": "InterruptedError", "Bases": [ - "builtins.OSError" + "OSError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "InterruptedError", + "Documentation": "Interrupted by signal." }, { - "Name": "IsADirectoryError", "Bases": [ - "builtins.OSError" + "OSError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "IsADirectoryError", + "Documentation": "Operation doesn't work on directories." }, { - "Name": "KeyError", "Bases": [ - "builtins.LookupError" + "LookupError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "KeyError", + "Documentation": "Mapping key not found." }, { - "Name": "KeyboardInterrupt", "Bases": [ - "builtins.BaseException" + "BaseException" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "KeyboardInterrupt", + "Documentation": "Program interrupted by user." }, { - "Name": "LookupError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "LookupError", + "Documentation": "Base class for lookup errors." }, { - "Name": "MemoryError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "MemoryError", + "Documentation": "Out of memory." }, { - "Name": "ModuleNotFoundError", "Bases": [ - "builtins.ImportError" + "ImportError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "ModuleNotFoundError", + "Documentation": "Module not found." }, { - "Name": "NameError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "NameError", + "Documentation": "Name not found globally." }, { - "Name": "NotADirectoryError", "Bases": [ - "builtins.OSError" + "OSError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "NotADirectoryError", + "Documentation": "Operation only works on directories." }, { - "Name": "NotImplementedError", "Bases": [ - "builtins.RuntimeError" + "RuntimeError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "NotImplementedError", + "Documentation": "Method or function hasn't been implemented yet." }, { - "Name": "OSError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "OSError", + "Documentation": "Base class for I/O related errors." }, { - "Name": "OverflowError", "Bases": [ - "builtins.ArithmeticError" + "ArithmeticError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "OverflowError", + "Documentation": "Result too large to be represented." }, { - "Name": "PendingDeprecationWarning", "Bases": [ - "builtins.Warning" + "Warning" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "PendingDeprecationWarning", + "Documentation": "Base class for warnings about features which will be deprecated\nin the future." }, { - "Name": "PermissionError", "Bases": [ - "builtins.OSError" + "OSError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "PermissionError", + "Documentation": "Not enough permissions." }, { - "Name": "ProcessLookupError", "Bases": [ - "builtins.OSError" + "OSError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "ProcessLookupError", + "Documentation": "Process not found." }, { - "Name": "RecursionError", "Bases": [ - "builtins.RuntimeError" + "RuntimeError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "RecursionError", + "Documentation": "Recursion limit exceeded." }, { - "Name": "ReferenceError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "ReferenceError", + "Documentation": "Weak ref proxy used after referent went away." }, { - "Name": "ResourceWarning", "Bases": [ - "builtins.Warning" + "Warning" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "ResourceWarning", + "Documentation": "Base class for warnings about resource usage." }, { - "Name": "RuntimeError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "RuntimeError", + "Documentation": "Unspecified run-time error." }, { - "Name": "RuntimeWarning", "Bases": [ - "builtins.Warning" + "Warning" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "RuntimeWarning", + "Documentation": "Base class for warnings about dubious runtime behavior." }, { - "Name": "StopAsyncIteration", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "StopAsyncIteration", + "Documentation": "Signal the end from iterator.__anext__()." }, { - "Name": "StopIteration", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "StopIteration", + "Documentation": "Signal the end from iterator.__next__()." }, { - "Name": "SyntaxError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "SyntaxError", + "Documentation": "Invalid syntax." }, { - "Name": "SyntaxWarning", "Bases": [ - "builtins.Warning" + "Warning" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "SyntaxWarning", + "Documentation": "Base class for warnings about dubious syntax." }, { - "Name": "SystemError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "SystemError", + "Documentation": "Internal error in the Python interpreter.\n\nPlease report this to the Python maintainer, along with the traceback,\nthe Python version, and the hardware/OS platform and version." }, { - "Name": "SystemExit", "Bases": [ - "builtins.BaseException" + "BaseException" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "SystemExit", + "Documentation": "Request to exit from the interpreter." }, { - "Name": "TabError", "Bases": [ - "builtins.IndentationError" + "IndentationError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "TabError", + "Documentation": "Improper mixture of spaces and tabs." }, { - "Name": "TimeoutError", "Bases": [ - "builtins.OSError" + "OSError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "TimeoutError", + "Documentation": "Timeout expired." }, { - "Name": "TypeError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "TypeError", + "Documentation": "Inappropriate argument type." }, { - "Name": "UnboundLocalError", "Bases": [ - "builtins.NameError" + "NameError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "UnboundLocalError", + "Documentation": "Local name referenced but not bound to a value." }, { - "Name": "UnicodeDecodeError", "Bases": [ - "builtins.UnicodeError" + "UnicodeError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "UnicodeDecodeError", + "Documentation": "Unicode decoding error." }, { - "Name": "UnicodeEncodeError", "Bases": [ - "builtins.UnicodeError" + "UnicodeError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "UnicodeEncodeError", + "Documentation": "Unicode encoding error." }, { - "Name": "UnicodeError", "Bases": [ - "builtins.ValueError" + "ValueError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "UnicodeError", + "Documentation": "Unicode related error." }, { - "Name": "UnicodeTranslateError", "Bases": [ - "builtins.UnicodeError" + "UnicodeError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "UnicodeTranslateError", + "Documentation": "Unicode translation error." }, { - "Name": "UnicodeWarning", "Bases": [ - "builtins.Warning" + "Warning" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "UnicodeWarning", + "Documentation": "Base class for warnings about Unicode related problems, mostly\nrelated to conversion problems." }, { - "Name": "UserWarning", "Bases": [ - "builtins.Warning" + "Warning" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "UserWarning", + "Documentation": "Base class for warnings generated by user code." }, { - "Name": "ValueError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "ValueError", + "Documentation": "Inappropriate argument value (of correct type)." }, { - "Name": "Warning", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "Warning", + "Documentation": "Base class for warning categories." }, { - "Name": "ZeroDivisionError", "Bases": [ - "builtins.ArithmeticError" + "ArithmeticError" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "ZeroDivisionError", + "Documentation": "Second argument to a division or modulo operation was zero." }, { - "Name": "bytearray", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "bytearray", + "Documentation": "bytearray(iterable_of_ints) -> bytearray\nbytearray(string, encoding[, errors]) -> bytearray\nbytearray(bytes_or_buffer) -> mutable copy of bytes_or_buffer\nbytearray(int) -> bytes array of size given by the parameter initialized with null bytes\nbytearray() -> empty bytes array\n\nConstruct a mutable bytearray object from:\n - an iterable yielding integers in range(256)\n - a text string encoded using the specified encoding\n - a bytes or a buffer object\n - any object implementing the buffer API.\n - an integer" }, { - "Name": "enumerate", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "enumerate", + "Documentation": "Return an enumerate object.\n\n iterable\n an object supporting iteration\n\nThe enumerate object yields pairs containing a count (from start, which\ndefaults to zero) and a value yielded by the iterable argument.\n\nenumerate is useful for obtaining an indexed list:\n (0, seq[0]), (1, seq[1]), (2, seq[2]), ..." }, { - "Name": "filter", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "filter", + "Documentation": "filter(function or None, iterable) --> filter object\n\nReturn an iterator yielding those items of iterable for which function(item)\nis true. If function is None, return the items that are true." }, { - "Name": "map", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "map", + "Documentation": "map(func, *iterables) --> map object\n\nMake an iterator that computes the function using arguments from\neach of the iterables. Stops when the shortest iterable is exhausted." }, { - "Name": "memoryview", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "memoryview", + "Documentation": "Create a new memoryview object which references the given object." }, { - "Name": "reversed", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "reversed", + "Documentation": "Return a reverse iterator over the values of the given sequence." }, { - "Name": "slice", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "slice", + "Documentation": "slice(stop)\nslice(start, stop[, step])\n\nCreate a slice object. This is used for extended slicing (e.g. a[0:10:2])." }, { - "Name": "super", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "super", + "Documentation": "super() -> same as super(__class__, )\nsuper(type) -> unbound super object\nsuper(type, obj) -> bound super object; requires isinstance(obj, type)\nsuper(type, type2) -> bound super object; requires issubclass(type2, type)\nTypical use to call a cooperative superclass method:\nclass C(B):\n def meth(self, arg):\n super().meth(arg)\nThis works for class methods too:\nclass C(B):\n @classmethod\n def cmeth(cls, arg):\n super().cmeth(arg)\n" }, { - "Name": "zip", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "zip", + "Documentation": "zip(iter1 [,iter2 [...]]) --> zip object\n\nReturn a zip object whose .__next__() method returns a tuple where\nthe i-th element comes from the i-th iterable argument. The .__next__()\nmethod continues until the shortest iterable in the argument sequence\nis exhausted and then it raises StopIteration." }, { - "Name": "object", "Bases": [], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "object", + "Documentation": "The most base type" }, { - "Name": "type", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "type", + "Documentation": "type(object_or_name, bases, dict)\ntype(object) -> the object's type\ntype(name, bases, dict) -> a new type" }, { - "Name": "int", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "int", + "Documentation": "int([x]) -> integer\nint(x, base=10) -> integer\n\nConvert a number or string to an integer, or return 0 if no arguments\nare given. If x is a number, return x.__int__(). For floating point\nnumbers, this truncates towards zero.\n\nIf x is not a number or if base is given, then x must be a string,\nbytes, or bytearray instance representing an integer literal in the\ngiven base. The literal can be preceded by '+' or '-' and be surrounded\nby whitespace. The base defaults to 10. Valid bases are 0 and 2-36.\nBase 0 means to interpret the base from the string as an integer literal.\n>>> int('0b100', base=0)\n4" }, { - "Name": "bool", "Bases": [ - "builtins.int" + "int" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "bool", + "Documentation": "bool(x) -> bool\n\nReturns True when the argument x is true, False otherwise.\nThe builtins True and False are the only two instances of the class bool.\nThe class bool is a subclass of the class int, and cannot be subclassed." }, { - "Name": "int", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "int", + "Documentation": "int([x]) -> integer\nint(x, base=10) -> integer\n\nConvert a number or string to an integer, or return 0 if no arguments\nare given. If x is a number, return x.__int__(). For floating point\nnumbers, this truncates towards zero.\n\nIf x is not a number or if base is given, then x must be a string,\nbytes, or bytearray instance representing an integer literal in the\ngiven base. The literal can be preceded by '+' or '-' and be surrounded\nby whitespace. The base defaults to 10. Valid bases are 0 and 2-36.\nBase 0 means to interpret the base from the string as an integer literal.\n>>> int('0b100', base=0)\n4" }, { - "Name": "float", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "float", + "Documentation": "Convert a string or number to a floating point number, if possible." }, { - "Name": "complex", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "complex", + "Documentation": "Create a complex number from a real part and an optional imaginary part.\n\nThis is equivalent to (real + imag*1j) where imag defaults to 0." }, { - "Name": "tuple", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "tuple", + "Documentation": "Built-in immutable sequence.\n\nIf no argument is given, the constructor returns an empty tuple.\nIf iterable is specified the tuple is initialized from iterable's items.\n\nIf the argument is a tuple, the return value is the same object." }, { - "Name": "list", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "list", + "Documentation": "Built-in mutable sequence.\n\nIf no argument is given, the constructor creates a new empty list.\nThe argument must be an iterable if specified." }, { - "Name": "dict", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "dict", + "Documentation": "dict() -> new empty dictionary\ndict(mapping) -> new dictionary initialized from a mapping object's\n (key, value) pairs\ndict(iterable) -> new dictionary initialized as if via:\n d = {}\n for k, v in iterable:\n d[k] = v\ndict(**kwargs) -> new dictionary initialized with the name=value pairs\n in the keyword argument list. For example: dict(one=1, two=2)" }, { - "Name": "set", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "set", + "Documentation": "set() -> new empty set object\nset(iterable) -> new set object\n\nBuild an unordered collection of unique elements." }, { - "Name": "frozenset", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "frozenset", + "Documentation": "frozenset() -> empty frozenset object\nfrozenset(iterable) -> frozenset object\n\nBuild an immutable unordered collection of unique elements." }, { - "Name": "bytes", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "bytes", + "Documentation": "bytes(iterable_of_ints) -> bytes\nbytes(string, encoding[, errors]) -> bytes\nbytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer\nbytes(int) -> bytes object of size given by the parameter initialized with null bytes\nbytes() -> empty bytes object\n\nConstruct an immutable array of bytes from:\n - an iterable yielding integers in range(256)\n - a text string encoded using the specified encoding\n - any object implementing the buffer API.\n - an integer" }, { - "Name": "bytes_iterator", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "bytes_iterator", + "Documentation": null }, { - "Name": "str", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "str", + "Documentation": "str(object='') -> str\nstr(bytes_or_buffer[, encoding[, errors]]) -> str\n\nCreate a new string object from the given object. If encoding or\nerrors is specified, then the object must expose a data buffer\nthat will be decoded using the given encoding and error handler.\nOtherwise, returns the result of object.__str__() (if defined)\nor repr(object).\nencoding defaults to sys.getdefaultencoding().\nerrors defaults to 'strict'." }, { - "Name": "str_iterator", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "str_iterator", + "Documentation": null }, { - "Name": "str", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "str", + "Documentation": "str(object='') -> str\nstr(bytes_or_buffer[, encoding[, errors]]) -> str\n\nCreate a new string object from the given object. If encoding or\nerrors is specified, then the object must expose a data buffer\nthat will be decoded using the given encoding and error handler.\nOtherwise, returns the result of object.__str__() (if defined)\nor repr(object).\nencoding defaults to sys.getdefaultencoding().\nerrors defaults to 'strict'." }, { - "Name": "str_iterator", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "str_iterator", + "Documentation": null }, { - "Name": "module", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "module", + "Documentation": "Create a module object.\n\nThe name must be a string; the optional doc argument can have any type." }, { - "Name": "function", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "function", + "Documentation": "Create a function object.\n\n code\n a code object\n globals\n the globals dictionary\n name\n a string that overrides the name from the code object\n argdefs\n a tuple that specifies the default argument values\n closure\n a tuple that supplies the bindings for free variables" }, { - "Name": "wrapper_descriptor", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "wrapper_descriptor", + "Documentation": null }, { - "Name": "builtin_function_or_method", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "builtin_function_or_method", + "Documentation": null }, { - "Name": "generator", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "generator", + "Documentation": null }, { - "Name": "property", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "property", + "Documentation": "Property attribute.\n\n fget\n function to be used for getting an attribute value\n fset\n function to be used for setting an attribute value\n fdel\n function to be used for del'ing an attribute\n doc\n docstring\n\nTypical use is to define a managed attribute x:\n\nclass C(object):\n def getx(self): return self._x\n def setx(self, value): self._x = value\n def delx(self): del self._x\n x = property(getx, setx, delx, \"I'm the 'x' property.\")\n\nDecorators make defining new properties or modifying existing ones easy:\n\nclass C(object):\n @property\n def x(self):\n \"I am the 'x' property.\"\n return self._x\n @x.setter\n def x(self, value):\n self._x = value\n @x.deleter\n def x(self):\n del self._x" }, { - "Name": "classmethod", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "classmethod", + "Documentation": "classmethod(function) -> method\n\nConvert a function to be a class method.\n\nA class method receives the class as implicit first argument,\njust like an instance method receives the instance.\nTo declare a class method, use this idiom:\n\n class C:\n @classmethod\n def f(cls, arg1, arg2, ...):\n ...\n\nIt can be called either on the class (e.g. C.f()) or on an instance\n(e.g. C().f()). The instance is ignored except for its class.\nIf a class method is called for a derived class, the derived class\nobject is passed as the implied first argument.\n\nClass methods are different than C++ or Java static methods.\nIf you want those, see the staticmethod builtin." }, { - "Name": "staticmethod", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "staticmethod", + "Documentation": "staticmethod(function) -> method\n\nConvert a function to be a static method.\n\nA static method does not receive an implicit first argument.\nTo declare a static method, use this idiom:\n\n class C:\n @staticmethod\n def f(arg1, arg2, ...):\n ...\n\nIt can be called either on the class (e.g. C.f()) or on an instance\n(e.g. C().f()). The instance is ignored except for its class.\n\nStatic methods in Python are similar to those found in Java or C++.\nFor a more advanced concept, see the classmethod builtin." }, { - "Name": "...", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "...", + "Documentation": null }, { - "Name": "tuple_iterator", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "tuple_iterator", + "Documentation": null }, { - "Name": "list_iterator", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "list_iterator", + "Documentation": null }, { - "Name": "dict_keys", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "dict_keys", + "Documentation": null }, { - "Name": "dict_values", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "dict_values", + "Documentation": null }, { - "Name": "dict_items", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "dict_items", + "Documentation": null }, { - "Name": "set_iterator", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "set_iterator", + "Documentation": null }, { - "Name": "callable_iterator", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "callable_iterator", + "Documentation": null }, { - "Name": "...", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "...", + "Documentation": null }, { - "Name": "OSError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "OSError", + "Documentation": "Base class for I/O related errors." }, { - "Name": "OSError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "OSError", + "Documentation": "Base class for I/O related errors." }, { - "Name": "NotImplementedType", "Bases": [ - "builtins.object" + "object" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "NotImplementedType", + "Documentation": null }, { - "Name": "OSError", "Bases": [ - "builtins.Exception" + "Exception" ], "Methods": [], "Properties": [], "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "OSError", + "Documentation": "Base class for I/O related errors." } - ] + ], + "Name": "builtins", + "Documentation": "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices." } \ No newline at end of file diff --git a/src/Caching/Test/Files/SmokeTest.json b/src/Caching/Test/Files/SmokeTest.json index 977ef3c0f..5b6f8ac84 100644 --- a/src/Caching/Test/Files/SmokeTest.json +++ b/src/Caching/Test/Files/SmokeTest.json @@ -1,23 +1,23 @@ { - "Name": "module", "Functions": [ { - "Name": "func", "Overloads": [ { "Parameters": [], - "ReturnType": "i:builtins.float" + "ReturnType": "i:float" } ], "Attributes": 0, "Classes": null, - "Functions": null + "Functions": null, + "Name": "func", + "Documentation": null } ], "Variables": [ { "Name": "x", - "Value": "i:builtins.str" + "Value": "i:str" }, { "Name": "c", @@ -26,63 +26,18 @@ ], "Classes": [ { - "Name": "C", "Bases": [ - "builtins.object" - ], - "Methods": [ - { - "Name": "__init__", - "Overloads": [ - { - "Parameters": [ - { - "Name": "self", - "Type": "module.C", - "DefaultValue": "", - "Kind": 0 - } - ], - "ReturnType": "" - } - ], - "Attributes": 0, - "Classes": null, - "Functions": null - }, - { - "Name": "method", - "Overloads": [ - { - "Parameters": [ - { - "Name": "self", - "Type": "module.C", - "DefaultValue": "", - "Kind": 0 - } - ], - "ReturnType": "i:builtins.float" - } - ], - "Attributes": 0, - "Classes": null, - "Functions": null - } + "object" ], + "Methods": [], "Properties": [], - "Fields": [ - { - "Name": "x", - "Value": "i:builtins.int" - }, - { - "Name": "y", - "Value": "i:builtins.int" - } - ], + "Fields": [], "GenericParameters": null, - "InnerClasses": [] + "InnerClasses": [], + "Name": "C", + "Documentation": null } - ] + ], + "Name": "module", + "Documentation": "" } \ No newline at end of file diff --git a/src/Caching/Test/Files/Sys.json b/src/Caching/Test/Files/Sys.json new file mode 100644 index 000000000..b2fbd480a --- /dev/null +++ b/src/Caching/Test/Files/Sys.json @@ -0,0 +1,846 @@ +{ + "Functions": [ + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__breakpointhook__", + "Documentation": "breakpointhook(*args, **kws)\n\nThis hook function is called by built-in breakpoint().\n" + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__displayhook__", + "Documentation": "displayhook(object) -> None\n\nPrint an object to sys.stdout and also save it in builtins._\n" + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__excepthook__", + "Documentation": "excepthook(exctype, value, traceback) -> None\n\nHandle an exception by displaying it with a traceback on sys.stderr.\n" + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__interactivehook__", + "Documentation": null + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": "i:__NoneType__" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "_clear_type_cache", + "Documentation": "_clear_type_cache() -> None\nClear the internal type lookup cache." + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": "i:builtins(3.7).dict" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "_current_frames", + "Documentation": "_current_frames() -> dictionary\n\nReturn a dictionary mapping each current thread T's thread id to T's\ncurrent stack frame.\n\nThis function should be used for specialized purposes only." + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "_debugmallocstats", + "Documentation": "_debugmallocstats()\n\nPrint summary info to stderr about the state of\npymalloc's structures.\n\nIn Py_DEBUG mode, also perform some expensive internal consistency\nchecks.\n" + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "_enablelegacywindowsfsencoding", + "Documentation": "_enablelegacywindowsfsencoding()\n\nChanges the default filesystem encoding to mbcs:replace for consistency\nwith earlier versions of Python. See PEP 529 for more information.\n\nThis is equivalent to defining the PYTHONLEGACYWINDOWSFSENCODING \nenvironment variable before launching Python." + }, + { + "Overloads": [ + { + "Parameters": [ + { + "Name": "depth", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:types.FrameType" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "_getframe", + "Documentation": "_getframe([depth]) -> frameobject\n\nReturn a frame object from the call stack. If optional integer depth is\ngiven, return the frame object that many calls below the top of the stack.\nIf that is deeper than the call stack, ValueError is raised. The default\nfor depth is zero, returning the frame at the top of the call stack.\n\nThis function should be used for internal and specialized\npurposes only." + }, + { + "Overloads": [ + { + "Parameters": [ + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kws", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "breakpointhook", + "Documentation": "breakpointhook(*args, **kws)\n\nThis hook function is called by built-in breakpoint().\n" + }, + { + "Overloads": [ + { + "Parameters": [ + { + "Name": "fn", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": "typing.Any", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:typing._T" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "call_tracing", + "Documentation": "call_tracing(func, args) -> object\n\nCall func(*args), while tracing is enabled. The tracing state is\nsaved, and restored afterwards. This is intended to be called from\na debugger from a checkpoint, to recursively debug some other code." + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "callstats", + "Documentation": "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" + }, + { + "Overloads": [ + { + "Parameters": [ + { + "Name": "value", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:__NoneType__" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "displayhook", + "Documentation": "displayhook(object) -> None\n\nPrint an object to sys.stdout and also save it in builtins._\n" + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": "i:builtins(3.7).tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "exc_info", + "Documentation": "exc_info() -> (type, value, traceback)\n\nReturn information about the most recent exception caught by an except\nclause in the current stack frame or in an older stack frame." + }, + { + "Overloads": [ + { + "Parameters": [ + { + "Name": "type_", + "Type": "typing.Type[builtins(3.7).BaseException]", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": "BaseException", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "traceback", + "Type": "types.TracebackType", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:__NoneType__" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "excepthook", + "Documentation": "excepthook(exctype, value, traceback) -> None\n\nHandle an exception by displaying it with a traceback on sys.stderr.\n" + }, + { + "Overloads": [ + { + "Parameters": [ + { + "Name": "arg", + "Type": "object", + "DefaultValue": "i:...", + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "exit", + "Documentation": "exit([status])\n\nExit the interpreter by raising SystemExit(status).\nIf the status is omitted or None, it defaults to zero (i.e., success).\nIf the status is an integer, it will be used as the system exit status.\nIf it is another kind of object, it will be printed and the system\nexit status will be one (i.e., failure)." + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "get_asyncgen_hooks", + "Documentation": "get_asyncgen_hooks()\n\nReturn a namedtuple of installed asynchronous generators hooks (firstiter, finalizer)." + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "get_coroutine_origin_tracking_depth", + "Documentation": "Check status of origin tracking for coroutine objects in this thread." + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "get_coroutine_wrapper", + "Documentation": "get_coroutine_wrapper()\n\nReturn the wrapper for coroutine objects set by sys.set_coroutine_wrapper." + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "getallocatedblocks", + "Documentation": "getallocatedblocks() -> integer\n\nReturn the number of memory blocks currently allocated, regardless of their\nsize." + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "getcheckinterval", + "Documentation": "getcheckinterval() -> current check interval; see setcheckinterval()." + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "getdefaultencoding", + "Documentation": "getdefaultencoding() -> string\n\nReturn the current default string encoding used by the Unicode \nimplementation." + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "getfilesystemencodeerrors", + "Documentation": "getfilesystemencodeerrors() -> string\n\nReturn the error mode used to convert Unicode filenames in\noperating system filenames." + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "getfilesystemencoding", + "Documentation": "getfilesystemencoding() -> string\n\nReturn the encoding used to convert Unicode filenames in\noperating system filenames." + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "getprofile", + "Documentation": "getprofile()\n\nReturn the profiling function set with sys.setprofile.\nSee the profiler chapter in the library manual." + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "getrecursionlimit", + "Documentation": "getrecursionlimit()\n\nReturn the current value of the recursion limit, the maximum depth\nof the Python interpreter stack. This limit prevents infinite\nrecursion from causing an overflow of the C stack and crashing Python." + }, + { + "Overloads": [ + { + "Parameters": [ + { + "Name": "arg", + "Type": "typing.Any", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "getrefcount", + "Documentation": "getrefcount(object) -> integer\n\nReturn the reference count of object. The count returned is generally\none higher than you might expect, because it includes the (temporary)\nreference as an argument to getrefcount()." + }, + { + "Overloads": [ + { + "Parameters": [ + { + "Name": "obj", + "Type": "object", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "default", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "getsizeof", + "Documentation": "getsizeof(object, default) -> int\n\nReturn the size of object in bytes." + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": "i:float" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "getswitchinterval", + "Documentation": "getswitchinterval() -> current thread switch interval; see setswitchinterval()." + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "gettrace", + "Documentation": "gettrace()\n\nReturn the global debug tracing function set with sys.settrace.\nSee the debugger chapter in the library manual." + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": "i:sys._WinVersion" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "getwindowsversion", + "Documentation": "getwindowsversion()\n\nReturn information about the running version of Windows as a named tuple.\nThe members are named: major, minor, build, platform, service_pack,\nservice_pack_major, service_pack_minor, suite_mask, and product_type. For\nbackward compatibility, only the first 5 items are available by indexing.\nAll elements are numbers, except service_pack and platform_type which are\nstrings, and platform_version which is a 3-tuple. Platform is always 2.\nProduct_type may be 1 for a workstation, 2 for a domain controller, 3 for a\nserver. Platform_version is a 3-tuple containing a version number that is\nintended for identifying the OS rather than feature detection." + }, + { + "Overloads": [ + { + "Parameters": [ + { + "Name": "string", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "intern", + "Documentation": "intern(string) -> string\n\n``Intern'' the given string. This enters the string in the (global)\ntable of interned strings whose purpose is to speed up dictionary lookups.\nReturn the string itself or the previously interned string object with the\nsame value." + }, + { + "Overloads": [ + { + "Parameters": [], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "is_finalizing", + "Documentation": "is_finalizing()\nReturn True if Python is exiting." + }, + { + "Overloads": [ + { + "Parameters": [ + { + "Name": "", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "firstiter", + "Type": null, + "DefaultValue": null, + "Kind": 3 + }, + { + "Name": "finalizer", + "Type": null, + "DefaultValue": null, + "Kind": 3 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "set_asyncgen_hooks", + "Documentation": "set_asyncgen_hooks(*, firstiter=None, finalizer=None)\n\nSet a finalizer for async generators objects." + }, + { + "Overloads": [ + { + "Parameters": [ + { + "Name": "depth", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "set_coroutine_origin_tracking_depth", + "Documentation": "Enable or disable origin tracking for coroutine objects in this thread.\n\nCoroutine objects will track 'depth' frames of traceback information about\nwhere they came from, available in their cr_origin attribute. Set depth of 0\nto disable." + }, + { + "Overloads": [ + { + "Parameters": [ + { + "Name": "wrapper", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "set_coroutine_wrapper", + "Documentation": "set_coroutine_wrapper(wrapper)\n\nSet a wrapper for coroutine objects." + }, + { + "Overloads": [ + { + "Parameters": [ + { + "Name": "interval", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:__NoneType__" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "setcheckinterval", + "Documentation": "setcheckinterval(n)\n\nTell the Python interpreter to check for asynchronous events every\nn instructions. This also affects how often thread switches occur." + }, + { + "Overloads": [ + { + "Parameters": [ + { + "Name": "profilefunc", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:__NoneType__" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "setprofile", + "Documentation": "setprofile(function)\n\nSet the profiling function. It will be called on each function call\nand return. See the profiler chapter in the library manual." + }, + { + "Overloads": [ + { + "Parameters": [ + { + "Name": "limit", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:__NoneType__" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "setrecursionlimit", + "Documentation": "setrecursionlimit(n)\n\nSet the maximum depth of the Python interpreter stack to n. This\nlimit prevents infinite recursion from causing an overflow of the C\nstack and crashing Python. The highest possible limit is platform-\ndependent." + }, + { + "Overloads": [ + { + "Parameters": [ + { + "Name": "interval", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:__NoneType__" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "setswitchinterval", + "Documentation": "setswitchinterval(n)\n\nSet the ideal thread switching delay inside the Python interpreter\nThe actual frequency of switching threads can be lower if the\ninterpreter executes long sequences of uninterruptible code\n(this is implementation-specific and workload-dependent).\n\nThe parameter must represent the desired switching delay in seconds\nA typical value is 0.005 (5 milliseconds)." + }, + { + "Overloads": [ + { + "Parameters": [ + { + "Name": "tracefunc", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:__NoneType__" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "settrace", + "Documentation": "settrace(function)\n\nSet the global debug tracing function. It will be called on each\nfunction call. See the debugger chapter in the library manual." + } + ], + "Variables": [], + "Classes": [ + { + "Bases": [ + "tuple", + "object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [], + "Name": "flags", + "Documentation": "sys.flags\n\nFlags provided through command line arguments or environment vars." + }, + { + "Bases": [ + "tuple", + "object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [], + "Name": "__float_info", + "Documentation": "sys.float_info\n\nA structseq holding information about the float type. It contains low level\ninformation about the precision and internal representation. Please study\nyour system's :file:`float.h` for more information." + }, + { + "Bases": [ + "tuple", + "object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [], + "Name": "__hash_info", + "Documentation": "hash_info\n\nA struct sequence providing parameters used for computing\nhashes. The attributes are read only." + }, + { + "Bases": [ + "tuple", + "object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [], + "Name": "__int_info", + "Documentation": "sys.int_info\n\nA struct sequence that holds information about Python's\ninternal representation of integers. The attributes are read only." + }, + { + "Bases": [ + "tuple", + "object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [], + "Name": "__thread_info", + "Documentation": "sys.thread_info\n\nA struct sequence holding information about the thread implementation." + }, + { + "Bases": [ + "tuple", + "object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [], + "Name": "__version_info", + "Documentation": "sys.version_info\n\nVersion information as a named tuple." + }, + { + "Bases": [ + "tuple", + "object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [], + "Name": "__float_info", + "Documentation": "sys.float_info\n\nA structseq holding information about the float type. It contains low level\ninformation about the precision and internal representation. Please study\nyour system's :file:`float.h` for more information." + }, + { + "Bases": [ + "tuple", + "object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [], + "Name": "__hash_info", + "Documentation": "hash_info\n\nA struct sequence providing parameters used for computing\nhashes. The attributes are read only." + }, + { + "Bases": [ + "tuple", + "object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [], + "Name": "__int_info", + "Documentation": "sys.int_info\n\nA struct sequence that holds information about Python's\ninternal representation of integers. The attributes are read only." + }, + { + "Bases": [ + "tuple", + "object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [], + "Name": "__thread_info", + "Documentation": "sys.thread_info\n\nA struct sequence holding information about the thread implementation." + }, + { + "Bases": [ + "tuple", + "object" + ], + "Methods": [], + "Properties": [], + "Fields": [], + "GenericParameters": null, + "InnerClasses": [], + "Name": "__version_info", + "Documentation": "sys.version_info\n\nVersion information as a named tuple." + } + ], + "Name": "sys", + "Documentation": "This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n\nStatic objects:\n\nbuiltin_module_names -- tuple of module names built into this interpreter\ncopyright -- copyright notice pertaining to this interpreter\nexec_prefix -- prefix used to find the machine-specific Python library\nexecutable -- absolute path of the executable binary of the Python interpreter\nfloat_info -- a struct sequence with information about the float implementation.\nfloat_repr_style -- string indicating the style of repr() output for floats\nhash_info -- a struct sequence with information about the hash algorithm.\nhexversion -- version information encoded as a single integer\nimplementation -- Python implementation information.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the value of the largest Unicode code point\nplatform -- platform identifier\nprefix -- prefix used to find the Python library\nthread_info -- a struct sequence with information about the thread implementation.\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\ndllhandle -- [Windows only] integer handle of the Python DLL\nwinver -- [Windows only] version number of the Python DLL\n_enablelegacywindowsfsencoding -- [Windows only] \n__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n" +} \ No newline at end of file From a5b3b20bb9c19015bacfb9d08d26212335e5f6b5 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Tue, 11 Jun 2019 13:13:40 -0700 Subject: [PATCH 55/82] Properly write variables --- src/Caching/Impl/Models/ModuleModel.cs | 10 +- src/Caching/Test/Files/Builtins.json | 99 ++++------- src/Caching/Test/Files/Sys.json | 230 ++++++++++++++++++------- 3 files changed, 213 insertions(+), 126 deletions(-) diff --git a/src/Caching/Impl/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs index 2ad59eec8..f8931c1b0 100644 --- a/src/Caching/Impl/Models/ModuleModel.cs +++ b/src/Caching/Impl/Models/ModuleModel.cs @@ -32,18 +32,16 @@ public static ModuleModel FromAnalysis(IDocumentAnalysis analysis) { foreach (var v in analysis.GlobalScope.Variables.Where(v => v.Source == VariableSource.Declaration)) { var t = v.Value.GetPythonType(); - // If variable is declaration and has location, then it is a user-defined variable. - if (v.Location.IsValid) { - variables.Add(VariableModel.FromVariable(v)); - continue; - } - switch (t) { + switch (v.Value) { case IPythonFunctionType ft when ft.DeclaringModule.Equals(analysis.Document): functions.Add(FunctionModel.FromType(ft)); break; case IPythonClassType cls when cls.DeclaringModule.Equals(analysis.Document): classes.Add(ClassModel.FromType(cls)); break; + default: + variables.Add(VariableModel.FromVariable(v)); + break; } } diff --git a/src/Caching/Test/Files/Builtins.json b/src/Caching/Test/Files/Builtins.json index 318ed56bc..236c577fe 100644 --- a/src/Caching/Test/Files/Builtins.json +++ b/src/Caching/Test/Files/Builtins.json @@ -1305,7 +1305,44 @@ "Documentation": "" } ], - "Variables": [], + "Variables": [ + { + "Name": "__builtin_module_names__", + "Value": null + }, + { + "Name": "Ellipsis", + "Value": "i:..." + }, + { + "Name": "EnvironmentError", + "Value": "i:OSError" + }, + { + "Name": "IOError", + "Value": "i:OSError" + }, + { + "Name": "NotImplemented", + "Value": "i:NotImplementedType" + }, + { + "Name": "WindowsError", + "Value": "i:OSError" + }, + { + "Name": "__doc__", + "Value": null + }, + { + "Name": "__name__", + "Value": null + }, + { + "Name": "__package__", + "Value": null + } + ], "Classes": [ { "Bases": [ @@ -2978,66 +3015,6 @@ "InnerClasses": [], "Name": "callable_iterator", "Documentation": null - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "...", - "Documentation": null - }, - { - "Bases": [ - "Exception" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "OSError", - "Documentation": "Base class for I/O related errors." - }, - { - "Bases": [ - "Exception" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "OSError", - "Documentation": "Base class for I/O related errors." - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "NotImplementedType", - "Documentation": null - }, - { - "Bases": [ - "Exception" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "OSError", - "Documentation": "Base class for I/O related errors." } ], "Name": "builtins", diff --git a/src/Caching/Test/Files/Sys.json b/src/Caching/Test/Files/Sys.json index b2fbd480a..50f6585f1 100644 --- a/src/Caching/Test/Files/Sys.json +++ b/src/Caching/Test/Files/Sys.json @@ -695,73 +695,185 @@ "Documentation": "settrace(function)\n\nSet the global debug tracing function. It will be called on each\nfunction call. See the debugger chapter in the library manual." } ], - "Variables": [], - "Classes": [ + "Variables": [ { - "Bases": [ - "tuple", - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "flags", - "Documentation": "sys.flags\n\nFlags provided through command line arguments or environment vars." + "Name": "__doc__", + "Value": "i:str" }, { - "Bases": [ - "tuple", - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "__float_info", - "Documentation": "sys.float_info\n\nA structseq holding information about the float type. It contains low level\ninformation about the precision and internal representation. Please study\nyour system's :file:`float.h` for more information." + "Name": "__name__", + "Value": "i:str" }, { - "Bases": [ - "tuple", - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "__hash_info", - "Documentation": "hash_info\n\nA struct sequence providing parameters used for computing\nhashes. The attributes are read only." + "Name": "__package__", + "Value": "i:str" }, { - "Bases": [ - "tuple", - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "__int_info", - "Documentation": "sys.int_info\n\nA struct sequence that holds information about Python's\ninternal representation of integers. The attributes are read only." + "Name": "__stderr__", + "Value": "i:_io.TextIOWrapper" }, { - "Bases": [ - "tuple", - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "__thread_info", - "Documentation": "sys.thread_info\n\nA struct sequence holding information about the thread implementation." + "Name": "__stdin__", + "Value": "i:_io.TextIOWrapper" + }, + { + "Name": "__stdout__", + "Value": "i:_io.TextIOWrapper" + }, + { + "Name": "_framework", + "Value": "i:str" + }, + { + "Name": "_git", + "Value": "i:tuple" + }, + { + "Name": "_home", + "Value": "i:NoneType" + }, + { + "Name": "_xoptions", + "Value": "i:dict" + }, + { + "Name": "api_version", + "Value": "i:int" + }, + { + "Name": "argv", + "Value": "i:list" }, + { + "Name": "base_exec_prefix", + "Value": "i:str" + }, + { + "Name": "base_prefix", + "Value": "i:str" + }, + { + "Name": "builtin_module_names", + "Value": "i:tuple" + }, + { + "Name": "byteorder", + "Value": "i:str" + }, + { + "Name": "copyright", + "Value": "i:str" + }, + { + "Name": "dllhandle", + "Value": "i:int" + }, + { + "Name": "dont_write_bytecode", + "Value": "i:bool" + }, + { + "Name": "exec_prefix", + "Value": "i:str" + }, + { + "Name": "executable", + "Value": "i:str" + }, + { + "Name": "float_repr_style", + "Value": "i:str" + }, + { + "Name": "hexversion", + "Value": "i:int" + }, + { + "Name": "implementation", + "Value": null + }, + { + "Name": "maxsize", + "Value": "i:int" + }, + { + "Name": "maxunicode", + "Value": "i:int" + }, + { + "Name": "meta_path", + "Value": "i:list" + }, + { + "Name": "modules", + "Value": "i:dict" + }, + { + "Name": "path", + "Value": "i:list" + }, + { + "Name": "path_hooks", + "Value": "i:list" + }, + { + "Name": "path_importer_cache", + "Value": "i:dict" + }, + { + "Name": "platform", + "Value": "i:str" + }, + { + "Name": "prefix", + "Value": "i:str" + }, + { + "Name": "stderr", + "Value": "i:_io.TextIOWrapper" + }, + { + "Name": "stdin", + "Value": "i:_io.TextIOWrapper" + }, + { + "Name": "stdout", + "Value": "i:_io.TextIOWrapper" + }, + { + "Name": "version", + "Value": "i:str" + }, + { + "Name": "warnoptions", + "Value": "i:list" + }, + { + "Name": "winver", + "Value": "i:str" + }, + { + "Name": "float_info", + "Value": "i:sys.__float_info" + }, + { + "Name": "hash_info", + "Value": "i:sys.__hash_info" + }, + { + "Name": "int_info", + "Value": "i:sys.__int_info" + }, + { + "Name": "thread_info", + "Value": "i:sys.__thread_info" + }, + { + "Name": "version_info", + "Value": "i:sys.__version_info" + } + ], + "Classes": [ { "Bases": [ "tuple", @@ -772,8 +884,8 @@ "Fields": [], "GenericParameters": null, "InnerClasses": [], - "Name": "__version_info", - "Documentation": "sys.version_info\n\nVersion information as a named tuple." + "Name": "flags", + "Documentation": "sys.flags\n\nFlags provided through command line arguments or environment vars." }, { "Bases": [ From f23a4872ebd9d42cd31f22aa4e00fb71048aaba5 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Tue, 11 Jun 2019 15:04:12 -0700 Subject: [PATCH 56/82] Partial --- src/Caching/Impl/PythonDbModule.cs | 123 ++++++++++++++++++----------- 1 file changed, 79 insertions(+), 44 deletions(-) diff --git a/src/Caching/Impl/PythonDbModule.cs b/src/Caching/Impl/PythonDbModule.cs index 5e6bc5cb6..23af4f88f 100644 --- a/src/Caching/Impl/PythonDbModule.cs +++ b/src/Caching/Impl/PythonDbModule.cs @@ -16,6 +16,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Versioning; using Microsoft.Python.Analysis.Caching.Models; using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; @@ -27,69 +28,103 @@ namespace Microsoft.Python.Analysis.Caching { internal sealed class PythonDbModule : SpecializedModule { private readonly ModuleModel _model; private readonly IMember _unknownType; + private readonly GlobalScopeImpl _globalScope; public PythonDbModule(ModuleModel model, IServiceContainer services) : base(model.Name, string.Empty, services) { _model = model; _unknownType = services.GetService().UnknownType; + _globalScope = new GlobalScopeImpl(model, this); } protected override string LoadContent() => string.Empty; - public override IEnumerable GetMemberNames() { - var classes = _model.Classes.Select(c => c.Name); - var functions = _model.Functions.Select(c => c.Name); - var variables = _model.Variables.Select(c => c.Name); - return classes.Concat(functions).Concat(variables); - } + public override string Documentation => _model.Documentation; + public override IEnumerable GetMemberNames() => _globalScope.Variables.Names; + public override IMember GetMember(string name) => _globalScope.Variables[name]; + public override IGlobalScope GlobalScope => _globalScope; - public override IMember GetMember(string name) { - var v = _model.Variables.FirstOrDefault(c => c.Name == name); - if(v != null) { - return new Variable(name, Construct(v.Value), VariableSource.Declaration, new Location(this)); + private sealed class GlobalScopeImpl : IGlobalScope { + private readonly VariableCollection _variables = new VariableCollection(); + + public GlobalScopeImpl(ModuleModel model, IPythonModule module) { + Module = module; + + foreach (var c in model.Classes) { + _variables.DeclareVariable(c.Name, ConstructClass(c), VariableSource.Declaration, new Location(module)); + } + foreach (var f in model.Functions) { + _variables.DeclareVariable(f.Name, ConstructFunction(f), VariableSource.Declaration, new Location(module)); + } + foreach (var v in model.Variables) { + var m = ConstructMember(v.Value); + if (m != null) { + _variables.DeclareVariable(v.Name, ConstructMember(v.Value), VariableSource.Declaration, new Location(module)); + } + } } - v = _model.Variables.FirstOrDefault(c => c.Name == name); - if (v != null) { - return new Variable(name, Construct(v.Value), VariableSource.Declaration, new Location(this)); + + private IPythonClassType ConstructClass(ClassModel cm) { + var cls = new PythonClassType(cm.Name, new Location(Module)); + foreach (var f in cm.Methods) { + cls.AddMember(f.Name, ConstructFunction(f), false); + } + foreach (var p in cm.Properties) { + cls.AddMember(p.Name, ConstructProperty(p), false); + } + foreach (var c in cm.InnerClasses) { + cls.AddMember(c.Name, ConstructClass(c), false); + } } - return _unknownType; - } + private IPythonFunctionType ConstructFunction(FunctionModel fm, IPythonClassType cls) { + var ft = new PythonFunctionType(fm.Name, new Location(Module), cls, fm.Documentation); + foreach(var om in fm.Overloads) { + var o = new PythonFunctionOverload(fm.Name, new Location(Module)); + o.SetDocumentation(fm.Documentation); // TODO: own documentation? + o.SetReturnValue(ConstructMember(om.ReturnType), true); + o.SetParameters(om.Parameters.Select(p => ConstructParameter(p))) + ft.AddOverload(o); + } + } - public override IGlobalScope GlobalScope => base.GlobalScope; + private IPythonPropertyType ConstructProperty(PropertyModel pm, IPythonClassType cls) + => new PythonPropertyType(pm.Name, new Location(Module), cls, (pm.Attributes & FunctionAttributes.Abstract) != 0); - private IMember Construct(string qualifiedName) { - var components = Split(qualifiedName, out var moduleName, out var isInstance); - return null; - } + private IParameterInfo ConstructParameter(ParameterModel pm) + => new ParameterInfo(pm.Name, ConstructType(pm.Type), pm.Kind, ConstructMember(pm.DefaultValue)); - private string[] Split(string qualifiedName, out string moduleName, out bool isInstance) { - isInstance = qualifiedName.StartsWith("i:"); - qualifiedName = isInstance ? qualifiedName.Substring(2) : qualifiedName; - var components = qualifiedName.Split('.'); - moduleName = components.Length > 0 ? components[0] : null; - return components.Length > 0 ? components.Skip(1).ToArray() : Array.Empty(); - } + private IPythonType ConstructType(string qualifiedName) { } - private sealed class GlobalScopeImpl : IGlobalScope { - private readonly ModuleModel _model; - private readonly VariableCollection _variables = new VariableCollection(); + private IMember ConstructMember(string qualifiedName) { + if (!SplitQualifiedName(qualifiedName, out var moduleName, out var typeName, out var isInstance)) { + return null; + } - public GlobalScopeImpl(ModuleModel model, IPythonModule module) { - _model = model; - Module = module; + if(moduleName == Module.Name) { + if(_model.g) + } + return isInstance ? new PythonInstance() : ; + } + + private bool SplitQualifiedName(string qualifiedName, out string moduleName, out string typeName, out bool isInstance) { + moduleName = null; + typeName = null; - //foreach (var v in model.Variables) { - // _variables.DeclareVariable(v.Name, Construct(v.Value), VariableSource.Declaration, new Location(module)); - //} - //foreach (var c in model.Classes) { - // _variables.DeclareVariable(c.Name, Construct(c), VariableSource.Declaration, new Location(module)); - //} - //foreach (var f in model.Functions) { - // _variables.DeclareVariable(f.Name, Construct(f), VariableSource.Declaration, new Location(module)); - //} - // TODO: classes and functions - // TODO: default variables + isInstance = qualifiedName.StartsWith("i:"); + qualifiedName = isInstance ? qualifiedName.Substring(2) : qualifiedName; + var components = qualifiedName.Split('.'); + switch (components.Length) { + case 1: + moduleName = "builtins"; + typeName = components[0]; + return true; + case 2: + moduleName = components[0]; + typeName = components[1]; + return true; + } + return false; } public string Name => _model.Name; From e6373a71fad7347a212c713a62ceaafec0565b2e Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Wed, 12 Jun 2019 13:02:11 -0700 Subject: [PATCH 57/82] Construct module from model --- src/Analysis/Ast/Impl/Caching/CacheFolders.cs | 4 - .../Definitions/IModuleDatabaseService.cs | 7 +- .../Caching/Definitions/ModuleStorageState.cs | 9 +- .../Microsoft.Python.Analysis.Caching.csproj | 8 + src/Caching/Impl/Models/ClassModel.cs | 1 + src/Caching/Impl/Models/FunctionModel.cs | 1 + src/Caching/Impl/Models/MemberModel.cs | 1 - src/Caching/Impl/Models/ModuleModel.cs | 1 + src/Caching/Impl/Models/PropertyModel.cs | 1 + src/Caching/Impl/Models/VariableModel.cs | 3 +- src/Caching/Impl/ModuleDatabase.cs | 85 ++++++++ src/Caching/Impl/PythonDbModule.cs | 206 ++++++++++++++---- src/Caching/Impl/Readers/ModuleReader.cs | 24 -- src/Caching/Impl/Writers/AnalysisWriter.cs | 42 ---- src/Caching/Impl/Writers/ModuleWriter.cs | 28 --- .../Impl/Implementation/Server.cs | 5 +- .../Microsoft.Python.LanguageServer.csproj | 1 + 17 files changed, 281 insertions(+), 146 deletions(-) create mode 100644 src/Caching/Impl/ModuleDatabase.cs delete mode 100644 src/Caching/Impl/Readers/ModuleReader.cs delete mode 100644 src/Caching/Impl/Writers/AnalysisWriter.cs delete mode 100644 src/Caching/Impl/Writers/ModuleWriter.cs diff --git a/src/Analysis/Ast/Impl/Caching/CacheFolders.cs b/src/Analysis/Ast/Impl/Caching/CacheFolders.cs index 36d5f8b91..0213fd40c 100644 --- a/src/Analysis/Ast/Impl/Caching/CacheFolders.cs +++ b/src/Analysis/Ast/Impl/Caching/CacheFolders.cs @@ -19,16 +19,12 @@ using System.Security.Cryptography; using System.Text; using Microsoft.Python.Core; -using Microsoft.Python.Core.IO; using Microsoft.Python.Core.Logging; using Microsoft.Python.Core.OS; namespace Microsoft.Python.Analysis.Caching { internal sealed class CacheFolderService: ICacheFolderService { - private readonly IServiceContainer _services; - public CacheFolderService(IServiceContainer services, string cacheRootFolder) { - _services = services; CacheFolder = cacheRootFolder ?? GetCacheFolder(services); } diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs index 4d1f61f42..08c0611ef 100644 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs +++ b/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs @@ -21,16 +21,15 @@ internal interface IModuleDatabaseService { /// Retrieves module representation from module index database /// or null if module does not exist. /// - /// Module unique id. + /// Module fully qualified name. /// Python module. /// Module storage state - ModuleStorageState TryGetModuleData(string uniqueId, out IPythonModule module); + ModuleStorageState TryGetModuleData(string qualifiedName, out IPythonModule module); /// /// Writes module data to the database. /// - /// Module unique id. /// Module analysis. - void StoreModuleData(string uniqueId, IDocumentAnalysis analysis); + void StoreModuleAnalysis(IDocumentAnalysis analysis); } } diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/ModuleStorageState.cs b/src/Analysis/Ast/Impl/Caching/Definitions/ModuleStorageState.cs index 44f5b8756..bbf14c809 100644 --- a/src/Analysis/Ast/Impl/Caching/Definitions/ModuleStorageState.cs +++ b/src/Analysis/Ast/Impl/Caching/Definitions/ModuleStorageState.cs @@ -17,7 +17,7 @@ namespace Microsoft.Python.Analysis.Caching { /// /// Describes module data stored in a database. /// - internal enum ModuleStorageState { + public enum ModuleStorageState { /// /// Module does not exist in the database. /// @@ -32,6 +32,11 @@ internal enum ModuleStorageState { /// /// Modules exist and the analysis is complete. /// - Complete + Complete, + + /// + /// Storage is corrupted or incompatible. + /// + Corrupted } } diff --git a/src/Caching/Impl/Microsoft.Python.Analysis.Caching.csproj b/src/Caching/Impl/Microsoft.Python.Analysis.Caching.csproj index c2d9cc03b..e81ee3640 100644 --- a/src/Caching/Impl/Microsoft.Python.Analysis.Caching.csproj +++ b/src/Caching/Impl/Microsoft.Python.Analysis.Caching.csproj @@ -13,6 +13,14 @@ + + + + + + + + diff --git a/src/Caching/Impl/Models/ClassModel.cs b/src/Caching/Impl/Models/ClassModel.cs index aafbdea7d..90933ae6b 100644 --- a/src/Caching/Impl/Models/ClassModel.cs +++ b/src/Caching/Impl/Models/ClassModel.cs @@ -20,6 +20,7 @@ namespace Microsoft.Python.Analysis.Caching.Models { internal sealed class ClassModel: MemberModel { + public string Documentation { get; set; } public string[] Bases { get; set; } public FunctionModel[] Methods { get; set; } public PropertyModel[] Properties { get; set; } diff --git a/src/Caching/Impl/Models/FunctionModel.cs b/src/Caching/Impl/Models/FunctionModel.cs index cbb37bc1e..720741582 100644 --- a/src/Caching/Impl/Models/FunctionModel.cs +++ b/src/Caching/Impl/Models/FunctionModel.cs @@ -18,6 +18,7 @@ namespace Microsoft.Python.Analysis.Caching.Models { internal sealed class FunctionModel: MemberModel { + public string Documentation { get; set; } public OverloadModel[] Overloads { get; set; } public FunctionAttributes Attributes { get; set; } public string[] Classes { get; set; } diff --git a/src/Caching/Impl/Models/MemberModel.cs b/src/Caching/Impl/Models/MemberModel.cs index 841e2cea1..d62e26c32 100644 --- a/src/Caching/Impl/Models/MemberModel.cs +++ b/src/Caching/Impl/Models/MemberModel.cs @@ -16,6 +16,5 @@ namespace Microsoft.Python.Analysis.Caching.Models { internal abstract class MemberModel { public string Name { get; set; } - public string Documentation { get; set; } } } diff --git a/src/Caching/Impl/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs index f8931c1b0..3dcc9245e 100644 --- a/src/Caching/Impl/Models/ModuleModel.cs +++ b/src/Caching/Impl/Models/ModuleModel.cs @@ -20,6 +20,7 @@ namespace Microsoft.Python.Analysis.Caching.Models { internal sealed class ModuleModel : MemberModel { + public string Documentation { get; set; } public FunctionModel[] Functions { get; set; } public VariableModel[] Variables { get; set; } public ClassModel[] Classes { get; set; } diff --git a/src/Caching/Impl/Models/PropertyModel.cs b/src/Caching/Impl/Models/PropertyModel.cs index c4930919a..1397011e1 100644 --- a/src/Caching/Impl/Models/PropertyModel.cs +++ b/src/Caching/Impl/Models/PropertyModel.cs @@ -17,6 +17,7 @@ namespace Microsoft.Python.Analysis.Caching.Models { internal sealed class PropertyModel: MemberModel { + public string Documentation { get; set; } public string ReturnType { get; set; } public FunctionAttributes Attributes { get; set; } diff --git a/src/Caching/Impl/Models/VariableModel.cs b/src/Caching/Impl/Models/VariableModel.cs index 6f0c9c965..de71b5658 100644 --- a/src/Caching/Impl/Models/VariableModel.cs +++ b/src/Caching/Impl/Models/VariableModel.cs @@ -17,8 +17,7 @@ using Microsoft.Python.Analysis.Values; namespace Microsoft.Python.Analysis.Caching.Models { - internal sealed class VariableModel { - public string Name { get; set; } + internal sealed class VariableModel: MemberModel { public string Value { get; set; } public static VariableModel FromVariable(IVariable v) => new VariableModel { diff --git a/src/Caching/Impl/ModuleDatabase.cs b/src/Caching/Impl/ModuleDatabase.cs new file mode 100644 index 000000000..1ea75f2d9 --- /dev/null +++ b/src/Caching/Impl/ModuleDatabase.cs @@ -0,0 +1,85 @@ +// 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.IO; +using System.Linq; +using LiteDB; +using Microsoft.Python.Analysis.Caching.Models; +using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Core; +using Microsoft.Python.Core.Logging; + +namespace Microsoft.Python.Analysis.Caching { + public sealed class ModuleDatabase : IModuleDatabaseService { + private const int _databaseFormatVersion = 1; + + private readonly object _lock = new object(); + private readonly IServiceContainer _services; + private readonly ILogger _log; + private readonly string _databaseFolder; + + public ModuleDatabase(IServiceContainer services) { + _services = services; + _log = services.GetService(); + var cfs = services.GetService(); + _databaseFolder = Path.Combine(cfs.CacheFolder, $"analysis.v{_databaseFormatVersion}"); + } + + public ModuleStorageState TryGetModuleData(string qualifiedName, out IPythonModule module) { + module = null; + lock (_lock) { + // We don't cache results here. Module resolution service decides when to call in here + // and it is responsible of overall management of the loaded Python modules. + try { + // TODO: make combined db rather than per module. + using (var db = new LiteDatabase(Path.Combine(_databaseFolder, $"{qualifiedName}.db"))) { + if (!db.CollectionExists("modules")) { + return ModuleStorageState.Corrupted; + } + + var modules = db.GetCollection("modules"); + var model = modules.Find(m => m.Name == qualifiedName).FirstOrDefault(); + if (model == null) { + return ModuleStorageState.DoesNotExist; + } + + module = new PythonDbModule(model, _services); + return ModuleStorageState.Complete; + } + } catch (IOException) { } catch (UnauthorizedAccessException) { } + + return ModuleStorageState.DoesNotExist; + } + } + + public void StoreModuleAnalysis(IDocumentAnalysis analysis) { + lock (_lock) { + var model = ModuleModel.FromAnalysis(analysis); + try { + using (var db = new LiteDatabase(Path.Combine(_databaseFolder, $"{model.Name}.db"))) { + var modules = db.GetCollection("modules"); + modules.Upsert(model); + } + } catch (Exception ex) { + _log?.Log(System.Diagnostics.TraceEventType.Warning, $"Unable to write analysis of {model.Name} to database. Exception {ex.Message}"); + if(ex.IsCriticalException()) { + throw; + } + } + } + } + } +} diff --git a/src/Caching/Impl/PythonDbModule.cs b/src/Caching/Impl/PythonDbModule.cs index 23af4f88f..410ecf247 100644 --- a/src/Caching/Impl/PythonDbModule.cs +++ b/src/Caching/Impl/PythonDbModule.cs @@ -15,8 +15,8 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; -using System.Runtime.Versioning; using Microsoft.Python.Analysis.Caching.Models; using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; @@ -26,108 +26,238 @@ namespace Microsoft.Python.Analysis.Caching { internal sealed class PythonDbModule : SpecializedModule { - private readonly ModuleModel _model; - private readonly IMember _unknownType; private readonly GlobalScopeImpl _globalScope; + private readonly IPythonInterpreter _interpreter; - public PythonDbModule(ModuleModel model, IServiceContainer services) + public PythonDbModule(ModuleModel model, IServiceContainer services) : base(model.Name, string.Empty, services) { - _model = model; - _unknownType = services.GetService().UnknownType; - _globalScope = new GlobalScopeImpl(model, this); + + _globalScope = new GlobalScopeImpl(model, this, services); + Documentation = model.Documentation; } protected override string LoadContent() => string.Empty; - public override string Documentation => _model.Documentation; + public override string Documentation { get; } public override IEnumerable GetMemberNames() => _globalScope.Variables.Names; public override IMember GetMember(string name) => _globalScope.Variables[name]; public override IGlobalScope GlobalScope => _globalScope; private sealed class GlobalScopeImpl : IGlobalScope { + private class ModelMemberPair { + public MemberModel Model; + public IMember Member; + } private readonly VariableCollection _variables = new VariableCollection(); + private readonly Dictionary _members; + private readonly IPythonInterpreter _interpreter; - public GlobalScopeImpl(ModuleModel model, IPythonModule module) { + public GlobalScopeImpl(ModuleModel model, IPythonModule module, IServiceContainer services) { Module = module; + Name = model.Name; + + _interpreter = services.GetService(); + _members = model.Variables + .Concat(model.Classes) + .Concat(model.Functions) + .ToDictionary(k => k.Name, v => new ModelMemberPair { + Model = v, + Member = null + }); - foreach (var c in model.Classes) { - _variables.DeclareVariable(c.Name, ConstructClass(c), VariableSource.Declaration, new Location(module)); + // TODO: store real location in models + + // Member creation may be non-linear. Consider function A returning instance + // of a class or type info of a function which hasn't been created yet. + // Thus check if member has already been created first. + var location = new Location(module); + foreach (var cm in model.Classes) { + var cls = ConstructClass(cm); + _variables.DeclareVariable(cm.Name, cls, VariableSource.Declaration, location); } - foreach (var f in model.Functions) { - _variables.DeclareVariable(f.Name, ConstructFunction(f), VariableSource.Declaration, new Location(module)); + + foreach (var fm in model.Functions) { + var ft = ConstructFunction(fm, null); + _variables.DeclareVariable(fm.Name, ft, VariableSource.Declaration, location); } - foreach (var v in model.Variables) { - var m = ConstructMember(v.Value); - if (m != null) { - _variables.DeclareVariable(v.Name, ConstructMember(v.Value), VariableSource.Declaration, new Location(module)); + + foreach (var vm in model.Variables) { + var m = _members[vm.Name].Member; + if (m == null) { + m = ConstructMember(vm.Value); + if (m != null) { + _variables.DeclareVariable(vm.Name, m, VariableSource.Declaration, location); + _members[vm.Name].Member = _variables[vm.Name]; + } } } + + // No longer need model data, free up some memory. + _members.Clear(); } private IPythonClassType ConstructClass(ClassModel cm) { + var pair = _members[cm.Name]; + + var m = pair.Member; + if (m != null) { + var ct = m as IPythonClassType; + Debug.Assert(ct != null); + return ct; + } + var cls = new PythonClassType(cm.Name, new Location(Module)); foreach (var f in cm.Methods) { - cls.AddMember(f.Name, ConstructFunction(f), false); + cls.AddMember(f.Name, ConstructFunction(f, cls), false); } foreach (var p in cm.Properties) { - cls.AddMember(p.Name, ConstructProperty(p), false); + cls.AddMember(p.Name, ConstructProperty(p, cls), false); } foreach (var c in cm.InnerClasses) { cls.AddMember(c.Name, ConstructClass(c), false); } + + pair.Member = cls; + return cls; } private IPythonFunctionType ConstructFunction(FunctionModel fm, IPythonClassType cls) { - var ft = new PythonFunctionType(fm.Name, new Location(Module), cls, fm.Documentation); - foreach(var om in fm.Overloads) { + var pair = _members[fm.Name]; + + var m = pair.Member; + if (m != null) { + var ft = m as IPythonFunctionType; + Debug.Assert(ft != null); + return ft; + } + + var f = new PythonFunctionType(fm.Name, new Location(Module), cls, fm.Documentation); + foreach (var om in fm.Overloads) { var o = new PythonFunctionOverload(fm.Name, new Location(Module)); o.SetDocumentation(fm.Documentation); // TODO: own documentation? o.SetReturnValue(ConstructMember(om.ReturnType), true); - o.SetParameters(om.Parameters.Select(p => ConstructParameter(p))) - ft.AddOverload(o); + o.SetParameters(om.Parameters.Select(ConstructParameter).ToArray()); + f.AddOverload(o); } + pair.Member = f; + return f; } - private IPythonPropertyType ConstructProperty(PropertyModel pm, IPythonClassType cls) - => new PythonPropertyType(pm.Name, new Location(Module), cls, (pm.Attributes & FunctionAttributes.Abstract) != 0); + private IVariable ConstructVariable(VariableModel vm) { + var pair = _members[vm.Name]; + var m = pair.Member; + if (m != null) { + var v = m as IVariable; + Debug.Assert(v != null); + return v; + } + + m = ConstructMember(vm.Value); + if (m != null) { + _variables.DeclareVariable(vm.Name, m, VariableSource.Declaration, new Location(Module)); + var v = _variables[vm.Name]; + _members[vm.Name].Member = v; + return v; + } + + return null; + } + + private IPythonPropertyType ConstructProperty(PropertyModel pm, IPythonClassType cls) { + var prop = new PythonPropertyType(pm.Name, new Location(Module), cls, (pm.Attributes & FunctionAttributes.Abstract) != 0); + prop.SetDocumentation(pm.Documentation); + var o = new PythonFunctionOverload(pm.Name, new Location(Module)); + o.SetDocumentation(pm.Documentation); // TODO: own documentation? + o.SetReturnValue(ConstructMember(pm.ReturnType), true); + prop.AddOverload(o); + return prop; + } private IParameterInfo ConstructParameter(ParameterModel pm) => new ParameterInfo(pm.Name, ConstructType(pm.Type), pm.Kind, ConstructMember(pm.DefaultValue)); - private IPythonType ConstructType(string qualifiedName) { } + private IPythonType ConstructType(string qualifiedName) => ConstructMember(qualifiedName)?.GetPythonType(); private IMember ConstructMember(string qualifiedName) { - if (!SplitQualifiedName(qualifiedName, out var moduleName, out var typeName, out var isInstance)) { + if (!SplitQualifiedName(qualifiedName, out var moduleName, out var typeNameParts, out var isInstance)) { + return null; + } + + Debug.Assert(typeNameParts.Count > 0); + var member = moduleName == Module.Name + ? GetMemberFromThisModule(typeNameParts) + : GetMemberFromModule(moduleName, typeNameParts); + + return isInstance && member != null ? new PythonInstance(member.GetPythonType()) : member; + } + + private IMember GetMemberFromModule(string moduleName, IReadOnlyList typeNameParts) { + // Module resolution will call back to the module database + // to get persisted analysis, if available. + var module = _interpreter.ModuleResolution.GetOrLoadModule(moduleName); + var member = module?.GetMember(typeNameParts[0]); + foreach (var p in typeNameParts.Skip(1)) { + var mc = member as IMemberContainer; + + Debug.Assert(mc != null); + member = mc?.GetMember(p); + + if (member == null) { + Debug.Assert(member != null); + break; + } + } + return member; + } + + private IMember GetMemberFromThisModule(IReadOnlyList typeNameParts) { + if (typeNameParts.Count == 0 || !_members.TryGetValue(typeNameParts[0], out var memberData)) { return null; } - if(moduleName == Module.Name) { - if(_model.g) + if (memberData.Member != null) { + return memberData.Member; + } + + // TODO: nested classes, etc + switch (memberData.Model) { + case ClassModel cm: + Debug.Assert(typeNameParts.Count == 1); + return ConstructClass(cm); + + case FunctionModel fm: + Debug.Assert(typeNameParts.Count == 1); + return ConstructFunction(fm, null); + + case VariableModel vm: + Debug.Assert(typeNameParts.Count == 1); + return ConstructVariable(vm); } - return isInstance ? new PythonInstance() : ; + return null; } - private bool SplitQualifiedName(string qualifiedName, out string moduleName, out string typeName, out bool isInstance) { + private bool SplitQualifiedName(string qualifiedName, out string moduleName, out List typeNameParts, out bool isInstance) { moduleName = null; - typeName = null; + typeNameParts = new List(); isInstance = qualifiedName.StartsWith("i:"); qualifiedName = isInstance ? qualifiedName.Substring(2) : qualifiedName; var components = qualifiedName.Split('.'); switch (components.Length) { + case 0: + return false; case 1: - moduleName = "builtins"; - typeName = components[0]; + moduleName = @"builtins"; + typeNameParts.Add(components[0]); return true; - case 2: + default: moduleName = components[0]; - typeName = components[1]; + typeNameParts.AddRange(components.Skip(1)); return true; } - return false; } - public string Name => _model.Name; + public string Name { get; } public ScopeStatement Node => null; public IScope OuterScope => null; public IReadOnlyList Children => Array.Empty(); diff --git a/src/Caching/Impl/Readers/ModuleReader.cs b/src/Caching/Impl/Readers/ModuleReader.cs deleted file mode 100644 index 3c11b3d83..000000000 --- a/src/Caching/Impl/Readers/ModuleReader.cs +++ /dev/null @@ -1,24 +0,0 @@ -// 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.Text; - -namespace Microsoft.Python.Analysis.Caching.Readers { - internal sealed class ModuleReader { - - } -} diff --git a/src/Caching/Impl/Writers/AnalysisWriter.cs b/src/Caching/Impl/Writers/AnalysisWriter.cs deleted file mode 100644 index 9ce3e320c..000000000 --- a/src/Caching/Impl/Writers/AnalysisWriter.cs +++ /dev/null @@ -1,42 +0,0 @@ -// 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.IO; -using LiteDB; -using Microsoft.Python.Analysis.Analyzer; -using Microsoft.Python.Core; - -namespace Microsoft.Python.Analysis.Caching.Writers { - internal sealed class AnalysisWriter { - private readonly IServiceContainer _services; - - public AnalysisWriter(IServiceContainer services) { - _services = services; - } - - public void StoreModuleAnalysis(string moduleId, IDocumentAnalysis analysis) { - if(!(analysis is DocumentAnalysis)) { - return; - } - - var cfs = _services.GetService(); - using (var db = new LiteDatabase(Path.Combine(cfs.CacheFolder, "Analysis.db"))) { - var mw = new ModuleWriter(); - mw.WriteModule(db, moduleId, analysis); - } - } - } -} - diff --git a/src/Caching/Impl/Writers/ModuleWriter.cs b/src/Caching/Impl/Writers/ModuleWriter.cs deleted file mode 100644 index 300981cfa..000000000 --- a/src/Caching/Impl/Writers/ModuleWriter.cs +++ /dev/null @@ -1,28 +0,0 @@ -// 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 LiteDB; -using Microsoft.Python.Analysis.Caching.Models; - -namespace Microsoft.Python.Analysis.Caching.Writers { - internal sealed class ModuleWriter { - public void WriteModule(LiteDatabase db, string moduleId, IDocumentAnalysis analysis) { - var model = ModuleModel.FromAnalysis(analysis); - - var moduleCollection = db.GetCollection("modules"); - moduleCollection.Update(model); - } - } -} diff --git a/src/LanguageServer/Impl/Implementation/Server.cs b/src/LanguageServer/Impl/Implementation/Server.cs index 39b1720d4..9603e2012 100644 --- a/src/LanguageServer/Impl/Implementation/Server.cs +++ b/src/LanguageServer/Impl/Implementation/Server.cs @@ -22,6 +22,7 @@ using System.Threading.Tasks; using Microsoft.Python.Analysis; using Microsoft.Python.Analysis.Analyzer; +using Microsoft.Python.Analysis.Caching; using Microsoft.Python.Analysis.Core.Interpreter; using Microsoft.Python.Analysis.Documents; using Microsoft.Python.Core; @@ -143,7 +144,9 @@ public async Task InitializeAsync(InitializeParams @params, Ca }; _interpreter = await PythonInterpreter.CreateAsync(configuration, _rootDir, _services, cancellationToken); - _services.AddService(_interpreter); + _services + .AddService(_interpreter) + .AddService(new ModuleDatabase(_services)); var fileSystem = _services.GetService(); _indexManager = new IndexManager(fileSystem, _interpreter.LanguageVersion, _rootDir, diff --git a/src/LanguageServer/Impl/Microsoft.Python.LanguageServer.csproj b/src/LanguageServer/Impl/Microsoft.Python.LanguageServer.csproj index 58b65f302..107026039 100644 --- a/src/LanguageServer/Impl/Microsoft.Python.LanguageServer.csproj +++ b/src/LanguageServer/Impl/Microsoft.Python.LanguageServer.csproj @@ -43,6 +43,7 @@ + From 6f6737d29f8273b646696b47278875cfc8a83065 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Wed, 12 Jun 2019 13:21:00 -0700 Subject: [PATCH 58/82] Test --- src/Caching/Impl/Models/ClassModel.cs | 3 +++ src/Caching/Impl/Models/FunctionModel.cs | 2 ++ src/Caching/Impl/Models/ModuleModel.cs | 22 +++++++++++++--------- src/Caching/Impl/Models/TypeVarModel.cs | 3 +++ src/Caching/Impl/Models/VariableModel.cs | 2 ++ src/Caching/Test/BasicTests.cs | 13 ++++++++++++- 6 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/Caching/Impl/Models/ClassModel.cs b/src/Caching/Impl/Models/ClassModel.cs index 90933ae6b..a8b0db1d5 100644 --- a/src/Caching/Impl/Models/ClassModel.cs +++ b/src/Caching/Impl/Models/ClassModel.cs @@ -14,11 +14,13 @@ // permissions and limitations under the License. using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; namespace Microsoft.Python.Analysis.Caching.Models { + [DebuggerDisplay("c:{Name}")] internal sealed class ClassModel: MemberModel { public string Documentation { get; set; } public string[] Bases { get; set; } @@ -50,6 +52,7 @@ private ClassModel(IPythonClassType cls) { if (!Push(m)) { continue; } + try { switch (m) { case IPythonClassType ct: diff --git a/src/Caching/Impl/Models/FunctionModel.cs b/src/Caching/Impl/Models/FunctionModel.cs index 720741582..1898c3043 100644 --- a/src/Caching/Impl/Models/FunctionModel.cs +++ b/src/Caching/Impl/Models/FunctionModel.cs @@ -13,10 +13,12 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. +using System.Diagnostics; using System.Linq; using Microsoft.Python.Analysis.Types; namespace Microsoft.Python.Analysis.Caching.Models { + [DebuggerDisplay("f:{Name}")] internal sealed class FunctionModel: MemberModel { public string Documentation { get; set; } public OverloadModel[] Overloads { get; set; } diff --git a/src/Caching/Impl/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs index 3dcc9245e..42c71da4e 100644 --- a/src/Caching/Impl/Models/ModuleModel.cs +++ b/src/Caching/Impl/Models/ModuleModel.cs @@ -14,6 +14,7 @@ // permissions and limitations under the License. using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; @@ -27,21 +28,24 @@ internal sealed class ModuleModel : MemberModel { // TODO: TypeVars, ... public static ModuleModel FromAnalysis(IDocumentAnalysis analysis) { - var variables = new List(); - var functions = new List(); - var classes = new List(); + var variables = new Dictionary(); + var functions = new Dictionary(); + var classes = new Dictionary(); foreach (var v in analysis.GlobalScope.Variables.Where(v => v.Source == VariableSource.Declaration)) { var t = v.Value.GetPythonType(); switch (v.Value) { case IPythonFunctionType ft when ft.DeclaringModule.Equals(analysis.Document): - functions.Add(FunctionModel.FromType(ft)); + Debug.Assert(!functions.ContainsKey(ft.Name)); + functions[ft.Name] = FunctionModel.FromType(ft); break; case IPythonClassType cls when cls.DeclaringModule.Equals(analysis.Document): - classes.Add(ClassModel.FromType(cls)); + Debug.Assert(!classes.ContainsKey(cls.Name)); + classes[cls.Name] = ClassModel.FromType(cls); break; default: - variables.Add(VariableModel.FromVariable(v)); + Debug.Assert(!variables.ContainsKey(v.Name)); + variables[v.Name] = VariableModel.FromVariable(v); break; } } @@ -49,9 +53,9 @@ public static ModuleModel FromAnalysis(IDocumentAnalysis analysis) { return new ModuleModel { Name = analysis.Document.GetQualifiedName(), Documentation = analysis.Document.Documentation, - Functions = functions.ToArray(), - Variables = variables.ToArray(), - Classes = classes.ToArray() + Functions = functions.Values.ToArray(), + Variables = variables.Values.ToArray(), + Classes = classes.Values.ToArray() }; } } diff --git a/src/Caching/Impl/Models/TypeVarModel.cs b/src/Caching/Impl/Models/TypeVarModel.cs index 1d82b3ae3..eeae11354 100644 --- a/src/Caching/Impl/Models/TypeVarModel.cs +++ b/src/Caching/Impl/Models/TypeVarModel.cs @@ -13,7 +13,10 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. +using System.Diagnostics; + namespace Microsoft.Python.Analysis.Caching.Models { + [DebuggerDisplay("t:{Name}")] internal sealed class TypeVarModel { public string Name { get; set; } public string[] Constraints { get; set; } diff --git a/src/Caching/Impl/Models/VariableModel.cs b/src/Caching/Impl/Models/VariableModel.cs index de71b5658..112e014d9 100644 --- a/src/Caching/Impl/Models/VariableModel.cs +++ b/src/Caching/Impl/Models/VariableModel.cs @@ -13,10 +13,12 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. +using System.Diagnostics; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; namespace Microsoft.Python.Analysis.Caching.Models { + [DebuggerDisplay("v:{Name} = {Value}")] internal sealed class VariableModel: MemberModel { public string Value { get; set; } diff --git a/src/Caching/Test/BasicTests.cs b/src/Caching/Test/BasicTests.cs index 55d5ae58f..eb43a3706 100644 --- a/src/Caching/Test/BasicTests.cs +++ b/src/Caching/Test/BasicTests.cs @@ -14,6 +14,7 @@ // permissions and limitations under the License. using System.IO; +using System.Linq; using System.Threading.Tasks; using Microsoft.Python.Analysis.Caching.Models; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -61,10 +62,20 @@ def func(): public async Task Builtins() { var analysis = await GetAnalysisAsync(string.Empty); var model = ModuleModel.FromAnalysis(analysis.Document.Interpreter.ModuleResolution.BuiltinsModule.Analysis); + + // Verify model contains unique members. Conversion will throw on duplicates. + var members = model.Variables + .Concat(model.Classes) + .Concat(model.Functions) + .ToDictionary(k => k.Name, v => v); + var json = ToJson(model); - Baseline.CompareToFile(BaselineFileName, json); + //Baseline.CompareToFile(BaselineFileName, json); + + var module = new PythonDbModule(model, Services); } + [TestMethod, Priority(0)] public async Task Sys() { var analysis = await GetAnalysisAsync("import sys"); From 081f4754bf4f1790472789ece59d42eedd4d6633 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Wed, 12 Jun 2019 15:28:26 -0700 Subject: [PATCH 59/82] Variable creations --- src/Caching/Impl/Models/ModuleModel.cs | 27 ++++++++++++++++++-------- src/Caching/Impl/PythonDbModule.cs | 2 +- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/Caching/Impl/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs index 42c71da4e..7f73192a9 100644 --- a/src/Caching/Impl/Models/ModuleModel.cs +++ b/src/Caching/Impl/Models/ModuleModel.cs @@ -32,22 +32,33 @@ public static ModuleModel FromAnalysis(IDocumentAnalysis analysis) { var functions = new Dictionary(); var classes = new Dictionary(); + // Go directly through variables rather than GetMemberNames/GetMember since + // module may have non-exported variables and types that it may be returning + // from functions and methods or otherwise using in declarations. foreach (var v in analysis.GlobalScope.Variables.Where(v => v.Source == VariableSource.Declaration)) { var t = v.Value.GetPythonType(); + // Create type model before variable since variable needs it. + string typeName = null; switch (v.Value) { case IPythonFunctionType ft when ft.DeclaringModule.Equals(analysis.Document): - Debug.Assert(!functions.ContainsKey(ft.Name)); - functions[ft.Name] = FunctionModel.FromType(ft); + if (!functions.ContainsKey(ft.Name)) { + typeName = ft.Name; + functions[ft.Name] = FunctionModel.FromType(ft); + } + break; case IPythonClassType cls when cls.DeclaringModule.Equals(analysis.Document): - Debug.Assert(!classes.ContainsKey(cls.Name)); - classes[cls.Name] = ClassModel.FromType(cls); - break; - default: - Debug.Assert(!variables.ContainsKey(v.Name)); - variables[v.Name] = VariableModel.FromVariable(v); + if (!classes.ContainsKey(cls.Name)) { + typeName = cls.Name; + classes[cls.Name] = ClassModel.FromType(cls); + } break; } + + // Do not re-declare classes and functions as variables in the model. + if (typeName == null && !variables.ContainsKey(v.Name)) { + variables[v.Name] = VariableModel.FromVariable(v); + } } return new ModuleModel { diff --git a/src/Caching/Impl/PythonDbModule.cs b/src/Caching/Impl/PythonDbModule.cs index 410ecf247..f4ec9a60f 100644 --- a/src/Caching/Impl/PythonDbModule.cs +++ b/src/Caching/Impl/PythonDbModule.cs @@ -91,7 +91,7 @@ public GlobalScopeImpl(ModuleModel model, IPythonModule module, IServiceContaine } } } - + // TODO: re-declare __doc__, __name__, etc. // No longer need model data, free up some memory. _members.Clear(); } From 42fa4dc7f9421ec22544df638eccc259d8e63e3b Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Wed, 12 Jun 2019 19:38:15 -0700 Subject: [PATCH 60/82] Factories --- src/Caching/Impl/Factories/ClassFactory.cs | 45 ++++ src/Caching/Impl/Factories/FactoryBase.cs | 57 +++++ src/Caching/Impl/Factories/FunctionFactory.cs | 42 ++++ src/Caching/Impl/Factories/ModuleFactory.cs | 136 ++++++++++ src/Caching/Impl/Factories/PropertyFactory.cs | 37 +++ src/Caching/Impl/Factories/VariableFactory.cs | 32 +++ src/Caching/Impl/GlobalScope.cs | 76 ++++++ src/Caching/Impl/PythonDbModule.cs | 238 +----------------- src/Caching/Test/BasicTests.cs | 7 - 9 files changed, 427 insertions(+), 243 deletions(-) create mode 100644 src/Caching/Impl/Factories/ClassFactory.cs create mode 100644 src/Caching/Impl/Factories/FactoryBase.cs create mode 100644 src/Caching/Impl/Factories/FunctionFactory.cs create mode 100644 src/Caching/Impl/Factories/ModuleFactory.cs create mode 100644 src/Caching/Impl/Factories/PropertyFactory.cs create mode 100644 src/Caching/Impl/Factories/VariableFactory.cs create mode 100644 src/Caching/Impl/GlobalScope.cs diff --git a/src/Caching/Impl/Factories/ClassFactory.cs b/src/Caching/Impl/Factories/ClassFactory.cs new file mode 100644 index 000000000..4c74a31bb --- /dev/null +++ b/src/Caching/Impl/Factories/ClassFactory.cs @@ -0,0 +1,45 @@ +// 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.Collections.Generic; +using System.Linq; +using Microsoft.Python.Analysis.Caching.Models; +using Microsoft.Python.Analysis.Types; + +namespace Microsoft.Python.Analysis.Caching.Factories { + internal sealed class ClassFactory : FactoryBase { + public ClassFactory(IEnumerable classes, ModuleFactory mf) + : base(classes, mf) { + } + + protected override IPythonClassType CreateMember(ClassModel cm, IPythonType declaringType) { + + var cls = new PythonClassType(cm.Name, new Location(ModuleFactory.Module)); + cls.SetBases(cm.Bases.Select(b => Construct(b, null))); + + foreach (var f in cm.Methods) { + cls.AddMember(f.Name, ModuleFactory.FunctionFactory.Construct(f, cls), false); + } + foreach (var p in cm.Properties) { + cls.AddMember(p.Name, ModuleFactory.PropertyFactory.Construct(p, cls), false); + } + foreach (var c in cm.InnerClasses) { + cls.AddMember(c.Name, Construct(c, cls), false); + } + // TODO: fields. Bypass variable cache! + return cls; + } + } +} diff --git a/src/Caching/Impl/Factories/FactoryBase.cs b/src/Caching/Impl/Factories/FactoryBase.cs new file mode 100644 index 000000000..3f4d53950 --- /dev/null +++ b/src/Caching/Impl/Factories/FactoryBase.cs @@ -0,0 +1,57 @@ +// 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.Caching.Models; +using Microsoft.Python.Analysis.Types; + +namespace Microsoft.Python.Analysis.Caching.Factories { + internal abstract class FactoryBase : IDisposable + where TModel : MemberModel + where TMember : IMember { + + private class ModelData { + public TModel Model; + public TMember Member; + } + + private readonly Dictionary _data; + + protected ModuleFactory ModuleFactory { get; } + + protected FactoryBase(IEnumerable models, ModuleFactory mf) { + ModuleFactory = mf; + _data = models.ToDictionary(k => k.Name, v => new ModelData { Model = v }); + } + + public TMember Construct(TModel cm, IPythonType declaringType, bool cached = true) { + if (!cached) { + return CreateMember(cm, declaringType); + } + + var data = _data[cm.Name]; + if (data.Member == null) { + data.Member = CreateMember(data.Model, declaringType); + } + return data.Member; + } + + public virtual void Dispose() => _data.Clear(); + + protected abstract TMember CreateMember(TModel model, IPythonType declaringType); + } +} diff --git a/src/Caching/Impl/Factories/FunctionFactory.cs b/src/Caching/Impl/Factories/FunctionFactory.cs new file mode 100644 index 000000000..b6f13f446 --- /dev/null +++ b/src/Caching/Impl/Factories/FunctionFactory.cs @@ -0,0 +1,42 @@ +// 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.Collections.Generic; +using System.Linq; +using Microsoft.Python.Analysis.Caching.Models; +using Microsoft.Python.Analysis.Types; + +namespace Microsoft.Python.Analysis.Caching.Factories { + internal sealed class FunctionFactory: FactoryBase { + public FunctionFactory(IEnumerable classes, ModuleFactory mf) + : base(classes, mf) { + } + + protected override IPythonFunctionType CreateMember(FunctionModel fm, IPythonType declaringType) { + var f = new PythonFunctionType(fm.Name, ModuleFactory.DefaultLocation, declaringType, fm.Documentation); + foreach (var om in fm.Overloads) { + var o = new PythonFunctionOverload(fm.Name, ModuleFactory.DefaultLocation); + o.SetDocumentation(fm.Documentation); + o.SetReturnValue(ModuleFactory.ConstructMember(om.ReturnType), true); + o.SetParameters(om.Parameters.Select(ConstructParameter).ToArray()); + f.AddOverload(o); + } + return f; + } + + private IParameterInfo ConstructParameter(ParameterModel pm) + => new ParameterInfo(pm.Name, ModuleFactory.ConstructType(pm.Type), pm.Kind, ModuleFactory.ConstructMember(pm.DefaultValue)); + } +} diff --git a/src/Caching/Impl/Factories/ModuleFactory.cs b/src/Caching/Impl/Factories/ModuleFactory.cs new file mode 100644 index 000000000..0d76e908d --- /dev/null +++ b/src/Caching/Impl/Factories/ModuleFactory.cs @@ -0,0 +1,136 @@ +// 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.Diagnostics; +using System.Linq; +using Microsoft.Python.Analysis.Caching.Models; +using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Analysis.Values; + +namespace Microsoft.Python.Analysis.Caching.Factories { + internal sealed class ModuleFactory : IDisposable { + public IPythonModule Module { get; } + public ClassFactory ClassFactory { get; } + public FunctionFactory FunctionFactory { get; } + public PropertyFactory PropertyFactory { get; } + public VariableFactory VariableFactory { get; } + public Location DefaultLocation { get; } + + public ModuleFactory(ModuleModel model, IPythonModule module) { + Module = module; + ClassFactory = new ClassFactory(model.Classes, this); + FunctionFactory = new FunctionFactory(model.Functions, this); + VariableFactory = new VariableFactory(model.Variables, this); + PropertyFactory = new PropertyFactory(this); + DefaultLocation = new Location(Module); + } + + public void Dispose() { + ClassFactory.Dispose(); + FunctionFactory.Dispose(); + VariableFactory.Dispose(); + } + + public IPythonType ConstructType(string qualifiedName) => ConstructMember(qualifiedName)?.GetPythonType(); + + public IMember ConstructMember(string qualifiedName) { + if (!SplitQualifiedName(qualifiedName, out var moduleName, out var typeNameParts, out var isInstance)) { + return null; + } + + Debug.Assert(typeNameParts.Count > 0); + var member = moduleName == Module.Name + ? GetMemberFromThisModule(typeNameParts) + : GetMemberFromModule(moduleName, typeNameParts); + + return isInstance && member != null ? new PythonInstance(member.GetPythonType()) : member; + } + + private IMember GetMemberFromModule(string moduleName, IReadOnlyList typeNameParts) { + // Module resolution will call back to the module database + // to get persisted analysis, if available. + var module = Module.Interpreter.ModuleResolution.GetOrLoadModule(moduleName); + var member = module?.GetMember(typeNameParts[0]); + foreach (var p in typeNameParts.Skip(1)) { + var mc = member as IMemberContainer; + + Debug.Assert(mc != null); + member = mc?.GetMember(p); + + if (member == null) { + Debug.Assert(member != null); + break; + } + } + return member; + } + + private IMember GetMemberFromThisModule(IReadOnlyList typeNameParts) { + if (typeNameParts.Count == 0) { + return null; + } + + if (_classes.TryGetValue(typeNameParts[0], out var cd)) { + if (cd.Member != null) { + return cd.Member; + } + Debug.Assert(typeNameParts.Count == 1); + return ConstructClass(cd.Model); + } + + if (_functions.TryGetValue(typeNameParts[0], out var fd)) { + if (fd.Member != null) { + return fd.Member; + } + Debug.Assert(typeNameParts.Count == 1); + return ConstructFunction(fd.Model, null); + } + + if (_variables.TryGetValue(typeNameParts[0], out var vd)) { + if (vd.Member != null) { + return vd.Member; + } + Debug.Assert(typeNameParts.Count == 1); + return ConstructVariable(vd.Model); + } + + return null; + } + + private bool SplitQualifiedName(string qualifiedName, out string moduleName, out List typeNameParts, out bool isInstance) { + moduleName = null; + typeNameParts = new List(); + + isInstance = qualifiedName.StartsWith("i:"); + qualifiedName = isInstance ? qualifiedName.Substring(2) : qualifiedName; + var components = qualifiedName.Split('.'); + switch (components.Length) { + case 0: + return false; + case 1: + moduleName = @"builtins"; + typeNameParts.Add(components[0]); + return true; + default: + moduleName = components[0]; + typeNameParts.AddRange(components.Skip(1)); + return true; + } + } + + } +} diff --git a/src/Caching/Impl/Factories/PropertyFactory.cs b/src/Caching/Impl/Factories/PropertyFactory.cs new file mode 100644 index 000000000..5673583f9 --- /dev/null +++ b/src/Caching/Impl/Factories/PropertyFactory.cs @@ -0,0 +1,37 @@ +// 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 Microsoft.Python.Analysis.Caching.Models; +using Microsoft.Python.Analysis.Types; + +namespace Microsoft.Python.Analysis.Caching.Factories { + internal sealed class PropertyFactory { + private readonly ModuleFactory _mf; + + public PropertyFactory(ModuleFactory mf) { + _mf = mf; + } + + public IPythonPropertyType Construct(PropertyModel pm, IPythonClassType cls) { + var prop = new PythonPropertyType(pm.Name, _mf.DefaultLocation, cls, (pm.Attributes & FunctionAttributes.Abstract) != 0); + prop.SetDocumentation(pm.Documentation); + var o = new PythonFunctionOverload(pm.Name, _mf.DefaultLocation); + o.SetDocumentation(pm.Documentation); // TODO: own documentation? + o.SetReturnValue(_mf.ConstructMember(pm.ReturnType), true); + prop.AddOverload(o); + return prop; + } + } +} diff --git a/src/Caching/Impl/Factories/VariableFactory.cs b/src/Caching/Impl/Factories/VariableFactory.cs new file mode 100644 index 000000000..6e86abdc6 --- /dev/null +++ b/src/Caching/Impl/Factories/VariableFactory.cs @@ -0,0 +1,32 @@ +// 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.Collections.Generic; +using Microsoft.Python.Analysis.Caching.Models; +using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Analysis.Values; + +namespace Microsoft.Python.Analysis.Caching.Factories { + internal sealed class VariableFactory : FactoryBase { + public VariableFactory(IEnumerable models, ModuleFactory mf) + : base(models, mf) { + } + + protected override IVariable CreateMember(VariableModel vm, IPythonType declaringType) { + var m = ModuleFactory.ConstructMember(vm.Value); + return m != null ? new Variable(vm.Name, m, VariableSource.Declaration, ModuleFactory.DefaultLocation) : null; + } + } +} diff --git a/src/Caching/Impl/GlobalScope.cs b/src/Caching/Impl/GlobalScope.cs new file mode 100644 index 000000000..5c791eaa3 --- /dev/null +++ b/src/Caching/Impl/GlobalScope.cs @@ -0,0 +1,76 @@ +// 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.Caching.Factories; +using Microsoft.Python.Analysis.Caching.Models; +using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Analysis.Values; +using Microsoft.Python.Core; +using Microsoft.Python.Parsing.Ast; + +namespace Microsoft.Python.Analysis.Caching { + internal sealed class GlobalScope : IGlobalScope { + private readonly VariableCollection _scopeVariables = new VariableCollection(); + private readonly IPythonInterpreter _interpreter; + + public GlobalScope(ModuleModel model, IPythonModule module, IServiceContainer services) { + Module = module; + Name = model.Name; + + _interpreter = services.GetService(); + + using (var mf = new ModuleFactory(model, module)) { + // TODO: store real location in models + + // Member creation may be non-linear. Consider function A returning instance + // of a class or type info of a function which hasn't been created yet. + // Thus check if member has already been created first. + foreach (var cm in model.Classes) { + var cls = mf.ClassFactory.Construct(cm, null); + _scopeVariables.DeclareVariable(cm.Name, cls, VariableSource.Declaration, mf.DefaultLocation); + } + + foreach (var fm in model.Functions) { + var ft = mf.FunctionFactory.Construct(fm, null); + _scopeVariables.DeclareVariable(fm.Name, ft, VariableSource.Declaration, mf.DefaultLocation); + } + + foreach (var vm in model.Variables) { + var v = mf.VariableFactory.Construct(vm, null); + _scopeVariables.DeclareVariable(vm.Name, v.Value, VariableSource.Declaration, mf.DefaultLocation); + } + // TODO: re-declare __doc__, __name__, etc. + } + } + + public string Name { get; } + public ScopeStatement Node => null; + public IScope OuterScope => null; + public IReadOnlyList Children => Array.Empty(); + public IEnumerable EnumerateTowardsGlobal => Enumerable.Empty(); + public IEnumerable EnumerateFromGlobal => Enumerable.Empty(); + public IVariableCollection Variables => _scopeVariables; + public IVariableCollection NonLocals => VariableCollection.Empty; + public IVariableCollection Globals => VariableCollection.Empty; + public IPythonModule Module { get; } + IGlobalScope IScope.GlobalScope => this; + + public void DeclareVariable(string name, IMember value, VariableSource source, Location location = default) { } + public void LinkVariable(string name, IVariable v, Location location) => throw new NotImplementedException() { }; + } +} diff --git a/src/Caching/Impl/PythonDbModule.cs b/src/Caching/Impl/PythonDbModule.cs index f4ec9a60f..e55426ef1 100644 --- a/src/Caching/Impl/PythonDbModule.cs +++ b/src/Caching/Impl/PythonDbModule.cs @@ -13,26 +13,22 @@ // 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.Diagnostics; -using System.Linq; using Microsoft.Python.Analysis.Caching.Models; using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; using Microsoft.Python.Core; -using Microsoft.Python.Parsing.Ast; namespace Microsoft.Python.Analysis.Caching { internal sealed class PythonDbModule : SpecializedModule { - private readonly GlobalScopeImpl _globalScope; + private readonly GlobalScope _globalScope; private readonly IPythonInterpreter _interpreter; public PythonDbModule(ModuleModel model, IServiceContainer services) : base(model.Name, string.Empty, services) { - _globalScope = new GlobalScopeImpl(model, this, services); + _globalScope = new GlobalScope(model, this, services); Documentation = model.Documentation; } @@ -42,235 +38,5 @@ public PythonDbModule(ModuleModel model, IServiceContainer services) public override IEnumerable GetMemberNames() => _globalScope.Variables.Names; public override IMember GetMember(string name) => _globalScope.Variables[name]; public override IGlobalScope GlobalScope => _globalScope; - - private sealed class GlobalScopeImpl : IGlobalScope { - private class ModelMemberPair { - public MemberModel Model; - public IMember Member; - } - private readonly VariableCollection _variables = new VariableCollection(); - private readonly Dictionary _members; - private readonly IPythonInterpreter _interpreter; - - public GlobalScopeImpl(ModuleModel model, IPythonModule module, IServiceContainer services) { - Module = module; - Name = model.Name; - - _interpreter = services.GetService(); - _members = model.Variables - .Concat(model.Classes) - .Concat(model.Functions) - .ToDictionary(k => k.Name, v => new ModelMemberPair { - Model = v, - Member = null - }); - - // TODO: store real location in models - - // Member creation may be non-linear. Consider function A returning instance - // of a class or type info of a function which hasn't been created yet. - // Thus check if member has already been created first. - var location = new Location(module); - foreach (var cm in model.Classes) { - var cls = ConstructClass(cm); - _variables.DeclareVariable(cm.Name, cls, VariableSource.Declaration, location); - } - - foreach (var fm in model.Functions) { - var ft = ConstructFunction(fm, null); - _variables.DeclareVariable(fm.Name, ft, VariableSource.Declaration, location); - } - - foreach (var vm in model.Variables) { - var m = _members[vm.Name].Member; - if (m == null) { - m = ConstructMember(vm.Value); - if (m != null) { - _variables.DeclareVariable(vm.Name, m, VariableSource.Declaration, location); - _members[vm.Name].Member = _variables[vm.Name]; - } - } - } - // TODO: re-declare __doc__, __name__, etc. - // No longer need model data, free up some memory. - _members.Clear(); - } - - private IPythonClassType ConstructClass(ClassModel cm) { - var pair = _members[cm.Name]; - - var m = pair.Member; - if (m != null) { - var ct = m as IPythonClassType; - Debug.Assert(ct != null); - return ct; - } - - var cls = new PythonClassType(cm.Name, new Location(Module)); - foreach (var f in cm.Methods) { - cls.AddMember(f.Name, ConstructFunction(f, cls), false); - } - foreach (var p in cm.Properties) { - cls.AddMember(p.Name, ConstructProperty(p, cls), false); - } - foreach (var c in cm.InnerClasses) { - cls.AddMember(c.Name, ConstructClass(c), false); - } - - pair.Member = cls; - return cls; - } - - private IPythonFunctionType ConstructFunction(FunctionModel fm, IPythonClassType cls) { - var pair = _members[fm.Name]; - - var m = pair.Member; - if (m != null) { - var ft = m as IPythonFunctionType; - Debug.Assert(ft != null); - return ft; - } - - var f = new PythonFunctionType(fm.Name, new Location(Module), cls, fm.Documentation); - foreach (var om in fm.Overloads) { - var o = new PythonFunctionOverload(fm.Name, new Location(Module)); - o.SetDocumentation(fm.Documentation); // TODO: own documentation? - o.SetReturnValue(ConstructMember(om.ReturnType), true); - o.SetParameters(om.Parameters.Select(ConstructParameter).ToArray()); - f.AddOverload(o); - } - pair.Member = f; - return f; - } - - private IVariable ConstructVariable(VariableModel vm) { - var pair = _members[vm.Name]; - var m = pair.Member; - if (m != null) { - var v = m as IVariable; - Debug.Assert(v != null); - return v; - } - - m = ConstructMember(vm.Value); - if (m != null) { - _variables.DeclareVariable(vm.Name, m, VariableSource.Declaration, new Location(Module)); - var v = _variables[vm.Name]; - _members[vm.Name].Member = v; - return v; - } - - return null; - } - - private IPythonPropertyType ConstructProperty(PropertyModel pm, IPythonClassType cls) { - var prop = new PythonPropertyType(pm.Name, new Location(Module), cls, (pm.Attributes & FunctionAttributes.Abstract) != 0); - prop.SetDocumentation(pm.Documentation); - var o = new PythonFunctionOverload(pm.Name, new Location(Module)); - o.SetDocumentation(pm.Documentation); // TODO: own documentation? - o.SetReturnValue(ConstructMember(pm.ReturnType), true); - prop.AddOverload(o); - return prop; - } - - private IParameterInfo ConstructParameter(ParameterModel pm) - => new ParameterInfo(pm.Name, ConstructType(pm.Type), pm.Kind, ConstructMember(pm.DefaultValue)); - - private IPythonType ConstructType(string qualifiedName) => ConstructMember(qualifiedName)?.GetPythonType(); - - private IMember ConstructMember(string qualifiedName) { - if (!SplitQualifiedName(qualifiedName, out var moduleName, out var typeNameParts, out var isInstance)) { - return null; - } - - Debug.Assert(typeNameParts.Count > 0); - var member = moduleName == Module.Name - ? GetMemberFromThisModule(typeNameParts) - : GetMemberFromModule(moduleName, typeNameParts); - - return isInstance && member != null ? new PythonInstance(member.GetPythonType()) : member; - } - - private IMember GetMemberFromModule(string moduleName, IReadOnlyList typeNameParts) { - // Module resolution will call back to the module database - // to get persisted analysis, if available. - var module = _interpreter.ModuleResolution.GetOrLoadModule(moduleName); - var member = module?.GetMember(typeNameParts[0]); - foreach (var p in typeNameParts.Skip(1)) { - var mc = member as IMemberContainer; - - Debug.Assert(mc != null); - member = mc?.GetMember(p); - - if (member == null) { - Debug.Assert(member != null); - break; - } - } - return member; - } - - private IMember GetMemberFromThisModule(IReadOnlyList typeNameParts) { - if (typeNameParts.Count == 0 || !_members.TryGetValue(typeNameParts[0], out var memberData)) { - return null; - } - - if (memberData.Member != null) { - return memberData.Member; - } - - // TODO: nested classes, etc - switch (memberData.Model) { - case ClassModel cm: - Debug.Assert(typeNameParts.Count == 1); - return ConstructClass(cm); - - case FunctionModel fm: - Debug.Assert(typeNameParts.Count == 1); - return ConstructFunction(fm, null); - - case VariableModel vm: - Debug.Assert(typeNameParts.Count == 1); - return ConstructVariable(vm); - } - return null; - } - - private bool SplitQualifiedName(string qualifiedName, out string moduleName, out List typeNameParts, out bool isInstance) { - moduleName = null; - typeNameParts = new List(); - - isInstance = qualifiedName.StartsWith("i:"); - qualifiedName = isInstance ? qualifiedName.Substring(2) : qualifiedName; - var components = qualifiedName.Split('.'); - switch (components.Length) { - case 0: - return false; - case 1: - moduleName = @"builtins"; - typeNameParts.Add(components[0]); - return true; - default: - moduleName = components[0]; - typeNameParts.AddRange(components.Skip(1)); - return true; - } - } - - public string Name { get; } - public ScopeStatement Node => null; - public IScope OuterScope => null; - public IReadOnlyList Children => Array.Empty(); - public IEnumerable EnumerateTowardsGlobal => Enumerable.Empty(); - public IEnumerable EnumerateFromGlobal => Enumerable.Empty(); - public IVariableCollection Variables => _variables; - public IVariableCollection NonLocals => VariableCollection.Empty; - public IVariableCollection Globals => VariableCollection.Empty; - public IPythonModule Module { get; } - IGlobalScope IScope.GlobalScope => this; - - public void DeclareVariable(string name, IMember value, VariableSource source, Location location = default) { } - public void LinkVariable(string name, IVariable v, Location location) => throw new NotImplementedException() { }; - } } } diff --git a/src/Caching/Test/BasicTests.cs b/src/Caching/Test/BasicTests.cs index eb43a3706..aedd8239a 100644 --- a/src/Caching/Test/BasicTests.cs +++ b/src/Caching/Test/BasicTests.cs @@ -62,13 +62,6 @@ def func(): public async Task Builtins() { var analysis = await GetAnalysisAsync(string.Empty); var model = ModuleModel.FromAnalysis(analysis.Document.Interpreter.ModuleResolution.BuiltinsModule.Analysis); - - // Verify model contains unique members. Conversion will throw on duplicates. - var members = model.Variables - .Concat(model.Classes) - .Concat(model.Functions) - .ToDictionary(k => k.Name, v => v); - var json = ToJson(model); //Baseline.CompareToFile(BaselineFileName, json); From 2f03cb92b21c675cc061be3930d74008ce350151 Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Wed, 12 Jun 2019 20:41:28 -0700 Subject: [PATCH 61/82] Factories --- .../Ast/Impl/Types/PythonClassType.cs | 2 +- src/Caching/Impl/Factories/ClassFactory.cs | 5 +-- src/Caching/Impl/Factories/FactoryBase.cs | 6 +++- src/Caching/Impl/Factories/ModuleFactory.cs | 36 ++++++------------- src/Caching/Impl/Models/ClassModel.cs | 2 +- src/Caching/Impl/TypeNames.cs | 2 +- 6 files changed, 21 insertions(+), 32 deletions(-) diff --git a/src/Analysis/Ast/Impl/Types/PythonClassType.cs b/src/Analysis/Ast/Impl/Types/PythonClassType.cs index b3e2de521..5f0a47247 100644 --- a/src/Analysis/Ast/Impl/Types/PythonClassType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonClassType.cs @@ -197,7 +197,7 @@ internal void SetBases(IEnumerable bases) { // During processing of builtins module some types may not be available yet. // Specialization will attach proper base at the end. Debug.Assert(!objectType.IsUnknown()); - if (!bases.Any(b => objectType.Equals(b))) { + if (!bases.Any(b => b.Name == "object" && b.DeclaringModule.Name == @"builtins")) { bases = bases.Concat(Enumerable.Repeat(objectType, 1)); } } diff --git a/src/Caching/Impl/Factories/ClassFactory.cs b/src/Caching/Impl/Factories/ClassFactory.cs index 4c74a31bb..fe91ec8f4 100644 --- a/src/Caching/Impl/Factories/ClassFactory.cs +++ b/src/Caching/Impl/Factories/ClassFactory.cs @@ -17,6 +17,7 @@ using System.Linq; using Microsoft.Python.Analysis.Caching.Models; using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Core; namespace Microsoft.Python.Analysis.Caching.Factories { internal sealed class ClassFactory : FactoryBase { @@ -26,8 +27,8 @@ public ClassFactory(IEnumerable classes, ModuleFactory mf) protected override IPythonClassType CreateMember(ClassModel cm, IPythonType declaringType) { - var cls = new PythonClassType(cm.Name, new Location(ModuleFactory.Module)); - cls.SetBases(cm.Bases.Select(b => Construct(b, null))); + var cls = new PythonClassType(cm.Name == "ellipsis" ? "..." : cm.Name, new Location(ModuleFactory.Module)); + cls.SetBases(cm.Bases.Select(b => TryCreate(b)).ExcludeDefault()); foreach (var f in cm.Methods) { cls.AddMember(f.Name, ModuleFactory.FunctionFactory.Construct(f, cls), false); diff --git a/src/Caching/Impl/Factories/FactoryBase.cs b/src/Caching/Impl/Factories/FactoryBase.cs index 3f4d53950..4e57799ce 100644 --- a/src/Caching/Impl/Factories/FactoryBase.cs +++ b/src/Caching/Impl/Factories/FactoryBase.cs @@ -18,6 +18,7 @@ using System.Linq; using Microsoft.Python.Analysis.Caching.Models; using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Analysis.Values; namespace Microsoft.Python.Analysis.Caching.Factories { internal abstract class FactoryBase : IDisposable @@ -38,7 +39,10 @@ protected FactoryBase(IEnumerable models, ModuleFactory mf) { _data = models.ToDictionary(k => k.Name, v => new ModelData { Model = v }); } - public TMember Construct(TModel cm, IPythonType declaringType, bool cached = true) { + public TMember TryCreate(string name, IPythonType declaringType = null) + => _data.TryGetValue(name, out var data) ? Construct(data.Model, declaringType) : default; + + public TMember Construct(TModel cm, IPythonType declaringType = null, bool cached = true) { if (!cached) { return CreateMember(cm, declaringType); } diff --git a/src/Caching/Impl/Factories/ModuleFactory.cs b/src/Caching/Impl/Factories/ModuleFactory.cs index 0d76e908d..583cbf44c 100644 --- a/src/Caching/Impl/Factories/ModuleFactory.cs +++ b/src/Caching/Impl/Factories/ModuleFactory.cs @@ -26,7 +26,7 @@ internal sealed class ModuleFactory : IDisposable { public IPythonModule Module { get; } public ClassFactory ClassFactory { get; } public FunctionFactory FunctionFactory { get; } - public PropertyFactory PropertyFactory { get; } + public PropertyFactory PropertyFactory { get; } public VariableFactory VariableFactory { get; } public Location DefaultLocation { get; } @@ -84,36 +84,20 @@ private IMember GetMemberFromThisModule(IReadOnlyList typeNameParts) { return null; } - if (_classes.TryGetValue(typeNameParts[0], out var cd)) { - if (cd.Member != null) { - return cd.Member; - } - Debug.Assert(typeNameParts.Count == 1); - return ConstructClass(cd.Model); - } - - if (_functions.TryGetValue(typeNameParts[0], out var fd)) { - if (fd.Member != null) { - return fd.Member; - } - Debug.Assert(typeNameParts.Count == 1); - return ConstructFunction(fd.Model, null); - } - - if (_variables.TryGetValue(typeNameParts[0], out var vd)) { - if (vd.Member != null) { - return vd.Member; - } - Debug.Assert(typeNameParts.Count == 1); - return ConstructVariable(vd.Model); - } - - return null; + // TODO: nested classes, etc (traverse parts and recurse). + return ClassFactory.TryCreate(typeNameParts[0]) + ?? (FunctionFactory.TryCreate(typeNameParts[0]) + ?? (IMember)VariableFactory.TryCreate(typeNameParts[0])); } private bool SplitQualifiedName(string qualifiedName, out string moduleName, out List typeNameParts, out bool isInstance) { moduleName = null; typeNameParts = new List(); + isInstance = false; + + if (string.IsNullOrEmpty(qualifiedName)) { + return false; + } isInstance = qualifiedName.StartsWith("i:"); qualifiedName = isInstance ? qualifiedName.Substring(2) : qualifiedName; diff --git a/src/Caching/Impl/Models/ClassModel.cs b/src/Caching/Impl/Models/ClassModel.cs index a8b0db1d5..5747620b5 100644 --- a/src/Caching/Impl/Models/ClassModel.cs +++ b/src/Caching/Impl/Models/ClassModel.cs @@ -94,7 +94,7 @@ private bool Push(IMember t) { return false; } _processing.Push(t); - return false; + return true; } private void Pop() => _processing.Pop(); #endregion diff --git a/src/Caching/Impl/TypeNames.cs b/src/Caching/Impl/TypeNames.cs index da9720b53..24fe85af7 100644 --- a/src/Caching/Impl/TypeNames.cs +++ b/src/Caching/Impl/TypeNames.cs @@ -27,7 +27,7 @@ public static string GetQualifiedName(this IMember m) { case IPythonInstance _: return $"i:{GetQualifiedName(t)}"; case IPythonType pt when pt.DeclaringModule.ModuleType == ModuleType.Builtins: - return pt.Name; + return pt.Name == "..." ? "ellipsis" : pt.Name; case IPythonType pt: return pt.QualifiedName; case null: From 1dc33397f239b5f9cf75a405c10ca9466a983d86 Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Wed, 12 Jun 2019 22:16:34 -0700 Subject: [PATCH 62/82] Split construction --- src/Caching/Impl/Factories/ClassFactory.cs | 18 +++++++++++------- src/Caching/Impl/Factories/FactoryBase.cs | 2 +- src/Caching/Impl/Models/ClassModel.cs | 6 +++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/Caching/Impl/Factories/ClassFactory.cs b/src/Caching/Impl/Factories/ClassFactory.cs index fe91ec8f4..b6045f30c 100644 --- a/src/Caching/Impl/Factories/ClassFactory.cs +++ b/src/Caching/Impl/Factories/ClassFactory.cs @@ -18,29 +18,33 @@ using Microsoft.Python.Analysis.Caching.Models; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Core; +using Microsoft.Python.Parsing; namespace Microsoft.Python.Analysis.Caching.Factories { - internal sealed class ClassFactory : FactoryBase { + internal sealed class ClassFactory : FactoryBase { public ClassFactory(IEnumerable classes, ModuleFactory mf) : base(classes, mf) { } - protected override IPythonClassType CreateMember(ClassModel cm, IPythonType declaringType) { + protected override PythonClassType CreateMember(ClassModel cm, IPythonType declaringType) + => new PythonClassType(cm.Name == "ellipsis" ? "..." : cm.Name, new Location(ModuleFactory.Module)); - var cls = new PythonClassType(cm.Name == "ellipsis" ? "..." : cm.Name, new Location(ModuleFactory.Module)); - cls.SetBases(cm.Bases.Select(b => TryCreate(b)).ExcludeDefault()); + protected override void CreateMemberParts(ClassModel cm, PythonClassType cls) { + // In Python 3 exclude object since type creation will add it automatically. + var is3x = ModuleFactory.Module.Interpreter.LanguageVersion.Is3x(); + var bases = cm.Bases.Select(b => is3x && b == "object" ? null : TryCreate(b)).ExcludeDefault().ToArray(); + cls.SetBases(bases); foreach (var f in cm.Methods) { - cls.AddMember(f.Name, ModuleFactory.FunctionFactory.Construct(f, cls), false); + cls.AddMember(f.Name, ModuleFactory.FunctionFactory.Construct(f, cls, false), false); } foreach (var p in cm.Properties) { cls.AddMember(p.Name, ModuleFactory.PropertyFactory.Construct(p, cls), false); } foreach (var c in cm.InnerClasses) { - cls.AddMember(c.Name, Construct(c, cls), false); + cls.AddMember(c.Name, Construct(c, cls, false), false); } // TODO: fields. Bypass variable cache! - return cls; } } } diff --git a/src/Caching/Impl/Factories/FactoryBase.cs b/src/Caching/Impl/Factories/FactoryBase.cs index 4e57799ce..93b9509f3 100644 --- a/src/Caching/Impl/Factories/FactoryBase.cs +++ b/src/Caching/Impl/Factories/FactoryBase.cs @@ -18,7 +18,6 @@ using System.Linq; using Microsoft.Python.Analysis.Caching.Models; using Microsoft.Python.Analysis.Types; -using Microsoft.Python.Analysis.Values; namespace Microsoft.Python.Analysis.Caching.Factories { internal abstract class FactoryBase : IDisposable @@ -57,5 +56,6 @@ public TMember Construct(TModel cm, IPythonType declaringType = null, bool cache public virtual void Dispose() => _data.Clear(); protected abstract TMember CreateMember(TModel model, IPythonType declaringType); + protected virtual void CreateMemberParts(TModel model, TMember member) { } } } diff --git a/src/Caching/Impl/Models/ClassModel.cs b/src/Caching/Impl/Models/ClassModel.cs index 5747620b5..7c1d4b5e3 100644 --- a/src/Caching/Impl/Models/ClassModel.cs +++ b/src/Caching/Impl/Models/ClassModel.cs @@ -55,16 +55,16 @@ private ClassModel(IPythonClassType cls) { try { switch (m) { - case IPythonClassType ct: + case IPythonClassType ct when ct.Name == name: if (!ct.DeclaringModule.Equals(cls.DeclaringModule)) { continue; } innerClasses.Add(FromType(ct)); break; - case IPythonFunctionType ft: + case IPythonFunctionType ft when ft.Name == name: methods.Add(FunctionModel.FromType(ft)); break; - case IPythonPropertyType prop: + case IPythonPropertyType prop when prop.Name == name: properties.Add(PropertyModel.FromType(prop)); break; case IPythonInstance inst: From 9535bad9f4c7ba510a9832d05ebffec4fb7ba078 Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Wed, 12 Jun 2019 22:36:24 -0700 Subject: [PATCH 63/82] Restore --- src/Caching/Impl/Factories/ClassFactory.cs | 2 +- src/Caching/Impl/Factories/FactoryBase.cs | 7 +- src/Caching/Impl/Factories/ModuleFactory.cs | 6 + src/Caching/Impl/Factories/VariableFactory.cs | 2 +- src/Caching/Impl/PythonDbModule.cs | 1 - src/Caching/Test/BasicTests.cs | 2 +- src/Caching/Test/Files/Builtins.json | 30318 +++++++++++++++- 7 files changed, 28794 insertions(+), 1544 deletions(-) diff --git a/src/Caching/Impl/Factories/ClassFactory.cs b/src/Caching/Impl/Factories/ClassFactory.cs index b6045f30c..bb7cb3138 100644 --- a/src/Caching/Impl/Factories/ClassFactory.cs +++ b/src/Caching/Impl/Factories/ClassFactory.cs @@ -27,7 +27,7 @@ public ClassFactory(IEnumerable classes, ModuleFactory mf) } protected override PythonClassType CreateMember(ClassModel cm, IPythonType declaringType) - => new PythonClassType(cm.Name == "ellipsis" ? "..." : cm.Name, new Location(ModuleFactory.Module)); + => new PythonClassType(cm.Name, ModuleFactory.DefaultLocation); protected override void CreateMemberParts(ClassModel cm, PythonClassType cls) { // In Python 3 exclude object since type creation will add it automatically. diff --git a/src/Caching/Impl/Factories/FactoryBase.cs b/src/Caching/Impl/Factories/FactoryBase.cs index 93b9509f3..9456eade4 100644 --- a/src/Caching/Impl/Factories/FactoryBase.cs +++ b/src/Caching/Impl/Factories/FactoryBase.cs @@ -42,13 +42,18 @@ public TMember TryCreate(string name, IPythonType declaringType = null) => _data.TryGetValue(name, out var data) ? Construct(data.Model, declaringType) : default; public TMember Construct(TModel cm, IPythonType declaringType = null, bool cached = true) { + TMember m; + if (!cached) { - return CreateMember(cm, declaringType); + m = CreateMember(cm, declaringType); + CreateMemberParts(cm, m); + return m; } var data = _data[cm.Name]; if (data.Member == null) { data.Member = CreateMember(data.Model, declaringType); + CreateMemberParts(cm, data.Member); } return data.Member; } diff --git a/src/Caching/Impl/Factories/ModuleFactory.cs b/src/Caching/Impl/Factories/ModuleFactory.cs index 583cbf44c..93aa7548d 100644 --- a/src/Caching/Impl/Factories/ModuleFactory.cs +++ b/src/Caching/Impl/Factories/ModuleFactory.cs @@ -99,6 +99,12 @@ private bool SplitQualifiedName(string qualifiedName, out string moduleName, out return false; } + if (qualifiedName == "..." || qualifiedName == "ellipsis") { + moduleName = @"builtins"; + typeNameParts.Add("..."); + return true; + } + isInstance = qualifiedName.StartsWith("i:"); qualifiedName = isInstance ? qualifiedName.Substring(2) : qualifiedName; var components = qualifiedName.Split('.'); diff --git a/src/Caching/Impl/Factories/VariableFactory.cs b/src/Caching/Impl/Factories/VariableFactory.cs index 6e86abdc6..b4f7adb54 100644 --- a/src/Caching/Impl/Factories/VariableFactory.cs +++ b/src/Caching/Impl/Factories/VariableFactory.cs @@ -26,7 +26,7 @@ public VariableFactory(IEnumerable models, ModuleFactory mf) protected override IVariable CreateMember(VariableModel vm, IPythonType declaringType) { var m = ModuleFactory.ConstructMember(vm.Value); - return m != null ? new Variable(vm.Name, m, VariableSource.Declaration, ModuleFactory.DefaultLocation) : null; + return new Variable(vm.Name, m, VariableSource.Declaration, ModuleFactory.DefaultLocation); } } } diff --git a/src/Caching/Impl/PythonDbModule.cs b/src/Caching/Impl/PythonDbModule.cs index e55426ef1..d9e44f011 100644 --- a/src/Caching/Impl/PythonDbModule.cs +++ b/src/Caching/Impl/PythonDbModule.cs @@ -23,7 +23,6 @@ namespace Microsoft.Python.Analysis.Caching { internal sealed class PythonDbModule : SpecializedModule { private readonly GlobalScope _globalScope; - private readonly IPythonInterpreter _interpreter; public PythonDbModule(ModuleModel model, IServiceContainer services) : base(model.Name, string.Empty, services) { diff --git a/src/Caching/Test/BasicTests.cs b/src/Caching/Test/BasicTests.cs index aedd8239a..4de502c4b 100644 --- a/src/Caching/Test/BasicTests.cs +++ b/src/Caching/Test/BasicTests.cs @@ -63,7 +63,7 @@ public async Task Builtins() { var analysis = await GetAnalysisAsync(string.Empty); var model = ModuleModel.FromAnalysis(analysis.Document.Interpreter.ModuleResolution.BuiltinsModule.Analysis); var json = ToJson(model); - //Baseline.CompareToFile(BaselineFileName, json); + Baseline.CompareToFile(BaselineFileName, json); var module = new PythonDbModule(model, Services); } diff --git a/src/Caching/Test/Files/Builtins.json b/src/Caching/Test/Files/Builtins.json index 236c577fe..a140b48c2 100644 --- a/src/Caching/Test/Files/Builtins.json +++ b/src/Caching/Test/Files/Builtins.json @@ -1,6 +1,8 @@ { + "Documentation": "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.", "Functions": [ { + "Documentation": "", "Overloads": [ { "Parameters": [], @@ -10,10 +12,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "type", - "Documentation": "" + "Name": "type" }, { + "Documentation": "__build_class__(func, name, *bases, metaclass=None, **kwds) -> class\n\nInternal helper function used by the class statement.", "Overloads": [ { "Parameters": [ @@ -54,10 +56,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "__build_class__", - "Documentation": "__build_class__(func, name, *bases, metaclass=None, **kwds) -> class\n\nInternal helper function used by the class statement." + "Name": "__build_class__" }, { + "Documentation": "__import__(name, globals=None, locals=None, fromlist=(), level=0) -> module\n\nImport a module. Because this function is meant for use by the Python\ninterpreter and not for general use, it is better to use\nimportlib.import_module() to programmatically import a module.\n\nThe globals argument is only used to determine the context;\nthey are not modified. The locals argument is unused. The fromlist\nshould be a list of names to emulate ``from name import ...'', or an\nempty list to emulate ``import name''.\nWhen importing a module from a package, note that __import__('A.B', ...)\nreturns package A when fromlist is empty, but its submodule B when\nfromlist is not empty. The level argument is used to determine whether to\nperform absolute or relative imports: 0 is absolute, while a positive number\nis the number of parent directories to search relative to the current module.", "Overloads": [ { "Parameters": [ @@ -98,10 +100,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "__import__", - "Documentation": "__import__(name, globals=None, locals=None, fromlist=(), level=0) -> module\n\nImport a module. Because this function is meant for use by the Python\ninterpreter and not for general use, it is better to use\nimportlib.import_module() to programmatically import a module.\n\nThe globals argument is only used to determine the context;\nthey are not modified. The locals argument is unused. The fromlist\nshould be a list of names to emulate ``from name import ...'', or an\nempty list to emulate ``import name''.\nWhen importing a module from a package, note that __import__('A.B', ...)\nreturns package A when fromlist is empty, but its submodule B when\nfromlist is not empty. The level argument is used to determine whether to\nperform absolute or relative imports: 0 is absolute, while a positive number\nis the number of parent directories to search relative to the current module." + "Name": "__import__" }, { + "Documentation": "Return the absolute value of the argument.", "Overloads": [ { "Parameters": [ @@ -118,10 +120,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "abs", - "Documentation": "Return the absolute value of the argument." + "Name": "abs" }, { + "Documentation": "Return True if bool(x) is True for all values x in the iterable.\n\nIf the iterable is empty, return True.", "Overloads": [ { "Parameters": [ @@ -138,10 +140,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "all", - "Documentation": "Return True if bool(x) is True for all values x in the iterable.\n\nIf the iterable is empty, return True." + "Name": "all" }, { + "Documentation": "Return True if bool(x) is True for any x in the iterable.\n\nIf the iterable is empty, return False.", "Overloads": [ { "Parameters": [ @@ -158,10 +160,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "any", - "Documentation": "Return True if bool(x) is True for any x in the iterable.\n\nIf the iterable is empty, return False." + "Name": "any" }, { + "Documentation": "Return an ASCII-only representation of an object.\n\nAs repr(), return a string containing a printable representation of an\nobject, but escape the non-ASCII characters in the string returned by\nrepr() using \\\\x, \\\\u or \\\\U escapes. This generates a string similar\nto that returned by repr() in Python 2.", "Overloads": [ { "Parameters": [ @@ -178,10 +180,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "ascii", - "Documentation": "Return an ASCII-only representation of an object.\n\nAs repr(), return a string containing a printable representation of an\nobject, but escape the non-ASCII characters in the string returned by\nrepr() using \\\\x, \\\\u or \\\\U escapes. This generates a string similar\nto that returned by repr() in Python 2." + "Name": "ascii" }, { + "Documentation": "Return the binary representation of an integer.\n\n >>> bin(2796202)\n '0b1010101010101010101010'", "Overloads": [ { "Parameters": [ @@ -198,10 +200,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "bin", - "Documentation": "Return the binary representation of an integer.\n\n >>> bin(2796202)\n '0b1010101010101010101010'" + "Name": "bin" }, { + "Documentation": "breakpoint(*args, **kws)\n\nCall sys.breakpointhook(*args, **kws). sys.breakpointhook() must accept\nwhatever arguments are passed.\n\nBy default, this drops you into the pdb debugger.", "Overloads": [ { "Parameters": [ @@ -224,10 +226,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "breakpoint", - "Documentation": "breakpoint(*args, **kws)\n\nCall sys.breakpointhook(*args, **kws). sys.breakpointhook() must accept\nwhatever arguments are passed.\n\nBy default, this drops you into the pdb debugger." + "Name": "breakpoint" }, { + "Documentation": "Return whether the object is callable (i.e., some kind of function).\n\nNote that classes are callable, as are instances of classes with a\n__call__() method.", "Overloads": [ { "Parameters": [ @@ -244,10 +246,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "callable", - "Documentation": "Return whether the object is callable (i.e., some kind of function).\n\nNote that classes are callable, as are instances of classes with a\n__call__() method." + "Name": "callable" }, { + "Documentation": "Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.", "Overloads": [ { "Parameters": [ @@ -264,10 +266,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "chr", - "Documentation": "Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff." + "Name": "chr" }, { + "Documentation": "Compile source into a code object that can be executed by exec() or eval().\n\nThe source code may represent a Python module, statement or expression.\nThe filename will be used for run-time error messages.\nThe mode must be 'exec' to compile a module, 'single' to compile a\nsingle (interactive) statement, or 'eval' to compile an expression.\nThe flags argument, if present, controls which future statements influence\nthe compilation of the code.\nThe dont_inherit argument, if true, stops the compilation inheriting\nthe effects of any future statements in effect in the code calling\ncompile; if absent or false these statements do influence the compilation,\nin addition to any features explicitly specified.", "Overloads": [ { "Parameters": [ @@ -314,10 +316,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "compile", - "Documentation": "Compile source into a code object that can be executed by exec() or eval().\n\nThe source code may represent a Python module, statement or expression.\nThe filename will be used for run-time error messages.\nThe mode must be 'exec' to compile a module, 'single' to compile a\nsingle (interactive) statement, or 'eval' to compile an expression.\nThe flags argument, if present, controls which future statements influence\nthe compilation of the code.\nThe dont_inherit argument, if true, stops the compilation inheriting\nthe effects of any future statements in effect in the code calling\ncompile; if absent or false these statements do influence the compilation,\nin addition to any features explicitly specified." + "Name": "compile" }, { + "Documentation": "interactive prompt objects for printing the license text, a list of\n contributors and the copyright notice.", "Overloads": [ { "Parameters": [ @@ -334,10 +336,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "copyright", - "Documentation": "interactive prompt objects for printing the license text, a list of\n contributors and the copyright notice." + "Name": "copyright" }, { + "Documentation": "interactive prompt objects for printing the license text, a list of\n contributors and the copyright notice.", "Overloads": [ { "Parameters": [ @@ -354,10 +356,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "credits", - "Documentation": "interactive prompt objects for printing the license text, a list of\n contributors and the copyright notice." + "Name": "credits" }, { + "Documentation": "Deletes the named attribute from the given object.\n\ndelattr(x, 'y') is equivalent to ``del x.y''", "Overloads": [ { "Parameters": [ @@ -380,10 +382,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "delattr", - "Documentation": "Deletes the named attribute from the given object.\n\ndelattr(x, 'y') is equivalent to ``del x.y''" + "Name": "delattr" }, { + "Documentation": "dir([object]) -> list of strings\n\nIf called without an argument, return the names in the current scope.\nElse, return an alphabetized list of names comprising (some of) the attributes\nof the given object, and of attributes reachable from it.\nIf the object supplies a method named __dir__, it will be used; otherwise\nthe default dir() logic is used and returns:\n for a module object: the module's attributes.\n for a class object: its attributes, and recursively the attributes\n of its bases.\n for any other object: its attributes, its class's attributes, and\n recursively the attributes of its class's base classes.", "Overloads": [ { "Parameters": [ @@ -400,10 +402,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "dir", - "Documentation": "dir([object]) -> list of strings\n\nIf called without an argument, return the names in the current scope.\nElse, return an alphabetized list of names comprising (some of) the attributes\nof the given object, and of attributes reachable from it.\nIf the object supplies a method named __dir__, it will be used; otherwise\nthe default dir() logic is used and returns:\n for a module object: the module's attributes.\n for a class object: its attributes, and recursively the attributes\n of its bases.\n for any other object: its attributes, its class's attributes, and\n recursively the attributes of its class's base classes." + "Name": "dir" }, { + "Documentation": "Return the tuple (x//y, x%y). Invariant: div*y + mod == x.", "Overloads": [ { "Parameters": [ @@ -426,10 +428,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "divmod", - "Documentation": "Return the tuple (x//y, x%y). Invariant: div*y + mod == x." + "Name": "divmod" }, { + "Documentation": "Evaluate the given source in the context of globals and locals.\n\nThe source may be a string representing a Python expression\nor a code object as returned by compile().\nThe globals must be a dictionary and locals can be any mapping,\ndefaulting to the current globals and locals.\nIf only globals is given, locals defaults to it.", "Overloads": [ { "Parameters": [ @@ -458,10 +460,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "eval", - "Documentation": "Evaluate the given source in the context of globals and locals.\n\nThe source may be a string representing a Python expression\nor a code object as returned by compile().\nThe globals must be a dictionary and locals can be any mapping,\ndefaulting to the current globals and locals.\nIf only globals is given, locals defaults to it." + "Name": "eval" }, { + "Documentation": "Execute the given source in the context of globals and locals.\n\nThe source may be a string representing one or more Python statements\nor a code object as returned by compile().\nThe globals must be a dictionary and locals can be any mapping,\ndefaulting to the current globals and locals.\nIf only globals is given, locals defaults to it.", "Overloads": [ { "Parameters": [ @@ -490,10 +492,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "exec", - "Documentation": "Execute the given source in the context of globals and locals.\n\nThe source may be a string representing one or more Python statements\nor a code object as returned by compile().\nThe globals must be a dictionary and locals can be any mapping,\ndefaulting to the current globals and locals.\nIf only globals is given, locals defaults to it." + "Name": "exec" }, { + "Documentation": null, "Overloads": [ { "Parameters": [ @@ -516,10 +518,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "exit", - "Documentation": null + "Name": "exit" }, { + "Documentation": "Return value.__format__(format_spec)\n\nformat_spec defaults to the empty string.\nSee the Format Specification Mini-Language section of help('FORMATTING') for\ndetails.", "Overloads": [ { "Parameters": [ @@ -542,10 +544,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "format", - "Documentation": "Return value.__format__(format_spec)\n\nformat_spec defaults to the empty string.\nSee the Format Specification Mini-Language section of help('FORMATTING') for\ndetails." + "Name": "format" }, { + "Documentation": "getattr(object, name[, default]) -> value\n\nGet a named attribute from an object; getattr(x, 'y') is equivalent to x.y.\nWhen a default argument is given, it is returned when the attribute doesn't\nexist; without it, an exception is raised in that case.", "Overloads": [ { "Parameters": [ @@ -574,10 +576,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "getattr", - "Documentation": "getattr(object, name[, default]) -> value\n\nGet a named attribute from an object; getattr(x, 'y') is equivalent to x.y.\nWhen a default argument is given, it is returned when the attribute doesn't\nexist; without it, an exception is raised in that case." + "Name": "getattr" }, { + "Documentation": "Return the dictionary containing the current scope's global variables.\n\nNOTE: Updates to this dictionary *will* affect name lookups in the current\nglobal scope and vice-versa.", "Overloads": [ { "Parameters": [], @@ -587,10 +589,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "globals", - "Documentation": "Return the dictionary containing the current scope's global variables.\n\nNOTE: Updates to this dictionary *will* affect name lookups in the current\nglobal scope and vice-versa." + "Name": "globals" }, { + "Documentation": "Return whether the object has an attribute with the given name.\n\nThis is done by calling getattr(obj, name) and catching AttributeError.", "Overloads": [ { "Parameters": [ @@ -613,10 +615,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "hasattr", - "Documentation": "Return whether the object has an attribute with the given name.\n\nThis is done by calling getattr(obj, name) and catching AttributeError." + "Name": "hasattr" }, { + "Documentation": "Return the hash value for the given object.\n\nTwo objects that compare equal must also have the same hash value, but the\nreverse is not necessarily true.", "Overloads": [ { "Parameters": [ @@ -633,10 +635,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "hash", - "Documentation": "Return the hash value for the given object.\n\nTwo objects that compare equal must also have the same hash value, but the\nreverse is not necessarily true." + "Name": "hash" }, { + "Documentation": "Define the builtin 'help'.\n\n This is a wrapper around pydoc.help that provides a helpful message\n when 'help' is typed at the Python interactive prompt.\n\n Calling help() at the Python prompt starts an interactive help session.\n Calling help(thing) prints help for the python object 'thing'.\n ", "Overloads": [ { "Parameters": [ @@ -665,10 +667,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "help", - "Documentation": "Define the builtin 'help'.\n\n This is a wrapper around pydoc.help that provides a helpful message\n when 'help' is typed at the Python interactive prompt.\n\n Calling help() at the Python prompt starts an interactive help session.\n Calling help(thing) prints help for the python object 'thing'.\n " + "Name": "help" }, { + "Documentation": "Return the hexadecimal representation of an integer.\n\n >>> hex(12648430)\n '0xc0ffee'", "Overloads": [ { "Parameters": [ @@ -685,10 +687,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "hex", - "Documentation": "Return the hexadecimal representation of an integer.\n\n >>> hex(12648430)\n '0xc0ffee'" + "Name": "hex" }, { + "Documentation": "Return the identity of an object.\n\nThis is guaranteed to be unique among simultaneously existing objects.\n(CPython uses the object's memory address.)", "Overloads": [ { "Parameters": [ @@ -705,10 +707,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "id", - "Documentation": "Return the identity of an object.\n\nThis is guaranteed to be unique among simultaneously existing objects.\n(CPython uses the object's memory address.)" + "Name": "id" }, { + "Documentation": "Read a string from standard input. The trailing newline is stripped.\n\nThe prompt string, if given, is printed to standard output without a\ntrailing newline before reading input.\n\nIf the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.\nOn *nix systems, readline is used if available.", "Overloads": [ { "Parameters": [ @@ -725,10 +727,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "input", - "Documentation": "Read a string from standard input. The trailing newline is stripped.\n\nThe prompt string, if given, is printed to standard output without a\ntrailing newline before reading input.\n\nIf the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.\nOn *nix systems, readline is used if available." + "Name": "input" }, { + "Documentation": "Return whether an object is an instance of a class or of a subclass thereof.\n\nA tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the target to\ncheck against. This is equivalent to ``isinstance(x, A) or isinstance(x, B)\nor ...`` etc.", "Overloads": [ { "Parameters": [ @@ -751,10 +753,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "isinstance", - "Documentation": "Return whether an object is an instance of a class or of a subclass thereof.\n\nA tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the target to\ncheck against. This is equivalent to ``isinstance(x, A) or isinstance(x, B)\nor ...`` etc." + "Name": "isinstance" }, { + "Documentation": "Return whether 'cls' is a derived from another class or is the same class.\n\nA tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the target to\ncheck against. This is equivalent to ``issubclass(x, A) or issubclass(x, B)\nor ...`` etc.", "Overloads": [ { "Parameters": [ @@ -777,10 +779,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "issubclass", - "Documentation": "Return whether 'cls' is a derived from another class or is the same class.\n\nA tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the target to\ncheck against. This is equivalent to ``issubclass(x, A) or issubclass(x, B)\nor ...`` etc." + "Name": "issubclass" }, { + "Documentation": "iter(iterable) -> iterator\niter(callable, sentinel) -> iterator\n\nGet an iterator from an object. In the first form, the argument must\nsupply its own iterator, or be a sequence.\nIn the second form, the callable is called until it returns the sentinel.", "Overloads": [ { "Parameters": [ @@ -803,10 +805,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "iter", - "Documentation": "iter(iterable) -> iterator\niter(callable, sentinel) -> iterator\n\nGet an iterator from an object. In the first form, the argument must\nsupply its own iterator, or be a sequence.\nIn the second form, the callable is called until it returns the sentinel." + "Name": "iter" }, { + "Documentation": "Return the number of items in a container.", "Overloads": [ { "Parameters": [ @@ -823,10 +825,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "len", - "Documentation": "Return the number of items in a container." + "Name": "len" }, { + "Documentation": "interactive prompt objects for printing the license text, a list of\n contributors and the copyright notice.", "Overloads": [ { "Parameters": [ @@ -843,10 +845,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "license", - "Documentation": "interactive prompt objects for printing the license text, a list of\n contributors and the copyright notice." + "Name": "license" }, { + "Documentation": "Return a dictionary containing the current scope's local variables.\n\nNOTE: Whether or not updates to this dictionary will affect name lookups in\nthe local scope and vice-versa is *implementation dependent* and not\ncovered by any backwards compatibility guarantees.", "Overloads": [ { "Parameters": [], @@ -856,10 +858,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "locals", - "Documentation": "Return a dictionary containing the current scope's local variables.\n\nNOTE: Whether or not updates to this dictionary will affect name lookups in\nthe local scope and vice-versa is *implementation dependent* and not\ncovered by any backwards compatibility guarantees." + "Name": "locals" }, { + "Documentation": "max(iterable, *[, default=obj, key=func]) -> value\nmax(arg1, arg2, *args, *[, key=func]) -> value\n\nWith a single iterable argument, return its biggest item. The\ndefault keyword-only argument specifies an object to return if\nthe provided iterable is empty.\nWith two or more arguments, return the largest argument.", "Overloads": [ { "Parameters": [ @@ -894,10 +896,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "max", - "Documentation": "max(iterable, *[, default=obj, key=func]) -> value\nmax(arg1, arg2, *args, *[, key=func]) -> value\n\nWith a single iterable argument, return its biggest item. The\ndefault keyword-only argument specifies an object to return if\nthe provided iterable is empty.\nWith two or more arguments, return the largest argument." + "Name": "max" }, { + "Documentation": "min(iterable, *[, default=obj, key=func]) -> value\nmin(arg1, arg2, *args, *[, key=func]) -> value\n\nWith a single iterable argument, return its smallest item. The\ndefault keyword-only argument specifies an object to return if\nthe provided iterable is empty.\nWith two or more arguments, return the smallest argument.", "Overloads": [ { "Parameters": [ @@ -932,10 +934,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "min", - "Documentation": "min(iterable, *[, default=obj, key=func]) -> value\nmin(arg1, arg2, *args, *[, key=func]) -> value\n\nWith a single iterable argument, return its smallest item. The\ndefault keyword-only argument specifies an object to return if\nthe provided iterable is empty.\nWith two or more arguments, return the smallest argument." + "Name": "min" }, { + "Documentation": "next(iterator[, default])\n\nReturn the next item from the iterator. If default is given and the iterator\nis exhausted, it is returned instead of raising StopIteration.", "Overloads": [ { "Parameters": [ @@ -958,10 +960,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "next", - "Documentation": "next(iterator[, default])\n\nReturn the next item from the iterator. If default is given and the iterator\nis exhausted, it is returned instead of raising StopIteration." + "Name": "next" }, { + "Documentation": "Return the octal representation of an integer.\n\n >>> oct(342391)\n '0o1234567'", "Overloads": [ { "Parameters": [ @@ -978,10 +980,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "oct", - "Documentation": "Return the octal representation of an integer.\n\n >>> oct(342391)\n '0o1234567'" + "Name": "oct" }, { + "Documentation": "Open file and return a stream. Raise OSError upon failure.\n\nfile is either a text or byte string giving the name (and the path\nif the file isn't in the current working directory) of the file to\nbe opened or an integer file descriptor of the file to be\nwrapped. (If a file descriptor is given, it is closed when the\nreturned I/O object is closed, unless closefd is set to False.)\n\nmode is an optional string that specifies the mode in which the file\nis opened. It defaults to 'r' which means open for reading in text\nmode. Other common values are 'w' for writing (truncating the file if\nit already exists), 'x' for creating and writing to a new file, and\n'a' for appending (which on some Unix systems, means that all writes\nappend to the end of the file regardless of the current seek position).\nIn text mode, if encoding is not specified the encoding used is platform\ndependent: locale.getpreferredencoding(False) is called to get the\ncurrent locale encoding. (For reading and writing raw bytes use binary\nmode and leave encoding unspecified.) The available modes are:\n\n========= ===============================================================\nCharacter Meaning\n--------- ---------------------------------------------------------------\n'r' open for reading (default)\n'w' open for writing, truncating the file first\n'x' create a new file and open it for writing\n'a' open for writing, appending to the end of the file if it exists\n'b' binary mode\n't' text mode (default)\n'+' open a disk file for updating (reading and writing)\n'U' universal newline mode (deprecated)\n========= ===============================================================\n\nThe default mode is 'rt' (open for reading text). For binary random\naccess, the mode 'w+b' opens and truncates the file to 0 bytes, while\n'r+b' opens the file without truncation. The 'x' mode implies 'w' and\nraises an `FileExistsError` if the file already exists.\n\nPython distinguishes between files opened in binary and text modes,\neven when the underlying operating system doesn't. Files opened in\nbinary mode (appending 'b' to the mode argument) return contents as\nbytes objects without any decoding. In text mode (the default, or when\n't' is appended to the mode argument), the contents of the file are\nreturned as strings, the bytes having been first decoded using a\nplatform-dependent encoding or using the specified encoding if given.\n\n'U' mode is deprecated and will raise an exception in future versions\nof Python. It has no effect in Python 3. Use newline to control\nuniversal newlines mode.\n\nbuffering is an optional integer used to set the buffering policy.\nPass 0 to switch buffering off (only allowed in binary mode), 1 to select\nline buffering (only usable in text mode), and an integer > 1 to indicate\nthe size of a fixed-size chunk buffer. When no buffering argument is\ngiven, the default buffering policy works as follows:\n\n* Binary files are buffered in fixed-size chunks; the size of the buffer\n is chosen using a heuristic trying to determine the underlying device's\n \"block size\" and falling back on `io.DEFAULT_BUFFER_SIZE`.\n On many systems, the buffer will typically be 4096 or 8192 bytes long.\n\n* \"Interactive\" text files (files for which isatty() returns True)\n use line buffering. Other text files use the policy described above\n for binary files.\n\nencoding is the name of the encoding used to decode or encode the\nfile. This should only be used in text mode. The default encoding is\nplatform dependent, but any encoding supported by Python can be\npassed. See the codecs module for the list of supported encodings.\n\nerrors is an optional string that specifies how encoding errors are to\nbe handled---this argument should not be used in binary mode. Pass\n'strict' to raise a ValueError exception if there is an encoding error\n(the default of None has the same effect), or pass 'ignore' to ignore\nerrors. (Note that ignoring encoding errors can lead to data loss.)\nSee the documentation for codecs.register or run 'help(codecs.Codec)'\nfor a list of the permitted encoding error strings.\n\nnewline controls how universal newlines works (it only applies to text\nmode). It can be None, '', '\\n', '\\r', and '\\r\\n'. It works as\nfollows:\n\n* On input, if newline is None, universal newlines mode is\n enabled. Lines in the input can end in '\\n', '\\r', or '\\r\\n', and\n these are translated into '\\n' before being returned to the\n caller. If it is '', universal newline mode is enabled, but line\n endings are returned to the caller untranslated. If it has any of\n the other legal values, input lines are only terminated by the given\n string, and the line ending is returned to the caller untranslated.\n\n* On output, if newline is None, any '\\n' characters written are\n translated to the system default line separator, os.linesep. If\n newline is '' or '\\n', no translation takes place. If newline is any\n of the other legal values, any '\\n' characters written are translated\n to the given string.\n\nIf closefd is False, the underlying file descriptor will be kept open\nwhen the file is closed. This does not work when a file name is given\nand must be True in that case.\n\nA custom opener can be used by passing a callable as *opener*. The\nunderlying file descriptor for the file object is then obtained by\ncalling *opener* with (*file*, *flags*). *opener* must return an open\nfile descriptor (passing os.open as *opener* results in functionality\nsimilar to passing None).\n\nopen() returns a file object whose type depends on the mode, and\nthrough which the standard file operations such as reading and writing\nare performed. When open() is used to open a file in a text mode ('w',\n'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open\na file in a binary mode, the returned class varies: in read binary\nmode, it returns a BufferedReader; in write binary and append binary\nmodes, it returns a BufferedWriter, and in read/write mode, it returns\na BufferedRandom.\n\nIt is also possible to use a string or bytearray as a file for both\nreading and writing. For strings StringIO can be used like a file\nopened in a text mode, and for bytes a BytesIO can be used like a file\nopened in a binary mode.", "Overloads": [ { "Parameters": [ @@ -1040,10 +1042,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "open", - "Documentation": "Open file and return a stream. Raise OSError upon failure.\n\nfile is either a text or byte string giving the name (and the path\nif the file isn't in the current working directory) of the file to\nbe opened or an integer file descriptor of the file to be\nwrapped. (If a file descriptor is given, it is closed when the\nreturned I/O object is closed, unless closefd is set to False.)\n\nmode is an optional string that specifies the mode in which the file\nis opened. It defaults to 'r' which means open for reading in text\nmode. Other common values are 'w' for writing (truncating the file if\nit already exists), 'x' for creating and writing to a new file, and\n'a' for appending (which on some Unix systems, means that all writes\nappend to the end of the file regardless of the current seek position).\nIn text mode, if encoding is not specified the encoding used is platform\ndependent: locale.getpreferredencoding(False) is called to get the\ncurrent locale encoding. (For reading and writing raw bytes use binary\nmode and leave encoding unspecified.) The available modes are:\n\n========= ===============================================================\nCharacter Meaning\n--------- ---------------------------------------------------------------\n'r' open for reading (default)\n'w' open for writing, truncating the file first\n'x' create a new file and open it for writing\n'a' open for writing, appending to the end of the file if it exists\n'b' binary mode\n't' text mode (default)\n'+' open a disk file for updating (reading and writing)\n'U' universal newline mode (deprecated)\n========= ===============================================================\n\nThe default mode is 'rt' (open for reading text). For binary random\naccess, the mode 'w+b' opens and truncates the file to 0 bytes, while\n'r+b' opens the file without truncation. The 'x' mode implies 'w' and\nraises an `FileExistsError` if the file already exists.\n\nPython distinguishes between files opened in binary and text modes,\neven when the underlying operating system doesn't. Files opened in\nbinary mode (appending 'b' to the mode argument) return contents as\nbytes objects without any decoding. In text mode (the default, or when\n't' is appended to the mode argument), the contents of the file are\nreturned as strings, the bytes having been first decoded using a\nplatform-dependent encoding or using the specified encoding if given.\n\n'U' mode is deprecated and will raise an exception in future versions\nof Python. It has no effect in Python 3. Use newline to control\nuniversal newlines mode.\n\nbuffering is an optional integer used to set the buffering policy.\nPass 0 to switch buffering off (only allowed in binary mode), 1 to select\nline buffering (only usable in text mode), and an integer > 1 to indicate\nthe size of a fixed-size chunk buffer. When no buffering argument is\ngiven, the default buffering policy works as follows:\n\n* Binary files are buffered in fixed-size chunks; the size of the buffer\n is chosen using a heuristic trying to determine the underlying device's\n \"block size\" and falling back on `io.DEFAULT_BUFFER_SIZE`.\n On many systems, the buffer will typically be 4096 or 8192 bytes long.\n\n* \"Interactive\" text files (files for which isatty() returns True)\n use line buffering. Other text files use the policy described above\n for binary files.\n\nencoding is the name of the encoding used to decode or encode the\nfile. This should only be used in text mode. The default encoding is\nplatform dependent, but any encoding supported by Python can be\npassed. See the codecs module for the list of supported encodings.\n\nerrors is an optional string that specifies how encoding errors are to\nbe handled---this argument should not be used in binary mode. Pass\n'strict' to raise a ValueError exception if there is an encoding error\n(the default of None has the same effect), or pass 'ignore' to ignore\nerrors. (Note that ignoring encoding errors can lead to data loss.)\nSee the documentation for codecs.register or run 'help(codecs.Codec)'\nfor a list of the permitted encoding error strings.\n\nnewline controls how universal newlines works (it only applies to text\nmode). It can be None, '', '\\n', '\\r', and '\\r\\n'. It works as\nfollows:\n\n* On input, if newline is None, universal newlines mode is\n enabled. Lines in the input can end in '\\n', '\\r', or '\\r\\n', and\n these are translated into '\\n' before being returned to the\n caller. If it is '', universal newline mode is enabled, but line\n endings are returned to the caller untranslated. If it has any of\n the other legal values, input lines are only terminated by the given\n string, and the line ending is returned to the caller untranslated.\n\n* On output, if newline is None, any '\\n' characters written are\n translated to the system default line separator, os.linesep. If\n newline is '' or '\\n', no translation takes place. If newline is any\n of the other legal values, any '\\n' characters written are translated\n to the given string.\n\nIf closefd is False, the underlying file descriptor will be kept open\nwhen the file is closed. This does not work when a file name is given\nand must be True in that case.\n\nA custom opener can be used by passing a callable as *opener*. The\nunderlying file descriptor for the file object is then obtained by\ncalling *opener* with (*file*, *flags*). *opener* must return an open\nfile descriptor (passing os.open as *opener* results in functionality\nsimilar to passing None).\n\nopen() returns a file object whose type depends on the mode, and\nthrough which the standard file operations such as reading and writing\nare performed. When open() is used to open a file in a text mode ('w',\n'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open\na file in a binary mode, the returned class varies: in read binary\nmode, it returns a BufferedReader; in write binary and append binary\nmodes, it returns a BufferedWriter, and in read/write mode, it returns\na BufferedRandom.\n\nIt is also possible to use a string or bytearray as a file for both\nreading and writing. For strings StringIO can be used like a file\nopened in a text mode, and for bytes a BytesIO can be used like a file\nopened in a binary mode." + "Name": "open" }, { + "Documentation": "Return the Unicode code point for a one-character string.", "Overloads": [ { "Parameters": [ @@ -1060,10 +1062,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "ord", - "Documentation": "Return the Unicode code point for a one-character string." + "Name": "ord" }, { + "Documentation": "Equivalent to x**y (with two arguments) or x**y % z (with three arguments)\n\nSome types, such as ints, are able to use a more efficient algorithm when\ninvoked using the three argument form.", "Overloads": [ { "Parameters": [ @@ -1092,10 +1094,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "pow", - "Documentation": "Equivalent to x**y (with two arguments) or x**y % z (with three arguments)\n\nSome types, such as ints, are able to use a more efficient algorithm when\ninvoked using the three argument form." + "Name": "pow" }, { + "Documentation": "print(value, ..., sep=' ', end='\\n', file=sys.stdout, flush=False)\n\nPrints the values to a stream, or to sys.stdout by default.\nOptional keyword arguments:\nfile: a file-like object (stream); defaults to the current sys.stdout.\nsep: string inserted between values, default a space.\nend: string appended after the last value, default a newline.\nflush: whether to forcibly flush the stream.", "Overloads": [ { "Parameters": [], @@ -1105,10 +1107,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "print", - "Documentation": "print(value, ..., sep=' ', end='\\n', file=sys.stdout, flush=False)\n\nPrints the values to a stream, or to sys.stdout by default.\nOptional keyword arguments:\nfile: a file-like object (stream); defaults to the current sys.stdout.\nsep: string inserted between values, default a space.\nend: string appended after the last value, default a newline.\nflush: whether to forcibly flush the stream." + "Name": "print" }, { + "Documentation": null, "Overloads": [ { "Parameters": [ @@ -1131,10 +1133,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "quit", - "Documentation": null + "Name": "quit" }, { + "Documentation": "", "Overloads": [ { "Parameters": [], @@ -1144,10 +1146,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "range", - "Documentation": "" + "Name": "range" }, { + "Documentation": "Return the canonical string representation of the object.\n\nFor many object types, including most builtins, eval(repr(obj)) == obj.", "Overloads": [ { "Parameters": [ @@ -1164,10 +1166,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "repr", - "Documentation": "Return the canonical string representation of the object.\n\nFor many object types, including most builtins, eval(repr(obj)) == obj." + "Name": "repr" }, { + "Documentation": "Round a number to a given precision in decimal digits.\n\nThe return value is an integer if ndigits is omitted or None. Otherwise\nthe return value has the same type as the number. ndigits may be negative.", "Overloads": [ { "Parameters": [ @@ -1190,10 +1192,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "round", - "Documentation": "Round a number to a given precision in decimal digits.\n\nThe return value is an integer if ndigits is omitted or None. Otherwise\nthe return value has the same type as the number. ndigits may be negative." + "Name": "round" }, { + "Documentation": "Sets the named attribute on the given object to the specified value.\n\nsetattr(x, 'y', v) is equivalent to ``x.y = v''", "Overloads": [ { "Parameters": [ @@ -1222,10 +1224,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "setattr", - "Documentation": "Sets the named attribute on the given object to the specified value.\n\nsetattr(x, 'y', v) is equivalent to ``x.y = v''" + "Name": "setattr" }, { + "Documentation": "Return a new list containing all items from the iterable in ascending order.\n\nA custom key function can be supplied to customize the sort order, and the\nreverse flag can be set to request the result in descending order.", "Overloads": [ { "Parameters": [ @@ -1242,10 +1244,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "sorted", - "Documentation": "Return a new list containing all items from the iterable in ascending order.\n\nA custom key function can be supplied to customize the sort order, and the\nreverse flag can be set to request the result in descending order." + "Name": "sorted" }, { + "Documentation": "Return the sum of a 'start' value (default: 0) plus an iterable of numbers\n\nWhen the iterable is empty, return the start value.\nThis function is intended specifically for use with numeric values and may\nreject non-numeric types.", "Overloads": [ { "Parameters": [ @@ -1268,10 +1270,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "sum", - "Documentation": "Return the sum of a 'start' value (default: 0) plus an iterable of numbers\n\nWhen the iterable is empty, return the start value.\nThis function is intended specifically for use with numeric values and may\nreject non-numeric types." + "Name": "sum" }, { + "Documentation": "vars([object]) -> dictionary\n\nWithout arguments, equivalent to locals().\nWith an argument, equivalent to object.__dict__.", "Overloads": [ { "Parameters": [ @@ -1288,10 +1290,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "vars", - "Documentation": "vars([object]) -> dictionary\n\nWithout arguments, equivalent to locals().\nWith an argument, equivalent to object.__dict__." + "Name": "vars" }, { + "Documentation": "", "Overloads": [ { "Parameters": [], @@ -1301,1722 +1303,28960 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "cmp", - "Documentation": "" + "Name": "cmp" } ], "Variables": [ { - "Name": "__builtin_module_names__", - "Value": null + "Value": "object", + "Name": "__Object__" }, { - "Name": "Ellipsis", - "Value": "i:..." + "Value": "int", + "Name": "__Int__" }, { - "Name": "EnvironmentError", - "Value": "i:OSError" + "Value": "bool", + "Name": "__Bool__" }, { - "Name": "IOError", - "Value": "i:OSError" + "Value": "int", + "Name": "__Long__" }, { - "Name": "NotImplemented", - "Value": "i:NotImplementedType" + "Value": "float", + "Name": "__Float__" }, { - "Name": "WindowsError", - "Value": "i:OSError" + "Value": "complex", + "Name": "__Complex__" }, { - "Name": "__doc__", - "Value": null + "Value": "tuple", + "Name": "__Tuple__" }, { - "Name": "__name__", - "Value": null + "Value": "list", + "Name": "__List__" }, { - "Name": "__package__", - "Value": null - } - ], - "Classes": [ + "Value": "dict", + "Name": "__Dict__" + }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "NotImplementedType", - "Documentation": null + "Value": "set", + "Name": "__Set__" }, { - "Bases": [], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "__Unknown__", - "Documentation": "" + "Value": "frozenset", + "Name": "__FrozenSet__" }, { - "Bases": [], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "__NoneType__", - "Documentation": "the type of the None object" + "Value": "bytes", + "Name": "__Bytes__" }, { - "Bases": [], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "object", - "Documentation": "The most base type" + "Value": "bytes_iterator", + "Name": "__BytesIterator__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "int", - "Documentation": "int([x]) -> integer\nint(x, base=10) -> integer\n\nConvert a number or string to an integer, or return 0 if no arguments\nare given. If x is a number, return x.__int__(). For floating point\nnumbers, this truncates towards zero.\n\nIf x is not a number or if base is given, then x must be a string,\nbytes, or bytearray instance representing an integer literal in the\ngiven base. The literal can be preceded by '+' or '-' and be surrounded\nby whitespace. The base defaults to 10. Valid bases are 0 and 2-36.\nBase 0 means to interpret the base from the string as an integer literal.\n>>> int('0b100', base=0)\n4" + "Value": "str", + "Name": "__Unicode__" }, { - "Bases": [ - "int" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "bool", - "Documentation": "bool(x) -> bool\n\nReturns True when the argument x is true, False otherwise.\nThe builtins True and False are the only two instances of the class bool.\nThe class bool is a subclass of the class int, and cannot be subclassed." + "Value": "str_iterator", + "Name": "__UnicodeIterator__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "float", - "Documentation": "Convert a string or number to a floating point number, if possible." + "Value": "str", + "Name": "__Str__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "complex", - "Documentation": "Create a complex number from a real part and an optional imaginary part.\n\nThis is equivalent to (real + imag*1j) where imag defaults to 0." + "Value": "str_iterator", + "Name": "__StrIterator__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "tuple", - "Documentation": "Built-in immutable sequence.\n\nIf no argument is given, the constructor returns an empty tuple.\nIf iterable is specified the tuple is initialized from iterable's items.\n\nIf the argument is a tuple, the return value is the same object." + "Value": "module", + "Name": "__Module__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "list", - "Documentation": "Built-in mutable sequence.\n\nIf no argument is given, the constructor creates a new empty list.\nThe argument must be an iterable if specified." + "Value": "function", + "Name": "__Function__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "dict", - "Documentation": "dict() -> new empty dictionary\ndict(mapping) -> new dictionary initialized from a mapping object's\n (key, value) pairs\ndict(iterable) -> new dictionary initialized as if via:\n d = {}\n for k, v in iterable:\n d[k] = v\ndict(**kwargs) -> new dictionary initialized with the name=value pairs\n in the keyword argument list. For example: dict(one=1, two=2)" + "Value": "wrapper_descriptor", + "Name": "__BuiltinMethodDescriptor__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "set", - "Documentation": "set() -> new empty set object\nset(iterable) -> new set object\n\nBuild an unordered collection of unique elements." + "Value": "builtin_function_or_method", + "Name": "__BuiltinFunction__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "frozenset", - "Documentation": "frozenset() -> empty frozenset object\nfrozenset(iterable) -> frozenset object\n\nBuild an immutable unordered collection of unique elements." + "Value": "generator", + "Name": "__Generator__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "bytes", - "Documentation": "bytes(iterable_of_ints) -> bytes\nbytes(string, encoding[, errors]) -> bytes\nbytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer\nbytes(int) -> bytes object of size given by the parameter initialized with null bytes\nbytes() -> empty bytes object\n\nConstruct an immutable array of bytes from:\n - an iterable yielding integers in range(256)\n - a text string encoded using the specified encoding\n - any object implementing the buffer API.\n - an integer" + "Value": "property", + "Name": "__Property__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "bytes_iterator", - "Documentation": null + "Value": "classmethod", + "Name": "__ClassMethod__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "str", - "Documentation": "str(object='') -> str\nstr(bytes_or_buffer[, encoding[, errors]]) -> str\n\nCreate a new string object from the given object. If encoding or\nerrors is specified, then the object must expose a data buffer\nthat will be decoded using the given encoding and error handler.\nOtherwise, returns the result of object.__str__() (if defined)\nor repr(object).\nencoding defaults to sys.getdefaultencoding().\nerrors defaults to 'strict'." + "Value": "staticmethod", + "Name": "__StaticMethod__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "str_iterator", - "Documentation": null + "Value": "ellipsis", + "Name": "__Ellipsis__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "module", - "Documentation": "Create a module object.\n\nThe name must be a string; the optional doc argument can have any type." + "Value": "tuple_iterator", + "Name": "__TupleIterator__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "function", - "Documentation": "Create a function object.\n\n code\n a code object\n globals\n the globals dictionary\n name\n a string that overrides the name from the code object\n argdefs\n a tuple that specifies the default argument values\n closure\n a tuple that supplies the bindings for free variables" + "Value": "list_iterator", + "Name": "__ListIterator__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "wrapper_descriptor", - "Documentation": null + "Value": "dict_keys", + "Name": "__DictKeys__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "builtin_function_or_method", - "Documentation": null + "Value": "dict_values", + "Name": "__DictValues__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "generator", - "Documentation": null + "Value": "dict_items", + "Name": "__DictItems__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "property", - "Documentation": "Property attribute.\n\n fget\n function to be used for getting an attribute value\n fset\n function to be used for setting an attribute value\n fdel\n function to be used for del'ing an attribute\n doc\n docstring\n\nTypical use is to define a managed attribute x:\n\nclass C(object):\n def getx(self): return self._x\n def setx(self, value): self._x = value\n def delx(self): del self._x\n x = property(getx, setx, delx, \"I'm the 'x' property.\")\n\nDecorators make defining new properties or modifying existing ones easy:\n\nclass C(object):\n @property\n def x(self):\n \"I am the 'x' property.\"\n return self._x\n @x.setter\n def x(self, value):\n self._x = value\n @x.deleter\n def x(self):\n del self._x" + "Value": "set_iterator", + "Name": "__SetIterator__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "classmethod", - "Documentation": "classmethod(function) -> method\n\nConvert a function to be a class method.\n\nA class method receives the class as implicit first argument,\njust like an instance method receives the instance.\nTo declare a class method, use this idiom:\n\n class C:\n @classmethod\n def f(cls, arg1, arg2, ...):\n ...\n\nIt can be called either on the class (e.g. C.f()) or on an instance\n(e.g. C().f()). The instance is ignored except for its class.\nIf a class method is called for a derived class, the derived class\nobject is passed as the implied first argument.\n\nClass methods are different than C++ or Java static methods.\nIf you want those, see the staticmethod builtin." + "Value": "callable_iterator", + "Name": "__CallableIterator__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "staticmethod", - "Documentation": "staticmethod(function) -> method\n\nConvert a function to be a static method.\n\nA static method does not receive an implicit first argument.\nTo declare a static method, use this idiom:\n\n class C:\n @staticmethod\n def f(arg1, arg2, ...):\n ...\n\nIt can be called either on the class (e.g. C.f()) or on an instance\n(e.g. C().f()). The instance is ignored except for its class.\n\nStatic methods in Python are similar to those found in Java or C++.\nFor a more advanced concept, see the classmethod builtin." + "Value": null, + "Name": "__builtin_module_names__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "...", - "Documentation": null + "Value": "i:ellipsis", + "Name": "Ellipsis" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "tuple_iterator", - "Documentation": null + "Value": "i:OSError", + "Name": "EnvironmentError" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "list_iterator", - "Documentation": null + "Value": "i:OSError", + "Name": "IOError" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "dict_keys", - "Documentation": null + "Value": "i:NotImplementedType", + "Name": "NotImplemented" + }, + { + "Value": "i:OSError", + "Name": "WindowsError" + }, + { + "Value": null, + "Name": "__doc__" + }, + { + "Value": null, + "Name": "__name__" }, { + "Value": null, + "Name": "__package__" + } + ], + "Classes": [ + { + "Documentation": null, "Bases": [ "object" ], - "Methods": [], + "Methods": [ + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "NotImplementedType", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "NotImplementedType", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "NotImplementedType", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__reduce__" + }, + { + "Documentation": "Return repr(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "NotImplementedType", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__repr__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "NotImplementedType", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + } + ], "Properties": [], - "Fields": [], + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], "GenericParameters": null, "InnerClasses": [], - "Name": "dict_values", - "Documentation": null + "Name": "NotImplementedType" }, { - "Bases": [ - "object" - ], + "Documentation": "", + "Bases": [], "Methods": [], "Properties": [], - "Fields": [], + "Fields": [ + { + "Value": null, + "Name": "__name__" + }, + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], "GenericParameters": null, "InnerClasses": [], - "Name": "dict_items", - "Documentation": null + "Name": "__Unknown__" }, { - "Bases": [ - "object" - ], + "Documentation": "the type of the None object", + "Bases": [], "Methods": [], "Properties": [], - "Fields": [], + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], "GenericParameters": null, "InnerClasses": [], - "Name": "set_iterator", - "Documentation": null + "Name": "__NoneType__" }, { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "callable_iterator", - "Documentation": null - }, - { - "Bases": [ - "Exception" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "ArithmeticError", - "Documentation": "Base class for arithmetic errors." - }, - { - "Bases": [ - "Exception" + "Documentation": "The most base type", + "Bases": [], + "Methods": [ + { + "Documentation": "Implement delattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "object", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__delattr__" + }, + { + "Documentation": "Default dir() implementation.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "object", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:list" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__dir__" + }, + { + "Documentation": "Return self==value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "object", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__eq__" + }, + { + "Documentation": "Default object formatter.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "object", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "format_spec", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__format__" + }, + { + "Documentation": "Return self>=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "object", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "object", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "object", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Return hash(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "object", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__hash__" + }, + { + "Documentation": "The most base type", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "object", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "object", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "object", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return self integer\nint(x, base=10) -> integer\n\nConvert a number or string to an integer, or return 0 if no arguments\nare given. If x is a number, return x.__int__(). For floating point\nnumbers, this truncates towards zero.\n\nIf x is not a number or if base is given, then x must be a string,\nbytes, or bytearray instance representing an integer literal in the\ngiven base. The literal can be preceded by '+' or '-' and be surrounded\nby whitespace. The base defaults to 10. Valid bases are 0 and 2-36.\nBase 0 means to interpret the base from the string as an integer literal.\n>>> int('0b100', base=0)\n4", "Bases": [ "object" ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "BaseException", - "Documentation": "Common base class for all exceptions" - }, - { - "Bases": [ - "OSError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "BlockingIOError", - "Documentation": "I/O operation would block." - }, - { - "Bases": [ - "ConnectionError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "BrokenPipeError", - "Documentation": "Broken pipe." - }, - { - "Bases": [ - "Exception" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "BufferError", - "Documentation": "Buffer error." - }, - { - "Bases": [ - "Warning" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "BytesWarning", - "Documentation": "Base class for warnings about bytes and buffer related problems, mostly\nrelated to conversion from str or comparing to str." - }, - { - "Bases": [ - "OSError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "ChildProcessError", - "Documentation": "Child process error." - }, - { - "Bases": [ - "ConnectionError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "ConnectionAbortedError", - "Documentation": "Connection aborted." - }, - { - "Bases": [ - "OSError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "ConnectionError", - "Documentation": "Connection error." - }, - { - "Bases": [ - "ConnectionError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "ConnectionRefusedError", - "Documentation": "Connection refused." - }, - { - "Bases": [ - "ConnectionError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "ConnectionResetError", - "Documentation": "Connection reset." - }, - { - "Bases": [ - "Warning" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "DeprecationWarning", - "Documentation": "Base class for warnings about deprecated features." - }, - { - "Bases": [ - "Exception" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "EOFError", - "Documentation": "Read beyond end of file." - }, - { - "Bases": [ - "BaseException" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "Exception", - "Documentation": "Common base class for all non-exit exceptions." - }, - { - "Bases": [ - "OSError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "FileExistsError", - "Documentation": "File already exists." - }, - { - "Bases": [ - "OSError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "FileNotFoundError", - "Documentation": "File not found." - }, - { - "Bases": [ - "ArithmeticError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "FloatingPointError", - "Documentation": "Floating point operation failed." - }, - { - "Bases": [ - "Warning" + "Methods": [ + { + "Documentation": "abs(self)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__abs__" + }, + { + "Documentation": "Return self+value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__add__" + }, + { + "Documentation": "Return self&value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__and__" + }, + { + "Documentation": "self != 0", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__bool__" + }, + { + "Documentation": "Ceiling of an Integral returns itself.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ceil__" + }, + { + "Documentation": "Return divmod(self, value).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__divmod__" + }, + { + "Documentation": "Return self==value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__eq__" + }, + { + "Documentation": "float(self)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__float__" + }, + { + "Documentation": "Flooring an Integral returns itself.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__floor__" + }, + { + "Documentation": "Return self//value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__floordiv__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "format_spec", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__format__" + }, + { + "Documentation": "Return self>=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getnewargs__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Return hash(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__hash__" + }, + { + "Documentation": "Return self converted to an integer, if self is suitable for use as an index into a list.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__index__" + }, + { + "Documentation": "int([x]) -> integer\nint(x, base=10) -> integer\n\nConvert a number or string to an integer, or return 0 if no arguments\nare given. If x is a number, return x.__int__(). For floating point\nnumbers, this truncates towards zero.\n\nIf x is not a number or if base is given, then x must be a string,\nbytes, or bytearray instance representing an integer literal in the\ngiven base. The literal can be preceded by '+' or '-' and be surrounded\nby whitespace. The base defaults to 10. Valid bases are 0 and 2-36.\nBase 0 means to interpret the base from the string as an integer literal.\n>>> int('0b100', base=0)\n4", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "x", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "base", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "int(self)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__int__" + }, + { + "Documentation": "~self", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__invert__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return self<>self.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__rrshift__" + }, + { + "Documentation": "Return self>>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__rshift__" + }, + { + "Documentation": "Return value-self.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__rsub__" + }, + { + "Documentation": "Return value/self.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__rtruediv__" + }, + { + "Documentation": "Return value^self.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__rxor__" + }, + { + "Documentation": "Returns size in memory, in bytes.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__sizeof__" + }, + { + "Documentation": "Return str(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__str__" + }, + { + "Documentation": "Return self-value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__sub__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + }, + { + "Documentation": "Return self/value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:float" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__truediv__" + }, + { + "Documentation": "Truncating an Integral returns itself.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__trunc__" + }, + { + "Documentation": "Return self^value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__xor__" + }, + { + "Documentation": "Number of bits necessary to represent self in binary.\n\n>>> bin(37)\n'0b100101'\n>>> (37).bit_length()\n6", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "bit_length" + }, + { + "Documentation": "Returns self, the complex conjugate of any int.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:complex" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "conjugate" + }, + { + "Documentation": "Return the integer represented by the given array of bytes.\n\n bytes\n Holds the array of bytes to convert. The argument must either\n support the buffer protocol or be an iterable object producing bytes.\n Bytes and bytearray are examples of built-in objects that support the\n buffer protocol.\n byteorder\n The byte order used to represent the integer. If byteorder is 'big',\n the most significant byte is at the beginning of the byte array. If\n byteorder is 'little', the most significant byte is at the end of the\n byte array. To request the native byte order of the host system, use\n `sys.byteorder' as the byte order value.\n signed\n Indicates whether two's complement is used to represent the integer.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "type", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "bytes", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "byteorder", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "from_bytes" + }, + { + "Documentation": "Return an array of bytes representing an integer.\n\n length\n Length of bytes object to use. An OverflowError is raised if the\n integer is not representable with the given number of bytes.\n byteorder\n The byte order used to represent the integer. If byteorder is 'big',\n the most significant byte is at the beginning of the byte array. If\n byteorder is 'little', the most significant byte is at the end of the\n byte array. To request the native byte order of the host system, use\n `sys.byteorder' as the byte order value.\n signed\n Determines whether two's complement is used to represent the integer.\n If signed is False and a negative integer is given, an OverflowError\n is raised.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "length", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "byteorder", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "to_bytes" + } ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "FutureWarning", - "Documentation": "Base class for warnings about constructs that will change semantically\nin the future." - }, - { - "Bases": [ - "BaseException" + "Properties": [ + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "denominator" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "imag" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "numerator" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "real" + } + ], + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } ], - "Methods": [], - "Properties": [], - "Fields": [], "GenericParameters": null, "InnerClasses": [], - "Name": "GeneratorExit", - "Documentation": "Request that a generator exit." + "Name": "int" }, { + "Documentation": "bool(x) -> bool\n\nReturns True when the argument x is true, False otherwise.\nThe builtins True and False are the only two instances of the class bool.\nThe class bool is a subclass of the class int, and cannot be subclassed.", "Bases": [ - "Exception" + "int" + ], + "Methods": [ + { + "Documentation": "Return self&value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bool", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__and__" + }, + { + "Documentation": "bool(x) -> bool\n\nReturns True when the argument x is true, False otherwise.\nThe builtins True and False are the only two instances of the class bool.\nThe class bool is a subclass of the class int, and cannot be subclassed.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bool", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "x", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "bool", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Return self|value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bool", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__or__" + }, + { + "Documentation": "Return value&self.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bool", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__rand__" + }, + { + "Documentation": "Return repr(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bool", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__repr__" + }, + { + "Documentation": "Return value|self.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bool", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ror__" + }, + { + "Documentation": "Return value^self.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bool", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__rxor__" + }, + { + "Documentation": "Return str(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bool", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__str__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "bool", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + }, + { + "Documentation": "Return self^value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bool", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__xor__" + }, + { + "Documentation": "Return the integer represented by the given array of bytes.\n\n bytes\n Holds the array of bytes to convert. The argument must either\n support the buffer protocol or be an iterable object producing bytes.\n Bytes and bytearray are examples of built-in objects that support the\n buffer protocol.\n byteorder\n The byte order used to represent the integer. If byteorder is 'big',\n the most significant byte is at the beginning of the byte array. If\n byteorder is 'little', the most significant byte is at the end of the\n byte array. To request the native byte order of the host system, use\n `sys.byteorder' as the byte order value.\n signed\n Indicates whether two's complement is used to represent the integer.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "bool", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "type", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "bytes", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "byteorder", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "from_bytes" + } + ], + "Properties": [], + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } ], - "Methods": [], - "Properties": [], - "Fields": [], "GenericParameters": null, "InnerClasses": [], - "Name": "ImportError", - "Documentation": "Import can't find module, or can't find name in module." + "Name": "bool" }, { + "Documentation": "Convert a string or number to a floating point number, if possible.", "Bases": [ - "Warning" + "object" + ], + "Methods": [ + { + "Documentation": "abs(self)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:float" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__abs__" + }, + { + "Documentation": "Return self+value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:float" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__add__" + }, + { + "Documentation": "self != 0", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__bool__" + }, + { + "Documentation": "Return divmod(self, value).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__divmod__" + }, + { + "Documentation": "Return self==value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__eq__" + }, + { + "Documentation": "float(self)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__float__" + }, + { + "Documentation": "Return self//value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__floordiv__" + }, + { + "Documentation": "Formats the float according to format_spec.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "format_spec", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__format__" + }, + { + "Documentation": "Return self>=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "You probably don't want to use this function.\n\n typestr\n Must be 'double' or 'float'.\n\nIt exists mainly to be used in Python's test suite.\n\nThis function returns whichever of 'unknown', 'IEEE, big-endian' or 'IEEE,\nlittle-endian' best describes the format of floating point numbers used by the\nC type named by typestr.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "type", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "typestr", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getformat__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getnewargs__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Return hash(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__hash__" + }, + { + "Documentation": "Convert a string or number to a floating point number, if possible.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "int(self)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__int__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return self>> (10.0).as_integer_ratio()\n(10, 1)\n>>> (0.0).as_integer_ratio()\n(0, 1)\n>>> (-.25).as_integer_ratio()\n(-1, 4)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "as_integer_ratio" + }, + { + "Documentation": "Return self, the complex conjugate of any float.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:complex" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "conjugate" + }, + { + "Documentation": "Create a floating-point number from a hexadecimal string.\n\n>>> float.fromhex('0x1.ffffp10')\n2047.984375\n>>> float.fromhex('-0x1p-1074')\n-5e-324", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "type", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "string", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "fromhex" + }, + { + "Documentation": "Return a hexadecimal representation of a floating-point number.\n\n>>> (-0.1).hex()\n'-0x1.999999999999ap-4'\n>>> 3.14159.hex()\n'0x1.921f9f01b866ep+1'", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "hex" + }, + { + "Documentation": "Return True if the float is an integer.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "float", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "is_integer" + } + ], + "Properties": [ + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "imag" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "real" + } + ], + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } ], - "Methods": [], - "Properties": [], - "Fields": [], "GenericParameters": null, "InnerClasses": [], - "Name": "ImportWarning", - "Documentation": "Base class for warnings about probable mistakes in module imports" + "Name": "float" }, { + "Documentation": "Create a complex number from a real part and an optional imaginary part.\n\nThis is equivalent to (real + imag*1j) where imag defaults to 0.", "Bases": [ - "SyntaxError" + "object" ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "IndentationError", - "Documentation": "Improper indentation." - }, - { - "Bases": [ - "LookupError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "IndexError", - "Documentation": "Sequence index out of range." - }, - { - "Bases": [ - "OSError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "InterruptedError", - "Documentation": "Interrupted by signal." - }, - { - "Bases": [ - "OSError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "IsADirectoryError", - "Documentation": "Operation doesn't work on directories." - }, - { - "Bases": [ - "LookupError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "KeyError", - "Documentation": "Mapping key not found." - }, - { - "Bases": [ - "BaseException" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "KeyboardInterrupt", - "Documentation": "Program interrupted by user." - }, - { - "Bases": [ - "Exception" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "LookupError", - "Documentation": "Base class for lookup errors." - }, - { - "Bases": [ - "Exception" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "MemoryError", - "Documentation": "Out of memory." - }, - { - "Bases": [ - "ImportError" + "Methods": [ + { + "Documentation": "abs(self)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "complex", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:complex" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__abs__" + }, + { + "Documentation": "Return self+value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "complex", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:complex" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__add__" + }, + { + "Documentation": "self != 0", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "complex", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__bool__" + }, + { + "Documentation": "Return divmod(self, value).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "complex", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__divmod__" + }, + { + "Documentation": "Return self==value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "complex", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__eq__" + }, + { + "Documentation": "float(self)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "complex", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__float__" + }, + { + "Documentation": "Return self//value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "complex", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__floordiv__" + }, + { + "Documentation": "complex.__format__() -> str\n\nConvert to a string according to format_spec.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "complex", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "format_spec", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__format__" + }, + { + "Documentation": "Return self>=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "complex", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "complex", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "complex", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getnewargs__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "complex", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Return hash(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "complex", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__hash__" + }, + { + "Documentation": "Create a complex number from a real part and an optional imaginary part.\n\nThis is equivalent to (real + imag*1j) where imag defaults to 0.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "complex", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "complex", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "int(self)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "complex", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__int__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "complex", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return self complex\n\nReturn the complex conjugate of its argument. (3-4j).conjugate() == 3+4j.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "complex", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:complex" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "conjugate" + } ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "ModuleNotFoundError", - "Documentation": "Module not found." - }, - { - "Bases": [ - "Exception" + "Properties": [ + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "imag" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "real" + } ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "NameError", - "Documentation": "Name not found globally." - }, - { - "Bases": [ - "OSError" + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } ], - "Methods": [], - "Properties": [], - "Fields": [], "GenericParameters": null, "InnerClasses": [], - "Name": "NotADirectoryError", - "Documentation": "Operation only works on directories." + "Name": "complex" }, { + "Documentation": "Built-in immutable sequence.\n\nIf no argument is given, the constructor returns an empty tuple.\nIf iterable is specified the tuple is initialized from iterable's items.\n\nIf the argument is a tuple, the return value is the same object.", "Bases": [ - "RuntimeError" + "object" ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "NotImplementedError", - "Documentation": "Method or function hasn't been implemented yet." - }, - { - "Bases": [ - "Exception" + "Methods": [ + { + "Documentation": "Return self+value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__add__" + }, + { + "Documentation": "Return key in self.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__contains__" + }, + { + "Documentation": "Return self==value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__eq__" + }, + { + "Documentation": "Return self>=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return self[key].", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getitem__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getnewargs__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Return hash(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__hash__" + }, + { + "Documentation": "Built-in immutable sequence.\n\nIf no argument is given, the constructor returns an empty tuple.\nIf iterable is specified the tuple is initialized from iterable's items.\n\nIf the argument is a tuple, the return value is the same object.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "tuple", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple_iterator" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return len(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__len__" + }, + { + "Documentation": "Return self=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "list", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "list", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "x.__getitem__(y) <==> x[y]", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "list", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "index", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getitem__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "list", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Implement self+=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "list", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iadd__" + }, + { + "Documentation": "Implement self*=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "list", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__imul__" + }, + { + "Documentation": "Built-in mutable sequence.\n\nIf no argument is given, the constructor creates a new empty list.\nThe argument must be an iterable if specified.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "list", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "list", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "list", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:list_iterator" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "list", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return len(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "list", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__len__" + }, + { + "Documentation": "Return self new empty dictionary\ndict(mapping) -> new dictionary initialized from a mapping object's\n (key, value) pairs\ndict(iterable) -> new dictionary initialized as if via:\n d = {}\n for k, v in iterable:\n d[k] = v\ndict(**kwargs) -> new dictionary initialized with the name=value pairs\n in the keyword argument list. For example: dict(one=1, two=2)", "Bases": [ - "OSError" + "object" ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "PermissionError", - "Documentation": "Not enough permissions." - }, - { - "Bases": [ - "OSError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "ProcessLookupError", - "Documentation": "Process not found." - }, - { - "Bases": [ - "RuntimeError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "RecursionError", - "Documentation": "Recursion limit exceeded." - }, - { - "Bases": [ - "Exception" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "ReferenceError", - "Documentation": "Weak ref proxy used after referent went away." - }, - { - "Bases": [ - "Warning" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "ResourceWarning", - "Documentation": "Base class for warnings about resource usage." - }, - { - "Bases": [ - "Exception" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "RuntimeError", - "Documentation": "Unspecified run-time error." - }, - { - "Bases": [ - "Warning" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "RuntimeWarning", - "Documentation": "Base class for warnings about dubious runtime behavior." - }, - { - "Bases": [ - "Exception" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "StopAsyncIteration", - "Documentation": "Signal the end from iterator.__anext__()." - }, - { - "Bases": [ - "Exception" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "StopIteration", - "Documentation": "Signal the end from iterator.__next__()." - }, - { - "Bases": [ - "Exception" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "SyntaxError", - "Documentation": "Invalid syntax." - }, - { - "Bases": [ - "Warning" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "SyntaxWarning", - "Documentation": "Base class for warnings about dubious syntax." - }, - { - "Bases": [ - "Exception" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "SystemError", - "Documentation": "Internal error in the Python interpreter.\n\nPlease report this to the Python maintainer, along with the traceback,\nthe Python version, and the hardware/OS platform and version." - }, - { - "Bases": [ - "BaseException" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "SystemExit", - "Documentation": "Request to exit from the interpreter." - }, - { - "Bases": [ - "IndentationError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "TabError", - "Documentation": "Improper mixture of spaces and tabs." - }, - { - "Bases": [ - "OSError" + "Methods": [ + { + "Documentation": "True if the dictionary has the specified key, else False.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__contains__" + }, + { + "Documentation": "Delete self[key].", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__delitem__" + }, + { + "Documentation": "Return self==value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__eq__" + }, + { + "Documentation": "Return self>=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "x.__getitem__(y) <==> x[y]", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getitem__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "dict() -> new empty dictionary\ndict(mapping) -> new dictionary initialized from a mapping object's\n (key, value) pairs\ndict(iterable) -> new dictionary initialized as if via:\n d = {}\n for k, v in iterable:\n d[k] = v\ndict(**kwargs) -> new dictionary initialized with the name=value pairs\n in the keyword argument list. For example: dict(one=1, two=2)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "iterable", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:dict_keys" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return len(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__len__" + }, + { + "Documentation": "Return self size of D in memory, in bytes", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__sizeof__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + }, + { + "Documentation": "D.clear() -> None. Remove all items from D.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "clear" + }, + { + "Documentation": "D.copy() -> a shallow copy of D", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:dict" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "copy" + }, + { + "Documentation": "Create a new dictionary with keys from iterable and values set to value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "type", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "iterable", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:dict" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "fromkeys" + }, + { + "Documentation": "Return the value for key if key is in the dictionary, else default.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "default", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:dict" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "get" + }, + { + "Documentation": "D.items() -> a set-like object providing a view on D's items", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:dict_items" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "items" + }, + { + "Documentation": "D.keys() -> a set-like object providing a view on D's keys", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:dict_keys" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "keys" + }, + { + "Documentation": "D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\nIf key is not found, d is returned if given, otherwise KeyError is raised", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "k", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "d", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:dict_keys" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "pop" + }, + { + "Documentation": "D.popitem() -> (k, v), remove and return some (key, value) pair as a\n2-tuple; but raise KeyError if D is empty.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "k", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "d", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:dict_items" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "popitem" + }, + { + "Documentation": "Insert key with a value of default if key is not in the dictionary.\n\nReturn the value for key if key is in the dictionary, else default.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "default", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:dict" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "setdefault" + }, + { + "Documentation": "D.update([E, ]**F) -> None. Update D from dict/iterable E and F.\nIf E is present and has a .keys() method, then does: for k in E: D[k] = E[k]\nIf E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v\nIn either case, this is followed by: for k in F: D[k] = F[k]", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "d", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "update" + }, + { + "Documentation": "D.values() -> an object providing a view on D's values", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:dict_values" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "values" + } ], - "Methods": [], "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "TimeoutError", - "Documentation": "Timeout expired." - }, - { - "Bases": [ - "Exception" + "Fields": [ + { + "Value": null, + "Name": "__hash__" + }, + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } ], - "Methods": [], - "Properties": [], - "Fields": [], "GenericParameters": null, "InnerClasses": [], - "Name": "TypeError", - "Documentation": "Inappropriate argument type." + "Name": "dict" }, { + "Documentation": "set() -> new empty set object\nset(iterable) -> new set object\n\nBuild an unordered collection of unique elements.", "Bases": [ - "NameError" + "object" ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "UnboundLocalError", - "Documentation": "Local name referenced but not bound to a value." - }, - { - "Bases": [ - "UnicodeError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "UnicodeDecodeError", - "Documentation": "Unicode decoding error." - }, - { - "Bases": [ - "UnicodeError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "UnicodeEncodeError", - "Documentation": "Unicode encoding error." - }, - { - "Bases": [ - "ValueError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "UnicodeError", - "Documentation": "Unicode related error." - }, - { - "Bases": [ - "UnicodeError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "UnicodeTranslateError", - "Documentation": "Unicode translation error." - }, - { - "Bases": [ - "Warning" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "UnicodeWarning", - "Documentation": "Base class for warnings about Unicode related problems, mostly\nrelated to conversion problems." - }, - { - "Bases": [ - "Warning" + "Methods": [ + { + "Documentation": "Return self&value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:set" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__and__" + }, + { + "Documentation": "x.__contains__(y) <==> y in x.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__contains__" + }, + { + "Documentation": "Return self==value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__eq__" + }, + { + "Documentation": "Return self>=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Return self&=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iand__" + }, + { + "Documentation": "set() -> new empty set object\nset(iterable) -> new set object\n\nBuild an unordered collection of unique elements.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "iterable", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Return self|=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ior__" + }, + { + "Documentation": "Return self-=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__isub__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:set_iterator" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Return self^=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ixor__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return len(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__len__" + }, + { + "Documentation": "Return self size of S in memory, in bytes", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__sizeof__" + }, + { + "Documentation": "Return self-value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:set" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__sub__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + }, + { + "Documentation": "Return self^value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:set" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__xor__" + }, + { + "Documentation": "Add an element to a set.\n\nThis has no effect if the element is already present.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "add" + }, + { + "Documentation": "Remove all elements from this set.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "clear" + }, + { + "Documentation": "Return a shallow copy of a set.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:set" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "copy" + }, + { + "Documentation": "Return the difference of two or more sets as a new set.\n\n(i.e. all elements that are in this set but not the others.)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "other", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:set" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "difference" + }, + { + "Documentation": "Remove all elements of another set from this set.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "others", + "Type": null, + "DefaultValue": null, + "Kind": 1 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "difference_update" + }, + { + "Documentation": "Remove an element from a set if it is a member.\n\nIf the element is not a member, do nothing.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "elem", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "discard" + }, + { + "Documentation": "Return the intersection of two sets as a new set.\n\n(i.e. all elements that are in both sets.)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "other", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:set" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "intersection" + }, + { + "Documentation": "Update a set with the intersection of itself and another.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "others", + "Type": null, + "DefaultValue": null, + "Kind": 1 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "intersection_update" + }, + { + "Documentation": "Return True if two sets have a null intersection.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "other", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isdisjoint" + }, + { + "Documentation": "Report whether another set contains this set.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "other", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "issubset" + }, + { + "Documentation": "Report whether this set contains another set.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "other", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "issuperset" + }, + { + "Documentation": "Remove and return an arbitrary set element.\nRaises KeyError if the set is empty.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "pop" + }, + { + "Documentation": "Remove an element from a set; it must be a member.\n\nIf the element is not a member, raise a KeyError.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "elem", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "remove" + }, + { + "Documentation": "Return the symmetric difference of two sets as a new set.\n\n(i.e. all elements that are in exactly one of the sets.)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "other", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:set" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "symmetric_difference" + }, + { + "Documentation": "Update a set with the symmetric difference of itself and another.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "others", + "Type": null, + "DefaultValue": null, + "Kind": 1 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "symmetric_difference_update" + }, + { + "Documentation": "Return the union of sets as a new set.\n\n(i.e. all elements that are in either set.)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "others", + "Type": null, + "DefaultValue": null, + "Kind": 1 + } + ], + "ReturnType": "i:set" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "union" + }, + { + "Documentation": "Update a set with the union of itself and others.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "set", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "others", + "Type": null, + "DefaultValue": null, + "Kind": 1 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "update" + } ], - "Methods": [], "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "UserWarning", - "Documentation": "Base class for warnings generated by user code." - }, - { - "Bases": [ - "Exception" + "Fields": [ + { + "Value": null, + "Name": "__hash__" + }, + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } ], - "Methods": [], - "Properties": [], - "Fields": [], "GenericParameters": null, "InnerClasses": [], - "Name": "ValueError", - "Documentation": "Inappropriate argument value (of correct type)." + "Name": "set" }, { + "Documentation": "frozenset() -> empty frozenset object\nfrozenset(iterable) -> frozenset object\n\nBuild an immutable unordered collection of unique elements.", "Bases": [ - "Exception" + "object" ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "Warning", - "Documentation": "Base class for warning categories." - }, - { - "Bases": [ - "ArithmeticError" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "ZeroDivisionError", - "Documentation": "Second argument to a division or modulo operation was zero." - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "bytearray", - "Documentation": "bytearray(iterable_of_ints) -> bytearray\nbytearray(string, encoding[, errors]) -> bytearray\nbytearray(bytes_or_buffer) -> mutable copy of bytes_or_buffer\nbytearray(int) -> bytes array of size given by the parameter initialized with null bytes\nbytearray() -> empty bytes array\n\nConstruct a mutable bytearray object from:\n - an iterable yielding integers in range(256)\n - a text string encoded using the specified encoding\n - a bytes or a buffer object\n - any object implementing the buffer API.\n - an integer" - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "enumerate", - "Documentation": "Return an enumerate object.\n\n iterable\n an object supporting iteration\n\nThe enumerate object yields pairs containing a count (from start, which\ndefaults to zero) and a value yielded by the iterable argument.\n\nenumerate is useful for obtaining an indexed list:\n (0, seq[0]), (1, seq[1]), (2, seq[2]), ..." - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "filter", - "Documentation": "filter(function or None, iterable) --> filter object\n\nReturn an iterator yielding those items of iterable for which function(item)\nis true. If function is None, return the items that are true." - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "map", - "Documentation": "map(func, *iterables) --> map object\n\nMake an iterator that computes the function using arguments from\neach of the iterables. Stops when the shortest iterable is exhausted." - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "memoryview", - "Documentation": "Create a new memoryview object which references the given object." - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "reversed", - "Documentation": "Return a reverse iterator over the values of the given sequence." - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "slice", - "Documentation": "slice(stop)\nslice(start, stop[, step])\n\nCreate a slice object. This is used for extended slicing (e.g. a[0:10:2])." - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "super", - "Documentation": "super() -> same as super(__class__, )\nsuper(type) -> unbound super object\nsuper(type, obj) -> bound super object; requires isinstance(obj, type)\nsuper(type, type2) -> bound super object; requires issubclass(type2, type)\nTypical use to call a cooperative superclass method:\nclass C(B):\n def meth(self, arg):\n super().meth(arg)\nThis works for class methods too:\nclass C(B):\n @classmethod\n def cmeth(cls, arg):\n super().cmeth(arg)\n" - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "zip", - "Documentation": "zip(iter1 [,iter2 [...]]) --> zip object\n\nReturn a zip object whose .__next__() method returns a tuple where\nthe i-th element comes from the i-th iterable argument. The .__next__()\nmethod continues until the shortest iterable in the argument sequence\nis exhausted and then it raises StopIteration." - }, - { - "Bases": [], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "object", - "Documentation": "The most base type" - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "type", - "Documentation": "type(object_or_name, bases, dict)\ntype(object) -> the object's type\ntype(name, bases, dict) -> a new type" - }, - { - "Bases": [ - "object" + "Methods": [ + { + "Documentation": "Return self&value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:frozenset" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__and__" + }, + { + "Documentation": "x.__contains__(y) <==> y in x.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__contains__" + }, + { + "Documentation": "Return self==value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__eq__" + }, + { + "Documentation": "Return self>=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Return hash(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__hash__" + }, + { + "Documentation": "frozenset() -> empty frozenset object\nfrozenset(iterable) -> frozenset object\n\nBuild an immutable unordered collection of unique elements.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "iterable", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:set_iterator" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return len(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__len__" + }, + { + "Documentation": "Return self size of S in memory, in bytes", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__sizeof__" + }, + { + "Documentation": "Return self-value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:frozenset" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__sub__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + }, + { + "Documentation": "Return self^value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:frozenset" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__xor__" + }, + { + "Documentation": "Return a shallow copy of a set.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:frozenset" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "copy" + }, + { + "Documentation": "Return the difference of two or more sets as a new set.\n\n(i.e. all elements that are in this set but not the others.)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "other", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:frozenset" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "difference" + }, + { + "Documentation": "Return the intersection of two sets as a new set.\n\n(i.e. all elements that are in both sets.)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "other", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:frozenset" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "intersection" + }, + { + "Documentation": "Return True if two sets have a null intersection.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "other", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isdisjoint" + }, + { + "Documentation": "Report whether another set contains this set.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "other", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "issubset" + }, + { + "Documentation": "Report whether this set contains another set.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "other", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "issuperset" + }, + { + "Documentation": "Return the symmetric difference of two sets as a new set.\n\n(i.e. all elements that are in exactly one of the sets.)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "other", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:frozenset" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "symmetric_difference" + }, + { + "Documentation": "Return the union of sets as a new set.\n\n(i.e. all elements that are in either set.)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "frozenset", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "others", + "Type": null, + "DefaultValue": null, + "Kind": 1 + } + ], + "ReturnType": "i:frozenset" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "union" + } ], - "Methods": [], "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "int", - "Documentation": "int([x]) -> integer\nint(x, base=10) -> integer\n\nConvert a number or string to an integer, or return 0 if no arguments\nare given. If x is a number, return x.__int__(). For floating point\nnumbers, this truncates towards zero.\n\nIf x is not a number or if base is given, then x must be a string,\nbytes, or bytearray instance representing an integer literal in the\ngiven base. The literal can be preceded by '+' or '-' and be surrounded\nby whitespace. The base defaults to 10. Valid bases are 0 and 2-36.\nBase 0 means to interpret the base from the string as an integer literal.\n>>> int('0b100', base=0)\n4" - }, - { - "Bases": [ - "int" + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } ], - "Methods": [], - "Properties": [], - "Fields": [], "GenericParameters": null, "InnerClasses": [], - "Name": "bool", - "Documentation": "bool(x) -> bool\n\nReturns True when the argument x is true, False otherwise.\nThe builtins True and False are the only two instances of the class bool.\nThe class bool is a subclass of the class int, and cannot be subclassed." + "Name": "frozenset" }, { + "Documentation": "bytes(iterable_of_ints) -> bytes\nbytes(string, encoding[, errors]) -> bytes\nbytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer\nbytes(int) -> bytes object of size given by the parameter initialized with null bytes\nbytes() -> empty bytes object\n\nConstruct an immutable array of bytes from:\n - an iterable yielding integers in range(256)\n - a text string encoded using the specified encoding\n - any object implementing the buffer API.\n - an integer", "Bases": [ "object" ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "int", - "Documentation": "int([x]) -> integer\nint(x, base=10) -> integer\n\nConvert a number or string to an integer, or return 0 if no arguments\nare given. If x is a number, return x.__int__(). For floating point\nnumbers, this truncates towards zero.\n\nIf x is not a number or if base is given, then x must be a string,\nbytes, or bytearray instance representing an integer literal in the\ngiven base. The literal can be preceded by '+' or '-' and be surrounded\nby whitespace. The base defaults to 10. Valid bases are 0 and 2-36.\nBase 0 means to interpret the base from the string as an integer literal.\n>>> int('0b100', base=0)\n4" - }, - { - "Bases": [ - "object" + "Methods": [ + { + "Documentation": "Return self+value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytes" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__add__" + }, + { + "Documentation": "Return key in self.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__contains__" + }, + { + "Documentation": "Return self==value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__eq__" + }, + { + "Documentation": "Return self>=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return self[key].", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytes" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getitem__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getnewargs__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Return hash(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__hash__" + }, + { + "Documentation": "bytes(iterable_of_ints) -> bytes\nbytes(string, encoding[, errors]) -> bytes\nbytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer\nbytes(int) -> bytes object of size given by the parameter initialized with null bytes\nbytes() -> empty bytes object\n\nConstruct an immutable array of bytes from:\n - an iterable yielding integers in range(256)\n - a text string encoded using the specified encoding\n - any object implementing the buffer API.\n - an integer", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "string", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "encoding", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "errors", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return len(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__len__" + }, + { + "Documentation": "Return self copy of B\n\nReturn a copy of B with only its first character capitalized (ASCII)\nand the rest lower-cased.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytes" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "capitalize" + }, + { + "Documentation": "B.center(width[, fillchar]) -> copy of B\n\nReturn B centered in a string of length width. Padding is\ndone using the specified fill character (default is a space).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "width", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "fillbyte", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytes" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "center" + }, + { + "Documentation": "B.count(sub[, start[, end]]) -> int\n\nReturn the number of non-overlapping occurrences of subsection sub in\nbytes B[start:end]. Optional arguments start and end are interpreted\nas in slice notation.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sub", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "count" + }, + { + "Documentation": "Decode the bytes using the codec registered for encoding.\n\n encoding\n The encoding with which to decode the bytes.\n errors\n The error handling scheme to use for the handling of decoding errors.\n The default is 'strict' meaning that decoding errors raise a\n UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n as well as any other name registered with codecs.register_error that\n can handle UnicodeDecodeErrors.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "encoding", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "errors", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "decode" + }, + { + "Documentation": "B.endswith(suffix[, start[, end]]) -> bool\n\nReturn True if B ends with the specified suffix, False otherwise.\nWith optional start, test B beginning at that position.\nWith optional end, stop comparing B at that position.\nsuffix can also be a tuple of bytes to try.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "suffix", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "endswith" + }, + { + "Documentation": "B.expandtabs(tabsize=8) -> copy of B\n\nReturn a copy of B where all tab characters are expanded using spaces.\nIf tabsize is not given, a tab size of 8 characters is assumed.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "tabsize", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytes" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "expandtabs" + }, + { + "Documentation": "B.find(sub[, start[, end]]) -> int\n\nReturn the lowest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end]. Optional\narguments start and end are interpreted as in slice notation.\n\nReturn -1 on failure.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sub", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "find" + }, + { + "Documentation": "Create a bytes object from a string of hexadecimal numbers.\n\nSpaces between two numbers are accepted.\nExample: bytes.fromhex('B9 01EF') -> b'\\\\xb9\\\\x01\\\\xef'.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "type", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "string", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "fromhex" + }, + { + "Documentation": "B.hex() -> string\n\nCreate a string of hexadecimal numbers from a bytes object.\nExample: b'\\xb9\\x01\\xef'.hex() -> 'b901ef'.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "hex" + }, + { + "Documentation": "B.index(sub[, start[, end]]) -> int\n\nReturn the lowest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end]. Optional\narguments start and end are interpreted as in slice notation.\n\nRaises ValueError when the subsection is not found.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sub", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "index" + }, + { + "Documentation": "B.isalnum() -> bool\n\nReturn True if all characters in B are alphanumeric\nand there is at least one character in B, False otherwise.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isalnum" + }, + { + "Documentation": "B.isalpha() -> bool\n\nReturn True if all characters in B are alphabetic\nand there is at least one character in B, False otherwise.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isalpha" + }, + { + "Documentation": "B.isascii() -> bool\n\nReturn True if B is empty or all characters in B are ASCII,\nFalse otherwise.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isascii" + }, + { + "Documentation": "B.isdigit() -> bool\n\nReturn True if all characters in B are digits\nand there is at least one character in B, False otherwise.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isdigit" + }, + { + "Documentation": "B.islower() -> bool\n\nReturn True if all cased characters in B are lowercase and there is\nat least one cased character in B, False otherwise.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "islower" + }, + { + "Documentation": "B.isspace() -> bool\n\nReturn True if all characters in B are whitespace\nand there is at least one character in B, False otherwise.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isspace" + }, + { + "Documentation": "B.istitle() -> bool\n\nReturn True if B is a titlecased string and there is at least one\ncharacter in B, i.e. uppercase characters may only follow uncased\ncharacters and lowercase characters only cased ones. Return False\notherwise.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "istitle" + }, + { + "Documentation": "B.isupper() -> bool\n\nReturn True if all cased characters in B are uppercase and there is\nat least one cased character in B, False otherwise.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isupper" + }, + { + "Documentation": "Concatenate any number of bytes objects.\n\nThe bytes whose method is called is inserted in between each pair.\n\nThe result is returned as a new bytes object.\n\nExample: b'.'.join([b'ab', b'pq', b'rs']) -> b'ab.pq.rs'.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "iterable_of_bytes", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "join" + }, + { + "Documentation": "B.ljust(width[, fillchar]) -> copy of B\n\nReturn B left justified in a string of length width. Padding is\ndone using the specified fill character (default is a space).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "width", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "fillbyte", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytes" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "ljust" + }, + { + "Documentation": "B.lower() -> copy of B\n\nReturn a copy of B with all ASCII characters converted to lowercase.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytes" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "lower" + }, + { + "Documentation": "Strip leading bytes contained in the argument.\n\nIf the argument is omitted or None, strip leading ASCII whitespace.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "bytes", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "lstrip" + }, + { + "Documentation": "Return a translation table useable for the bytes or bytearray translate method.\n\nThe returned table will be one where each byte in frm is mapped to the byte at\nthe same position in to.\n\nThe bytes objects frm and to must be of the same length.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "frm", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "to", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "maketrans" + }, + { + "Documentation": "Partition the bytes into three parts using the given separator.\n\nThis will search for the separator sep in the bytes. If the separator is found,\nreturns a 3-tuple containing the part before the separator, the separator\nitself, and the part after it.\n\nIf the separator is not found, returns a 3-tuple containing the original bytes\nobject and two empty bytes objects.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sep", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "partition" + }, + { + "Documentation": "Return a copy with all occurrences of substring old replaced by new.\n\n count\n Maximum number of occurrences to replace.\n -1 (the default value) means replace all occurrences.\n\nIf the optional argument count is given, only the first count occurrences are\nreplaced.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "old", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "new", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "count", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytes" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "replace" + }, + { + "Documentation": "B.rfind(sub[, start[, end]]) -> int\n\nReturn the highest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end]. Optional\narguments start and end are interpreted as in slice notation.\n\nReturn -1 on failure.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sub", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "rfind" + }, + { + "Documentation": "B.rindex(sub[, start[, end]]) -> int\n\nReturn the highest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end]. Optional\narguments start and end are interpreted as in slice notation.\n\nRaise ValueError when the subsection is not found.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sub", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "rindex" + }, + { + "Documentation": "B.rjust(width[, fillchar]) -> copy of B\n\nReturn B right justified in a string of length width. Padding is\ndone using the specified fill character (default is a space)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "width", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "fillbyte", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytes" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "rjust" + }, + { + "Documentation": "Partition the bytes into three parts using the given separator.\n\nThis will search for the separator sep in the bytes, starting at the end. If\nthe separator is found, returns a 3-tuple containing the part before the\nseparator, the separator itself, and the part after it.\n\nIf the separator is not found, returns a 3-tuple containing two empty bytes\nobjects and the original bytes object.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sep", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "rpartition" + }, + { + "Documentation": "Return a list of the sections in the bytes, using sep as the delimiter.\n\n sep\n The delimiter according which to split the bytes.\n None (the default value) means split on ASCII whitespace characters\n (space, tab, return, newline, formfeed, vertical tab).\n maxsplit\n Maximum number of splits to do.\n -1 (the default value) means no limit.\n\nSplitting is done starting at the end of the bytes and working to the front.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sep", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "maxsplit", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:list" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "rsplit" + }, + { + "Documentation": "Strip trailing bytes contained in the argument.\n\nIf the argument is omitted or None, strip trailing ASCII whitespace.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "bytes", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "rstrip" + }, + { + "Documentation": "Return a list of the sections in the bytes, using sep as the delimiter.\n\n sep\n The delimiter according which to split the bytes.\n None (the default value) means split on ASCII whitespace characters\n (space, tab, return, newline, formfeed, vertical tab).\n maxsplit\n Maximum number of splits to do.\n -1 (the default value) means no limit.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sep", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "maxsplit", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:list" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "split" + }, + { + "Documentation": "Return a list of the lines in the bytes, breaking at line boundaries.\n\nLine breaks are not included in the resulting list unless keepends is given and\ntrue.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "keepends", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:list" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "splitlines" + }, + { + "Documentation": "B.startswith(prefix[, start[, end]]) -> bool\n\nReturn True if B starts with the specified prefix, False otherwise.\nWith optional start, test B beginning at that position.\nWith optional end, stop comparing B at that position.\nprefix can also be a tuple of bytes to try.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "prefix", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "startswith" + }, + { + "Documentation": "Strip leading and trailing bytes contained in the argument.\n\nIf the argument is omitted or None, strip leading and trailing ASCII whitespace.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "bytes", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "strip" + }, + { + "Documentation": "B.swapcase() -> copy of B\n\nReturn a copy of B with uppercase ASCII characters converted\nto lowercase ASCII and vice versa.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytes" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "swapcase" + }, + { + "Documentation": "B.title() -> copy of B\n\nReturn a titlecased version of B, i.e. ASCII words start with uppercase\ncharacters, all remaining cased characters have lowercase.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytes" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "title" + }, + { + "Documentation": "Return a copy with each character mapped by the given translation table.\n\n table\n Translation table, which must be a bytes object of length 256.\n\nAll characters occurring in the optional argument delete are removed.\nThe remaining characters are mapped through the given translation table.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "table", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "delete", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytes" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "translate" + }, + { + "Documentation": "B.upper() -> copy of B\n\nReturn a copy of B with all ASCII characters converted to uppercase.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytes" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "upper" + }, + { + "Documentation": "B.zfill(width) -> copy of B\n\nPad a numeric string B with zeros on the left, to fill a field\nof the specified width. B is never truncated.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "width", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytes" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "zfill" + } ], - "Methods": [], "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "float", - "Documentation": "Convert a string or number to a floating point number, if possible." - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "complex", - "Documentation": "Create a complex number from a real part and an optional imaginary part.\n\nThis is equivalent to (real + imag*1j) where imag defaults to 0." - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "tuple", - "Documentation": "Built-in immutable sequence.\n\nIf no argument is given, the constructor returns an empty tuple.\nIf iterable is specified the tuple is initialized from iterable's items.\n\nIf the argument is a tuple, the return value is the same object." - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "list", - "Documentation": "Built-in mutable sequence.\n\nIf no argument is given, the constructor creates a new empty list.\nThe argument must be an iterable if specified." - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "dict", - "Documentation": "dict() -> new empty dictionary\ndict(mapping) -> new dictionary initialized from a mapping object's\n (key, value) pairs\ndict(iterable) -> new dictionary initialized as if via:\n d = {}\n for k, v in iterable:\n d[k] = v\ndict(**kwargs) -> new dictionary initialized with the name=value pairs\n in the keyword argument list. For example: dict(one=1, two=2)" - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "set", - "Documentation": "set() -> new empty set object\nset(iterable) -> new set object\n\nBuild an unordered collection of unique elements." - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "frozenset", - "Documentation": "frozenset() -> empty frozenset object\nfrozenset(iterable) -> frozenset object\n\nBuild an immutable unordered collection of unique elements." - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "bytes", - "Documentation": "bytes(iterable_of_ints) -> bytes\nbytes(string, encoding[, errors]) -> bytes\nbytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer\nbytes(int) -> bytes object of size given by the parameter initialized with null bytes\nbytes() -> empty bytes object\n\nConstruct an immutable array of bytes from:\n - an iterable yielding integers in range(256)\n - a text string encoded using the specified encoding\n - any object implementing the buffer API.\n - an integer" - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "bytes_iterator", - "Documentation": null - }, - { - "Bases": [ - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "str", - "Documentation": "str(object='') -> str\nstr(bytes_or_buffer[, encoding[, errors]]) -> str\n\nCreate a new string object from the given object. If encoding or\nerrors is specified, then the object must expose a data buffer\nthat will be decoded using the given encoding and error handler.\nOtherwise, returns the result of object.__str__() (if defined)\nor repr(object).\nencoding defaults to sys.getdefaultencoding().\nerrors defaults to 'strict'." - }, - { - "Bases": [ - "object" + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } ], - "Methods": [], - "Properties": [], - "Fields": [], "GenericParameters": null, "InnerClasses": [], - "Name": "str_iterator", - "Documentation": null + "Name": "bytes" }, { + "Documentation": null, "Bases": [ "object" ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "str", - "Documentation": "str(object='') -> str\nstr(bytes_or_buffer[, encoding[, errors]]) -> str\n\nCreate a new string object from the given object. If encoding or\nerrors is specified, then the object must expose a data buffer\nthat will be decoded using the given encoding and error handler.\nOtherwise, returns the result of object.__str__() (if defined)\nor repr(object).\nencoding defaults to sys.getdefaultencoding().\nerrors defaults to 'strict'." - }, - { - "Bases": [ - "object" + "Methods": [ + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes_iterator", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes_iterator", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "bytes_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytes_iterator" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Private method returning an estimate of len(list(it)).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__length_hint__" + }, + { + "Documentation": "Implement next(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__next__" + }, + { + "Documentation": "Return state information for pickling.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__reduce__" + }, + { + "Documentation": "Set state information for unpickling.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytes_iterator", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "state", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__setstate__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "bytes_iterator", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + } ], - "Methods": [], "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "str_iterator", - "Documentation": null - }, - { - "Bases": [ - "object" + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } ], - "Methods": [], - "Properties": [], - "Fields": [], "GenericParameters": null, "InnerClasses": [], - "Name": "module", - "Documentation": "Create a module object.\n\nThe name must be a string; the optional doc argument can have any type." + "Name": "bytes_iterator" }, { + "Documentation": "str(object='') -> str\nstr(bytes_or_buffer[, encoding[, errors]]) -> str\n\nCreate a new string object from the given object. If encoding or\nerrors is specified, then the object must expose a data buffer\nthat will be decoded using the given encoding and error handler.\nOtherwise, returns the result of object.__str__() (if defined)\nor repr(object).\nencoding defaults to sys.getdefaultencoding().\nerrors defaults to 'strict'.", "Bases": [ "object" ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "function", - "Documentation": "Create a function object.\n\n code\n a code object\n globals\n the globals dictionary\n name\n a string that overrides the name from the code object\n argdefs\n a tuple that specifies the default argument values\n closure\n a tuple that supplies the bindings for free variables" - }, - { - "Bases": [ - "object" + "Methods": [ + { + "Documentation": "Return self+value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__add__" + }, + { + "Documentation": "Return key in self.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__contains__" + }, + { + "Documentation": "Return self==value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__eq__" + }, + { + "Documentation": "Return a formatted version of the string as described by format_spec.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "format_spec", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__format__" + }, + { + "Documentation": "Return self>=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return self[key].", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getitem__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getnewargs__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Return hash(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__hash__" + }, + { + "Documentation": "str(object='') -> str\nstr(bytes_or_buffer[, encoding[, errors]]) -> str\n\nCreate a new string object from the given object. If encoding or\nerrors is specified, then the object must expose a data buffer\nthat will be decoded using the given encoding and error handler.\nOtherwise, returns the result of object.__str__() (if defined)\nor repr(object).\nencoding defaults to sys.getdefaultencoding().\nerrors defaults to 'strict'.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "bytes_or_buffer", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "encoding", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "errors", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return len(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__len__" + }, + { + "Documentation": "Return self int\n\nReturn the number of non-overlapping occurrences of substring sub in\nstring S[start:end]. Optional arguments start and end are\ninterpreted as in slice notation.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sub", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "count" + }, + { + "Documentation": "Encode the string using the codec registered for encoding.\n\n encoding\n The encoding in which to encode the string.\n errors\n The error handling scheme to use for encoding errors.\n The default is 'strict' meaning that encoding errors raise a\n UnicodeEncodeError. Other possible values are 'ignore', 'replace' and\n 'xmlcharrefreplace' as well as any other name registered with\n codecs.register_error that can handle UnicodeEncodeErrors.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "encoding", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "errors", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "encode" + }, + { + "Documentation": "S.endswith(suffix[, start[, end]]) -> bool\n\nReturn True if S ends with the specified suffix, False otherwise.\nWith optional start, test S beginning at that position.\nWith optional end, stop comparing S at that position.\nsuffix can also be a tuple of strings to try.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "suffix", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "endswith" + }, + { + "Documentation": "Return a copy where all tab characters are expanded using spaces.\n\nIf tabsize is not given, a tab size of 8 characters is assumed.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "tabsize", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "expandtabs" + }, + { + "Documentation": "S.find(sub[, start[, end]]) -> int\n\nReturn the lowest index in S where substring sub is found,\nsuch that sub is contained within S[start:end]. Optional\narguments start and end are interpreted as in slice notation.\n\nReturn -1 on failure.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sub", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "find" + }, + { + "Documentation": "S.format(*args, **kwargs) -> str\n\nReturn a formatted version of S, using substitutions from args and kwargs.\nThe substitutions are identified by braces ('{' and '}').", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "format" + }, + { + "Documentation": "S.format_map(mapping) -> str\n\nReturn a formatted version of S, using substitutions from mapping.\nThe substitutions are identified by braces ('{' and '}').", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "mapping", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "format_map" + }, + { + "Documentation": "S.index(sub[, start[, end]]) -> int\n\nReturn the lowest index in S where substring sub is found, \nsuch that sub is contained within S[start:end]. Optional\narguments start and end are interpreted as in slice notation.\n\nRaises ValueError when the substring is not found.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sub", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "index" + }, + { + "Documentation": "Return True if the string is an alpha-numeric string, False otherwise.\n\nA string is alpha-numeric if all characters in the string are alpha-numeric and\nthere is at least one character in the string.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isalnum" + }, + { + "Documentation": "Return True if the string is an alphabetic string, False otherwise.\n\nA string is alphabetic if all characters in the string are alphabetic and there\nis at least one character in the string.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isalpha" + }, + { + "Documentation": "Return True if all characters in the string are ASCII, False otherwise.\n\nASCII characters have code points in the range U+0000-U+007F.\nEmpty string is ASCII too.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isascii" + }, + { + "Documentation": "Return True if the string is a decimal string, False otherwise.\n\nA string is a decimal string if all characters in the string are decimal and\nthere is at least one character in the string.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isdecimal" + }, + { + "Documentation": "Return True if the string is a digit string, False otherwise.\n\nA string is a digit string if all characters in the string are digits and there\nis at least one character in the string.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isdigit" + }, + { + "Documentation": "Return True if the string is a valid Python identifier, False otherwise.\n\nUse keyword.iskeyword() to test for reserved identifiers such as \"def\" and\n\"class\".", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isidentifier" + }, + { + "Documentation": "Return True if the string is a lowercase string, False otherwise.\n\nA string is lowercase if all cased characters in the string are lowercase and\nthere is at least one cased character in the string.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "islower" + }, + { + "Documentation": "Return True if the string is a numeric string, False otherwise.\n\nA string is numeric if all characters in the string are numeric and there is at\nleast one character in the string.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isnumeric" + }, + { + "Documentation": "Return True if the string is printable, False otherwise.\n\nA string is printable if all of its characters are considered printable in\nrepr() or if it is empty.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isprintable" + }, + { + "Documentation": "Return True if the string is a whitespace string, False otherwise.\n\nA string is whitespace if all characters in the string are whitespace and there\nis at least one character in the string.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isspace" + }, + { + "Documentation": "Return True if the string is a title-cased string, False otherwise.\n\nIn a title-cased string, upper- and title-case characters may only\nfollow uncased characters and lowercase characters only cased ones.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "istitle" + }, + { + "Documentation": "Return True if the string is an uppercase string, False otherwise.\n\nA string is uppercase if all cased characters in the string are uppercase and\nthere is at least one cased character in the string.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isupper" + }, + { + "Documentation": "Concatenate any number of strings.\n\nThe string whose method is called is inserted in between each given string.\nThe result is returned as a new string.\n\nExample: '.'.join(['ab', 'pq', 'rs']) -> 'ab.pq.rs'", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "iterable", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "join" + }, + { + "Documentation": "Return a left-justified string of length width.\n\nPadding is done using the specified fill character (default is a space).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "width", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "fillchar", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "ljust" + }, + { + "Documentation": "Return a copy of the string converted to lowercase.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "lower" + }, + { + "Documentation": "Return a copy of the string with leading whitespace removed.\n\nIf chars is given and not None, remove characters in chars instead.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "chars", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "lstrip" + }, + { + "Documentation": "Return a translation table usable for str.translate().\n\nIf there is only one argument, it must be a dictionary mapping Unicode\nordinals (integers) or characters to Unicode ordinals, strings or None.\nCharacter keys will be then converted to ordinals.\nIf there are two arguments, they must be strings of equal length, and\nin the resulting dictionary, each character in x will be mapped to the\ncharacter at the same position in y. If there is a third argument, it\nmust be a string, whose characters will be mapped to None in the result.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "x", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "y", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "z", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:dict" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "maketrans" + }, + { + "Documentation": "Partition the string into three parts using the given separator.\n\nThis will search for the separator in the string. If the separator is found,\nreturns a 3-tuple containing the part before the separator, the separator\nitself, and the part after it.\n\nIf the separator is not found, returns a 3-tuple containing the original string\nand two empty strings.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sep", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "partition" + }, + { + "Documentation": "Return a copy with all occurrences of substring old replaced by new.\n\n count\n Maximum number of occurrences to replace.\n -1 (the default value) means replace all occurrences.\n\nIf the optional argument count is given, only the first count occurrences are\nreplaced.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "old", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "new", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "count", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "replace" + }, + { + "Documentation": "S.rfind(sub[, start[, end]]) -> int\n\nReturn the highest index in S where substring sub is found,\nsuch that sub is contained within S[start:end]. Optional\narguments start and end are interpreted as in slice notation.\n\nReturn -1 on failure.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sub", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "rfind" + }, + { + "Documentation": "S.rindex(sub[, start[, end]]) -> int\n\nReturn the highest index in S where substring sub is found,\nsuch that sub is contained within S[start:end]. Optional\narguments start and end are interpreted as in slice notation.\n\nRaises ValueError when the substring is not found.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sub", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "rindex" + }, + { + "Documentation": "Return a right-justified string of length width.\n\nPadding is done using the specified fill character (default is a space).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "width", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "fillchar", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "rjust" + }, + { + "Documentation": "Partition the string into three parts using the given separator.\n\nThis will search for the separator in the string, starting at the end. If\nthe separator is found, returns a 3-tuple containing the part before the\nseparator, the separator itself, and the part after it.\n\nIf the separator is not found, returns a 3-tuple containing two empty strings\nand the original string.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sep", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "rpartition" + }, + { + "Documentation": "Return a list of the words in the string, using sep as the delimiter string.\n\n sep\n The delimiter according which to split the string.\n None (the default value) means split according to any whitespace,\n and discard empty strings from the result.\n maxsplit\n Maximum number of splits to do.\n -1 (the default value) means no limit.\n\nSplits are done starting at the end of the string and working to the front.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sep", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "maxsplit", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:list" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "rsplit" + }, + { + "Documentation": "Return a copy of the string with trailing whitespace removed.\n\nIf chars is given and not None, remove characters in chars instead.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "chars", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "rstrip" + }, + { + "Documentation": "Return a list of the words in the string, using sep as the delimiter string.\n\n sep\n The delimiter according which to split the string.\n None (the default value) means split according to any whitespace,\n and discard empty strings from the result.\n maxsplit\n Maximum number of splits to do.\n -1 (the default value) means no limit.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sep", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "maxsplit", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:list" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "split" + }, + { + "Documentation": "Return a list of the lines in the string, breaking at line boundaries.\n\nLine breaks are not included in the resulting list unless keepends is given and\ntrue.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "keepends", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:list" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "splitlines" + }, + { + "Documentation": "S.startswith(prefix[, start[, end]]) -> bool\n\nReturn True if S starts with the specified prefix, False otherwise.\nWith optional start, test S beginning at that position.\nWith optional end, stop comparing S at that position.\nprefix can also be a tuple of strings to try.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "prefix", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "startswith" + }, + { + "Documentation": "Return a copy of the string with leading and trailing whitespace remove.\n\nIf chars is given and not None, remove characters in chars instead.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "chars", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "strip" + }, + { + "Documentation": "Convert uppercase characters to lowercase and lowercase characters to uppercase.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "swapcase" + }, + { + "Documentation": "Return a version of the string where each word is titlecased.\n\nMore specifically, words start with uppercased characters and all remaining\ncased characters have lower case.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "title" + }, + { + "Documentation": "Replace each character in the string using the given translation table.\n\n table\n Translation table, which must be a mapping of Unicode ordinals to\n Unicode ordinals, strings, or None.\n\nThe table must implement lookup/indexing via __getitem__, for instance a\ndictionary or list. If this operation raises LookupError, the character is\nleft untouched. Characters mapped to None are deleted.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "table", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "translate" + }, + { + "Documentation": "Return a copy of the string converted to uppercase.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "upper" + }, + { + "Documentation": "Pad a numeric string with zeros on the left, to fill a field of the given width.\n\nThe string is never truncated.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "width", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "zfill" + } + ], + "Properties": [], + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Name": "str" + }, + { + "Documentation": null, + "Bases": [ + "object" + ], + "Methods": [ + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str_iterator", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str_iterator", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "str_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str_iterator" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Private method returning an estimate of len(list(it)).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__length_hint__" + }, + { + "Documentation": "Implement next(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__next__" + }, + { + "Documentation": "Return state information for pickling.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__reduce__" + }, + { + "Documentation": "Set state information for unpickling.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "str_iterator", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "state", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__setstate__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "str_iterator", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + } + ], + "Properties": [], + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Name": "str_iterator" + }, + { + "Documentation": "Create a module object.\n\nThe name must be a string; the optional doc argument can have any type.", + "Bases": [ + "object" + ], + "Methods": [ + { + "Documentation": "Implement delattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "module", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__delattr__" + }, + { + "Documentation": "__dir__() -> list\nspecialized dir() implementation", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "module", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:list" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__dir__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "module", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Create a module object.\n\nThe name must be a string; the optional doc argument can have any type.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "module", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "module", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Return repr(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "module", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__repr__" + }, + { + "Documentation": "Implement setattr(self, name, value).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "module", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__setattr__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "module", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + } + ], + "Properties": [], + "Fields": [ + { + "Value": "i:dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Name": "module" + }, + { + "Documentation": "Create a function object.\n\n code\n a code object\n globals\n the globals dictionary\n name\n a string that overrides the name from the code object\n argdefs\n a tuple that specifies the default argument values\n closure\n a tuple that supplies the bindings for free variables", + "Bases": [ + "object" + ], + "Methods": [ + { + "Documentation": "Call self as a function.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "function", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__call__" + }, + { + "Documentation": "Return an attribute of instance, which is of type owner.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "function", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "instance", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "owner", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:function" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__get__" + }, + { + "Documentation": "Create a function object.\n\n code\n a code object\n globals\n the globals dictionary\n name\n a string that overrides the name from the code object\n argdefs\n a tuple that specifies the default argument values\n closure\n a tuple that supplies the bindings for free variables", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "function", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "function", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Return repr(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "function", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__repr__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "function", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + } + ], + "Properties": [ + { + "Documentation": "", + "ReturnType": "i:dict", + "Attributes": 0, + "Name": "__annotations__" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "__closure__" + }, + { + "Documentation": "", + "ReturnType": "i:object", + "Attributes": 0, + "Name": "__code__" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "__defaults__" + }, + { + "Documentation": "", + "ReturnType": "i:dict", + "Attributes": 0, + "Name": "__globals__" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "__kwdefaults__" + } + ], + "Fields": [ + { + "Value": "i:dict", + "Name": "__dict__" + }, + { + "Value": null, + "Name": "__name__" + }, + { + "Value": null, + "Name": "__qualname__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Name": "function" + }, + { + "Documentation": null, + "Bases": [ + "object" + ], + "Methods": [ + { + "Documentation": "Call self as a function.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "wrapper_descriptor", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__call__" + }, + { + "Documentation": "Return an attribute of instance, which is of type owner.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "wrapper_descriptor", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "instance", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "owner", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:wrapper_descriptor" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__get__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "wrapper_descriptor", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "wrapper_descriptor", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "wrapper_descriptor", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__reduce__" + }, + { + "Documentation": "Return repr(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "wrapper_descriptor", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__repr__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "wrapper_descriptor", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + } + ], + "Properties": [ + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "__objclass__" + } + ], + "Fields": [ + { + "Value": null, + "Name": "__name__" + }, + { + "Value": null, + "Name": "__qualname__" + }, + { + "Value": null, + "Name": "__text_signature__" + }, + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Name": "wrapper_descriptor" + }, + { + "Documentation": null, + "Bases": [ + "object" + ], + "Methods": [ + { + "Documentation": "Call self as a function.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "builtin_function_or_method", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__call__" + }, + { + "Documentation": "Return self==value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "builtin_function_or_method", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__eq__" + }, + { + "Documentation": "Return self>=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "builtin_function_or_method", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "builtin_function_or_method", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "builtin_function_or_method", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Return hash(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "builtin_function_or_method", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__hash__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "builtin_function_or_method", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "builtin_function_or_method", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return self raise GeneratorExit inside generator.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "generator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "close" + }, + { + "Documentation": "send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "generator", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "send" + }, + { + "Documentation": "throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "generator", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "type", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "traceback", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "throw" + } + ], + "Properties": [ + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "gi_code" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "gi_frame" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "gi_running" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "gi_yieldfrom" + } + ], + "Fields": [ + { + "Value": null, + "Name": "__name__" + }, + { + "Value": null, + "Name": "__qualname__" + }, + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Name": "generator" + }, + { + "Documentation": "Property attribute.\n\n fget\n function to be used for getting an attribute value\n fset\n function to be used for setting an attribute value\n fdel\n function to be used for del'ing an attribute\n doc\n docstring\n\nTypical use is to define a managed attribute x:\n\nclass C(object):\n def getx(self): return self._x\n def setx(self, value): self._x = value\n def delx(self): del self._x\n x = property(getx, setx, delx, \"I'm the 'x' property.\")\n\nDecorators make defining new properties or modifying existing ones easy:\n\nclass C(object):\n @property\n def x(self):\n \"I am the 'x' property.\"\n return self._x\n @x.setter\n def x(self, value):\n self._x = value\n @x.deleter\n def x(self):\n del self._x", + "Bases": [ + "object" + ], + "Methods": [ + { + "Documentation": "Delete an attribute of instance.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "property", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "instance", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__delete__" + }, + { + "Documentation": "Return an attribute of instance, which is of type owner.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "property", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "instance", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "owner", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:property" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__get__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "property", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Property attribute.\n\n fget\n function to be used for getting an attribute value\n fset\n function to be used for setting an attribute value\n fdel\n function to be used for del'ing an attribute\n doc\n docstring\n\nTypical use is to define a managed attribute x:\n\nclass C(object):\n def getx(self): return self._x\n def setx(self, value): self._x = value\n def delx(self): del self._x\n x = property(getx, setx, delx, \"I'm the 'x' property.\")\n\nDecorators make defining new properties or modifying existing ones easy:\n\nclass C(object):\n @property\n def x(self):\n \"I am the 'x' property.\"\n return self._x\n @x.setter\n def x(self, value):\n self._x = value\n @x.deleter\n def x(self):\n del self._x", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "property", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "property", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Set an attribute of instance to value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "property", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "instance", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__set__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "property", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + }, + { + "Documentation": "Descriptor to change the deleter on a property.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "property", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "func", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "deleter" + }, + { + "Documentation": "Descriptor to change the getter on a property.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "property", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "func", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "getter" + }, + { + "Documentation": "Descriptor to change the setter on a property.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "property", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "func", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "setter" + } + ], + "Properties": [ + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "__isabstractmethod__" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "fdel" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "fget" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "fset" + } + ], + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Name": "property" + }, + { + "Documentation": "classmethod(function) -> method\n\nConvert a function to be a class method.\n\nA class method receives the class as implicit first argument,\njust like an instance method receives the instance.\nTo declare a class method, use this idiom:\n\n class C:\n @classmethod\n def f(cls, arg1, arg2, ...):\n ...\n\nIt can be called either on the class (e.g. C.f()) or on an instance\n(e.g. C().f()). The instance is ignored except for its class.\nIf a class method is called for a derived class, the derived class\nobject is passed as the implied first argument.\n\nClass methods are different than C++ or Java static methods.\nIf you want those, see the staticmethod builtin.", + "Bases": [ + "object" + ], + "Methods": [ + { + "Documentation": "Return an attribute of instance, which is of type owner.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "classmethod", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "instance", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "owner", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:classmethod" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__get__" + }, + { + "Documentation": "classmethod(function) -> method\n\nConvert a function to be a class method.\n\nA class method receives the class as implicit first argument,\njust like an instance method receives the instance.\nTo declare a class method, use this idiom:\n\n class C:\n @classmethod\n def f(cls, arg1, arg2, ...):\n ...\n\nIt can be called either on the class (e.g. C.f()) or on an instance\n(e.g. C().f()). The instance is ignored except for its class.\nIf a class method is called for a derived class, the derived class\nobject is passed as the implied first argument.\n\nClass methods are different than C++ or Java static methods.\nIf you want those, see the staticmethod builtin.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "classmethod", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "function", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "classmethod", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "classmethod", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + } + ], + "Properties": [ + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "__func__" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "__isabstractmethod__" + } + ], + "Fields": [ + { + "Value": "i:dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Name": "classmethod" + }, + { + "Documentation": "staticmethod(function) -> method\n\nConvert a function to be a static method.\n\nA static method does not receive an implicit first argument.\nTo declare a static method, use this idiom:\n\n class C:\n @staticmethod\n def f(arg1, arg2, ...):\n ...\n\nIt can be called either on the class (e.g. C.f()) or on an instance\n(e.g. C().f()). The instance is ignored except for its class.\n\nStatic methods in Python are similar to those found in Java or C++.\nFor a more advanced concept, see the classmethod builtin.", + "Bases": [ + "object" + ], + "Methods": [ + { + "Documentation": "Return an attribute of instance, which is of type owner.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "staticmethod", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "instance", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "owner", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:staticmethod" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__get__" + }, + { + "Documentation": "staticmethod(function) -> method\n\nConvert a function to be a static method.\n\nA static method does not receive an implicit first argument.\nTo declare a static method, use this idiom:\n\n class C:\n @staticmethod\n def f(arg1, arg2, ...):\n ...\n\nIt can be called either on the class (e.g. C.f()) or on an instance\n(e.g. C().f()). The instance is ignored except for its class.\n\nStatic methods in Python are similar to those found in Java or C++.\nFor a more advanced concept, see the classmethod builtin.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "staticmethod", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "function", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "staticmethod", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "staticmethod", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + } + ], + "Properties": [ + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "__func__" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "__isabstractmethod__" + } + ], + "Fields": [ + { + "Value": "i:dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Name": "staticmethod" + }, + { + "Documentation": null, + "Bases": [ + "object" + ], + "Methods": [ + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "ellipsis", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "ellipsis", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "ellipsis", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "ellipsis", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__reduce__" + }, + { + "Documentation": "Return repr(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "ellipsis", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__repr__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "ellipsis", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + } + ], + "Properties": [], + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Name": "..." + }, + { + "Documentation": null, + "Bases": [ + "object" + ], + "Methods": [ + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple_iterator", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple_iterator", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "tuple_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple_iterator" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Private method returning an estimate of len(list(it)).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__length_hint__" + }, + { + "Documentation": "Implement next(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__next__" + }, + { + "Documentation": "Return state information for pickling.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__reduce__" + }, + { + "Documentation": "Set state information for unpickling.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "tuple_iterator", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "state", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__setstate__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "tuple_iterator", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + } + ], + "Properties": [], + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Name": "tuple_iterator" + }, + { + "Documentation": null, + "Bases": [ + "object" + ], + "Methods": [ + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "list_iterator", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "list_iterator", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "list_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "list_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:list_iterator" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Private method returning an estimate of len(list(it)).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "list_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__length_hint__" + }, + { + "Documentation": "Implement next(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "list_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__next__" + }, + { + "Documentation": "Return state information for pickling.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "list_iterator", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__reduce__" + }, + { + "Documentation": "Set state information for unpickling.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "list_iterator", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "state", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__setstate__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "list_iterator", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + } + ], + "Properties": [], + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Name": "list_iterator" + }, + { + "Documentation": null, + "Bases": [ + "object" + ], + "Methods": [ + { + "Documentation": "Return self&value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict_keys", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:dict_keys" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__and__" + }, + { + "Documentation": "Return key in self.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict_keys", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__contains__" + }, + { + "Documentation": "Return self==value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict_keys", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__eq__" + }, + { + "Documentation": "Return self>=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict_keys", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict_keys", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict_keys", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict_keys", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "dict_keys", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict_keys", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:dict_keys" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict_keys", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return len(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict_keys", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__len__" + }, + { + "Documentation": "Return self=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict_items", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict_items", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict_items", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict_items", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "dict_items", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict_items", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:dict_items" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict_items", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return len(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "dict_items", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__len__" + }, + { + "Documentation": "Return self bytearray\nbytearray(string, encoding[, errors]) -> bytearray\nbytearray(bytes_or_buffer) -> mutable copy of bytes_or_buffer\nbytearray(int) -> bytes array of size given by the parameter initialized with null bytes\nbytearray() -> empty bytes array\n\nConstruct a mutable bytearray object from:\n - an iterable yielding integers in range(256)\n - a text string encoded using the specified encoding\n - a bytes or a buffer object\n - any object implementing the buffer API.\n - an integer", + "Bases": [ + "object" + ], + "Methods": [ + { + "Documentation": "Return self+value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytearray" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__add__" + }, + { + "Documentation": "B.__alloc__() -> int\n\nReturn the number of bytes actually allocated.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__alloc__" + }, + { + "Documentation": "Return key in self.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__contains__" + }, + { + "Documentation": "Delete self[key].", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__delitem__" + }, + { + "Documentation": "Return self==value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__eq__" + }, + { + "Documentation": "Return self>=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return self[key].", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getitem__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Implement self+=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iadd__" + }, + { + "Documentation": "Implement self*=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__imul__" + }, + { + "Documentation": "bytearray(iterable_of_ints) -> bytearray\nbytearray(string, encoding[, errors]) -> bytearray\nbytearray(bytes_or_buffer) -> mutable copy of bytes_or_buffer\nbytearray(int) -> bytes array of size given by the parameter initialized with null bytes\nbytearray() -> empty bytes array\n\nConstruct a mutable bytearray object from:\n - an iterable yielding integers in range(256)\n - a text string encoded using the specified encoding\n - a bytes or a buffer object\n - any object implementing the buffer API.\n - an integer", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "string", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "encoding", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "errors", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytearray" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return len(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__len__" + }, + { + "Documentation": "Return self copy of B\n\nReturn a copy of B with only its first character capitalized (ASCII)\nand the rest lower-cased.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytearray" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "capitalize" + }, + { + "Documentation": "B.center(width[, fillchar]) -> copy of B\n\nReturn B centered in a string of length width. Padding is\ndone using the specified fill character (default is a space).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytearray" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "center" + }, + { + "Documentation": "Remove all items from the bytearray.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "clear" + }, + { + "Documentation": "Return a copy of B.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytearray" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "copy" + }, + { + "Documentation": "B.count(sub[, start[, end]]) -> int\n\nReturn the number of non-overlapping occurrences of subsection sub in\nbytes B[start:end]. Optional arguments start and end are interpreted\nas in slice notation.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "x", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "count" + }, + { + "Documentation": "Decode the bytearray using the codec registered for encoding.\n\n encoding\n The encoding with which to decode the bytearray.\n errors\n The error handling scheme to use for the handling of decoding errors.\n The default is 'strict' meaning that decoding errors raise a\n UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n as well as any other name registered with codecs.register_error that\n can handle UnicodeDecodeErrors.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "encoding", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "errors", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "decode" + }, + { + "Documentation": "B.endswith(suffix[, start[, end]]) -> bool\n\nReturn True if B ends with the specified suffix, False otherwise.\nWith optional start, test B beginning at that position.\nWith optional end, stop comparing B at that position.\nsuffix can also be a tuple of bytes to try.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "suffix", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "endswith" + }, + { + "Documentation": "B.expandtabs(tabsize=8) -> copy of B\n\nReturn a copy of B where all tab characters are expanded using spaces.\nIf tabsize is not given, a tab size of 8 characters is assumed.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "tabsize", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytearray" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "expandtabs" + }, + { + "Documentation": "Append all the items from the iterator or sequence to the end of the bytearray.\n\n iterable_of_ints\n The iterable of items to append.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "iterable_of_ints", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "extend" + }, + { + "Documentation": "B.find(sub[, start[, end]]) -> int\n\nReturn the lowest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end]. Optional\narguments start and end are interpreted as in slice notation.\n\nReturn -1 on failure.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sub", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "find" + }, + { + "Documentation": "Create a bytearray object from a string of hexadecimal numbers.\n\nSpaces between two numbers are accepted.\nExample: bytearray.fromhex('B9 01EF') -> bytearray(b'\\\\xb9\\\\x01\\\\xef')", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "type", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "string", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "fromhex" + }, + { + "Documentation": "B.hex() -> string\n\nCreate a string of hexadecimal numbers from a bytearray object.\nExample: bytearray([0xb9, 0x01, 0xef]).hex() -> 'b901ef'.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "hex" + }, + { + "Documentation": "B.index(sub[, start[, end]]) -> int\n\nReturn the lowest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end]. Optional\narguments start and end are interpreted as in slice notation.\n\nRaises ValueError when the subsection is not found.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "v", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "index" + }, + { + "Documentation": "Insert a single item into the bytearray before the given index.\n\n index\n The index where the value is to be inserted.\n item\n The item to be inserted.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "index", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "item", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "insert" + }, + { + "Documentation": "B.isalnum() -> bool\n\nReturn True if all characters in B are alphanumeric\nand there is at least one character in B, False otherwise.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isalnum" + }, + { + "Documentation": "B.isalpha() -> bool\n\nReturn True if all characters in B are alphabetic\nand there is at least one character in B, False otherwise.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isalpha" + }, + { + "Documentation": "B.isascii() -> bool\n\nReturn True if B is empty or all characters in B are ASCII,\nFalse otherwise.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isascii" + }, + { + "Documentation": "B.isdigit() -> bool\n\nReturn True if all characters in B are digits\nand there is at least one character in B, False otherwise.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isdigit" + }, + { + "Documentation": "B.islower() -> bool\n\nReturn True if all cased characters in B are lowercase and there is\nat least one cased character in B, False otherwise.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "islower" + }, + { + "Documentation": "B.isspace() -> bool\n\nReturn True if all characters in B are whitespace\nand there is at least one character in B, False otherwise.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isspace" + }, + { + "Documentation": "B.istitle() -> bool\n\nReturn True if B is a titlecased string and there is at least one\ncharacter in B, i.e. uppercase characters may only follow uncased\ncharacters and lowercase characters only cased ones. Return False\notherwise.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "istitle" + }, + { + "Documentation": "B.isupper() -> bool\n\nReturn True if all cased characters in B are uppercase and there is\nat least one cased character in B, False otherwise.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "isupper" + }, + { + "Documentation": "Concatenate any number of bytes/bytearray objects.\n\nThe bytearray whose method is called is inserted in between each pair.\n\nThe result is returned as a new bytearray object.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "iterable_of_bytes", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "join" + }, + { + "Documentation": "B.ljust(width[, fillchar]) -> copy of B\n\nReturn B left justified in a string of length width. Padding is\ndone using the specified fill character (default is a space).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytearray" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "ljust" + }, + { + "Documentation": "B.lower() -> copy of B\n\nReturn a copy of B with all ASCII characters converted to lowercase.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytearray" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "lower" + }, + { + "Documentation": "Strip leading bytes contained in the argument.\n\nIf the argument is omitted or None, strip leading ASCII whitespace.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "bytes", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytearray" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "lstrip" + }, + { + "Documentation": "Return a translation table useable for the bytes or bytearray translate method.\n\nThe returned table will be one where each byte in frm is mapped to the byte at\nthe same position in to.\n\nThe bytes objects frm and to must be of the same length.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "frm", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "to", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "maketrans" + }, + { + "Documentation": "Partition the bytearray into three parts using the given separator.\n\nThis will search for the separator sep in the bytearray. If the separator is\nfound, returns a 3-tuple containing the part before the separator, the\nseparator itself, and the part after it as new bytearray objects.\n\nIf the separator is not found, returns a 3-tuple containing the copy of the\noriginal bytearray object and two empty bytearray objects.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sep", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "partition" + }, + { + "Documentation": "Remove and return a single item from B.\n\n index\n The index from where to remove the item.\n -1 (the default value) means remove the last item.\n\nIf no index argument is given, will pop the last item.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "index", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "pop" + }, + { + "Documentation": "Remove the first occurrence of a value in the bytearray.\n\n value\n The value to remove.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "remove" + }, + { + "Documentation": "Return a copy with all occurrences of substring old replaced by new.\n\n count\n Maximum number of occurrences to replace.\n -1 (the default value) means replace all occurrences.\n\nIf the optional argument count is given, only the first count occurrences are\nreplaced.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "old", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "new", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "count", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytearray" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "replace" + }, + { + "Documentation": "Reverse the order of the values in B in place.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "reverse" + }, + { + "Documentation": "B.rfind(sub[, start[, end]]) -> int\n\nReturn the highest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end]. Optional\narguments start and end are interpreted as in slice notation.\n\nReturn -1 on failure.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sub", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "rfind" + }, + { + "Documentation": "B.rindex(sub[, start[, end]]) -> int\n\nReturn the highest index in B where subsection sub is found,\nsuch that sub is contained within B[start,end]. Optional\narguments start and end are interpreted as in slice notation.\n\nRaise ValueError when the subsection is not found.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sub", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "rindex" + }, + { + "Documentation": "B.rjust(width[, fillchar]) -> copy of B\n\nReturn B right justified in a string of length width. Padding is\ndone using the specified fill character (default is a space)", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytearray" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "rjust" + }, + { + "Documentation": "Partition the bytearray into three parts using the given separator.\n\nThis will search for the separator sep in the bytearray, starting at the end.\nIf the separator is found, returns a 3-tuple containing the part before the\nseparator, the separator itself, and the part after it as new bytearray\nobjects.\n\nIf the separator is not found, returns a 3-tuple containing two empty bytearray\nobjects and the copy of the original bytearray object.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sep", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "rpartition" + }, + { + "Documentation": "Return a list of the sections in the bytearray, using sep as the delimiter.\n\n sep\n The delimiter according which to split the bytearray.\n None (the default value) means split on ASCII whitespace characters\n (space, tab, return, newline, formfeed, vertical tab).\n maxsplit\n Maximum number of splits to do.\n -1 (the default value) means no limit.\n\nSplitting is done starting at the end of the bytearray and working to the front.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sep", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "maxsplit", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:list" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "rsplit" + }, + { + "Documentation": "Strip trailing bytes contained in the argument.\n\nIf the argument is omitted or None, strip trailing ASCII whitespace.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "bytes", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytearray" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "rstrip" + }, + { + "Documentation": "Return a list of the sections in the bytearray, using sep as the delimiter.\n\n sep\n The delimiter according which to split the bytearray.\n None (the default value) means split on ASCII whitespace characters\n (space, tab, return, newline, formfeed, vertical tab).\n maxsplit\n Maximum number of splits to do.\n -1 (the default value) means no limit.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "sep", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "maxsplit", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:list" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "split" + }, + { + "Documentation": "Return a list of the lines in the bytearray, breaking at line boundaries.\n\nLine breaks are not included in the resulting list unless keepends is given and\ntrue.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "keepends", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:list" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "splitlines" + }, + { + "Documentation": "B.startswith(prefix[, start[, end]]) -> bool\n\nReturn True if B starts with the specified prefix, False otherwise.\nWith optional start, test B beginning at that position.\nWith optional end, stop comparing B at that position.\nprefix can also be a tuple of bytes to try.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "prefix", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "end", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "startswith" + }, + { + "Documentation": "Strip leading and trailing bytes contained in the argument.\n\nIf the argument is omitted or None, strip leading and trailing ASCII whitespace.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "bytes", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytearray" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "strip" + }, + { + "Documentation": "B.swapcase() -> copy of B\n\nReturn a copy of B with uppercase ASCII characters converted\nto lowercase ASCII and vice versa.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytearray" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "swapcase" + }, + { + "Documentation": "B.title() -> copy of B\n\nReturn a titlecased version of B, i.e. ASCII words start with uppercase\ncharacters, all remaining cased characters have lowercase.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytearray" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "title" + }, + { + "Documentation": "Return a copy with each character mapped by the given translation table.\n\n table\n Translation table, which must be a bytes object of length 256.\n\nAll characters occurring in the optional argument delete are removed.\nThe remaining characters are mapped through the given translation table.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "table", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "delete", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "translate" + }, + { + "Documentation": "B.upper() -> copy of B\n\nReturn a copy of B with all ASCII characters converted to uppercase.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytearray" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "upper" + }, + { + "Documentation": "B.zfill(width) -> copy of B\n\nPad a numeric string B with zeros on the left, to fill a field\nof the specified width. B is never truncated.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "bytearray", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "width", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bytearray" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "zfill" + } ], - "Methods": [], "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "wrapper_descriptor", - "Documentation": null - }, - { - "Bases": [ - "object" + "Fields": [ + { + "Value": null, + "Name": "__hash__" + }, + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } ], - "Methods": [], - "Properties": [], - "Fields": [], "GenericParameters": null, "InnerClasses": [], - "Name": "builtin_function_or_method", - "Documentation": null + "Name": "bytearray" }, { + "Documentation": "Return an enumerate object.\n\n iterable\n an object supporting iteration\n\nThe enumerate object yields pairs containing a count (from start, which\ndefaults to zero) and a value yielded by the iterable argument.\n\nenumerate is useful for obtaining an indexed list:\n (0, seq[0]), (1, seq[1]), (2, seq[2]), ...", "Bases": [ "object" ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "generator", - "Documentation": null - }, - { - "Bases": [ - "object" + "Methods": [ + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "enumerate", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return an enumerate object.\n\n iterable\n an object supporting iteration\n\nThe enumerate object yields pairs containing a count (from start, which\ndefaults to zero) and a value yielded by the iterable argument.\n\nenumerate is useful for obtaining an indexed list:\n (0, seq[0]), (1, seq[1]), (2, seq[2]), ...", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "enumerate", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "enumerate", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "enumerate", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:enumerate" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Implement next(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "enumerate", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__next__" + }, + { + "Documentation": "Return state information for pickling.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "enumerate", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__reduce__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "enumerate", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + } ], - "Methods": [], "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "property", - "Documentation": "Property attribute.\n\n fget\n function to be used for getting an attribute value\n fset\n function to be used for setting an attribute value\n fdel\n function to be used for del'ing an attribute\n doc\n docstring\n\nTypical use is to define a managed attribute x:\n\nclass C(object):\n def getx(self): return self._x\n def setx(self, value): self._x = value\n def delx(self): del self._x\n x = property(getx, setx, delx, \"I'm the 'x' property.\")\n\nDecorators make defining new properties or modifying existing ones easy:\n\nclass C(object):\n @property\n def x(self):\n \"I am the 'x' property.\"\n return self._x\n @x.setter\n def x(self, value):\n self._x = value\n @x.deleter\n def x(self):\n del self._x" - }, - { - "Bases": [ - "object" + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } ], - "Methods": [], - "Properties": [], - "Fields": [], "GenericParameters": null, "InnerClasses": [], - "Name": "classmethod", - "Documentation": "classmethod(function) -> method\n\nConvert a function to be a class method.\n\nA class method receives the class as implicit first argument,\njust like an instance method receives the instance.\nTo declare a class method, use this idiom:\n\n class C:\n @classmethod\n def f(cls, arg1, arg2, ...):\n ...\n\nIt can be called either on the class (e.g. C.f()) or on an instance\n(e.g. C().f()). The instance is ignored except for its class.\nIf a class method is called for a derived class, the derived class\nobject is passed as the implied first argument.\n\nClass methods are different than C++ or Java static methods.\nIf you want those, see the staticmethod builtin." + "Name": "enumerate" }, { + "Documentation": "filter(function or None, iterable) --> filter object\n\nReturn an iterator yielding those items of iterable for which function(item)\nis true. If function is None, return the items that are true.", "Bases": [ "object" ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "staticmethod", - "Documentation": "staticmethod(function) -> method\n\nConvert a function to be a static method.\n\nA static method does not receive an implicit first argument.\nTo declare a static method, use this idiom:\n\n class C:\n @staticmethod\n def f(arg1, arg2, ...):\n ...\n\nIt can be called either on the class (e.g. C.f()) or on an instance\n(e.g. C().f()). The instance is ignored except for its class.\n\nStatic methods in Python are similar to those found in Java or C++.\nFor a more advanced concept, see the classmethod builtin." - }, - { - "Bases": [ - "object" + "Methods": [ + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "filter", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "filter(function or None, iterable) --> filter object\n\nReturn an iterator yielding those items of iterable for which function(item)\nis true. If function is None, return the items that are true.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "filter", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "functionorNone", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "iterable", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "filter", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "filter", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:filter" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Implement next(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "filter", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__next__" + }, + { + "Documentation": "Return state information for pickling.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "filter", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__reduce__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "filter", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + } ], - "Methods": [], "Properties": [], - "Fields": [], + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], "GenericParameters": null, "InnerClasses": [], - "Name": "...", - "Documentation": null + "Name": "filter" }, { + "Documentation": "map(func, *iterables) --> map object\n\nMake an iterator that computes the function using arguments from\neach of the iterables. Stops when the shortest iterable is exhausted.", "Bases": [ "object" ], - "Methods": [], + "Methods": [ + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "map", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "map(func, *iterables) --> map object\n\nMake an iterator that computes the function using arguments from\neach of the iterables. Stops when the shortest iterable is exhausted.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "map", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "func", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "iterables", + "Type": null, + "DefaultValue": null, + "Kind": 1 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "map", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "map", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:map" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Implement next(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "map", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__next__" + }, + { + "Documentation": "Return state information for pickling.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "map", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__reduce__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "map", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + } + ], "Properties": [], - "Fields": [], + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], "GenericParameters": null, "InnerClasses": [], - "Name": "tuple_iterator", - "Documentation": null + "Name": "map" }, { + "Documentation": "Create a new memoryview object which references the given object.", "Bases": [ "object" ], - "Methods": [], - "Properties": [], - "Fields": [], + "Methods": [ + { + "Documentation": "Delete self[key].", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "memoryview", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__delitem__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "memoryview", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:memoryview" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__enter__" + }, + { + "Documentation": "Return self==value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "memoryview", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__eq__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "memoryview", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__exit__" + }, + { + "Documentation": "Return self>=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "memoryview", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "memoryview", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return self[key].", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "memoryview", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getitem__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "memoryview", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Return hash(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "memoryview", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__hash__" + }, + { + "Documentation": "Create a new memoryview object which references the given object.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "memoryview", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "memoryview", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "memoryview", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return len(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "memoryview", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__len__" + }, + { + "Documentation": "Return self=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "slice", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "slice", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "slice", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "slice(stop)\nslice(start, stop[, step])\n\nCreate a slice object. This is used for extended slicing (e.g. a[0:10:2]).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "slice", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "start", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "stop", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "step", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "slice", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "slice", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return self (start, stop, stride)\n\nAssuming a sequence of length len, calculate the start and stop\nindices, and the stride length of the extended slice described by\nS. Out of bounds indices are clipped in a manner consistent with the\nhandling of normal slices.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "slice", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "indices" + } + ], + "Properties": [ + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "start" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "step" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "stop" + } + ], + "Fields": [ + { + "Value": null, + "Name": "__hash__" + }, + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], "GenericParameters": null, "InnerClasses": [], - "Name": "dict_values", - "Documentation": null + "Name": "slice" }, { + "Documentation": "super() -> same as super(__class__, )\nsuper(type) -> unbound super object\nsuper(type, obj) -> bound super object; requires isinstance(obj, type)\nsuper(type, type2) -> bound super object; requires issubclass(type2, type)\nTypical use to call a cooperative superclass method:\nclass C(B):\n def meth(self, arg):\n super().meth(arg)\nThis works for class methods too:\nclass C(B):\n @classmethod\n def cmeth(cls, arg):\n super().cmeth(arg)\n", "Bases": [ "object" ], - "Methods": [], - "Properties": [], - "Fields": [], + "Methods": [ + { + "Documentation": "Return an attribute of instance, which is of type owner.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "super", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "instance", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "owner", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:super" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__get__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "super", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "super() -> same as super(__class__, )\nsuper(type) -> unbound super object\nsuper(type, obj) -> bound super object; requires isinstance(obj, type)\nsuper(type, type2) -> bound super object; requires issubclass(type2, type)\nTypical use to call a cooperative superclass method:\nclass C(B):\n def meth(self, arg):\n super().meth(arg)\nThis works for class methods too:\nclass C(B):\n @classmethod\n def cmeth(cls, arg):\n super().cmeth(arg)\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "super", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "type", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "type2", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "super", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Return repr(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "super", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__repr__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "super", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + } + ], + "Properties": [ + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "__self__" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "__self_class__" + }, + { + "Documentation": "", + "ReturnType": null, + "Attributes": 0, + "Name": "__thisclass__" + } + ], + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], "GenericParameters": null, "InnerClasses": [], - "Name": "dict_items", - "Documentation": null + "Name": "super" }, { + "Documentation": "zip(iter1 [,iter2 [...]]) --> zip object\n\nReturn a zip object whose .__next__() method returns a tuple where\nthe i-th element comes from the i-th iterable argument. The .__next__()\nmethod continues until the shortest iterable in the argument sequence\nis exhausted and then it raises StopIteration.", "Bases": [ "object" ], - "Methods": [], + "Methods": [ + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "zip", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "zip(iter1 [,iter2 [...]]) --> zip object\n\nReturn a zip object whose .__next__() method returns a tuple where\nthe i-th element comes from the i-th iterable argument. The .__next__()\nmethod continues until the shortest iterable in the argument sequence\nis exhausted and then it raises StopIteration.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "zip", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "zip", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "zip", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:zip" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Implement next(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "zip", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__next__" + }, + { + "Documentation": "Return state information for pickling.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "zip", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__reduce__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "zip", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + } + ], "Properties": [], - "Fields": [], + "Fields": [ + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], "GenericParameters": null, "InnerClasses": [], - "Name": "set_iterator", - "Documentation": null + "Name": "zip" }, { + "Documentation": "type(object_or_name, bases, dict)\ntype(object) -> the object's type\ntype(name, bases, dict) -> a new type", "Bases": [ "object" ], - "Methods": [], + "Methods": [ + { + "Documentation": "Call self as a function.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "type", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__call__" + }, + { + "Documentation": "Implement delattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "type", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__delattr__" + }, + { + "Documentation": "Specialized __dir__ implementation for types.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "type", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:list" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__dir__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "type", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "type(object_or_name, bases, dict)\ntype(object) -> the object's type\ntype(name, bases, dict) -> a new type", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "type", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "object_or_name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "bases", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "dict", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "type", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Check if an object is an instance.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "type", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "instance", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__instancecheck__" + }, + { + "Documentation": "__prepare__() -> dict\nused to create the namespace for the class statement", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "type", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "bases", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "kwds", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__prepare__" + }, + { + "Documentation": "Return repr(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "type", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__repr__" + }, + { + "Documentation": "Implement setattr(self, name, value).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "type", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__setattr__" + }, + { + "Documentation": "Return memory consumption of the type object.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "type", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__sizeof__" + }, + { + "Documentation": "Check if a class is a subclass.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "type", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasscheck__" + }, + { + "Documentation": "Return a list of immediate subclasses.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "type", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasses__" + }, + { + "Documentation": "Abstract classes can override this to customize issubclass().\n\nThis is invoked early on by abc.ABCMeta.__subclasscheck__().\nIt should return True, False or NotImplemented. If it returns\nNotImplemented, the normal algorithm is used. Otherwise, it\noverrides the normal algorithm (and the outcome is cached).\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "type", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "subclass", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__subclasshook__" + } + ], "Properties": [], - "Fields": [], + "Fields": [ + { + "Value": null, + "Name": "__basicsize__" + }, + { + "Value": "i:dict", + "Name": "__dict__" + }, + { + "Value": null, + "Name": "__dictoffset__" + }, + { + "Value": null, + "Name": "__flags__" + }, + { + "Value": null, + "Name": "__itemsize__" + }, + { + "Value": "i:tuple", + "Name": "__mro__" + }, + { + "Value": null, + "Name": "__name__" + }, + { + "Value": null, + "Name": "__qualname__" + }, + { + "Value": null, + "Name": "__text_signature__" + }, + { + "Value": null, + "Name": "__weakrefoffset__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], "GenericParameters": null, "InnerClasses": [], - "Name": "callable_iterator", - "Documentation": null + "Name": "type" } ], - "Name": "builtins", - "Documentation": "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices." + "Name": "builtins" } \ No newline at end of file From bec2a82abb2c72c4bf168c82ae8ae37feee696e9 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Thu, 13 Jun 2019 12:38:14 -0700 Subject: [PATCH 64/82] Save builtins --- .../Ast/Impl/Properties/AssemblyInfo.cs | 1 + .../Microsoft.Python.Analysis.Tests.csproj | 3 +++ .../Ast/Test/Properties/AssemblyInfo.cs | 18 ++++++++++++++++++ src/Caching/Impl/Models/ModuleModel.cs | 3 ++- src/Caching/Impl/PythonDbModule.cs | 1 + src/Caching/Impl/TypeNames.cs | 2 +- src/Caching/Test/BasicTests.cs | 13 ++++++++++--- src/Caching/Test/Files/Builtins.json | 12 ++++++++++++ .../Test/FluentAssertions/AssertionsFactory.cs | 9 +++++++-- 9 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 src/Analysis/Ast/Test/Properties/AssemblyInfo.cs diff --git a/src/Analysis/Ast/Impl/Properties/AssemblyInfo.cs b/src/Analysis/Ast/Impl/Properties/AssemblyInfo.cs index b7b07d6de..9aa458a2d 100644 --- a/src/Analysis/Ast/Impl/Properties/AssemblyInfo.cs +++ b/src/Analysis/Ast/Impl/Properties/AssemblyInfo.cs @@ -17,4 +17,5 @@ [assembly: InternalsVisibleTo("Microsoft.Python.Analysis.Caching, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("Microsoft.Python.Analysis.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +[assembly: InternalsVisibleTo("Microsoft.Python.Analysis.Caching.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("Microsoft.Python.LanguageServer.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] diff --git a/src/Analysis/Ast/Test/Microsoft.Python.Analysis.Tests.csproj b/src/Analysis/Ast/Test/Microsoft.Python.Analysis.Tests.csproj index 4a7a9f7a7..c4c6a9380 100644 --- a/src/Analysis/Ast/Test/Microsoft.Python.Analysis.Tests.csproj +++ b/src/Analysis/Ast/Test/Microsoft.Python.Analysis.Tests.csproj @@ -42,6 +42,9 @@ + + + diff --git a/src/Analysis/Ast/Test/Properties/AssemblyInfo.cs b/src/Analysis/Ast/Test/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..9d32fae0c --- /dev/null +++ b/src/Analysis/Ast/Test/Properties/AssemblyInfo.cs @@ -0,0 +1,18 @@ +// 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.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Microsoft.Python.Analysis.Caching.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] diff --git a/src/Caching/Impl/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs index 7f73192a9..267f231ce 100644 --- a/src/Caching/Impl/Models/ModuleModel.cs +++ b/src/Caching/Impl/Models/ModuleModel.cs @@ -35,7 +35,8 @@ public static ModuleModel FromAnalysis(IDocumentAnalysis analysis) { // Go directly through variables rather than GetMemberNames/GetMember since // module may have non-exported variables and types that it may be returning // from functions and methods or otherwise using in declarations. - foreach (var v in analysis.GlobalScope.Variables.Where(v => v.Source == VariableSource.Declaration)) { + foreach (var v in analysis.GlobalScope.Variables + .Where(v => v.Source == VariableSource.Declaration || v.Source == VariableSource.Builtin)) { var t = v.Value.GetPythonType(); // Create type model before variable since variable needs it. string typeName = null; diff --git a/src/Caching/Impl/PythonDbModule.cs b/src/Caching/Impl/PythonDbModule.cs index d9e44f011..3afd13556 100644 --- a/src/Caching/Impl/PythonDbModule.cs +++ b/src/Caching/Impl/PythonDbModule.cs @@ -19,6 +19,7 @@ using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; using Microsoft.Python.Core; +using GlobalScope = Microsoft.Python.Analysis.Caching.GlobalScope; namespace Microsoft.Python.Analysis.Caching { internal sealed class PythonDbModule : SpecializedModule { diff --git a/src/Caching/Impl/TypeNames.cs b/src/Caching/Impl/TypeNames.cs index 24fe85af7..6e7ae1fcc 100644 --- a/src/Caching/Impl/TypeNames.cs +++ b/src/Caching/Impl/TypeNames.cs @@ -27,7 +27,7 @@ public static string GetQualifiedName(this IMember m) { case IPythonInstance _: return $"i:{GetQualifiedName(t)}"; case IPythonType pt when pt.DeclaringModule.ModuleType == ModuleType.Builtins: - return pt.Name == "..." ? "ellipsis" : pt.Name; + return pt.TypeId == BuiltinTypeId.Ellipsis ? "ellipsis" : pt.Name; case IPythonType pt: return pt.QualifiedName; case null: diff --git a/src/Caching/Test/BasicTests.cs b/src/Caching/Test/BasicTests.cs index 4de502c4b..fde88fa99 100644 --- a/src/Caching/Test/BasicTests.cs +++ b/src/Caching/Test/BasicTests.cs @@ -14,9 +14,9 @@ // permissions and limitations under the License. using System.IO; -using System.Linq; using System.Threading.Tasks; using Microsoft.Python.Analysis.Caching.Models; +using Microsoft.Python.Analysis.Caching.Tests.FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using TestUtilities; @@ -61,11 +61,18 @@ def func(): [TestMethod, Priority(0)] public async Task Builtins() { var analysis = await GetAnalysisAsync(string.Empty); - var model = ModuleModel.FromAnalysis(analysis.Document.Interpreter.ModuleResolution.BuiltinsModule.Analysis); + var builtins = analysis.Document.Interpreter.ModuleResolution.BuiltinsModule; + var model = ModuleModel.FromAnalysis(builtins.Analysis); + + // Compare data to the baseline. var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); + + // Read persistent data back + var dbModule = new PythonDbModule(model, Services); - var module = new PythonDbModule(model, Services); + // Compare to the original members, should be identical. + dbModule.Should().HaveSameMembersAs(builtins); } diff --git a/src/Caching/Test/Files/Builtins.json b/src/Caching/Test/Files/Builtins.json index a140b48c2..d6f9f0f2c 100644 --- a/src/Caching/Test/Files/Builtins.json +++ b/src/Caching/Test/Files/Builtins.json @@ -1474,6 +1474,18 @@ { "Value": null, "Name": "__package__" + }, + { + "Value": "bool", + "Name": "True" + }, + { + "Value": "bool", + "Name": "False" + }, + { + "Value": "__NoneType__", + "Name": "None" } ], "Classes": [ diff --git a/src/Caching/Test/FluentAssertions/AssertionsFactory.cs b/src/Caching/Test/FluentAssertions/AssertionsFactory.cs index beea908f7..594897a40 100644 --- a/src/Caching/Test/FluentAssertions/AssertionsFactory.cs +++ b/src/Caching/Test/FluentAssertions/AssertionsFactory.cs @@ -14,19 +14,24 @@ // permissions and limitations under the License. using System.Diagnostics.CodeAnalysis; +using Microsoft.Python.Analysis.Tests.FluentAssertions; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; using Microsoft.Python.Core.Text; -namespace Microsoft.Python.Analysis.Tests.FluentAssertions { +namespace Microsoft.Python.Analysis.Caching.Tests.FluentAssertions { [ExcludeFromCodeCoverage] internal static class AssertionsFactory { public static DocumentAnalysisAssertions Should(this IDocumentAnalysis analysis) => new DocumentAnalysisAssertions(analysis); - public static VariableAssertions Should(this IVariable v) => new VariableAssertions(v); + public static MemberAssertions Should(this IMember member) => new MemberAssertions(member); + public static PythonFunctionAssertions Should(this IPythonFunctionType f) => new PythonFunctionAssertions(f); + public static PythonFunctionOverloadAssertions Should(this IPythonFunctionOverload f) => new PythonFunctionOverloadAssertions(f); + public static ParameterAssertions Should(this IParameterInfo p) => new ParameterAssertions(p); public static RangeAssertions Should(this Range? range) => new RangeAssertions(range); public static SourceSpanAssertions Should(this SourceSpan span) => new SourceSpanAssertions(span); public static SourceSpanAssertions Should(this SourceSpan? span) => new SourceSpanAssertions(span.Value); + public static VariableAssertions Should(this IVariable v) => new VariableAssertions(v); } } From 80c9b1cec2313322f71d981c05847c4d6593b9bd Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Thu, 13 Jun 2019 13:00:51 -0700 Subject: [PATCH 65/82] Test passes --- src/Caching/Impl/Models/ClassModel.cs | 2 +- src/Caching/Test/Files/Builtins.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Caching/Impl/Models/ClassModel.cs b/src/Caching/Impl/Models/ClassModel.cs index 7c1d4b5e3..8ff65828f 100644 --- a/src/Caching/Impl/Models/ClassModel.cs +++ b/src/Caching/Impl/Models/ClassModel.cs @@ -79,7 +79,7 @@ private ClassModel(IPythonClassType cls) { } } - Name = cls.Name; + Name = cls.TypeId == BuiltinTypeId.Ellipsis ? "ellipsis" : cls.Name; Documentation = cls.Documentation; Bases = cls.Bases.OfType().Select(t => t.GetQualifiedName()).ToArray(); Methods = methods.ToArray(); diff --git a/src/Caching/Test/Files/Builtins.json b/src/Caching/Test/Files/Builtins.json index d6f9f0f2c..794678c66 100644 --- a/src/Caching/Test/Files/Builtins.json +++ b/src/Caching/Test/Files/Builtins.json @@ -16433,7 +16433,7 @@ ], "GenericParameters": null, "InnerClasses": [], - "Name": "..." + "Name": "ellipsis" }, { "Documentation": null, From 5b372f7985f75dea9b83eb69c9f06112894ad792 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Thu, 13 Jun 2019 13:15:03 -0700 Subject: [PATCH 66/82] Qualified name --- .../Evaluation/ExpressionEval.Callables.cs | 1 - .../Analyzer/Symbols/FunctionEvaluator.cs | 1 - .../Extensions/PythonFunctionExtensions.cs | 13 ++++- .../Ast/Impl/Modules/PythonModule.Id.cs | 2 +- src/Analysis/Ast/Impl/Types/ArgumentSet.cs | 1 - .../Ast/Impl/Types/PythonFunctionType.cs | 2 + .../Ast/Impl/Types/PythonPropertyType.cs | 4 +- .../PythonFunctionAssertions.cs | 2 - src/Caching/Impl/TypeNames.cs | 10 ---- src/Caching/Test/BasicTests.cs | 26 ++++++++- src/Caching/Test/Files/Requests.json | 54 +++++++++++++++++++ 11 files changed, 95 insertions(+), 21 deletions(-) create mode 100644 src/Caching/Test/Files/Requests.json diff --git a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs index 38346a6e0..657ab23d2 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs @@ -17,7 +17,6 @@ using System.Diagnostics; using System.Linq; using Microsoft.Python.Analysis.Documents; -using Microsoft.Python.Analysis.Extensions; using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; diff --git a/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs b/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs index 847bbc000..9732aea0e 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Symbols/FunctionEvaluator.cs @@ -18,7 +18,6 @@ using System.Diagnostics; using System.Linq; using Microsoft.Python.Analysis.Analyzer.Evaluation; -using Microsoft.Python.Analysis.Extensions; using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; diff --git a/src/Analysis/Ast/Impl/Extensions/PythonFunctionExtensions.cs b/src/Analysis/Ast/Impl/Extensions/PythonFunctionExtensions.cs index b1914d9c0..0d8301240 100644 --- a/src/Analysis/Ast/Impl/Extensions/PythonFunctionExtensions.cs +++ b/src/Analysis/Ast/Impl/Extensions/PythonFunctionExtensions.cs @@ -13,12 +13,13 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. +using System.Collections.Generic; using System.Linq; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; using Microsoft.Python.Core; -namespace Microsoft.Python.Analysis.Extensions { +namespace Microsoft.Python.Analysis { public static class PythonFunctionExtensions { public static bool IsUnbound(this IPythonFunctionType f) => f.DeclaringType != null && f.MemberType == PythonMemberType.Function; @@ -34,5 +35,15 @@ public static IScope GetScope(this IPythonFunctionType f) { IScope gs = f.DeclaringModule.GlobalScope; return gs?.TraverseBreadthFirst(s => s.Children).FirstOrDefault(s => s.Node == f.FunctionDefinition); } + + public static string GetQualifiedName(this IPythonClassMember cm) { + var s = new Stack(); + s.Push(cm.Name); + for (var p = cm.DeclaringType as IPythonClassMember; p != null; p = p.DeclaringType as IPythonClassMember) { + s.Push(p.Name); + } + return string.Join(".", s); + } + } } diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.Id.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.Id.cs index df2990b8e..67550e6fa 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.Id.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.Id.cs @@ -27,7 +27,7 @@ private string CalculateUniqueId() { var sitePackagesPath = PythonLibraryPath.GetSitePackagesPath(Interpreter.Configuration); if (FileSystem.IsPathUnderRoot(sitePackagesPath, FilePath)) { // If module is in site-packages and is versioned, then unique id = name + version + interpreter version. - // Example: 'lxml' and 'lxml-4.2.5.dist-info'. + // Example: 'requests' and 'requests-2.21.0.dist-info'. var moduleFolder = Path.GetDirectoryName(Path.GetDirectoryName(FilePath)); var folders = FileSystem .GetFileSystemEntries(moduleFolder, "*-*.dist-info", SearchOption.TopDirectoryOnly) diff --git a/src/Analysis/Ast/Impl/Types/ArgumentSet.cs b/src/Analysis/Ast/Impl/Types/ArgumentSet.cs index 6aa2b5038..e0acc25a7 100644 --- a/src/Analysis/Ast/Impl/Types/ArgumentSet.cs +++ b/src/Analysis/Ast/Impl/Types/ArgumentSet.cs @@ -20,7 +20,6 @@ using Microsoft.Python.Analysis.Analyzer; using Microsoft.Python.Analysis.Analyzer.Evaluation; using Microsoft.Python.Analysis.Diagnostics; -using Microsoft.Python.Analysis.Extensions; using Microsoft.Python.Analysis.Values; using Microsoft.Python.Core; using Microsoft.Python.Parsing; diff --git a/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs b/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs index 82c1def63..865fdac58 100644 --- a/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonFunctionType.cs @@ -72,6 +72,8 @@ Location location public override PythonMemberType MemberType => TypeId == BuiltinTypeId.Function ? PythonMemberType.Function : PythonMemberType.Method; + public override string QualifiedName => this.GetQualifiedName(); + public override IMember Call(IPythonInstance instance, string memberName, IArgumentSet args) { // Now we can go and find overload with matching arguments. var overload = Overloads[args.OverloadIndex]; diff --git a/src/Analysis/Ast/Impl/Types/PythonPropertyType.cs b/src/Analysis/Ast/Impl/Types/PythonPropertyType.cs index 850fd5e0f..56913f45a 100644 --- a/src/Analysis/Ast/Impl/Types/PythonPropertyType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonPropertyType.cs @@ -33,13 +33,11 @@ public PythonPropertyType(string name, Location location, IPythonType declaringT } #region IPythonType - public override PythonMemberType MemberType => PythonMemberType.Property; - + public override string QualifiedName => this.GetQualifiedName(); #endregion #region IPythonPropertyType - public FunctionDefinition FunctionDefinition => DeclaringModule.GetAstNode(this); public override bool IsAbstract { get; } public bool IsReadOnly => true; diff --git a/src/Analysis/Ast/Test/FluentAssertions/PythonFunctionAssertions.cs b/src/Analysis/Ast/Test/FluentAssertions/PythonFunctionAssertions.cs index cd1d846dd..5ba32fa27 100644 --- a/src/Analysis/Ast/Test/FluentAssertions/PythonFunctionAssertions.cs +++ b/src/Analysis/Ast/Test/FluentAssertions/PythonFunctionAssertions.cs @@ -13,12 +13,10 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. -using System; using System.Linq; using FluentAssertions; using FluentAssertions.Execution; using FluentAssertions.Primitives; -using Microsoft.Python.Analysis.Extensions; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; using static Microsoft.Python.Analysis.Tests.FluentAssertions.AssertionsUtilities; diff --git a/src/Caching/Impl/TypeNames.cs b/src/Caching/Impl/TypeNames.cs index 6e7ae1fcc..32ddfaa9c 100644 --- a/src/Caching/Impl/TypeNames.cs +++ b/src/Caching/Impl/TypeNames.cs @@ -13,7 +13,6 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. -using System.Collections.Generic; using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; @@ -36,14 +35,5 @@ public static string GetQualifiedName(this IMember m) { } return null; } - - private static string GetQualifiedName(this IPythonClassMember cm) { - var s = new Stack(); - s.Push(cm.Name); - for (var p = cm.DeclaringType as IPythonClassMember; p != null; p = p.DeclaringType as IPythonClassMember) { - s.Push(p.Name); - } - return string.Join(".", s); - } } } diff --git a/src/Caching/Test/BasicTests.cs b/src/Caching/Test/BasicTests.cs index fde88fa99..df9836adb 100644 --- a/src/Caching/Test/BasicTests.cs +++ b/src/Caching/Test/BasicTests.cs @@ -17,6 +17,9 @@ using System.Threading.Tasks; using Microsoft.Python.Analysis.Caching.Models; using Microsoft.Python.Analysis.Caching.Tests.FluentAssertions; +using Microsoft.Python.Analysis.Modules; +using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Parsing.Tests; using Microsoft.VisualStudio.TestTools.UnitTesting; using TestUtilities; @@ -70,7 +73,6 @@ public async Task Builtins() { // Read persistent data back var dbModule = new PythonDbModule(model, Services); - // Compare to the original members, should be identical. dbModule.Should().HaveSameMembersAs(builtins); } @@ -84,5 +86,27 @@ public async Task Sys() { var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); } + + [TestMethod, Priority(0)] + public async Task Requests() { + const string code = @" +import requests +x = requests.get('microsoft.com') +"; + var analysis = await GetAnalysisAsync(code, PythonVersions.LatestAvailable3X); + var v = analysis.GlobalScope.Variables["requests"]; + v.Should().NotBeNull(); + if (v.Value.GetPythonType().ModuleType == ModuleType.Unresolved) { + Assert.Inconclusive("'requests' package is not installed."); + } + + var rq = analysis.Document.Interpreter.ModuleResolution.GetImportedModule("requests"); + var model = ModuleModel.FromAnalysis(rq.Analysis); + var json = ToJson(model); + Baseline.CompareToFile(BaselineFileName, json); + + for var dbModule = new PythonDbModule(model, Services); + dbModule.Should().HaveSameMembersAs(rq); + } } } diff --git a/src/Caching/Test/Files/Requests.json b/src/Caching/Test/Files/Requests.json new file mode 100644 index 000000000..a49d3616f --- /dev/null +++ b/src/Caching/Test/Files/Requests.json @@ -0,0 +1,54 @@ +{ + "Documentation": "Requests HTTP Library\r\n~~~~~~~~~~~~~~~~~~~~~\r\n\r\nRequests is an HTTP library, written in Python, for human beings. Basic GET\r\nusage:\r\n\r\n >>> import requests\r\n >>> r = requests.get('https://www.python.org')\r\n >>> r.status_code\r\n 200\r\n >>> 'Python is a programming language' in r.content\r\n True\r\n\r\n... or POST:\r\n\r\n >>> payload = dict(key1='value1', key2='value2')\r\n >>> r = requests.post('https://httpbin.org/post', data=payload)\r\n >>> print(r.text)\r\n {\r\n ...\r\n \"form\": {\r\n \"key2\": \"value2\",\r\n \"key1\": \"value1\"\r\n },\r\n ...\r\n }\r\n\r\nThe other HTTP methods are supported - see `requests.api`. Full documentation\r\nis at .\r\n\r\n:copyright: (c) 2017 by Kenneth Reitz.\r\n:license: Apache 2.0, see LICENSE for more details.\r\n", + "Functions": [ + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "urllib3_version", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "chardet_version", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "check_compatibility" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "cryptography_version", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "_check_cryptography" + } + ], + "Variables": [], + "Classes": [], + "Name": "requests" +} \ No newline at end of file From 30665541a4e12b544243cec9465c516a7e4eb935 Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Thu, 13 Jun 2019 21:56:26 -0700 Subject: [PATCH 67/82] Better export detection --- src/Caching/Impl/Models/ModuleModel.cs | 9 +- src/Caching/Test/BasicTests.cs | 2 +- src/Caching/Test/Files/Requests.json | 175 ++++++++++++++++++++++++- 3 files changed, 178 insertions(+), 8 deletions(-) diff --git a/src/Caching/Impl/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs index 267f231ce..b0ebd5989 100644 --- a/src/Caching/Impl/Models/ModuleModel.cs +++ b/src/Caching/Impl/Models/ModuleModel.cs @@ -32,12 +32,9 @@ public static ModuleModel FromAnalysis(IDocumentAnalysis analysis) { var functions = new Dictionary(); var classes = new Dictionary(); - // Go directly through variables rather than GetMemberNames/GetMember since - // module may have non-exported variables and types that it may be returning - // from functions and methods or otherwise using in declarations. - foreach (var v in analysis.GlobalScope.Variables - .Where(v => v.Source == VariableSource.Declaration || v.Source == VariableSource.Builtin)) { - var t = v.Value.GetPythonType(); + // Go directly through variables which names are listed in GetMemberNames. + var exportedNames = new HashSet(analysis.Document.GetMemberNames()); + foreach (var v in analysis.GlobalScope.Variables.Where(v => exportedNames.Contains(v.Name))) { // Create type model before variable since variable needs it. string typeName = null; switch (v.Value) { diff --git a/src/Caching/Test/BasicTests.cs b/src/Caching/Test/BasicTests.cs index df9836adb..5e5aa4fab 100644 --- a/src/Caching/Test/BasicTests.cs +++ b/src/Caching/Test/BasicTests.cs @@ -105,7 +105,7 @@ import requests var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); - for var dbModule = new PythonDbModule(model, Services); + var dbModule = new PythonDbModule(model, Services); dbModule.Should().HaveSameMembersAs(rq); } } diff --git a/src/Caching/Test/Files/Requests.json b/src/Caching/Test/Files/Requests.json index a49d3616f..1dc2902af 100644 --- a/src/Caching/Test/Files/Requests.json +++ b/src/Caching/Test/Files/Requests.json @@ -48,7 +48,180 @@ "Name": "_check_cryptography" } ], - "Variables": [], + "Variables": [ + { + "Value": "PythonVariableModule.urllib3", + "Name": "urllib3" + }, + { + "Value": "PythonVariableModule.chardet", + "Name": "chardet" + }, + { + "Value": "PythonVariableModule.warnings", + "Name": "warnings" + }, + { + "Value": "requests.exceptions.RequestsDependencyWarning", + "Name": "RequestsDependencyWarning" + }, + { + "Value": "PythonVariableModule.urllib3.contrib.pyopenssl", + "Name": "pyopenssl" + }, + { + "Value": "urllib3.exceptions.DependencyWarning", + "Name": "DependencyWarning" + }, + { + "Value": "i:str", + "Name": "__title__" + }, + { + "Value": "i:str", + "Name": "__description__" + }, + { + "Value": "i:str", + "Name": "__url__" + }, + { + "Value": "i:str", + "Name": "__version__" + }, + { + "Value": "i:int", + "Name": "__build__" + }, + { + "Value": "i:str", + "Name": "__author__" + }, + { + "Value": "i:str", + "Name": "__author_email__" + }, + { + "Value": "i:str", + "Name": "__license__" + }, + { + "Value": "i:str", + "Name": "__copyright__" + }, + { + "Value": "i:str", + "Name": "__cake__" + }, + { + "Value": "PythonVariableModule.requests.utils", + "Name": "utils" + }, + { + "Value": "PythonVariableModule.requests.packages", + "Name": "packages" + }, + { + "Value": null, + "Name": "Request" + }, + { + "Value": null, + "Name": "Response" + }, + { + "Value": null, + "Name": "PreparedRequest" + }, + { + "Value": "request", + "Name": "request" + }, + { + "Value": "get", + "Name": "get" + }, + { + "Value": "head", + "Name": "head" + }, + { + "Value": "post", + "Name": "post" + }, + { + "Value": "patch", + "Name": "patch" + }, + { + "Value": "put", + "Name": "put" + }, + { + "Value": "delete", + "Name": "delete" + }, + { + "Value": "options", + "Name": "options" + }, + { + "Value": null, + "Name": "session" + }, + { + "Value": null, + "Name": "Session" + }, + { + "Value": null, + "Name": "codes" + }, + { + "Value": "requests.exceptions.RequestException", + "Name": "RequestException" + }, + { + "Value": "requests.exceptions.Timeout", + "Name": "Timeout" + }, + { + "Value": "requests.exceptions.URLRequired", + "Name": "URLRequired" + }, + { + "Value": "requests.exceptions.TooManyRedirects", + "Name": "TooManyRedirects" + }, + { + "Value": "requests.exceptions.HTTPError", + "Name": "HTTPError" + }, + { + "Value": "requests.exceptions.ConnectionError", + "Name": "ConnectionError" + }, + { + "Value": "requests.exceptions.FileModeWarning", + "Name": "FileModeWarning" + }, + { + "Value": "requests.exceptions.ConnectTimeout", + "Name": "ConnectTimeout" + }, + { + "Value": "requests.exceptions.ReadTimeout", + "Name": "ReadTimeout" + }, + { + "Value": "PythonVariableModule.logging", + "Name": "logging" + }, + { + "Value": null, + "Name": "NullHandler" + } + ], "Classes": [], "Name": "requests" } \ No newline at end of file From 91491d4c3355697d0d473b618c426e1e81dc5dfe Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Fri, 14 Jun 2019 12:15:04 -0700 Subject: [PATCH 68/82] Test fixes --- .../Impl/Analyzer/Handlers/ImportHandler.cs | 4 +- .../Modules/CompiledBuiltinPythonModule.cs | 2 +- ...honModule.Id.cs => ModuleQualifiedName.cs} | 48 +- src/Analysis/Ast/Impl/Modules/PythonModule.cs | 26 +- .../Ast/Impl/Modules/PythonVariableModule.cs | 30 +- .../Ast/Impl/Modules/SentinelModule.cs | 2 +- .../Ast/Impl/Modules/SpecializedModule.cs | 2 +- src/Caching/Impl/Models/ModuleModel.cs | 8 +- src/Caching/Test/BasicTests.cs | 25 +- src/Caching/Test/Files/Builtins.json | 2 +- src/Caching/Test/Files/SmokeTest.json | 110 +- src/Caching/Test/Files/Sys.json | 5472 ++++++++++++++++- src/Caching/Test/Files/VersionedModule.json | 44 + 13 files changed, 5469 insertions(+), 306 deletions(-) rename src/Analysis/Ast/Impl/Modules/{PythonModule.Id.cs => ModuleQualifiedName.cs} (52%) create mode 100644 src/Caching/Test/Files/VersionedModule.json diff --git a/src/Analysis/Ast/Impl/Analyzer/Handlers/ImportHandler.cs b/src/Analysis/Ast/Impl/Analyzer/Handlers/ImportHandler.cs index f5fe93800..64394f977 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Handlers/ImportHandler.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Handlers/ImportHandler.cs @@ -174,7 +174,7 @@ private PythonVariableModule GetOrCreateVariableModule(in string fullName, in Py return variableModule; } - variableModule = new PythonVariableModule(fullName, Interpreter); + variableModule = new PythonVariableModule(fullName, Eval.Services); _variableModules[fullName] = variableModule; parentModule?.AddChildModule(memberName, variableModule); return variableModule; @@ -186,7 +186,7 @@ private PythonVariableModule GetOrCreateVariableModule(in IPythonModule module, return variableModule; } - variableModule = new PythonVariableModule(module); + variableModule = new PythonVariableModule(module, Eval.Services); _variableModules[moduleFullName] = variableModule; parentModule?.AddChildModule(memberName, variableModule); return variableModule; diff --git a/src/Analysis/Ast/Impl/Modules/CompiledBuiltinPythonModule.cs b/src/Analysis/Ast/Impl/Modules/CompiledBuiltinPythonModule.cs index 693c82545..15f7134c4 100644 --- a/src/Analysis/Ast/Impl/Modules/CompiledBuiltinPythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/CompiledBuiltinPythonModule.cs @@ -26,7 +26,7 @@ internal sealed class CompiledBuiltinPythonModule : CompiledPythonModule { public CompiledBuiltinPythonModule(string moduleName, IPythonModule stub, IServiceContainer services) : base(moduleName, ModuleType.CompiledBuiltin, MakeFakeFilePath(moduleName, services), stub, services) { } - public override string UniqueId => $"{Name}({Interpreter.Configuration.Version})"; + public override string QualifiedName => $"{Name}({Interpreter.Configuration.Version})"; protected override string[] GetScrapeArguments(IPythonInterpreter interpreter) => !InstallPath.TryGetFile("scrape_module.py", out var sm) ? null : new [] { "-W", "ignore", "-B", "-E", sm, "-u8", Name }; diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.Id.cs b/src/Analysis/Ast/Impl/Modules/ModuleQualifiedName.cs similarity index 52% rename from src/Analysis/Ast/Impl/Modules/PythonModule.Id.cs rename to src/Analysis/Ast/Impl/Modules/ModuleQualifiedName.cs index 67550e6fa..d29cecfd7 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.Id.cs +++ b/src/Analysis/Ast/Impl/Modules/ModuleQualifiedName.cs @@ -17,46 +17,52 @@ using System.IO; using System.Linq; using System.Security.Cryptography; -using System.Text; using Microsoft.Python.Analysis.Core.Interpreter; +using Microsoft.Python.Analysis.Types; using Microsoft.Python.Core.IO; namespace Microsoft.Python.Analysis.Modules { - internal partial class PythonModule { - private string CalculateUniqueId() { - var sitePackagesPath = PythonLibraryPath.GetSitePackagesPath(Interpreter.Configuration); - if (FileSystem.IsPathUnderRoot(sitePackagesPath, FilePath)) { + internal static class ModuleQualifiedName { + public static string CalculateQualifiedName(IPythonModule module, IFileSystem fs) { + var config = module.Interpreter.Configuration; + var sitePackagesPath = PythonLibraryPath.GetSitePackagesPath(config); + if (fs.IsPathUnderRoot(sitePackagesPath, module.FilePath)) { // If module is in site-packages and is versioned, then unique id = name + version + interpreter version. // Example: 'requests' and 'requests-2.21.0.dist-info'. - var moduleFolder = Path.GetDirectoryName(Path.GetDirectoryName(FilePath)); - var folders = FileSystem + var moduleFolder = Path.GetDirectoryName(Path.GetDirectoryName(module.FilePath)); + // TODO: for egg (https://github.com/microsoft/python-language-server/issues/196), consider *.egg-info + var folders = fs .GetFileSystemEntries(moduleFolder, "*-*.dist-info", SearchOption.TopDirectoryOnly) - .Where(p => p.StartsWith(Name, StringComparison.OrdinalIgnoreCase)) // Module name can be capitalized differently. + .Select(Path.GetFileName) + .Where(n => n.StartsWith(module.Name, StringComparison.OrdinalIgnoreCase)) // Module name can be capitalized differently. .ToArray(); - if (folders.Length == 2) { - return Path.GetFileNameWithoutExtension(folders[1]); + if (folders.Length == 1) { + return Path.GetFileNameWithoutExtension(folders[0]).Replace('.', ':'); } } - var standardLibraryPath = PythonLibraryPath.GetStandardLibraryPath(Interpreter.Configuration); - if (FileSystem.IsPathUnderRoot(standardLibraryPath, FilePath)) { + var standardLibraryPath = PythonLibraryPath.GetStandardLibraryPath(config); + if (fs.IsPathUnderRoot(standardLibraryPath, module.FilePath)) { // If module is a standard library, unique id is its name + interpreter version. - return $"{Name}({Interpreter.Configuration.Version})"; + return $"{module.Name}({config.Version})"; } // If all else fails, hash the entire content. - return $"{Name}.{HashModuleContent(Path.GetDirectoryName(FilePath))}"; + return $"{module.Name}.{HashModuleContent(Path.GetDirectoryName(module.FilePath), fs)}"; } - private string HashModuleContent(string moduleFolder) { - // TODO: consider async? What about *.pyd? + private static string HashModuleContent(string moduleFolder, IFileSystem fs) { + // Hash file sizes using (var sha256 = SHA256.Create()) { - var bytes = FileSystem - .GetFileSystemEntries(moduleFolder, "*.py", SearchOption.AllDirectories) - .Select(p => sha256.ComputeHash(new UTF8Encoding(false).GetBytes(FileSystem.ReadTextWithRetry(p)))) - .Aggregate((b1, b2) => b1.Zip(b2, (x1, x2) => (byte)(x1 ^ x2)).ToArray()); + var total = fs + .GetFileSystemEntries(moduleFolder, "*.*", SearchOption.AllDirectories) + .Where(fs.FileExists) + .Select(fs.FileSize) + .Aggregate((hash, e) => unchecked(hash * 31 ^ e.GetHashCode())); - return Convert.ToBase64String(bytes).Replace('/', '_').Replace('+', '-'); + return Convert + .ToBase64String(sha256.ComputeHash(BitConverter.GetBytes(total))) + .Replace('/', '_').Replace('+', '-'); } } } diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.cs index bbeca665f..a96e98562 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.cs @@ -16,6 +16,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -60,7 +61,7 @@ private enum State { private CancellationTokenSource _linkedParseCts; // combined with 'dispose' cts private Task _parsingTask; private bool _updated; - private string _uniqueId; + private string _qualifiedName; protected ILogger Log { get; } protected IFileSystem FileSystem { get; } @@ -114,7 +115,15 @@ internal PythonModule(ModuleCreationOptions creationOptions, IServiceContainer s #region IPythonType public string Name { get; } - public virtual string QualifiedName => Name; + + public virtual string QualifiedName { + get { + if (string.IsNullOrEmpty(FilePath) || ModuleType == ModuleType.User || ModuleType == ModuleType.Stub) { + return Name; + } + return string.IsNullOrEmpty(_qualifiedName) ? (_qualifiedName = ModuleQualifiedName.CalculateQualifiedName(this, FileSystem)) : _qualifiedName; + } + } public BuiltinTypeId TypeId => BuiltinTypeId.Module; public bool IsBuiltin => true; @@ -197,19 +206,6 @@ public virtual IEnumerable GetMemberNames() { /// public IPythonModule PrimaryModule { get; private set; } - /// - /// Unique identifier of the module. Derives from module type, - /// library type, version (if available) and the installation path. - /// - public virtual string UniqueId { - get { - if (string.IsNullOrEmpty(FilePath) || ModuleType == ModuleType.User || ModuleType == ModuleType.Stub) { - return string.Empty; - } - return string.IsNullOrEmpty(_uniqueId) ? (_uniqueId = CalculateUniqueId()) : _uniqueId; - } - } - #endregion #region IDisposable diff --git a/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs b/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs index f3d3e5973..56f298233 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs @@ -19,6 +19,7 @@ using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; using Microsoft.Python.Core; +using Microsoft.Python.Core.IO; namespace Microsoft.Python.Analysis.Modules { /// @@ -28,9 +29,18 @@ namespace Microsoft.Python.Analysis.Modules { /// internal sealed class PythonVariableModule : LocatedMember, IPythonModule, IEquatable { private readonly Dictionary _children = new Dictionary(); + private readonly IFileSystem _fs; + private string _qualifiedName; public string Name { get; } - public string QualifiedName => $"{nameof(PythonVariableModule)}.{Name}"; // TODO: re-work. + public string QualifiedName { + get { + if (string.IsNullOrEmpty(FilePath) || ModuleType == ModuleType.User || ModuleType == ModuleType.Stub) { + return Name; + } + return string.IsNullOrEmpty(_qualifiedName) ? (_qualifiedName = ModuleQualifiedName.CalculateQualifiedName(this, _fs)) : _qualifiedName; + } + } public IPythonModule Module { get; } public IPythonInterpreter Interpreter { get; } @@ -48,16 +58,18 @@ internal sealed class PythonVariableModule : LocatedMember, IPythonModule, IEqua public Uri Uri => Module?.Uri; public override PythonMemberType MemberType => PythonMemberType.Module; - public PythonVariableModule(string name, IPythonInterpreter interpreter): base(null) { - Name = name; - Interpreter = interpreter; - SetDeclaringModule(this); - } + public PythonVariableModule(string name, IServiceContainer services) + : this(name, null, services) { } - public PythonVariableModule(IPythonModule module): base(module) { - Name = module.Name; - Interpreter = module.Interpreter; + public PythonVariableModule(IPythonModule module, IServiceContainer services) + : this(module.Name, module, services) { } + + private PythonVariableModule(string name, IPythonModule module, IServiceContainer services) : base(module) { Module = module; + Name = module?.Name ?? name; + Interpreter = module?.Interpreter ?? services.GetService(); + _fs = services.GetService(); + SetDeclaringModule(this); } public void AddChildModule(string memberName, PythonVariableModule module) => _children[memberName] = module; diff --git a/src/Analysis/Ast/Impl/Modules/SentinelModule.cs b/src/Analysis/Ast/Impl/Modules/SentinelModule.cs index 41b56edd9..893f44477 100644 --- a/src/Analysis/Ast/Impl/Modules/SentinelModule.cs +++ b/src/Analysis/Ast/Impl/Modules/SentinelModule.cs @@ -20,6 +20,6 @@ internal sealed class SentinelModule : PythonModule { public SentinelModule(string name, IServiceContainer services) : base(name, ModuleType.Unresolved, services) { } - public override string UniqueId => "unresolved"; + public override string QualifiedName => Name; } } diff --git a/src/Analysis/Ast/Impl/Modules/SpecializedModule.cs b/src/Analysis/Ast/Impl/Modules/SpecializedModule.cs index bb8a31bff..74432abb8 100644 --- a/src/Analysis/Ast/Impl/Modules/SpecializedModule.cs +++ b/src/Analysis/Ast/Impl/Modules/SpecializedModule.cs @@ -33,7 +33,7 @@ internal abstract class SpecializedModule : PythonModule { protected SpecializedModule(string name, string modulePath, IServiceContainer services) : base(name, modulePath, ModuleType.Specialized, null, services) { } - public override string UniqueId => Name; + public override string QualifiedName => Name; protected override string LoadContent() { // Exceptions are handled in the base return FileSystem.FileExists(FilePath) ? FileSystem.ReadTextWithRetry(FilePath) : string.Empty; diff --git a/src/Caching/Impl/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs index b0ebd5989..9b115446e 100644 --- a/src/Caching/Impl/Models/ModuleModel.cs +++ b/src/Caching/Impl/Models/ModuleModel.cs @@ -32,9 +32,11 @@ public static ModuleModel FromAnalysis(IDocumentAnalysis analysis) { var functions = new Dictionary(); var classes = new Dictionary(); - // Go directly through variables which names are listed in GetMemberNames. + // Go directly through variables which names are listed in GetMemberNames + // as well as variables that are declarations. var exportedNames = new HashSet(analysis.Document.GetMemberNames()); - foreach (var v in analysis.GlobalScope.Variables.Where(v => exportedNames.Contains(v.Name))) { + foreach (var v in analysis.GlobalScope.Variables + .Where(v => exportedNames.Contains(v.Name) || v.Source == VariableSource.Declaration || v.Source == VariableSource.Builtin)) { // Create type model before variable since variable needs it. string typeName = null; switch (v.Value) { @@ -60,7 +62,7 @@ public static ModuleModel FromAnalysis(IDocumentAnalysis analysis) { } return new ModuleModel { - Name = analysis.Document.GetQualifiedName(), + Name = analysis.Document.QualifiedName, Documentation = analysis.Document.Documentation, Functions = functions.Values.ToArray(), Variables = variables.Values.ToArray(), diff --git a/src/Caching/Test/BasicTests.cs b/src/Caching/Test/BasicTests.cs index 5e5aa4fab..9d9e81da3 100644 --- a/src/Caching/Test/BasicTests.cs +++ b/src/Caching/Test/BasicTests.cs @@ -67,13 +67,10 @@ public async Task Builtins() { var builtins = analysis.Document.Interpreter.ModuleResolution.BuiltinsModule; var model = ModuleModel.FromAnalysis(builtins.Analysis); - // Compare data to the baseline. var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); - // Read persistent data back var dbModule = new PythonDbModule(model, Services); - // Compare to the original members, should be identical. dbModule.Should().HaveSameMembersAs(builtins); } @@ -83,6 +80,28 @@ public async Task Sys() { var analysis = await GetAnalysisAsync("import sys"); var sys = analysis.Document.Interpreter.ModuleResolution.GetImportedModule("sys"); var model = ModuleModel.FromAnalysis(sys.Analysis); + + var json = ToJson(model); + Baseline.CompareToFile(BaselineFileName, json); + + var dbModule = new PythonDbModule(model, Services); + dbModule.Should().HaveSameMembersAs(sys); + } + + [TestMethod, Priority(0)] + public async Task VersionedModule() { + const string code = @" +import requests +x = requests.get('microsoft.com') +"; + var analysis = await GetAnalysisAsync(code, PythonVersions.LatestAvailable3X); + var v = analysis.GlobalScope.Variables["requests"]; + v.Should().NotBeNull(); + if (v.Value.GetPythonType().ModuleType == ModuleType.Unresolved) { + Assert.Inconclusive("'requests' package is not installed."); + } + + var model = ModuleModel.FromAnalysis(analysis); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); } diff --git a/src/Caching/Test/Files/Builtins.json b/src/Caching/Test/Files/Builtins.json index 794678c66..a09f2fdb7 100644 --- a/src/Caching/Test/Files/Builtins.json +++ b/src/Caching/Test/Files/Builtins.json @@ -30270,5 +30270,5 @@ "Name": "type" } ], - "Name": "builtins" + "Name": "builtins(3.7)" } \ No newline at end of file diff --git a/src/Caching/Test/Files/SmokeTest.json b/src/Caching/Test/Files/SmokeTest.json index 5b6f8ac84..316251847 100644 --- a/src/Caching/Test/Files/SmokeTest.json +++ b/src/Caching/Test/Files/SmokeTest.json @@ -1,6 +1,8 @@ { + "Documentation": "", "Functions": [ { + "Documentation": null, "Overloads": [ { "Parameters": [], @@ -10,34 +12,118 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "func", - "Documentation": null + "Name": "func" } ], "Variables": [ { - "Name": "x", - "Value": "i:str" + "Value": "bool", + "Name": "__debug__" }, { - "Name": "c", - "Value": "i:module.C" + "Value": "str", + "Name": "__doc__" + }, + { + "Value": "str", + "Name": "__file__" + }, + { + "Value": "str", + "Name": "__name__" + }, + { + "Value": "str", + "Name": "__package__" + }, + { + "Value": "list", + "Name": "__path__" + }, + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "i:str", + "Name": "x" + }, + { + "Value": "i:module.C", + "Name": "c" } ], "Classes": [ { + "Documentation": null, "Bases": [ "object" ], - "Methods": [], + "Methods": [ + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "module.C", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "module.C", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:float" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "method" + } + ], "Properties": [], - "Fields": [], + "Fields": [ + { + "Value": "i:int", + "Name": "x" + }, + { + "Value": "i:int", + "Name": "y" + }, + { + "Value": "dict", + "Name": "__dict__" + }, + { + "Value": "object", + "Name": "__weakref__" + } + ], "GenericParameters": null, "InnerClasses": [], - "Name": "C", - "Documentation": null + "Name": "C" } ], - "Name": "module", - "Documentation": "" + "Name": "module" } \ No newline at end of file diff --git a/src/Caching/Test/Files/Sys.json b/src/Caching/Test/Files/Sys.json index 50f6585f1..17ed7333e 100644 --- a/src/Caching/Test/Files/Sys.json +++ b/src/Caching/Test/Files/Sys.json @@ -1,6 +1,8 @@ { + "Documentation": "This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n\nStatic objects:\n\nbuiltin_module_names -- tuple of module names built into this interpreter\ncopyright -- copyright notice pertaining to this interpreter\nexec_prefix -- prefix used to find the machine-specific Python library\nexecutable -- absolute path of the executable binary of the Python interpreter\nfloat_info -- a struct sequence with information about the float implementation.\nfloat_repr_style -- string indicating the style of repr() output for floats\nhash_info -- a struct sequence with information about the hash algorithm.\nhexversion -- version information encoded as a single integer\nimplementation -- Python implementation information.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the value of the largest Unicode code point\nplatform -- platform identifier\nprefix -- prefix used to find the Python library\nthread_info -- a struct sequence with information about the thread implementation.\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\ndllhandle -- [Windows only] integer handle of the Python DLL\nwinver -- [Windows only] version number of the Python DLL\n_enablelegacywindowsfsencoding -- [Windows only] \n__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n", "Functions": [ { + "Documentation": "breakpointhook(*args, **kws)\n\nThis hook function is called by built-in breakpoint().\n", "Overloads": [ { "Parameters": [], @@ -10,10 +12,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "__breakpointhook__", - "Documentation": "breakpointhook(*args, **kws)\n\nThis hook function is called by built-in breakpoint().\n" + "Name": "__breakpointhook__" }, { + "Documentation": "displayhook(object) -> None\n\nPrint an object to sys.stdout and also save it in builtins._\n", "Overloads": [ { "Parameters": [], @@ -23,10 +25,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "__displayhook__", - "Documentation": "displayhook(object) -> None\n\nPrint an object to sys.stdout and also save it in builtins._\n" + "Name": "__displayhook__" }, { + "Documentation": "excepthook(exctype, value, traceback) -> None\n\nHandle an exception by displaying it with a traceback on sys.stderr.\n", "Overloads": [ { "Parameters": [], @@ -36,10 +38,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "__excepthook__", - "Documentation": "excepthook(exctype, value, traceback) -> None\n\nHandle an exception by displaying it with a traceback on sys.stderr.\n" + "Name": "__excepthook__" }, { + "Documentation": null, "Overloads": [ { "Parameters": [], @@ -49,10 +51,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "__interactivehook__", - "Documentation": null + "Name": "__interactivehook__" }, { + "Documentation": "_clear_type_cache() -> None\nClear the internal type lookup cache.", "Overloads": [ { "Parameters": [], @@ -62,23 +64,23 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "_clear_type_cache", - "Documentation": "_clear_type_cache() -> None\nClear the internal type lookup cache." + "Name": "_clear_type_cache" }, { + "Documentation": "_current_frames() -> dictionary\n\nReturn a dictionary mapping each current thread T's thread id to T's\ncurrent stack frame.\n\nThis function should be used for specialized purposes only.", "Overloads": [ { "Parameters": [], - "ReturnType": "i:builtins(3.7).dict" + "ReturnType": "i:builtins(3:7).dict" } ], "Attributes": 0, "Classes": null, "Functions": null, - "Name": "_current_frames", - "Documentation": "_current_frames() -> dictionary\n\nReturn a dictionary mapping each current thread T's thread id to T's\ncurrent stack frame.\n\nThis function should be used for specialized purposes only." + "Name": "_current_frames" }, { + "Documentation": "_debugmallocstats()\n\nPrint summary info to stderr about the state of\npymalloc's structures.\n\nIn Py_DEBUG mode, also perform some expensive internal consistency\nchecks.\n", "Overloads": [ { "Parameters": [], @@ -88,10 +90,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "_debugmallocstats", - "Documentation": "_debugmallocstats()\n\nPrint summary info to stderr about the state of\npymalloc's structures.\n\nIn Py_DEBUG mode, also perform some expensive internal consistency\nchecks.\n" + "Name": "_debugmallocstats" }, { + "Documentation": "_enablelegacywindowsfsencoding()\n\nChanges the default filesystem encoding to mbcs:replace for consistency\nwith earlier versions of Python. See PEP 529 for more information.\n\nThis is equivalent to defining the PYTHONLEGACYWINDOWSFSENCODING \nenvironment variable before launching Python.", "Overloads": [ { "Parameters": [], @@ -101,10 +103,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "_enablelegacywindowsfsencoding", - "Documentation": "_enablelegacywindowsfsencoding()\n\nChanges the default filesystem encoding to mbcs:replace for consistency\nwith earlier versions of Python. See PEP 529 for more information.\n\nThis is equivalent to defining the PYTHONLEGACYWINDOWSFSENCODING \nenvironment variable before launching Python." + "Name": "_enablelegacywindowsfsencoding" }, { + "Documentation": "_getframe([depth]) -> frameobject\n\nReturn a frame object from the call stack. If optional integer depth is\ngiven, return the frame object that many calls below the top of the stack.\nIf that is deeper than the call stack, ValueError is raised. The default\nfor depth is zero, returning the frame at the top of the call stack.\n\nThis function should be used for internal and specialized\npurposes only.", "Overloads": [ { "Parameters": [ @@ -115,16 +117,16 @@ "Kind": 0 } ], - "ReturnType": "i:types.FrameType" + "ReturnType": "i:types(3:7).FrameType" } ], "Attributes": 0, "Classes": null, "Functions": null, - "Name": "_getframe", - "Documentation": "_getframe([depth]) -> frameobject\n\nReturn a frame object from the call stack. If optional integer depth is\ngiven, return the frame object that many calls below the top of the stack.\nIf that is deeper than the call stack, ValueError is raised. The default\nfor depth is zero, returning the frame at the top of the call stack.\n\nThis function should be used for internal and specialized\npurposes only." + "Name": "_getframe" }, { + "Documentation": "breakpointhook(*args, **kws)\n\nThis hook function is called by built-in breakpoint().\n", "Overloads": [ { "Parameters": [ @@ -147,10 +149,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "breakpointhook", - "Documentation": "breakpointhook(*args, **kws)\n\nThis hook function is called by built-in breakpoint().\n" + "Name": "breakpointhook" }, { + "Documentation": "call_tracing(func, args) -> object\n\nCall func(*args), while tracing is enabled. The tracing state is\nsaved, and restored afterwards. This is intended to be called from\na debugger from a checkpoint, to recursively debug some other code.", "Overloads": [ { "Parameters": [ @@ -173,10 +175,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "call_tracing", - "Documentation": "call_tracing(func, args) -> object\n\nCall func(*args), while tracing is enabled. The tracing state is\nsaved, and restored afterwards. This is intended to be called from\na debugger from a checkpoint, to recursively debug some other code." + "Name": "call_tracing" }, { + "Documentation": "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()", "Overloads": [ { "Parameters": [], @@ -186,10 +188,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "callstats", - "Documentation": "callstats() -> tuple of integers\n\nReturn a tuple of function call statistics, if CALL_PROFILE was defined\nwhen Python was built. Otherwise, return None.\n\nWhen enabled, this function returns detailed, implementation-specific\ndetails about the number of function calls executed. The return value is\na 11-tuple where the entries in the tuple are counts of:\n0. all function calls\n1. calls to PyFunction_Type objects\n2. PyFunction calls that do not create an argument tuple\n3. PyFunction calls that do not create an argument tuple\n and bypass PyEval_EvalCodeEx()\n4. PyMethod calls\n5. PyMethod calls on bound methods\n6. PyType calls\n7. PyCFunction calls\n8. generator calls\n9. All other calls\n10. Number of stack pops performed by call_function()" + "Name": "callstats" }, { + "Documentation": "displayhook(object) -> None\n\nPrint an object to sys.stdout and also save it in builtins._\n", "Overloads": [ { "Parameters": [ @@ -206,29 +208,29 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "displayhook", - "Documentation": "displayhook(object) -> None\n\nPrint an object to sys.stdout and also save it in builtins._\n" + "Name": "displayhook" }, { + "Documentation": "exc_info() -> (type, value, traceback)\n\nReturn information about the most recent exception caught by an except\nclause in the current stack frame or in an older stack frame.", "Overloads": [ { "Parameters": [], - "ReturnType": "i:builtins(3.7).tuple" + "ReturnType": "i:builtins(3:7).tuple" } ], "Attributes": 0, "Classes": null, "Functions": null, - "Name": "exc_info", - "Documentation": "exc_info() -> (type, value, traceback)\n\nReturn information about the most recent exception caught by an except\nclause in the current stack frame or in an older stack frame." + "Name": "exc_info" }, { + "Documentation": "excepthook(exctype, value, traceback) -> None\n\nHandle an exception by displaying it with a traceback on sys.stderr.\n", "Overloads": [ { "Parameters": [ { "Name": "type_", - "Type": "typing.Type[builtins(3.7).BaseException]", + "Type": "typing.Type[builtins(3:7).BaseException]", "DefaultValue": null, "Kind": 0 }, @@ -240,7 +242,7 @@ }, { "Name": "traceback", - "Type": "types.TracebackType", + "Type": "types(3:7).TracebackType", "DefaultValue": null, "Kind": 0 } @@ -251,17 +253,17 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "excepthook", - "Documentation": "excepthook(exctype, value, traceback) -> None\n\nHandle an exception by displaying it with a traceback on sys.stderr.\n" + "Name": "excepthook" }, { + "Documentation": "exit([status])\n\nExit the interpreter by raising SystemExit(status).\nIf the status is omitted or None, it defaults to zero (i.e., success).\nIf the status is an integer, it will be used as the system exit status.\nIf it is another kind of object, it will be printed and the system\nexit status will be one (i.e., failure).", "Overloads": [ { "Parameters": [ { "Name": "arg", "Type": "object", - "DefaultValue": "i:...", + "DefaultValue": "i:ellipsis", "Kind": 0 } ], @@ -271,10 +273,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "exit", - "Documentation": "exit([status])\n\nExit the interpreter by raising SystemExit(status).\nIf the status is omitted or None, it defaults to zero (i.e., success).\nIf the status is an integer, it will be used as the system exit status.\nIf it is another kind of object, it will be printed and the system\nexit status will be one (i.e., failure)." + "Name": "exit" }, { + "Documentation": "get_asyncgen_hooks()\n\nReturn a namedtuple of installed asynchronous generators hooks (firstiter, finalizer).", "Overloads": [ { "Parameters": [], @@ -284,10 +286,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "get_asyncgen_hooks", - "Documentation": "get_asyncgen_hooks()\n\nReturn a namedtuple of installed asynchronous generators hooks (firstiter, finalizer)." + "Name": "get_asyncgen_hooks" }, { + "Documentation": "Check status of origin tracking for coroutine objects in this thread.", "Overloads": [ { "Parameters": [], @@ -297,10 +299,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "get_coroutine_origin_tracking_depth", - "Documentation": "Check status of origin tracking for coroutine objects in this thread." + "Name": "get_coroutine_origin_tracking_depth" }, { + "Documentation": "get_coroutine_wrapper()\n\nReturn the wrapper for coroutine objects set by sys.set_coroutine_wrapper.", "Overloads": [ { "Parameters": [], @@ -310,10 +312,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "get_coroutine_wrapper", - "Documentation": "get_coroutine_wrapper()\n\nReturn the wrapper for coroutine objects set by sys.set_coroutine_wrapper." + "Name": "get_coroutine_wrapper" }, { + "Documentation": "getallocatedblocks() -> integer\n\nReturn the number of memory blocks currently allocated, regardless of their\nsize.", "Overloads": [ { "Parameters": [], @@ -323,10 +325,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "getallocatedblocks", - "Documentation": "getallocatedblocks() -> integer\n\nReturn the number of memory blocks currently allocated, regardless of their\nsize." + "Name": "getallocatedblocks" }, { + "Documentation": "getcheckinterval() -> current check interval; see setcheckinterval().", "Overloads": [ { "Parameters": [], @@ -336,10 +338,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "getcheckinterval", - "Documentation": "getcheckinterval() -> current check interval; see setcheckinterval()." + "Name": "getcheckinterval" }, { + "Documentation": "getdefaultencoding() -> string\n\nReturn the current default string encoding used by the Unicode \nimplementation.", "Overloads": [ { "Parameters": [], @@ -349,10 +351,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "getdefaultencoding", - "Documentation": "getdefaultencoding() -> string\n\nReturn the current default string encoding used by the Unicode \nimplementation." + "Name": "getdefaultencoding" }, { + "Documentation": "getfilesystemencodeerrors() -> string\n\nReturn the error mode used to convert Unicode filenames in\noperating system filenames.", "Overloads": [ { "Parameters": [], @@ -362,10 +364,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "getfilesystemencodeerrors", - "Documentation": "getfilesystemencodeerrors() -> string\n\nReturn the error mode used to convert Unicode filenames in\noperating system filenames." + "Name": "getfilesystemencodeerrors" }, { + "Documentation": "getfilesystemencoding() -> string\n\nReturn the encoding used to convert Unicode filenames in\noperating system filenames.", "Overloads": [ { "Parameters": [], @@ -375,10 +377,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "getfilesystemencoding", - "Documentation": "getfilesystemencoding() -> string\n\nReturn the encoding used to convert Unicode filenames in\noperating system filenames." + "Name": "getfilesystemencoding" }, { + "Documentation": "getprofile()\n\nReturn the profiling function set with sys.setprofile.\nSee the profiler chapter in the library manual.", "Overloads": [ { "Parameters": [], @@ -388,10 +390,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "getprofile", - "Documentation": "getprofile()\n\nReturn the profiling function set with sys.setprofile.\nSee the profiler chapter in the library manual." + "Name": "getprofile" }, { + "Documentation": "getrecursionlimit()\n\nReturn the current value of the recursion limit, the maximum depth\nof the Python interpreter stack. This limit prevents infinite\nrecursion from causing an overflow of the C stack and crashing Python.", "Overloads": [ { "Parameters": [], @@ -401,10 +403,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "getrecursionlimit", - "Documentation": "getrecursionlimit()\n\nReturn the current value of the recursion limit, the maximum depth\nof the Python interpreter stack. This limit prevents infinite\nrecursion from causing an overflow of the C stack and crashing Python." + "Name": "getrecursionlimit" }, { + "Documentation": "getrefcount(object) -> integer\n\nReturn the reference count of object. The count returned is generally\none higher than you might expect, because it includes the (temporary)\nreference as an argument to getrefcount().", "Overloads": [ { "Parameters": [ @@ -421,10 +423,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "getrefcount", - "Documentation": "getrefcount(object) -> integer\n\nReturn the reference count of object. The count returned is generally\none higher than you might expect, because it includes the (temporary)\nreference as an argument to getrefcount()." + "Name": "getrefcount" }, { + "Documentation": "getsizeof(object, default) -> int\n\nReturn the size of object in bytes.", "Overloads": [ { "Parameters": [ @@ -447,10 +449,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "getsizeof", - "Documentation": "getsizeof(object, default) -> int\n\nReturn the size of object in bytes." + "Name": "getsizeof" }, { + "Documentation": "getswitchinterval() -> current thread switch interval; see setswitchinterval().", "Overloads": [ { "Parameters": [], @@ -460,10 +462,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "getswitchinterval", - "Documentation": "getswitchinterval() -> current thread switch interval; see setswitchinterval()." + "Name": "getswitchinterval" }, { + "Documentation": "gettrace()\n\nReturn the global debug tracing function set with sys.settrace.\nSee the debugger chapter in the library manual.", "Overloads": [ { "Parameters": [], @@ -473,23 +475,23 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "gettrace", - "Documentation": "gettrace()\n\nReturn the global debug tracing function set with sys.settrace.\nSee the debugger chapter in the library manual." + "Name": "gettrace" }, { + "Documentation": "getwindowsversion()\n\nReturn information about the running version of Windows as a named tuple.\nThe members are named: major, minor, build, platform, service_pack,\nservice_pack_major, service_pack_minor, suite_mask, and product_type. For\nbackward compatibility, only the first 5 items are available by indexing.\nAll elements are numbers, except service_pack and platform_type which are\nstrings, and platform_version which is a 3-tuple. Platform is always 2.\nProduct_type may be 1 for a workstation, 2 for a domain controller, 3 for a\nserver. Platform_version is a 3-tuple containing a version number that is\nintended for identifying the OS rather than feature detection.", "Overloads": [ { "Parameters": [], - "ReturnType": "i:sys._WinVersion" + "ReturnType": "i:sys(3:7)._WinVersion" } ], "Attributes": 0, "Classes": null, "Functions": null, - "Name": "getwindowsversion", - "Documentation": "getwindowsversion()\n\nReturn information about the running version of Windows as a named tuple.\nThe members are named: major, minor, build, platform, service_pack,\nservice_pack_major, service_pack_minor, suite_mask, and product_type. For\nbackward compatibility, only the first 5 items are available by indexing.\nAll elements are numbers, except service_pack and platform_type which are\nstrings, and platform_version which is a 3-tuple. Platform is always 2.\nProduct_type may be 1 for a workstation, 2 for a domain controller, 3 for a\nserver. Platform_version is a 3-tuple containing a version number that is\nintended for identifying the OS rather than feature detection." + "Name": "getwindowsversion" }, { + "Documentation": "intern(string) -> string\n\n``Intern'' the given string. This enters the string in the (global)\ntable of interned strings whose purpose is to speed up dictionary lookups.\nReturn the string itself or the previously interned string object with the\nsame value.", "Overloads": [ { "Parameters": [ @@ -506,10 +508,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "intern", - "Documentation": "intern(string) -> string\n\n``Intern'' the given string. This enters the string in the (global)\ntable of interned strings whose purpose is to speed up dictionary lookups.\nReturn the string itself or the previously interned string object with the\nsame value." + "Name": "intern" }, { + "Documentation": "is_finalizing()\nReturn True if Python is exiting.", "Overloads": [ { "Parameters": [], @@ -519,10 +521,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "is_finalizing", - "Documentation": "is_finalizing()\nReturn True if Python is exiting." + "Name": "is_finalizing" }, { + "Documentation": "set_asyncgen_hooks(*, firstiter=None, finalizer=None)\n\nSet a finalizer for async generators objects.", "Overloads": [ { "Parameters": [ @@ -551,10 +553,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "set_asyncgen_hooks", - "Documentation": "set_asyncgen_hooks(*, firstiter=None, finalizer=None)\n\nSet a finalizer for async generators objects." + "Name": "set_asyncgen_hooks" }, { + "Documentation": "Enable or disable origin tracking for coroutine objects in this thread.\n\nCoroutine objects will track 'depth' frames of traceback information about\nwhere they came from, available in their cr_origin attribute. Set depth of 0\nto disable.", "Overloads": [ { "Parameters": [ @@ -571,10 +573,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "set_coroutine_origin_tracking_depth", - "Documentation": "Enable or disable origin tracking for coroutine objects in this thread.\n\nCoroutine objects will track 'depth' frames of traceback information about\nwhere they came from, available in their cr_origin attribute. Set depth of 0\nto disable." + "Name": "set_coroutine_origin_tracking_depth" }, { + "Documentation": "set_coroutine_wrapper(wrapper)\n\nSet a wrapper for coroutine objects.", "Overloads": [ { "Parameters": [ @@ -591,10 +593,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "set_coroutine_wrapper", - "Documentation": "set_coroutine_wrapper(wrapper)\n\nSet a wrapper for coroutine objects." + "Name": "set_coroutine_wrapper" }, { + "Documentation": "setcheckinterval(n)\n\nTell the Python interpreter to check for asynchronous events every\nn instructions. This also affects how often thread switches occur.", "Overloads": [ { "Parameters": [ @@ -611,10 +613,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "setcheckinterval", - "Documentation": "setcheckinterval(n)\n\nTell the Python interpreter to check for asynchronous events every\nn instructions. This also affects how often thread switches occur." + "Name": "setcheckinterval" }, { + "Documentation": "setprofile(function)\n\nSet the profiling function. It will be called on each function call\nand return. See the profiler chapter in the library manual.", "Overloads": [ { "Parameters": [ @@ -631,10 +633,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "setprofile", - "Documentation": "setprofile(function)\n\nSet the profiling function. It will be called on each function call\nand return. See the profiler chapter in the library manual." + "Name": "setprofile" }, { + "Documentation": "setrecursionlimit(n)\n\nSet the maximum depth of the Python interpreter stack to n. This\nlimit prevents infinite recursion from causing an overflow of the C\nstack and crashing Python. The highest possible limit is platform-\ndependent.", "Overloads": [ { "Parameters": [ @@ -651,10 +653,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "setrecursionlimit", - "Documentation": "setrecursionlimit(n)\n\nSet the maximum depth of the Python interpreter stack to n. This\nlimit prevents infinite recursion from causing an overflow of the C\nstack and crashing Python. The highest possible limit is platform-\ndependent." + "Name": "setrecursionlimit" }, { + "Documentation": "setswitchinterval(n)\n\nSet the ideal thread switching delay inside the Python interpreter\nThe actual frequency of switching threads can be lower if the\ninterpreter executes long sequences of uninterruptible code\n(this is implementation-specific and workload-dependent).\n\nThe parameter must represent the desired switching delay in seconds\nA typical value is 0.005 (5 milliseconds).", "Overloads": [ { "Parameters": [ @@ -671,10 +673,10 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "setswitchinterval", - "Documentation": "setswitchinterval(n)\n\nSet the ideal thread switching delay inside the Python interpreter\nThe actual frequency of switching threads can be lower if the\ninterpreter executes long sequences of uninterruptible code\n(this is implementation-specific and workload-dependent).\n\nThe parameter must represent the desired switching delay in seconds\nA typical value is 0.005 (5 milliseconds)." + "Name": "setswitchinterval" }, { + "Documentation": "settrace(function)\n\nSet the global debug tracing function. It will be called on each\nfunction call. See the debugger chapter in the library manual.", "Overloads": [ { "Parameters": [ @@ -691,268 +693,5264 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Name": "settrace", - "Documentation": "settrace(function)\n\nSet the global debug tracing function. It will be called on each\nfunction call. See the debugger chapter in the library manual." + "Name": "settrace" } ], "Variables": [ { - "Name": "__doc__", - "Value": "i:str" + "Value": "_io.gUdbe7JPo__mmtlB2OEXEoJfodVUlyVJH8hq4p8uxB0=", + "Name": "_mod__io" }, { - "Name": "__name__", - "Value": "i:str" + "Value": "builtins", + "Name": "_mod_builtins" }, { - "Name": "__package__", - "Value": "i:str" + "Value": "types(3:7)", + "Name": "_mod_types" }, { - "Name": "__stderr__", - "Value": "i:_io.TextIOWrapper" + "Value": "i:str", + "Name": "__doc__" }, { - "Name": "__stdin__", - "Value": "i:_io.TextIOWrapper" + "Value": "i:str", + "Name": "__name__" }, { - "Name": "__stdout__", - "Value": "i:_io.TextIOWrapper" + "Value": "i:str", + "Name": "__package__" }, { - "Name": "_framework", - "Value": "i:str" + "Value": "i:_io(3:7).TextIOWrapper", + "Name": "__stderr__" }, { - "Name": "_git", - "Value": "i:tuple" + "Value": "i:_io(3:7).TextIOWrapper", + "Name": "__stdin__" }, { - "Name": "_home", - "Value": "i:NoneType" + "Value": "i:_io(3:7).TextIOWrapper", + "Name": "__stdout__" }, { - "Name": "_xoptions", - "Value": "i:dict" + "Value": "i:str", + "Name": "_framework" }, { - "Name": "api_version", - "Value": "i:int" + "Value": "i:tuple", + "Name": "_git" }, { - "Name": "argv", - "Value": "i:list" + "Value": "i:NoneType", + "Name": "_home" }, { - "Name": "base_exec_prefix", - "Value": "i:str" + "Value": "i:dict", + "Name": "_xoptions" }, { - "Name": "base_prefix", - "Value": "i:str" + "Value": "i:int", + "Name": "api_version" }, { - "Name": "builtin_module_names", - "Value": "i:tuple" + "Value": "i:list", + "Name": "argv" }, { - "Name": "byteorder", - "Value": "i:str" + "Value": "i:str", + "Name": "base_exec_prefix" }, { - "Name": "copyright", - "Value": "i:str" + "Value": "i:str", + "Name": "base_prefix" }, { - "Name": "dllhandle", - "Value": "i:int" + "Value": "i:tuple", + "Name": "builtin_module_names" }, { - "Name": "dont_write_bytecode", - "Value": "i:bool" + "Value": "i:str", + "Name": "byteorder" }, { - "Name": "exec_prefix", - "Value": "i:str" + "Value": "i:str", + "Name": "copyright" }, { - "Name": "executable", - "Value": "i:str" + "Value": "i:int", + "Name": "dllhandle" }, { - "Name": "float_repr_style", - "Value": "i:str" + "Value": "i:bool", + "Name": "dont_write_bytecode" }, { - "Name": "hexversion", - "Value": "i:int" + "Value": "i:str", + "Name": "exec_prefix" }, { - "Name": "implementation", - "Value": null + "Value": "i:str", + "Name": "executable" }, { - "Name": "maxsize", - "Value": "i:int" + "Value": "i:str", + "Name": "float_repr_style" }, { - "Name": "maxunicode", - "Value": "i:int" + "Value": "i:int", + "Name": "hexversion" }, { - "Name": "meta_path", - "Value": "i:list" + "Value": null, + "Name": "implementation" }, { - "Name": "modules", - "Value": "i:dict" + "Value": "i:int", + "Name": "maxsize" }, { - "Name": "path", - "Value": "i:list" + "Value": "i:int", + "Name": "maxunicode" }, { - "Name": "path_hooks", - "Value": "i:list" + "Value": "i:list", + "Name": "meta_path" }, { - "Name": "path_importer_cache", - "Value": "i:dict" + "Value": "i:dict", + "Name": "modules" }, { - "Name": "platform", - "Value": "i:str" + "Value": "i:list", + "Name": "path" }, { - "Name": "prefix", - "Value": "i:str" + "Value": "i:list", + "Name": "path_hooks" }, { - "Name": "stderr", - "Value": "i:_io.TextIOWrapper" + "Value": "i:dict", + "Name": "path_importer_cache" }, { - "Name": "stdin", - "Value": "i:_io.TextIOWrapper" + "Value": "i:str", + "Name": "platform" }, { - "Name": "stdout", - "Value": "i:_io.TextIOWrapper" + "Value": "i:str", + "Name": "prefix" }, { - "Name": "version", - "Value": "i:str" + "Value": "i:_io(3:7).TextIOWrapper", + "Name": "stderr" }, { - "Name": "warnoptions", - "Value": "i:list" + "Value": "i:_io(3:7).TextIOWrapper", + "Name": "stdin" }, { - "Name": "winver", - "Value": "i:str" + "Value": "i:_io(3:7).TextIOWrapper", + "Name": "stdout" }, { - "Name": "float_info", - "Value": "i:sys.__float_info" + "Value": "i:str", + "Name": "version" }, { - "Name": "hash_info", - "Value": "i:sys.__hash_info" + "Value": "i:list", + "Name": "warnoptions" }, { - "Name": "int_info", - "Value": "i:sys.__int_info" + "Value": "i:str", + "Name": "winver" }, { - "Name": "thread_info", - "Value": "i:sys.__thread_info" + "Value": "i:sys(3:7).__float_info", + "Name": "float_info" }, { - "Name": "version_info", - "Value": "i:sys.__version_info" - } - ], - "Classes": [ - { - "Bases": [ - "tuple", - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "flags", - "Documentation": "sys.flags\n\nFlags provided through command line arguments or environment vars." + "Value": "i:sys(3:7).__hash_info", + "Name": "hash_info" }, { - "Bases": [ - "tuple", - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "__float_info", - "Documentation": "sys.float_info\n\nA structseq holding information about the float type. It contains low level\ninformation about the precision and internal representation. Please study\nyour system's :file:`float.h` for more information." + "Value": "i:sys(3:7).__int_info", + "Name": "int_info" }, { - "Bases": [ - "tuple", - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "__hash_info", - "Documentation": "hash_info\n\nA struct sequence providing parameters used for computing\nhashes. The attributes are read only." + "Value": "i:sys(3:7).__thread_info", + "Name": "thread_info" }, { - "Bases": [ - "tuple", - "object" - ], - "Methods": [], - "Properties": [], - "Fields": [], - "GenericParameters": null, - "InnerClasses": [], - "Name": "__int_info", - "Documentation": "sys.int_info\n\nA struct sequence that holds information about Python's\ninternal representation of integers. The attributes are read only." - }, + "Value": "i:sys(3:7).__version_info", + "Name": "version_info" + } + ], + "Classes": [ { + "Documentation": "sys.flags\n\nFlags provided through command line arguments or environment vars.", "Bases": [ "tuple", "object" ], - "Methods": [], + "Methods": [ + { + "Documentation": "Return self+value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__add__" + }, + { + "Documentation": "Return key in self.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__contains__" + }, + { + "Documentation": "Implement delattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:NoneType" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__delattr__" + }, + { + "Documentation": "Default dir() implementation.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:builtins(3:7).list" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__dir__" + }, + { + "Documentation": "Return self==value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__eq__" + }, + { + "Documentation": "Default object formatter.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "format_spec", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:str" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__format__" + }, + { + "Documentation": "Return self>=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return self[key].", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getitem__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:builtins(3:7).tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getnewargs__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Return hash(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__hash__" + }, + { + "Documentation": "sys.flags\n\nFlags provided through command line arguments or environment vars.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:NoneType" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return len(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__len__" + }, + { + "Documentation": "Return self=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__float_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__float_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return self[key].", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__float_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getitem__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "sys(3:7).__float_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:builtins(3:7).tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getnewargs__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__float_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Return hash(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__float_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__hash__" + }, + { + "Documentation": "sys.float_info\n\nA structseq holding information about the float type. It contains low level\ninformation about the precision and internal representation. Please study\nyour system's :file:`float.h` for more information.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__float_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "sys(3:7).__float_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:NoneType" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__float_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__float_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return len(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__float_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__len__" + }, + { + "Documentation": "Return self=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__hash_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__hash_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return self[key].", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__hash_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getitem__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "sys(3:7).__hash_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:builtins(3:7).tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getnewargs__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__hash_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Return hash(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__hash_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__hash__" + }, + { + "Documentation": "hash_info\n\nA struct sequence providing parameters used for computing\nhashes. The attributes are read only.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__hash_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "sys(3:7).__hash_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:NoneType" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__hash_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__hash_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return len(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__hash_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__len__" + }, + { + "Documentation": "Return self=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__int_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__int_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return self[key].", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__int_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getitem__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "sys(3:7).__int_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:builtins(3:7).tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getnewargs__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__int_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Return hash(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__int_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__hash__" + }, + { + "Documentation": "sys.int_info\n\nA struct sequence that holds information about Python's\ninternal representation of integers. The attributes are read only.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__int_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "sys(3:7).__int_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:NoneType" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__int_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__int_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return len(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__int_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__len__" + }, + { + "Documentation": "Return self=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__thread_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__thread_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return self[key].", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__thread_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getitem__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "sys(3:7).__thread_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:builtins(3:7).tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getnewargs__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__thread_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Return hash(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__thread_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__hash__" + }, + { + "Documentation": "sys.thread_info\n\nA struct sequence holding information about the thread implementation.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__thread_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "sys(3:7).__thread_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:NoneType" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__thread_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__thread_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return len(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__thread_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__len__" + }, + { + "Documentation": "Return self=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__version_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__ge__" + }, + { + "Documentation": "Return getattr(self, name).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__version_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "name", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getattribute__" + }, + { + "Documentation": "Return self[key].", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__version_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "key", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getitem__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "sys(3:7).__version_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "self", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:builtins(3:7).tuple" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__getnewargs__" + }, + { + "Documentation": "Return self>value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__version_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__gt__" + }, + { + "Documentation": "Return hash(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__version_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__hash__" + }, + { + "Documentation": "sys.version_info\n\nVersion information as a named tuple.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__version_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "args", + "Type": null, + "DefaultValue": null, + "Kind": 1 + }, + { + "Name": "kwargs", + "Type": null, + "DefaultValue": null, + "Kind": 2 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init__" + }, + { + "Documentation": "This method is called when a class is subclassed.\n\nThe default implementation does nothing. It may be\noverridden to extend subclasses.\n", + "Overloads": [ + { + "Parameters": [ + { + "Name": "cls", + "Type": "sys(3:7).__version_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:NoneType" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__init_subclass__" + }, + { + "Documentation": "Implement iter(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__version_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__iter__" + }, + { + "Documentation": "Return self<=value.", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__version_info", + "DefaultValue": null, + "Kind": 0 + }, + { + "Name": "value", + "Type": null, + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__le__" + }, + { + "Documentation": "Return len(self).", + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "sys(3:7).__version_info", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Name": "__len__" + }, + { + "Documentation": "Return self Date: Fri, 14 Jun 2019 13:24:06 -0700 Subject: [PATCH 69/82] More consistent qualified names --- .../Ast/Impl/Modules/ModuleQualifiedName.cs | 13 +++- src/Caching/Impl/TypeNames.cs | 66 +++++++++++++++++++ src/Caching/Test/BasicTests.cs | 19 ++++++ src/Caching/Test/Files/VersionedModule.json | 4 +- 4 files changed, 99 insertions(+), 3 deletions(-) diff --git a/src/Analysis/Ast/Impl/Modules/ModuleQualifiedName.cs b/src/Analysis/Ast/Impl/Modules/ModuleQualifiedName.cs index d29cecfd7..f4a14b0a0 100644 --- a/src/Analysis/Ast/Impl/Modules/ModuleQualifiedName.cs +++ b/src/Analysis/Ast/Impl/Modules/ModuleQualifiedName.cs @@ -26,18 +26,23 @@ internal static class ModuleQualifiedName { public static string CalculateQualifiedName(IPythonModule module, IFileSystem fs) { var config = module.Interpreter.Configuration; var sitePackagesPath = PythonLibraryPath.GetSitePackagesPath(config); + if (fs.IsPathUnderRoot(sitePackagesPath, module.FilePath)) { // If module is in site-packages and is versioned, then unique id = name + version + interpreter version. // Example: 'requests' and 'requests-2.21.0.dist-info'. var moduleFolder = Path.GetDirectoryName(Path.GetDirectoryName(module.FilePath)); + // TODO: for egg (https://github.com/microsoft/python-language-server/issues/196), consider *.egg-info var folders = fs .GetFileSystemEntries(moduleFolder, "*-*.dist-info", SearchOption.TopDirectoryOnly) .Select(Path.GetFileName) .Where(n => n.StartsWith(module.Name, StringComparison.OrdinalIgnoreCase)) // Module name can be capitalized differently. .ToArray(); + if (folders.Length == 1) { - return Path.GetFileNameWithoutExtension(folders[0]).Replace('.', ':'); + var fileName = Path.GetFileNameWithoutExtension(folders[0]); + var dash = fileName.IndexOf('-'); + return $"{fileName.Substring(0, dash)}({fileName.Substring(dash + 1)})"; } } @@ -51,6 +56,12 @@ public static string CalculateQualifiedName(IPythonModule module, IFileSystem fs return $"{module.Name}.{HashModuleContent(Path.GetDirectoryName(module.FilePath), fs)}"; } + public static string GetModuleName(string moduleQualifiedName) { + var index = moduleQualifiedName.IndexOf('('); + return index >= 0 ? moduleQualifiedName.Substring(0, index) : moduleQualifiedName; + } + + private static string HashModuleContent(string moduleFolder, IFileSystem fs) { // Hash file sizes using (var sha256 = SHA256.Create()) { diff --git a/src/Caching/Impl/TypeNames.cs b/src/Caching/Impl/TypeNames.cs index 32ddfaa9c..54188e3a5 100644 --- a/src/Caching/Impl/TypeNames.cs +++ b/src/Caching/Impl/TypeNames.cs @@ -13,6 +13,7 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. +using System.Diagnostics; using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; @@ -35,5 +36,70 @@ public static string GetQualifiedName(this IMember m) { } return null; } + + public static bool DeconstructQualifiedName(string qualifiedName, out string moduleQualifiedName, out string moduleName, out string typeName, out bool isInstance) { + moduleQualifiedName = null; + moduleName = null; + typeName = null; + isInstance = false; + + if (string.IsNullOrEmpty(qualifiedName)) { + return false; + } + + isInstance = qualifiedName.StartsWith("i:"); + qualifiedName = isInstance ? qualifiedName.Substring(2) : qualifiedName; + + if (qualifiedName == "..." || qualifiedName == "ellipsis") { + moduleName = @"builtins"; + moduleQualifiedName = moduleName; + typeName = "ellipsis"; + return true; + } + + // First chunk is qualified module name except dots in braces. + // Builtin types don't have module prefix. + typeName = GetModuleNames(qualifiedName, out moduleQualifiedName, out moduleName) + ? qualifiedName.Substring(moduleQualifiedName.Length + 1) + : qualifiedName; + + moduleQualifiedName = moduleQualifiedName ?? @"builtins"; + moduleName = moduleName ?? @"builtins"; + return true; + } + + private static bool GetModuleNames(string s, out string moduleQualifiedName, out string moduleName) { + moduleQualifiedName = null; + moduleName = null; + + var firstDot = -1; + var skip = false; + + for (var i = 0; i < s.Length; i++) { + var ch = s[i]; + + if (ch == '(') { + skip = true; + continue; + } + + if (ch == ')') { + skip = false; + } + + if (!skip && ch == '.') { + firstDot = i; + break; + } + } + + if (firstDot < 0) { + return false; + } + + moduleQualifiedName = s.Substring(0, firstDot); + moduleName = ModuleQualifiedName.GetModuleName(moduleQualifiedName); + return true; + } } } diff --git a/src/Caching/Test/BasicTests.cs b/src/Caching/Test/BasicTests.cs index 9d9e81da3..491a12618 100644 --- a/src/Caching/Test/BasicTests.cs +++ b/src/Caching/Test/BasicTests.cs @@ -15,6 +15,7 @@ using System.IO; using System.Threading.Tasks; +using FluentAssertions; using Microsoft.Python.Analysis.Caching.Models; using Microsoft.Python.Analysis.Caching.Tests.FluentAssertions; using Microsoft.Python.Analysis.Modules; @@ -127,5 +128,23 @@ import requests var dbModule = new PythonDbModule(model, Services); dbModule.Should().HaveSameMembersAs(rq); } + + [DataTestMethod, Priority(0)] + [DataRow("", null, null, null, false)] + [DataRow("str", "builtins", "builtins", "str", false)] + [DataRow("i:str", "builtins", "builtins", "str", true)] + [DataRow("i:...", "builtins", "builtins", "ellipsis", true)] + [DataRow("ellipsis", "builtins", "builtins", "ellipsis", false)] + [DataRow("i:builtins(3.7).str", "builtins(3.7)", "builtins", "str", true)] + [DataRow("mod(2.2.1).z", "mod(2.2.1)", "mod", "z", false)] + [DataRow("i:mod(2.2.1).z", "mod(2.2.1)", "mod", "z", true)] + [DataRow("i:mod.x", "mod", "mod", "x", true)] + public void QualifiedNames(string qualifiedName, string moduleQualifiedName, string moduleName, string typeName, bool isInstance) { + TypeNames.DeconstructQualifiedName(qualifiedName, out var actualModuleQualifiedName, out var actualModuleName, out var actualTypeName, out var actualIsInstance); + actualModuleQualifiedName.Should().Be(moduleQualifiedName); + actualModuleName.Should().Be(moduleName); + actualTypeName.Should().Be(typeName); + actualIsInstance.Should().Be(isInstance); + } } } diff --git a/src/Caching/Test/Files/VersionedModule.json b/src/Caching/Test/Files/VersionedModule.json index 81a6ff5ab..426c22ef3 100644 --- a/src/Caching/Test/Files/VersionedModule.json +++ b/src/Caching/Test/Files/VersionedModule.json @@ -31,11 +31,11 @@ "Name": "__dict__" }, { - "Value": "requests-2:21:0", + "Value": "requests(2.21.0)", "Name": "requests" }, { - "Value": "i:requests.models(3.7).Response", + "Value": null, "Name": "x" } ], From af69880598f75e3834ca1512b93344ec27af09fd Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Fri, 14 Jun 2019 15:24:15 -0700 Subject: [PATCH 70/82] Sys test --- src/Analysis/Ast/Impl/Types/PythonType.cs | 8 +- .../Ast/Impl/Types/PythonUnionType.cs | 12 +- src/Caching/Impl/Factories/ModuleFactory.cs | 74 ++-- src/Caching/Impl/TypeNames.cs | 52 ++- src/Caching/Test/BasicTests.cs | 3 + src/Caching/Test/Files/Sys.json | 386 +++++++++--------- 6 files changed, 277 insertions(+), 258 deletions(-) diff --git a/src/Analysis/Ast/Impl/Types/PythonType.cs b/src/Analysis/Ast/Impl/Types/PythonType.cs index 2999b633d..51c6483e1 100644 --- a/src/Analysis/Ast/Impl/Types/PythonType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonType.cs @@ -17,6 +17,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Values; using Microsoft.Python.Core.Diagnostics; @@ -56,7 +57,12 @@ private PythonType(string name, Location location, BuiltinTypeId typeId) : base( #region IPythonType public virtual string Name => TypeId == BuiltinTypeId.Ellipsis ? "..." : _name; - public virtual string QualifiedName => $"{DeclaringModule.QualifiedName}.{(TypeId == BuiltinTypeId.Ellipsis ? "ellipsis" : Name)}"; + + public virtual string QualifiedName + => DeclaringModule.ModuleType == ModuleType.Builtins + ? TypeId == BuiltinTypeId.Ellipsis ? "ellipsis" : Name + : $"{DeclaringModule.QualifiedName}.{Name}"; + public virtual string Documentation { get; private set; } public virtual BuiltinTypeId TypeId => _typeId; public bool IsBuiltin => DeclaringModule == null || DeclaringModule is IBuiltinsPythonModule; diff --git a/src/Analysis/Ast/Impl/Types/PythonUnionType.cs b/src/Analysis/Ast/Impl/Types/PythonUnionType.cs index eedaa82f1..f4f53f11d 100644 --- a/src/Analysis/Ast/Impl/Types/PythonUnionType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonUnionType.cs @@ -26,11 +26,13 @@ internal sealed class PythonUnionType : LocatedMember, IPythonUnionType { private readonly HashSet _types = new HashSet(PythonTypeComparer.Instance); private readonly object _lock = new object(); - public PythonUnionType(IEnumerable types, IPythonModule declaringModule) : base(declaringModule) { + public PythonUnionType(IEnumerable types, IPythonModule declaringModule) + : base(declaringModule.Interpreter.ModuleResolution.GetSpecializedModule("typing")) { _types.UnionWith(types); } - private PythonUnionType(IPythonType x, IPythonType y) : base(x.DeclaringModule) { + private PythonUnionType(IPythonType x, IPythonType y) + : base(x.DeclaringModule.Interpreter.ModuleResolution.GetSpecializedModule("typing")) { Check.Argument(nameof(x), () => !(x is IPythonUnionType)); Check.Argument(nameof(y), () => !(y is IPythonUnionType)); _types.Add(x); @@ -46,11 +48,7 @@ public string Name { } public string QualifiedName { - get { lock (_lock) { return CodeFormatter.FormatSequence("Union", '[', _types.Select(t => t.QualifiedName).ToArray()); } } - } - - public override IPythonModule DeclaringModule { - get { lock (_lock) { return _types.First().DeclaringModule; } } + get { lock (_lock) { return CodeFormatter.FormatSequence("typing.Union", '[', _types.Select(t => t.QualifiedName).ToArray()); } } } public BuiltinTypeId TypeId => BuiltinTypeId.Type; diff --git a/src/Caching/Impl/Factories/ModuleFactory.cs b/src/Caching/Impl/Factories/ModuleFactory.cs index 93aa7548d..d69c71dc4 100644 --- a/src/Caching/Impl/Factories/ModuleFactory.cs +++ b/src/Caching/Impl/Factories/ModuleFactory.cs @@ -18,6 +18,7 @@ using System.Diagnostics; using System.Linq; using Microsoft.Python.Analysis.Caching.Models; +using Microsoft.Python.Analysis.Specializations.Typing; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; @@ -48,22 +49,41 @@ public void Dispose() { public IPythonType ConstructType(string qualifiedName) => ConstructMember(qualifiedName)?.GetPythonType(); public IMember ConstructMember(string qualifiedName) { - if (!SplitQualifiedName(qualifiedName, out var moduleName, out var typeNameParts, out var isInstance)) { + if (!TypeNames.DeconstructQualifiedName(qualifiedName, out var moduleQualifiedName, out var moduleName, out var typeName, out var isInstance)) { return null; } - Debug.Assert(typeNameParts.Count > 0); + if(string.IsNullOrEmpty(typeName)) { + // TODO: resolve from database first? + return Module.Interpreter.ModuleResolution.GetOrLoadModule(moduleName); + } + + // Construct complex types from parts, such as Union[typing.Any, a.b.c] + var typeArgs = Array.Empty(); + var openBracket = typeName.IndexOf('['); + if (openBracket > 0) { + var closeBracket = typeName.LastIndexOf(']'); + if (closeBracket > 0) { + var argumentString = typeName.Substring(openBracket + 1, closeBracket - openBracket - 1); + var arguments = argumentString.Split(',').Select(s => s.Trim()); + typeArgs = arguments.Select(ConstructType).ToArray(); + typeName = typeName.Substring(0, openBracket); + } + } + var member = moduleName == Module.Name - ? GetMemberFromThisModule(typeNameParts) - : GetMemberFromModule(moduleName, typeNameParts); + ? GetMemberFromThisModule(typeName) + : GetMemberFromModule(moduleQualifiedName, moduleName, typeName, typeArgs); return isInstance && member != null ? new PythonInstance(member.GetPythonType()) : member; } - private IMember GetMemberFromModule(string moduleName, IReadOnlyList typeNameParts) { - // Module resolution will call back to the module database - // to get persisted analysis, if available. + private IMember GetMemberFromModule(string moduleQualifiedName, string moduleName, string typeName, IReadOnlyList typeArgs) { + var typeNameParts = typeName.Split('.'); + + // TODO: Try resolving from database first. var module = Module.Interpreter.ModuleResolution.GetOrLoadModule(moduleName); + var member = module?.GetMember(typeNameParts[0]); foreach (var p in typeNameParts.Skip(1)) { var mc = member as IMemberContainer; @@ -76,11 +96,14 @@ private IMember GetMemberFromModule(string moduleName, IReadOnlyList typ break; } } - return member; + return typeArgs.Any() && member is IGenericType gt + ? gt.CreateSpecificType(typeArgs) + : member; } - private IMember GetMemberFromThisModule(IReadOnlyList typeNameParts) { - if (typeNameParts.Count == 0) { + private IMember GetMemberFromThisModule(string typeName) { + var typeNameParts = typeName.Split('.'); + if (typeNameParts.Length == 0) { return null; } @@ -90,37 +113,6 @@ private IMember GetMemberFromThisModule(IReadOnlyList typeNameParts) { ?? (IMember)VariableFactory.TryCreate(typeNameParts[0])); } - private bool SplitQualifiedName(string qualifiedName, out string moduleName, out List typeNameParts, out bool isInstance) { - moduleName = null; - typeNameParts = new List(); - isInstance = false; - - if (string.IsNullOrEmpty(qualifiedName)) { - return false; - } - - if (qualifiedName == "..." || qualifiedName == "ellipsis") { - moduleName = @"builtins"; - typeNameParts.Add("..."); - return true; - } - - isInstance = qualifiedName.StartsWith("i:"); - qualifiedName = isInstance ? qualifiedName.Substring(2) : qualifiedName; - var components = qualifiedName.Split('.'); - switch (components.Length) { - case 0: - return false; - case 1: - moduleName = @"builtins"; - typeNameParts.Add(components[0]); - return true; - default: - moduleName = components[0]; - typeNameParts.AddRange(components.Skip(1)); - return true; - } - } } } diff --git a/src/Caching/Impl/TypeNames.cs b/src/Caching/Impl/TypeNames.cs index 54188e3a5..c51ead081 100644 --- a/src/Caching/Impl/TypeNames.cs +++ b/src/Caching/Impl/TypeNames.cs @@ -59,27 +59,34 @@ public static bool DeconstructQualifiedName(string qualifiedName, out string mod // First chunk is qualified module name except dots in braces. // Builtin types don't have module prefix. - typeName = GetModuleNames(qualifiedName, out moduleQualifiedName, out moduleName) - ? qualifiedName.Substring(moduleQualifiedName.Length + 1) - : qualifiedName; + GetModuleNames(qualifiedName, out moduleQualifiedName, out moduleName); + + typeName = string.IsNullOrEmpty(moduleQualifiedName) + ? qualifiedName + : qualifiedName.Substring(moduleQualifiedName.Length).TrimStart('.'); moduleQualifiedName = moduleQualifiedName ?? @"builtins"; moduleName = moduleName ?? @"builtins"; + typeName = string.IsNullOrEmpty(typeName) ? null : typeName; + return true; } - private static bool GetModuleNames(string s, out string moduleQualifiedName, out string moduleName) { - moduleQualifiedName = null; - moduleName = null; - - var firstDot = -1; + private static void GetModuleNames(string qualifiedTypeName, out string moduleQualifiedName, out string moduleName) { + var openBraceIndex = -1; + var typeSeparatorDotIndex = -1; var skip = false; - for (var i = 0; i < s.Length; i++) { - var ch = s[i]; + // types(3.7) + // mod.x + // mod(2.2.1).z + // typing.Union[typing.Any, mod.y] + for (var i = 0; i < qualifiedTypeName.Length; i++) { + var ch = qualifiedTypeName[i]; if (ch == '(') { skip = true; + openBraceIndex = i; continue; } @@ -88,18 +95,31 @@ private static bool GetModuleNames(string s, out string moduleQualifiedName, out } if (!skip && ch == '.') { - firstDot = i; + typeSeparatorDotIndex = i; break; } } - if (firstDot < 0) { - return false; + if(typeSeparatorDotIndex > 0) { + // mod.x or mod(2.2.1).x + moduleQualifiedName = qualifiedTypeName.Substring(0, typeSeparatorDotIndex); + } else { + // str or types(3.7) + moduleQualifiedName = openBraceIndex > 0 ? qualifiedTypeName : null; } - moduleQualifiedName = s.Substring(0, firstDot); - moduleName = ModuleQualifiedName.GetModuleName(moduleQualifiedName); - return true; + moduleName = null; + if (!string.IsNullOrEmpty(moduleQualifiedName)) { + if (openBraceIndex > 0) { + // types(3.7) + moduleName = qualifiedTypeName.Substring(0, openBraceIndex); + } else if(typeSeparatorDotIndex > 0) { + // mod.x + moduleName = qualifiedTypeName.Substring(0, typeSeparatorDotIndex); + } + } + + Debug.Assert(string.IsNullOrEmpty(moduleQualifiedName) == string.IsNullOrEmpty(moduleName)); } } } diff --git a/src/Caching/Test/BasicTests.cs b/src/Caching/Test/BasicTests.cs index 491a12618..125442a95 100644 --- a/src/Caching/Test/BasicTests.cs +++ b/src/Caching/Test/BasicTests.cs @@ -139,6 +139,9 @@ import requests [DataRow("mod(2.2.1).z", "mod(2.2.1)", "mod", "z", false)] [DataRow("i:mod(2.2.1).z", "mod(2.2.1)", "mod", "z", true)] [DataRow("i:mod.x", "mod", "mod", "x", true)] + [DataRow("types(3.7)", "types(3.7)", "types", null, false)] + [DataRow("typing.Union[str, tuple]", "typing", "typing", "Union[str, tuple]", false)] + [DataRow("typing.Union[typing.Any, mod.y]", "typing", "typing", "Union[typing.Any, mod.y]", false)] public void QualifiedNames(string qualifiedName, string moduleQualifiedName, string moduleName, string typeName, bool isInstance) { TypeNames.DeconstructQualifiedName(qualifiedName, out var actualModuleQualifiedName, out var actualModuleName, out var actualTypeName, out var actualIsInstance); actualModuleQualifiedName.Should().Be(moduleQualifiedName); diff --git a/src/Caching/Test/Files/Sys.json b/src/Caching/Test/Files/Sys.json index 17ed7333e..4e1ad5c96 100644 --- a/src/Caching/Test/Files/Sys.json +++ b/src/Caching/Test/Files/Sys.json @@ -71,7 +71,7 @@ "Overloads": [ { "Parameters": [], - "ReturnType": "i:builtins(3:7).dict" + "ReturnType": "i:dict" } ], "Attributes": 0, @@ -117,7 +117,7 @@ "Kind": 0 } ], - "ReturnType": "i:types(3:7).FrameType" + "ReturnType": "i:types(3.7).FrameType" } ], "Attributes": 0, @@ -215,7 +215,7 @@ "Overloads": [ { "Parameters": [], - "ReturnType": "i:builtins(3:7).tuple" + "ReturnType": "i:tuple" } ], "Attributes": 0, @@ -230,7 +230,7 @@ "Parameters": [ { "Name": "type_", - "Type": "typing.Type[builtins(3:7).BaseException]", + "Type": "typing.Type[BaseException]", "DefaultValue": null, "Kind": 0 }, @@ -242,7 +242,7 @@ }, { "Name": "traceback", - "Type": "types(3:7).TracebackType", + "Type": "types(3.7).TracebackType", "DefaultValue": null, "Kind": 0 } @@ -482,7 +482,7 @@ "Overloads": [ { "Parameters": [], - "ReturnType": "i:sys(3:7)._WinVersion" + "ReturnType": "i:sys(3.7)._WinVersion" } ], "Attributes": 0, @@ -706,7 +706,7 @@ "Name": "_mod_builtins" }, { - "Value": "types(3:7)", + "Value": "types(3.7)", "Name": "_mod_types" }, { @@ -722,15 +722,15 @@ "Name": "__package__" }, { - "Value": "i:_io(3:7).TextIOWrapper", + "Value": "i:_io(3.7).TextIOWrapper", "Name": "__stderr__" }, { - "Value": "i:_io(3:7).TextIOWrapper", + "Value": "i:_io(3.7).TextIOWrapper", "Name": "__stdin__" }, { - "Value": "i:_io(3:7).TextIOWrapper", + "Value": "i:_io(3.7).TextIOWrapper", "Name": "__stdout__" }, { @@ -842,15 +842,15 @@ "Name": "prefix" }, { - "Value": "i:_io(3:7).TextIOWrapper", + "Value": "i:_io(3.7).TextIOWrapper", "Name": "stderr" }, { - "Value": "i:_io(3:7).TextIOWrapper", + "Value": "i:_io(3.7).TextIOWrapper", "Name": "stdin" }, { - "Value": "i:_io(3:7).TextIOWrapper", + "Value": "i:_io(3.7).TextIOWrapper", "Name": "stdout" }, { @@ -866,23 +866,23 @@ "Name": "winver" }, { - "Value": "i:sys(3:7).__float_info", + "Value": "i:sys(3.7).__float_info", "Name": "float_info" }, { - "Value": "i:sys(3:7).__hash_info", + "Value": "i:sys(3.7).__hash_info", "Name": "hash_info" }, { - "Value": "i:sys(3:7).__int_info", + "Value": "i:sys(3.7).__int_info", "Name": "int_info" }, { - "Value": "i:sys(3:7).__thread_info", + "Value": "i:sys(3.7).__thread_info", "Name": "thread_info" }, { - "Value": "i:sys(3:7).__version_info", + "Value": "i:sys(3.7).__version_info", "Name": "version_info" } ], @@ -984,7 +984,7 @@ "Kind": 0 } ], - "ReturnType": "i:builtins(3:7).list" + "ReturnType": "i:list" } ], "Attributes": 0, @@ -1134,7 +1134,7 @@ "Kind": 0 } ], - "ReturnType": "i:builtins(3:7).tuple" + "ReturnType": "i:tuple" } ], "Attributes": 0, @@ -1396,7 +1396,7 @@ "Kind": 0 } ], - "ReturnType": "i:Union[str, tuple]" + "ReturnType": "i:typing.Union[str, tuple]" } ], "Attributes": 0, @@ -1422,7 +1422,7 @@ "Kind": 0 } ], - "ReturnType": "i:Union[str, tuple]" + "ReturnType": "i:typing.Union[str, tuple]" } ], "Attributes": 0, @@ -1740,7 +1740,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1766,7 +1766,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1792,7 +1792,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1818,7 +1818,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1829,7 +1829,7 @@ "Kind": 0 } ], - "ReturnType": "i:builtins(3:7).list" + "ReturnType": "i:list" } ], "Attributes": 0, @@ -1844,7 +1844,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1870,7 +1870,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1902,7 +1902,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1928,7 +1928,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1954,7 +1954,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1980,7 +1980,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1991,7 +1991,7 @@ "Kind": 0 } ], - "ReturnType": "i:builtins(3:7).tuple" + "ReturnType": "i:tuple" } ], "Attributes": 0, @@ -2006,7 +2006,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2032,7 +2032,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 } @@ -2052,7 +2052,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2084,7 +2084,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 } @@ -2104,7 +2104,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 } @@ -2124,7 +2124,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2150,7 +2150,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 } @@ -2170,7 +2170,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2196,7 +2196,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2222,7 +2222,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2248,12 +2248,12 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 } ], - "ReturnType": "i:Union[str, tuple]" + "ReturnType": "i:typing.Union[str, tuple]" } ], "Attributes": 0, @@ -2268,7 +2268,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2285,7 +2285,7 @@ "Kind": 0 } ], - "ReturnType": "i:Union[str, tuple]" + "ReturnType": "i:typing.Union[str, tuple]" } ], "Attributes": 0, @@ -2300,7 +2300,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 } @@ -2320,7 +2320,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2346,7 +2346,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2378,7 +2378,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2404,7 +2404,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 } @@ -2424,7 +2424,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2450,7 +2450,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2482,7 +2482,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__float_info", + "Type": "sys(3.7).__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2605,7 +2605,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2631,7 +2631,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2657,7 +2657,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2683,7 +2683,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2694,7 +2694,7 @@ "Kind": 0 } ], - "ReturnType": "i:builtins(3:7).list" + "ReturnType": "i:list" } ], "Attributes": 0, @@ -2709,7 +2709,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2735,7 +2735,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2767,7 +2767,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2793,7 +2793,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2819,7 +2819,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2845,7 +2845,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2856,7 +2856,7 @@ "Kind": 0 } ], - "ReturnType": "i:builtins(3:7).tuple" + "ReturnType": "i:tuple" } ], "Attributes": 0, @@ -2871,7 +2871,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2897,7 +2897,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 } @@ -2917,7 +2917,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2949,7 +2949,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 } @@ -2969,7 +2969,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 } @@ -2989,7 +2989,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3015,7 +3015,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 } @@ -3035,7 +3035,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3061,7 +3061,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3087,7 +3087,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3113,12 +3113,12 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 } ], - "ReturnType": "i:Union[str, tuple]" + "ReturnType": "i:typing.Union[str, tuple]" } ], "Attributes": 0, @@ -3133,7 +3133,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3150,7 +3150,7 @@ "Kind": 0 } ], - "ReturnType": "i:Union[str, tuple]" + "ReturnType": "i:typing.Union[str, tuple]" } ], "Attributes": 0, @@ -3165,7 +3165,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 } @@ -3185,7 +3185,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3211,7 +3211,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3243,7 +3243,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3269,7 +3269,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 } @@ -3289,7 +3289,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3315,7 +3315,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3347,7 +3347,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__hash_info", + "Type": "sys(3.7).__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3462,7 +3462,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3488,7 +3488,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3514,7 +3514,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3540,7 +3540,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3551,7 +3551,7 @@ "Kind": 0 } ], - "ReturnType": "i:builtins(3:7).list" + "ReturnType": "i:list" } ], "Attributes": 0, @@ -3566,7 +3566,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3592,7 +3592,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3624,7 +3624,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3650,7 +3650,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3676,7 +3676,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3702,7 +3702,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3713,7 +3713,7 @@ "Kind": 0 } ], - "ReturnType": "i:builtins(3:7).tuple" + "ReturnType": "i:tuple" } ], "Attributes": 0, @@ -3728,7 +3728,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3754,7 +3754,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 } @@ -3774,7 +3774,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3806,7 +3806,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 } @@ -3826,7 +3826,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 } @@ -3846,7 +3846,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3872,7 +3872,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 } @@ -3892,7 +3892,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3918,7 +3918,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3944,7 +3944,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3970,12 +3970,12 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 } ], - "ReturnType": "i:Union[str, tuple]" + "ReturnType": "i:typing.Union[str, tuple]" } ], "Attributes": 0, @@ -3990,7 +3990,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4007,7 +4007,7 @@ "Kind": 0 } ], - "ReturnType": "i:Union[str, tuple]" + "ReturnType": "i:typing.Union[str, tuple]" } ], "Attributes": 0, @@ -4022,7 +4022,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 } @@ -4042,7 +4042,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4068,7 +4068,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4100,7 +4100,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4126,7 +4126,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 } @@ -4146,7 +4146,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4172,7 +4172,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4204,7 +4204,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__int_info", + "Type": "sys(3.7).__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4291,7 +4291,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4317,7 +4317,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4343,7 +4343,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4369,7 +4369,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4380,7 +4380,7 @@ "Kind": 0 } ], - "ReturnType": "i:builtins(3:7).list" + "ReturnType": "i:list" } ], "Attributes": 0, @@ -4395,7 +4395,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4421,7 +4421,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4453,7 +4453,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4479,7 +4479,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4505,7 +4505,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4531,7 +4531,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4542,7 +4542,7 @@ "Kind": 0 } ], - "ReturnType": "i:builtins(3:7).tuple" + "ReturnType": "i:tuple" } ], "Attributes": 0, @@ -4557,7 +4557,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4583,7 +4583,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 } @@ -4603,7 +4603,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4635,7 +4635,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 } @@ -4655,7 +4655,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 } @@ -4675,7 +4675,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4701,7 +4701,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 } @@ -4721,7 +4721,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4747,7 +4747,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4773,7 +4773,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4799,12 +4799,12 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 } ], - "ReturnType": "i:Union[str, tuple]" + "ReturnType": "i:typing.Union[str, tuple]" } ], "Attributes": 0, @@ -4819,7 +4819,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4836,7 +4836,7 @@ "Kind": 0 } ], - "ReturnType": "i:Union[str, tuple]" + "ReturnType": "i:typing.Union[str, tuple]" } ], "Attributes": 0, @@ -4851,7 +4851,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 } @@ -4871,7 +4871,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4897,7 +4897,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4929,7 +4929,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4955,7 +4955,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 } @@ -4975,7 +4975,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -5001,7 +5001,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -5033,7 +5033,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__thread_info", + "Type": "sys(3.7).__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -5124,7 +5124,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5150,7 +5150,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5176,7 +5176,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5202,7 +5202,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5213,7 +5213,7 @@ "Kind": 0 } ], - "ReturnType": "i:builtins(3:7).list" + "ReturnType": "i:list" } ], "Attributes": 0, @@ -5228,7 +5228,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5254,7 +5254,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5286,7 +5286,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5312,7 +5312,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5338,7 +5338,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5364,7 +5364,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5375,7 +5375,7 @@ "Kind": 0 } ], - "ReturnType": "i:builtins(3:7).tuple" + "ReturnType": "i:tuple" } ], "Attributes": 0, @@ -5390,7 +5390,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5416,7 +5416,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 } @@ -5436,7 +5436,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5468,7 +5468,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 } @@ -5488,7 +5488,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 } @@ -5508,7 +5508,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5534,7 +5534,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 } @@ -5554,7 +5554,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5580,7 +5580,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5606,7 +5606,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5632,12 +5632,12 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 } ], - "ReturnType": "i:Union[str, tuple]" + "ReturnType": "i:typing.Union[str, tuple]" } ], "Attributes": 0, @@ -5652,7 +5652,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5669,7 +5669,7 @@ "Kind": 0 } ], - "ReturnType": "i:Union[str, tuple]" + "ReturnType": "i:typing.Union[str, tuple]" } ], "Attributes": 0, @@ -5684,7 +5684,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 } @@ -5704,7 +5704,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5730,7 +5730,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5762,7 +5762,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5788,7 +5788,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 } @@ -5808,7 +5808,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5834,7 +5834,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5866,7 +5866,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3:7).__version_info", + "Type": "sys(3.7).__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5952,5 +5952,5 @@ "Name": "__version_info" } ], - "Name": "sys(3:7)" + "Name": "sys(3.7)" } \ No newline at end of file From 5c1a0c38da8cf3f30ca4106b041107b9991f1314 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Fri, 14 Jun 2019 16:26:35 -0700 Subject: [PATCH 71/82] Demo --- src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs | 1 + .../Ast/Impl/Analyzer/PythonAnalyzerSession.cs | 1 + .../Ast/Impl/Modules/PythonModule.Analysis.cs | 13 +++++++++++-- src/Analysis/Ast/Impl/Modules/PythonModule.cs | 1 - .../Impl/Modules/Resolution/ModuleResolutionBase.cs | 9 +++++++++ src/Analysis/Ast/Impl/Types/ParameterInfo.cs | 2 +- src/Caching/Impl/Models/ClassModel.cs | 3 +++ src/Caching/Impl/Models/FunctionModel.cs | 1 + src/Caching/Impl/Models/MemberModel.cs | 1 + src/Caching/Impl/Models/ModuleModel.cs | 2 +- src/Caching/Impl/Models/PropertyModel.cs | 1 + src/Caching/Impl/Models/VariableModel.cs | 3 +++ src/Caching/Impl/ModuleDatabase.cs | 4 ++++ src/Caching/Impl/PythonDbModule.cs | 2 +- src/LanguageServer/Impl/Program.cs | 2 +- 15 files changed, 39 insertions(+), 7 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs b/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs index 42caa54da..4ac06e9a4 100644 --- a/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs +++ b/src/Analysis/Ast/Impl/Analyzer/LibraryAnalysis.cs @@ -16,6 +16,7 @@ using System.Collections.Generic; using System.Linq; using Microsoft.Python.Analysis.Analyzer.Evaluation; +using Microsoft.Python.Analysis.Caching; using Microsoft.Python.Analysis.Diagnostics; using Microsoft.Python.Analysis.Documents; using Microsoft.Python.Analysis.Modules; diff --git a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs index c0e9215f0..d2d9a58f1 100644 --- a/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs +++ b/src/Analysis/Ast/Impl/Analyzer/PythonAnalyzerSession.cs @@ -19,6 +19,7 @@ using System.Runtime; using System.Threading; using System.Threading.Tasks; +using Microsoft.Python.Analysis.Caching; using Microsoft.Python.Analysis.Dependencies; using Microsoft.Python.Analysis.Diagnostics; using Microsoft.Python.Analysis.Modules; diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.Analysis.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.Analysis.cs index a346e78f5..61d90913a 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.Analysis.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.Analysis.cs @@ -19,6 +19,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Python.Analysis.Analyzer; +using Microsoft.Python.Analysis.Caching; using Microsoft.Python.Analysis.Diagnostics; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; @@ -103,9 +104,17 @@ protected virtual void OnAnalysisComplete() { } public Task GetAnalysisAsync(int waitTime = 200, CancellationToken cancellationToken = default) => Services.GetService().GetAnalysisAsync(this, waitTime, cancellationToken); - private IDocumentAnalysis CreateAnalysis(int version, ModuleWalker walker, bool isFinalPass) - => ModuleType == ModuleType.Library && isFinalPass + private IDocumentAnalysis CreateAnalysis(int version, ModuleWalker walker, bool isFinalPass) { + var analysis = ModuleType == ModuleType.Library && isFinalPass ? new LibraryAnalysis(this, version, walker.Eval.Services, walker.GlobalScope, walker.StarImportMemberNames) : (IDocumentAnalysis)new DocumentAnalysis(this, version, walker.GlobalScope, walker.Eval, walker.StarImportMemberNames); + + if (analysis.Document.Name == "sys" && analysis.Document.ModuleType == ModuleType.CompiledBuiltin) { + var dbs = Services.GetService(); + dbs.StoreModuleAnalysis(analysis); + } + + return analysis; + } } } diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.cs index a96e98562..6795d538e 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.cs @@ -16,7 +16,6 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; diff --git a/src/Analysis/Ast/Impl/Modules/Resolution/ModuleResolutionBase.cs b/src/Analysis/Ast/Impl/Modules/Resolution/ModuleResolutionBase.cs index 1ddc7d3ed..03e00fb5b 100644 --- a/src/Analysis/Ast/Impl/Modules/Resolution/ModuleResolutionBase.cs +++ b/src/Analysis/Ast/Impl/Modules/Resolution/ModuleResolutionBase.cs @@ -146,6 +146,15 @@ public IPythonModule GetOrCreate(string name, ModuleResolutionBase mrb) { return _module; } + if (name == "sys") { + var dbs = mrb._services.GetService(); + dbs.TryGetModuleData("sys(3.7.2)", out var m); + if (m != null) { + _module = m; + return m; + } + } + var module = mrb.CreateModule(name); _module = module; return module; diff --git a/src/Analysis/Ast/Impl/Types/ParameterInfo.cs b/src/Analysis/Ast/Impl/Types/ParameterInfo.cs index 07f5a5e5b..c03e8b56a 100644 --- a/src/Analysis/Ast/Impl/Types/ParameterInfo.cs +++ b/src/Analysis/Ast/Impl/Types/ParameterInfo.cs @@ -29,7 +29,7 @@ public ParameterInfo(PythonAst ast, Parameter p, IPythonType type, IMember defau } public ParameterInfo(string name, IPythonType type, ParameterKind? kind, IMember defaultValue) { - Name = name ?? throw new ArgumentNullException(nameof(name)); + Name = name ?? "*"; // ?? throw new ArgumentNullException(nameof(name)); Documentation = string.Empty; DefaultValue = defaultValue; Type = type; diff --git a/src/Caching/Impl/Models/ClassModel.cs b/src/Caching/Impl/Models/ClassModel.cs index 8ff65828f..e4c6a30a8 100644 --- a/src/Caching/Impl/Models/ClassModel.cs +++ b/src/Caching/Impl/Models/ClassModel.cs @@ -34,6 +34,8 @@ internal sealed class ClassModel: MemberModel { public static ClassModel FromType(IPythonClassType cls) => new ClassModel(cls); + public ClassModel() { } + private ClassModel(IPythonClassType cls) { var methods = new List(); var properties = new List(); @@ -80,6 +82,7 @@ private ClassModel(IPythonClassType cls) { } Name = cls.TypeId == BuiltinTypeId.Ellipsis ? "ellipsis" : cls.Name; + Id = Name.GetHashCode(); Documentation = cls.Documentation; Bases = cls.Bases.OfType().Select(t => t.GetQualifiedName()).ToArray(); Methods = methods.ToArray(); diff --git a/src/Caching/Impl/Models/FunctionModel.cs b/src/Caching/Impl/Models/FunctionModel.cs index 1898c3043..aaaca007b 100644 --- a/src/Caching/Impl/Models/FunctionModel.cs +++ b/src/Caching/Impl/Models/FunctionModel.cs @@ -28,6 +28,7 @@ internal sealed class FunctionModel: MemberModel { public static FunctionModel FromType(IPythonFunctionType ft) { return new FunctionModel { + Id = ft.Name.GetHashCode(), Name = ft.Name, Documentation = ft.Documentation, Overloads = ft.Overloads.Select(FromOverload).ToArray() diff --git a/src/Caching/Impl/Models/MemberModel.cs b/src/Caching/Impl/Models/MemberModel.cs index d62e26c32..158d4ba44 100644 --- a/src/Caching/Impl/Models/MemberModel.cs +++ b/src/Caching/Impl/Models/MemberModel.cs @@ -15,6 +15,7 @@ namespace Microsoft.Python.Analysis.Caching.Models { internal abstract class MemberModel { + public int Id { get; set; } public string Name { get; set; } } } diff --git a/src/Caching/Impl/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs index 9b115446e..b4fa247e3 100644 --- a/src/Caching/Impl/Models/ModuleModel.cs +++ b/src/Caching/Impl/Models/ModuleModel.cs @@ -14,7 +14,6 @@ // permissions and limitations under the License. using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; @@ -62,6 +61,7 @@ public static ModuleModel FromAnalysis(IDocumentAnalysis analysis) { } return new ModuleModel { + Id = analysis.Document.QualifiedName.GetHashCode(), Name = analysis.Document.QualifiedName, Documentation = analysis.Document.Documentation, Functions = functions.Values.ToArray(), diff --git a/src/Caching/Impl/Models/PropertyModel.cs b/src/Caching/Impl/Models/PropertyModel.cs index 1397011e1..d1085a557 100644 --- a/src/Caching/Impl/Models/PropertyModel.cs +++ b/src/Caching/Impl/Models/PropertyModel.cs @@ -23,6 +23,7 @@ internal sealed class PropertyModel: MemberModel { public static PropertyModel FromType(IPythonPropertyType prop) { return new PropertyModel { + Id = prop.Name.GetHashCode(), Name = prop.Name, Documentation = prop.Documentation, ReturnType = prop.ReturnType.GetQualifiedName(), diff --git a/src/Caching/Impl/Models/VariableModel.cs b/src/Caching/Impl/Models/VariableModel.cs index 112e014d9..1c715e156 100644 --- a/src/Caching/Impl/Models/VariableModel.cs +++ b/src/Caching/Impl/Models/VariableModel.cs @@ -23,16 +23,19 @@ internal sealed class VariableModel: MemberModel { public string Value { get; set; } public static VariableModel FromVariable(IVariable v) => new VariableModel { + Id = v.Name.GetHashCode(), Name = v.Name, Value = v.Value.GetQualifiedName() }; public static VariableModel FromInstance(string name, IPythonInstance inst) => new VariableModel { + Id = name.GetHashCode(), Name = name, Value = inst.GetQualifiedName() }; public static VariableModel FromType(string name, IPythonType t) => new VariableModel { + Id = name.GetHashCode(), Name = name, Value = t.GetQualifiedName() }; diff --git a/src/Caching/Impl/ModuleDatabase.cs b/src/Caching/Impl/ModuleDatabase.cs index 1ea75f2d9..891e7dc51 100644 --- a/src/Caching/Impl/ModuleDatabase.cs +++ b/src/Caching/Impl/ModuleDatabase.cs @@ -20,6 +20,7 @@ using Microsoft.Python.Analysis.Caching.Models; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Core; +using Microsoft.Python.Core.IO; using Microsoft.Python.Core.Logging; namespace Microsoft.Python.Analysis.Caching { @@ -69,6 +70,9 @@ public void StoreModuleAnalysis(IDocumentAnalysis analysis) { lock (_lock) { var model = ModuleModel.FromAnalysis(analysis); try { + if(!Directory.Exists(_databaseFolder)) { + Directory.CreateDirectory(_databaseFolder); + } using (var db = new LiteDatabase(Path.Combine(_databaseFolder, $"{model.Name}.db"))) { var modules = db.GetCollection("modules"); modules.Upsert(model); diff --git a/src/Caching/Impl/PythonDbModule.cs b/src/Caching/Impl/PythonDbModule.cs index 3afd13556..b4b092b56 100644 --- a/src/Caching/Impl/PythonDbModule.cs +++ b/src/Caching/Impl/PythonDbModule.cs @@ -26,7 +26,7 @@ internal sealed class PythonDbModule : SpecializedModule { private readonly GlobalScope _globalScope; public PythonDbModule(ModuleModel model, IServiceContainer services) - : base(model.Name, string.Empty, services) { + : base(ModuleQualifiedName.GetModuleName(model.Name), string.Empty, services) { _globalScope = new GlobalScope(model, this, services); Documentation = model.Documentation; diff --git a/src/LanguageServer/Impl/Program.cs b/src/LanguageServer/Impl/Program.cs index 024f9af18..24adfa924 100644 --- a/src/LanguageServer/Impl/Program.cs +++ b/src/LanguageServer/Impl/Program.cs @@ -13,7 +13,7 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. -// #define WAIT_FOR_DEBUGGER +#define WAIT_FOR_DEBUGGER using System; using System.Diagnostics; From 41466904a5103cdeab5bc933be5fe0bbc93dde22 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Mon, 17 Jun 2019 13:55:46 -0700 Subject: [PATCH 72/82] Complete sys write/read --- .../Definitions/IModuleDatabaseService.cs | 6 +- .../Modules/CompiledBuiltinPythonModule.cs | 2 - .../Ast/Impl/Modules/ModuleQualifiedName.cs | 23 +- .../Ast/Impl/Modules/PythonModule.Analysis.cs | 4 +- src/Analysis/Ast/Impl/Modules/PythonModule.cs | 14 +- .../Ast/Impl/Modules/PythonVariableModule.cs | 4 +- .../Resolution/MainModuleResolution.cs | 11 +- .../Resolution/ModuleResolutionBase.cs | 11 +- .../Ast/Impl/Modules/StubPythonModule.cs | 2 - .../Ast/Impl/Utilities/ReentrancyGuard.cs | 32 +++ src/Caching/Impl/Factories/ModuleFactory.cs | 53 ++-- src/Caching/Impl/Models/ClassModel.cs | 20 +- src/Caching/Impl/ModuleDatabase.cs | 111 ++++++-- src/Caching/Impl/PythonDbModule.cs | 15 +- src/Caching/Test/BasicTests.cs | 50 +++- src/Caching/Test/Files/NestedClasses.json | 246 ++++++++++++++++++ .../Impl/Implementation/Server.cs | 5 +- 17 files changed, 493 insertions(+), 116 deletions(-) create mode 100644 src/Analysis/Ast/Impl/Utilities/ReentrancyGuard.cs create mode 100644 src/Caching/Test/Files/NestedClasses.json diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs index 08c0611ef..46127938c 100644 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs +++ b/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs @@ -21,10 +21,12 @@ internal interface IModuleDatabaseService { /// Retrieves module representation from module index database /// or null if module does not exist. /// - /// Module fully qualified name. + /// Module name. If the name is not qualified + /// the module will ge resolved against active Python version. + /// Module file path. /// Python module. /// Module storage state - ModuleStorageState TryGetModuleData(string qualifiedName, out IPythonModule module); + ModuleStorageState TryGetModuleData(string moduleName, string filePath, out IPythonModule module); /// /// Writes module data to the database. diff --git a/src/Analysis/Ast/Impl/Modules/CompiledBuiltinPythonModule.cs b/src/Analysis/Ast/Impl/Modules/CompiledBuiltinPythonModule.cs index 15f7134c4..e020e7b26 100644 --- a/src/Analysis/Ast/Impl/Modules/CompiledBuiltinPythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/CompiledBuiltinPythonModule.cs @@ -26,8 +26,6 @@ internal sealed class CompiledBuiltinPythonModule : CompiledPythonModule { public CompiledBuiltinPythonModule(string moduleName, IPythonModule stub, IServiceContainer services) : base(moduleName, ModuleType.CompiledBuiltin, MakeFakeFilePath(moduleName, services), stub, services) { } - public override string QualifiedName => $"{Name}({Interpreter.Configuration.Version})"; - protected override string[] GetScrapeArguments(IPythonInterpreter interpreter) => !InstallPath.TryGetFile("scrape_module.py", out var sm) ? null : new [] { "-W", "ignore", "-B", "-E", sm, "-u8", Name }; diff --git a/src/Analysis/Ast/Impl/Modules/ModuleQualifiedName.cs b/src/Analysis/Ast/Impl/Modules/ModuleQualifiedName.cs index f4a14b0a0..57f12cb29 100644 --- a/src/Analysis/Ast/Impl/Modules/ModuleQualifiedName.cs +++ b/src/Analysis/Ast/Impl/Modules/ModuleQualifiedName.cs @@ -23,20 +23,23 @@ namespace Microsoft.Python.Analysis.Modules { internal static class ModuleQualifiedName { - public static string CalculateQualifiedName(IPythonModule module, IFileSystem fs) { - var config = module.Interpreter.Configuration; + public static string CalculateQualifiedName(this IPythonModule module, IFileSystem fs) + => CalculateQualifiedName(module.Name, module.FilePath, module.Interpreter, fs); + + public static string CalculateQualifiedName(string moduleName, string filePath, IPythonInterpreter interpreter, IFileSystem fs) { + var config = interpreter.Configuration; var sitePackagesPath = PythonLibraryPath.GetSitePackagesPath(config); - if (fs.IsPathUnderRoot(sitePackagesPath, module.FilePath)) { + if (!string.IsNullOrEmpty(filePath) && fs.IsPathUnderRoot(sitePackagesPath, filePath)) { // If module is in site-packages and is versioned, then unique id = name + version + interpreter version. // Example: 'requests' and 'requests-2.21.0.dist-info'. - var moduleFolder = Path.GetDirectoryName(Path.GetDirectoryName(module.FilePath)); - + var moduleFolder = Path.GetDirectoryName(Path.GetDirectoryName(filePath)); + // TODO: for egg (https://github.com/microsoft/python-language-server/issues/196), consider *.egg-info var folders = fs .GetFileSystemEntries(moduleFolder, "*-*.dist-info", SearchOption.TopDirectoryOnly) .Select(Path.GetFileName) - .Where(n => n.StartsWith(module.Name, StringComparison.OrdinalIgnoreCase)) // Module name can be capitalized differently. + .Where(n => n.StartsWith(moduleName, StringComparison.OrdinalIgnoreCase)) // Module name can be capitalized differently. .ToArray(); if (folders.Length == 1) { @@ -47,13 +50,13 @@ public static string CalculateQualifiedName(IPythonModule module, IFileSystem fs } var standardLibraryPath = PythonLibraryPath.GetStandardLibraryPath(config); - if (fs.IsPathUnderRoot(standardLibraryPath, module.FilePath)) { + if (string.IsNullOrEmpty(filePath) || fs.IsPathUnderRoot(standardLibraryPath, filePath)) { // If module is a standard library, unique id is its name + interpreter version. - return $"{module.Name}({config.Version})"; + return $"{moduleName}({config.Version.Major}.{config.Version.Minor})"; } - // If all else fails, hash the entire content. - return $"{module.Name}.{HashModuleContent(Path.GetDirectoryName(module.FilePath), fs)}"; + // If all else fails, hash module data. + return $"{moduleName}.{HashModuleContent(Path.GetDirectoryName(filePath), fs)}"; } public static string GetModuleName(string moduleQualifiedName) { diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.Analysis.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.Analysis.cs index 61d90913a..b8ad6c832 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.Analysis.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.Analysis.cs @@ -109,9 +109,9 @@ private IDocumentAnalysis CreateAnalysis(int version, ModuleWalker walker, bool ? new LibraryAnalysis(this, version, walker.Eval.Services, walker.GlobalScope, walker.StarImportMemberNames) : (IDocumentAnalysis)new DocumentAnalysis(this, version, walker.GlobalScope, walker.Eval, walker.StarImportMemberNames); - if (analysis.Document.Name == "sys" && analysis.Document.ModuleType == ModuleType.CompiledBuiltin) { + if (analysis.Document.ModuleType != ModuleType.Stub) { var dbs = Services.GetService(); - dbs.StoreModuleAnalysis(analysis); + dbs?.StoreModuleAnalysis(analysis); } return analysis; diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.cs index 6795d538e..948143727 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.cs @@ -76,6 +76,7 @@ protected PythonModule(string name, ModuleType moduleType, IServiceContainer ser Log = services.GetService(); Interpreter = services.GetService(); Analysis = new EmptyAnalysis(services, this); + GlobalScope = Analysis.GlobalScope; _diagnosticsService = services.GetService(); SetDeclaringModule(this); @@ -117,10 +118,11 @@ internal PythonModule(ModuleCreationOptions creationOptions, IServiceContainer s public virtual string QualifiedName { get { - if (string.IsNullOrEmpty(FilePath) || ModuleType == ModuleType.User || ModuleType == ModuleType.Stub) { + if (string.IsNullOrEmpty(FilePath) || ModuleType == ModuleType.User) { return Name; } - return string.IsNullOrEmpty(_qualifiedName) ? (_qualifiedName = ModuleQualifiedName.CalculateQualifiedName(this, FileSystem)) : _qualifiedName; + return string.IsNullOrEmpty(_qualifiedName) + ? _qualifiedName = this.CalculateQualifiedName(FileSystem) : _qualifiedName; } } @@ -156,10 +158,10 @@ public virtual string Documentation { #endregion #region IMemberContainer - public virtual IMember GetMember(string name) => Analysis.GlobalScope.Variables[name]?.Value; + public virtual IMember GetMember(string name) => GlobalScope.Variables[name]?.Value; public virtual IEnumerable GetMemberNames() { // drop imported modules and typing. - return Analysis.GlobalScope.Variables + return GlobalScope.Variables .Where(v => { // Instances are always fine. if (v.Value is IPythonInstance) { @@ -181,7 +183,7 @@ public virtual IEnumerable GetMemberNames() { #endregion #region IPythonModule - public virtual string FilePath { get; } + public virtual string FilePath { get; protected set; } public virtual Uri Uri { get; } public IDocumentAnalysis Analysis { get; private set; } @@ -196,7 +198,7 @@ public virtual IEnumerable GetMemberNames() { /// /// Global cope of the module. /// - public virtual IGlobalScope GlobalScope { get; private set; } + public virtual IGlobalScope GlobalScope { get; protected set; } /// /// If module is a stub points to the primary module. diff --git a/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs b/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs index 56f298233..73bfd0a45 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs @@ -38,7 +38,9 @@ public string QualifiedName { if (string.IsNullOrEmpty(FilePath) || ModuleType == ModuleType.User || ModuleType == ModuleType.Stub) { return Name; } - return string.IsNullOrEmpty(_qualifiedName) ? (_qualifiedName = ModuleQualifiedName.CalculateQualifiedName(this, _fs)) : _qualifiedName; + return string.IsNullOrEmpty(_qualifiedName) + ? _qualifiedName = this.CalculateQualifiedName(_fs) + : _qualifiedName; } } public IPythonModule Module { get; } diff --git a/src/Analysis/Ast/Impl/Modules/Resolution/MainModuleResolution.cs b/src/Analysis/Ast/Impl/Modules/Resolution/MainModuleResolution.cs index 176f32a1a..2a6a1e4e2 100644 --- a/src/Analysis/Ast/Impl/Modules/Resolution/MainModuleResolution.cs +++ b/src/Analysis/Ast/Impl/Modules/Resolution/MainModuleResolution.cs @@ -99,7 +99,12 @@ protected override IPythonModule CreateModule(string name) { return module; } } - + + var dbs = _services.GetService(); + if (dbs != null && dbs.TryGetModuleData(name, moduleImport.ModulePath, out var m) != ModuleStorageState.DoesNotExist && m != null) { + return m; + } + // If there is a stub, make sure it is loaded and attached // First check stub next to the module. if (!TryCreateModuleStub(name, moduleImport.ModulePath, out var stub)) { @@ -200,7 +205,7 @@ public async Task ReloadAsync(CancellationToken cancellationToken = default) { .ExcludeDefault()) { GetRdt()?.UnlockDocument(uri); } - + // Preserve builtins, they don't need to be reloaded since interpreter does not change. var builtins = Modules[BuiltinModuleName]; Modules.Clear(); @@ -226,7 +231,7 @@ public async Task ReloadAsync(CancellationToken cancellationToken = default) { ReloadModulePaths(addedRoots); } - public IEnumerable SetUserSearchPaths(in IEnumerable searchPaths) + public IEnumerable SetUserSearchPaths(in IEnumerable searchPaths) => PathResolver.SetUserSearchPaths(searchPaths); // For tests diff --git a/src/Analysis/Ast/Impl/Modules/Resolution/ModuleResolutionBase.cs b/src/Analysis/Ast/Impl/Modules/Resolution/ModuleResolutionBase.cs index 03e00fb5b..06dfe6802 100644 --- a/src/Analysis/Ast/Impl/Modules/Resolution/ModuleResolutionBase.cs +++ b/src/Analysis/Ast/Impl/Modules/Resolution/ModuleResolutionBase.cs @@ -83,7 +83,7 @@ public IReadOnlyCollection GetPackagesFromDirectory(string searchPath, C public IStubCache StubCache { get; protected set; } - public IPythonModule GetImportedModule(string name) + public IPythonModule GetImportedModule(string name) => Modules.TryGetValue(name, out var moduleRef) ? moduleRef.Value : _interpreter.ModuleResolution.GetSpecializedModule(name); public IPythonModule GetOrLoadModule(string name) { @@ -146,15 +146,6 @@ public IPythonModule GetOrCreate(string name, ModuleResolutionBase mrb) { return _module; } - if (name == "sys") { - var dbs = mrb._services.GetService(); - dbs.TryGetModuleData("sys(3.7.2)", out var m); - if (m != null) { - _module = m; - return m; - } - } - var module = mrb.CreateModule(name); _module = module; return module; diff --git a/src/Analysis/Ast/Impl/Modules/StubPythonModule.cs b/src/Analysis/Ast/Impl/Modules/StubPythonModule.cs index 907572b14..83fa0ffbe 100644 --- a/src/Analysis/Ast/Impl/Modules/StubPythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/StubPythonModule.cs @@ -29,8 +29,6 @@ public StubPythonModule(string moduleName, string stubPath, bool isTypeshed, ISe IsTypeshed = isTypeshed; } - public override string QualifiedName => PrimaryModule.QualifiedName; - protected override string LoadContent() { // Exceptions are handled in the base return FileSystem.FileExists(FilePath) ? FileSystem.ReadTextWithRetry(FilePath) : string.Empty; diff --git a/src/Analysis/Ast/Impl/Utilities/ReentrancyGuard.cs b/src/Analysis/Ast/Impl/Utilities/ReentrancyGuard.cs new file mode 100644 index 000000000..c168dc409 --- /dev/null +++ b/src/Analysis/Ast/Impl/Utilities/ReentrancyGuard.cs @@ -0,0 +1,32 @@ +// 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.Collections.Generic; + +namespace Microsoft.Python.Analysis.Utilities { + public sealed class ReentrancyGuard { + private readonly Stack _processing = new Stack(); + + public bool Push(T t) { + if (_processing.Contains(t)) { + return false; + } + _processing.Push(t); + return true; + } + + public void Pop() => _processing.Pop(); + } +} diff --git a/src/Caching/Impl/Factories/ModuleFactory.cs b/src/Caching/Impl/Factories/ModuleFactory.cs index d69c71dc4..9c0d57b34 100644 --- a/src/Caching/Impl/Factories/ModuleFactory.cs +++ b/src/Caching/Impl/Factories/ModuleFactory.cs @@ -19,11 +19,15 @@ using System.Linq; using Microsoft.Python.Analysis.Caching.Models; using Microsoft.Python.Analysis.Specializations.Typing; +using Microsoft.Python.Analysis.Specializations.Typing.Types; using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Analysis.Utilities; using Microsoft.Python.Analysis.Values; namespace Microsoft.Python.Analysis.Caching.Factories { internal sealed class ModuleFactory : IDisposable { + private static readonly ReentrancyGuard _processing = new ReentrancyGuard(); + public IPythonModule Module { get; } public ClassFactory ClassFactory { get; } public FunctionFactory FunctionFactory { get; } @@ -53,29 +57,42 @@ public IMember ConstructMember(string qualifiedName) { return null; } - if(string.IsNullOrEmpty(typeName)) { - // TODO: resolve from database first? - return Module.Interpreter.ModuleResolution.GetOrLoadModule(moduleName); + // TODO: better resolve circular references? + if (!_processing.Push(qualifiedName)) { + return null; } - // Construct complex types from parts, such as Union[typing.Any, a.b.c] - var typeArgs = Array.Empty(); - var openBracket = typeName.IndexOf('['); - if (openBracket > 0) { - var closeBracket = typeName.LastIndexOf(']'); - if (closeBracket > 0) { - var argumentString = typeName.Substring(openBracket + 1, closeBracket - openBracket - 1); - var arguments = argumentString.Split(',').Select(s => s.Trim()); - typeArgs = arguments.Select(ConstructType).ToArray(); - typeName = typeName.Substring(0, openBracket); + try { + if (string.IsNullOrEmpty(typeName)) { + return moduleName == Module.Name ? Module : Module.Interpreter.ModuleResolution.GetOrLoadModule(moduleName); } - } - var member = moduleName == Module.Name - ? GetMemberFromThisModule(typeName) - : GetMemberFromModule(moduleQualifiedName, moduleName, typeName, typeArgs); + // Construct complex types from parts, such as Union[typing.Any, a.b.c] + var typeArgs = new List(); + var openBracket = typeName.IndexOf('['); + if (openBracket > 0) { + var closeBracket = typeName.LastIndexOf(']'); + if (closeBracket > 0) { + var argumentString = typeName.Substring(openBracket + 1, closeBracket - openBracket - 1); + var arguments = argumentString.Split(',').Select(s => s.Trim()).ToArray(); + // TODO: better handle generics. + foreach (var a in arguments) { + var t = ConstructType(a); + t = t ?? new GenericTypeParameter(a, Module, Array.Empty(), string.Empty, DefaultLocation.IndexSpan); + typeArgs.Add(t); + } + typeName = typeName.Substring(0, openBracket); + } + } + + var member = moduleName == Module.Name + ? GetMemberFromThisModule(typeName) + : GetMemberFromModule(moduleQualifiedName, moduleName, typeName, typeArgs); - return isInstance && member != null ? new PythonInstance(member.GetPythonType()) : member; + return isInstance && member != null ? new PythonInstance(member.GetPythonType()) : member; + } finally { + _processing.Pop(); + } } private IMember GetMemberFromModule(string moduleQualifiedName, string moduleName, string typeName, IReadOnlyList typeArgs) { diff --git a/src/Caching/Impl/Models/ClassModel.cs b/src/Caching/Impl/Models/ClassModel.cs index e4c6a30a8..57bf0bcbe 100644 --- a/src/Caching/Impl/Models/ClassModel.cs +++ b/src/Caching/Impl/Models/ClassModel.cs @@ -17,6 +17,7 @@ using System.Diagnostics; using System.Linq; using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Analysis.Utilities; using Microsoft.Python.Analysis.Values; namespace Microsoft.Python.Analysis.Caching.Models { @@ -30,11 +31,11 @@ internal sealed class ClassModel: MemberModel { public string[] GenericParameters { get; set; } public ClassModel[] InnerClasses { get; set; } - private readonly Stack _processing = new Stack(); + private readonly ReentrancyGuard _processing = new ReentrancyGuard(); public static ClassModel FromType(IPythonClassType cls) => new ClassModel(cls); - public ClassModel() { } + public ClassModel() { } // For de-serializer from JSON private ClassModel(IPythonClassType cls) { var methods = new List(); @@ -51,7 +52,7 @@ private ClassModel(IPythonClassType cls) { continue; } - if (!Push(m)) { + if (!_processing.Push(m)) { continue; } @@ -77,7 +78,7 @@ private ClassModel(IPythonClassType cls) { break; } } finally { - Pop(); + _processing.Pop(); } } @@ -90,16 +91,5 @@ private ClassModel(IPythonClassType cls) { Fields = fields.ToArray(); InnerClasses = innerClasses.ToArray(); } - - #region Reentrancy guards - private bool Push(IMember t) { - if (_processing.Contains(t)) { - return false; - } - _processing.Push(t); - return true; - } - private void Pop() => _processing.Pop(); - #endregion } } diff --git a/src/Caching/Impl/ModuleDatabase.cs b/src/Caching/Impl/ModuleDatabase.cs index 891e7dc51..4dcfe00fe 100644 --- a/src/Caching/Impl/ModuleDatabase.cs +++ b/src/Caching/Impl/ModuleDatabase.cs @@ -16,8 +16,10 @@ using System; using System.IO; using System.Linq; +using System.Threading; using LiteDB; using Microsoft.Python.Analysis.Caching.Models; +using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Core; using Microsoft.Python.Core.IO; @@ -30,37 +32,57 @@ public sealed class ModuleDatabase : IModuleDatabaseService { private readonly object _lock = new object(); private readonly IServiceContainer _services; private readonly ILogger _log; + private readonly IFileSystem _fs; private readonly string _databaseFolder; public ModuleDatabase(IServiceContainer services) { _services = services; _log = services.GetService(); + _fs = services.GetService(); var cfs = services.GetService(); _databaseFolder = Path.Combine(cfs.CacheFolder, $"analysis.v{_databaseFormatVersion}"); } - public ModuleStorageState TryGetModuleData(string qualifiedName, out IPythonModule module) { + /// + /// Retrieves module representation from module index database + /// or null if module does not exist. + /// + /// Module name. If the name is not qualified + /// the module will ge resolved against active Python version. + /// Module file path. + /// Python module. + /// Module storage state + public ModuleStorageState TryGetModuleData(string moduleName, string filePath, out IPythonModule module) { module = null; lock (_lock) { // We don't cache results here. Module resolution service decides when to call in here // and it is responsible of overall management of the loaded Python modules. - try { - // TODO: make combined db rather than per module. - using (var db = new LiteDatabase(Path.Combine(_databaseFolder, $"{qualifiedName}.db"))) { - if (!db.CollectionExists("modules")) { - return ModuleStorageState.Corrupted; - } - - var modules = db.GetCollection("modules"); - var model = modules.Find(m => m.Name == qualifiedName).FirstOrDefault(); - if (model == null) { + for (var retries = 50; retries > 0; --retries) { + try { + // TODO: make combined db rather than per module? + var dbPath = FindDatabaseFile(moduleName, filePath, out var qualifiedName); + if (string.IsNullOrEmpty(dbPath)) { return ModuleStorageState.DoesNotExist; } - module = new PythonDbModule(model, _services); - return ModuleStorageState.Complete; + using (var db = new LiteDatabase(dbPath)) { + if (!db.CollectionExists("modules")) { + return ModuleStorageState.Corrupted; + } + + var modules = db.GetCollection("modules"); + var model = modules.Find(m => m.Name == qualifiedName).FirstOrDefault(); + if (model == null) { + return ModuleStorageState.DoesNotExist; + } + + module = new PythonDbModule(model, filePath, _services); + return ModuleStorageState.Complete; + } + } catch (Exception ex) when (ex is IOException || ex is UnauthorizedAccessException) { + Thread.Sleep(10); } - } catch (IOException) { } catch (UnauthorizedAccessException) { } + } return ModuleStorageState.DoesNotExist; } @@ -69,21 +91,60 @@ public ModuleStorageState TryGetModuleData(string qualifiedName, out IPythonModu public void StoreModuleAnalysis(IDocumentAnalysis analysis) { lock (_lock) { var model = ModuleModel.FromAnalysis(analysis); - try { - if(!Directory.Exists(_databaseFolder)) { - Directory.CreateDirectory(_databaseFolder); - } - using (var db = new LiteDatabase(Path.Combine(_databaseFolder, $"{model.Name}.db"))) { - var modules = db.GetCollection("modules"); - modules.Upsert(model); + Exception ex = null; + for (var retries = 50; retries > 0; --retries) { + try { + if (!_fs.DirectoryExists(_databaseFolder)) { + _fs.CreateDirectory(_databaseFolder); + } + + using (var db = new LiteDatabase(Path.Combine(_databaseFolder, $"{model.Name}.db"))) { + var modules = db.GetCollection("modules"); + modules.Upsert(model); + } + } catch (Exception ex1) when (ex1 is IOException || ex1 is UnauthorizedAccessException) { + ex = ex1; + Thread.Sleep(10); + } catch (Exception ex2) { + ex = ex2; + break; } - } catch (Exception ex) { + } + + if (ex != null) { _log?.Log(System.Diagnostics.TraceEventType.Warning, $"Unable to write analysis of {model.Name} to database. Exception {ex.Message}"); - if(ex.IsCriticalException()) { - throw; + if (ex.IsCriticalException()) { + throw ex; } - } + } } } + + private string FindDatabaseFile(string moduleName, string filePath, out string qualifiedName) { + var interpreter = _services.GetService(); + qualifiedName = ModuleQualifiedName.CalculateQualifiedName(moduleName, filePath, interpreter, _fs); + if(string.IsNullOrEmpty(qualifiedName)) { + return null; + } + + // Try module name as is. + var dbPath = Path.Combine(_databaseFolder, $"{qualifiedName}.db"); + if(_fs.FileExists(dbPath)) { + return dbPath; + } + + // TODO: resolving to a different version can be an option + // Try with the major.minor Python version. + var pythonVersion = interpreter.Configuration.Version; + + dbPath = Path.Combine(_databaseFolder, $"{qualifiedName}({pythonVersion.Major}.{pythonVersion.Minor}).db"); + if (_fs.FileExists(dbPath)) { + return dbPath; + } + + // Try with just the major Python version. + dbPath = Path.Combine(_databaseFolder, $"{qualifiedName}({pythonVersion.Major}).db"); + return _fs.FileExists(dbPath) ? dbPath : null; + } } } diff --git a/src/Caching/Impl/PythonDbModule.cs b/src/Caching/Impl/PythonDbModule.cs index b4b092b56..38eb1bb55 100644 --- a/src/Caching/Impl/PythonDbModule.cs +++ b/src/Caching/Impl/PythonDbModule.cs @@ -16,27 +16,20 @@ using System.Collections.Generic; using Microsoft.Python.Analysis.Caching.Models; using Microsoft.Python.Analysis.Modules; -using Microsoft.Python.Analysis.Types; -using Microsoft.Python.Analysis.Values; using Microsoft.Python.Core; -using GlobalScope = Microsoft.Python.Analysis.Caching.GlobalScope; namespace Microsoft.Python.Analysis.Caching { internal sealed class PythonDbModule : SpecializedModule { - private readonly GlobalScope _globalScope; - - public PythonDbModule(ModuleModel model, IServiceContainer services) + public PythonDbModule(ModuleModel model, string filePath, IServiceContainer services) : base(ModuleQualifiedName.GetModuleName(model.Name), string.Empty, services) { - - _globalScope = new GlobalScope(model, this, services); + FilePath = filePath; + GlobalScope = new GlobalScope(model, this, services); Documentation = model.Documentation; } protected override string LoadContent() => string.Empty; public override string Documentation { get; } - public override IEnumerable GetMemberNames() => _globalScope.Variables.Names; - public override IMember GetMember(string name) => _globalScope.Variables[name]; - public override IGlobalScope GlobalScope => _globalScope; + public override IEnumerable GetMemberNames() => GlobalScope.Variables.Names; } } diff --git a/src/Caching/Test/BasicTests.cs b/src/Caching/Test/BasicTests.cs index 125442a95..62543527f 100644 --- a/src/Caching/Test/BasicTests.cs +++ b/src/Caching/Test/BasicTests.cs @@ -51,6 +51,10 @@ def __init__(self): def method(self): return func() + @property + def prop(self) -> int: + return x + def func(): return 2.0 @@ -62,6 +66,38 @@ def func(): Baseline.CompareToFile(BaselineFileName, json); } + [TestMethod, Priority(0)] + public async Task NestedClasses() { + const string code = @" +x = 'str' + +class A: + def methodA(self): + return True + +class B: + x: int + + class C: + def __init__(self): + self.y = 1 + def methodC(self): + return False + + def methodB1(self): + return C() + + def methodB2(self): + return C().y + +c = B().methodB1() +"; + var analysis = await GetAnalysisAsync(code); + var model = ModuleModel.FromAnalysis(analysis); + var json = ToJson(model); + Baseline.CompareToFile(BaselineFileName, json); + } + [TestMethod, Priority(0)] public async Task Builtins() { var analysis = await GetAnalysisAsync(string.Empty); @@ -71,7 +107,7 @@ public async Task Builtins() { var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); - var dbModule = new PythonDbModule(model, Services); + var dbModule = new PythonDbModule(model, null, Services); dbModule.Should().HaveSameMembersAs(builtins); } @@ -84,9 +120,10 @@ public async Task Sys() { var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); - - var dbModule = new PythonDbModule(model, Services); - dbModule.Should().HaveSameMembersAs(sys); + + using (var dbModule = new PythonDbModule(model, sys.FilePath, Services)) { + dbModule.Should().HaveSameMembersAs(sys); + } } [TestMethod, Priority(0)] @@ -125,8 +162,9 @@ import requests var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); - var dbModule = new PythonDbModule(model, Services); - dbModule.Should().HaveSameMembersAs(rq); + using (var dbModule = new PythonDbModule(model, rq.FilePath, Services)) { + dbModule.Should().HaveSameMembersAs(rq); + } } [DataTestMethod, Priority(0)] diff --git a/src/Caching/Test/Files/NestedClasses.json b/src/Caching/Test/Files/NestedClasses.json new file mode 100644 index 000000000..505fb0381 --- /dev/null +++ b/src/Caching/Test/Files/NestedClasses.json @@ -0,0 +1,246 @@ +{ + "Documentation": "", + "Functions": [], + "Variables": [ + { + "Value": "bool", + "Id": -284397016, + "Name": "__debug__" + }, + { + "Value": "str", + "Id": 1716814261, + "Name": "__doc__" + }, + { + "Value": "str", + "Id": -1651825028, + "Name": "__file__" + }, + { + "Value": "str", + "Id": 359927558, + "Name": "__name__" + }, + { + "Value": "str", + "Id": 1376117645, + "Name": "__package__" + }, + { + "Value": "list", + "Id": -1181510515, + "Name": "__path__" + }, + { + "Value": "dict", + "Id": -2101168703, + "Name": "__dict__" + }, + { + "Value": "i:str", + "Id": 1524797253, + "Name": "x" + }, + { + "Value": "i:module.C", + "Id": -466436537, + "Name": "c" + } + ], + "Classes": [ + { + "Documentation": null, + "Bases": [ + "object" + ], + "Methods": [ + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "module.A", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Id": 1064115010, + "Name": "methodA" + } + ], + "Properties": [], + "Fields": [ + { + "Value": "dict", + "Id": -2101168703, + "Name": "__dict__" + }, + { + "Value": "object", + "Id": -184559367, + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Id": 1589709533, + "Name": "A" + }, + { + "Documentation": null, + "Bases": [ + "object" + ], + "Methods": [ + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "module.B", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:module.C" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Id": -31822871, + "Name": "methodB1" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "module.B", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Id": 485037146, + "Name": "methodB2" + } + ], + "Properties": [], + "Fields": [ + { + "Value": "i:int", + "Id": 1524797253, + "Name": "x" + }, + { + "Value": "dict", + "Id": -2101168703, + "Name": "__dict__" + }, + { + "Value": "object", + "Id": -184559367, + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [ + { + "Documentation": null, + "Bases": [ + "object" + ], + "Methods": [ + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "module.C", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": null + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Id": 506751156, + "Name": "__init__" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "self", + "Type": "module.C", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:bool" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Id": 1910290968, + "Name": "methodC" + } + ], + "Properties": [], + "Fields": [ + { + "Value": "i:int", + "Id": 466874038, + "Name": "y" + }, + { + "Value": "dict", + "Id": -2101168703, + "Name": "__dict__" + }, + { + "Value": "object", + "Id": -184559367, + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Id": 339060664, + "Name": "C" + } + ], + "Id": 431513585, + "Name": "B" + } + ], + "Id": 1345059090, + "Name": "module" +} \ No newline at end of file diff --git a/src/LanguageServer/Impl/Implementation/Server.cs b/src/LanguageServer/Impl/Implementation/Server.cs index 9603e2012..63b26a64a 100644 --- a/src/LanguageServer/Impl/Implementation/Server.cs +++ b/src/LanguageServer/Impl/Implementation/Server.cs @@ -143,10 +143,9 @@ public async Task InitializeAsync(InitializeParams @params, Ca TypeshedPath = @params.initializationOptions.typeStubSearchPaths.FirstOrDefault() }; + _services.AddService(new ModuleDatabase(_services)); _interpreter = await PythonInterpreter.CreateAsync(configuration, _rootDir, _services, cancellationToken); - _services - .AddService(_interpreter) - .AddService(new ModuleDatabase(_services)); + _services.AddService(_interpreter); var fileSystem = _services.GetService(); _indexManager = new IndexManager(fileSystem, _interpreter.LanguageVersion, _rootDir, From 48763aacc78594ee3670932c178781436c3ddaaf Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Mon, 17 Jun 2019 16:30:58 -0700 Subject: [PATCH 73/82] Partial --- src/Caching/Impl/Factories/ModuleFactory.cs | 101 +++++++++++--------- src/Caching/Impl/TypeNames.cs | 93 ++++++++---------- src/Caching/Test/BasicTests.cs | 10 +- 3 files changed, 103 insertions(+), 101 deletions(-) diff --git a/src/Caching/Impl/Factories/ModuleFactory.cs b/src/Caching/Impl/Factories/ModuleFactory.cs index 9c0d57b34..6fcca515a 100644 --- a/src/Caching/Impl/Factories/ModuleFactory.cs +++ b/src/Caching/Impl/Factories/ModuleFactory.cs @@ -14,6 +14,7 @@ // permissions and limitations under the License. using System; +using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; @@ -52,42 +53,27 @@ public void Dispose() { public IPythonType ConstructType(string qualifiedName) => ConstructMember(qualifiedName)?.GetPythonType(); - public IMember ConstructMember(string qualifiedName) { - if (!TypeNames.DeconstructQualifiedName(qualifiedName, out var moduleQualifiedName, out var moduleName, out var typeName, out var isInstance)) { + public IMember ConstructMember(string rawQualifiedName) { + if (!TypeNames.DeconstructQualifiedName(rawQualifiedName, out _, out var nameParts, out var isInstance)) { return null; } - // TODO: better resolve circular references? - if (!_processing.Push(qualifiedName)) { + // TODO: better resolve circular references. + if (!_processing.Push(rawQualifiedName) || nameParts.Count < 2) { return null; } try { - if (string.IsNullOrEmpty(typeName)) { - return moduleName == Module.Name ? Module : Module.Interpreter.ModuleResolution.GetOrLoadModule(moduleName); - } - - // Construct complex types from parts, such as Union[typing.Any, a.b.c] - var typeArgs = new List(); - var openBracket = typeName.IndexOf('['); - if (openBracket > 0) { - var closeBracket = typeName.LastIndexOf(']'); - if (closeBracket > 0) { - var argumentString = typeName.Substring(openBracket + 1, closeBracket - openBracket - 1); - var arguments = argumentString.Split(',').Select(s => s.Trim()).ToArray(); - // TODO: better handle generics. - foreach (var a in arguments) { - var t = ConstructType(a); - t = t ?? new GenericTypeParameter(a, Module, Array.Empty(), string.Empty, DefaultLocation.IndexSpan); - typeArgs.Add(t); - } - typeName = typeName.Substring(0, openBracket); - } + // See if member is a module first. + var moduleName = TypeNames.GetNameWithoutVersion(nameParts[0]); + var module = moduleName == Module.Name ? Module : Module.Interpreter.ModuleResolution.GetOrLoadModule(moduleName); + if (module == null) { + return null; } var member = moduleName == Module.Name - ? GetMemberFromThisModule(typeName) - : GetMemberFromModule(moduleQualifiedName, moduleName, typeName, typeArgs); + ? GetMemberFromThisModule(nameParts, 1) + : GetMemberFromModule(module, nameParts, 1); return isInstance && member != null ? new PythonInstance(member.GetPythonType()) : member; } finally { @@ -95,41 +81,70 @@ public IMember ConstructMember(string qualifiedName) { } } - private IMember GetMemberFromModule(string moduleQualifiedName, string moduleName, string typeName, IReadOnlyList typeArgs) { - var typeNameParts = typeName.Split('.'); + private IMember GetMemberFromModule(IPythonModule module, IReadOnlyList nameParts, int index) { + if (index >= nameParts.Count) { + return null; + } - // TODO: Try resolving from database first. - var module = Module.Interpreter.ModuleResolution.GetOrLoadModule(moduleName); + var member = module?.GetMember(nameParts[index++]); + for (; index < nameParts.Count; index++) { + var memberName = nameParts[index]; + var typeArgs = GetTypeArguments(memberName, out var typeName); - var member = module?.GetMember(typeNameParts[0]); - foreach (var p in typeNameParts.Skip(1)) { var mc = member as IMemberContainer; Debug.Assert(mc != null); - member = mc?.GetMember(p); + member = mc?.GetMember(memberName); if (member == null) { Debug.Assert(member != null); break; } + + member = typeArgs.Any() && member is IGenericType gt + ? gt.CreateSpecificType(typeArgs) + : member; } - return typeArgs.Any() && member is IGenericType gt - ? gt.CreateSpecificType(typeArgs) - : member; + + return member; } - private IMember GetMemberFromThisModule(string typeName) { - var typeNameParts = typeName.Split('.'); - if (typeNameParts.Length == 0) { + private IMember GetMemberFromThisModule(IReadOnlyList nameParts, int index) { + if (index >= nameParts.Count) { return null; } // TODO: nested classes, etc (traverse parts and recurse). - return ClassFactory.TryCreate(typeNameParts[0]) - ?? (FunctionFactory.TryCreate(typeNameParts[0]) - ?? (IMember)VariableFactory.TryCreate(typeNameParts[0])); + var name = nameParts[index]; + return ClassFactory.TryCreate(name) + ?? (FunctionFactory.TryCreate(name) + ?? (IMember)VariableFactory.TryCreate(name)); } - + private IReadOnlyList GetTypeArguments(string memberName, out string typeName) { + typeName = null; + // TODO: better handle generics. + // https://github.com/microsoft/python-language-server/issues/1215 + // Determine generic type arguments, if any, so we can construct + // complex types from parts, such as Union[typing.Any, a.b.c]. + var typeArgs = new List(); + var openBracket = memberName.IndexOf('['); + if (openBracket > 0) { + var closeBracket = memberName.LastIndexOf(']'); + if (closeBracket > 0) { + var argumentString = memberName.Substring(openBracket + 1, closeBracket - openBracket - 1); + var arguments = argumentString.Split(',').Select(s => s.Trim()).ToArray(); + foreach (var a in arguments) { + var t = ConstructType(a); + // TODO: better handle generics type definitions from TypeVar. + // https://github.com/microsoft/python-language-server/issues/1214 + t = t ?? new GenericTypeParameter(a, Module, Array.Empty(), string.Empty, DefaultLocation.IndexSpan); + typeArgs.Add(t); + } + typeName = memberName.Substring(0, openBracket); + } + } + return typeArgs; + } } } diff --git a/src/Caching/Impl/TypeNames.cs b/src/Caching/Impl/TypeNames.cs index c51ead081..4eba970fe 100644 --- a/src/Caching/Impl/TypeNames.cs +++ b/src/Caching/Impl/TypeNames.cs @@ -13,7 +13,7 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. -using System.Diagnostics; +using System.Collections.Generic; using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; @@ -37,56 +37,62 @@ public static string GetQualifiedName(this IMember m) { return null; } - public static bool DeconstructQualifiedName(string qualifiedName, out string moduleQualifiedName, out string moduleName, out string typeName, out bool isInstance) { - moduleQualifiedName = null; - moduleName = null; - typeName = null; + /// + /// Splits qualified type name in form of i:A(3.6).B.C into parts. as well as determines if + /// qualified name designates instance (prefixed with 'i:'). + /// + /// Raw qualified name to split. May include instance prefix. + /// Qualified name without optional instance prefix, such as A(3.6).B(3.6).C + /// Name parts such as 'A(3.6)', 'B(3.6)', 'C'. + /// If true, the qualified name describes instance of a type. + public static bool DeconstructQualifiedName(string rawQualifiedName, out string typeQualifiedName, out IReadOnlyList nameParts, out bool isInstance) { + typeQualifiedName = null; + nameParts = null; isInstance = false; - if (string.IsNullOrEmpty(qualifiedName)) { + if (string.IsNullOrEmpty(rawQualifiedName)) { return false; } - isInstance = qualifiedName.StartsWith("i:"); - qualifiedName = isInstance ? qualifiedName.Substring(2) : qualifiedName; + isInstance = rawQualifiedName.StartsWith("i:"); + typeQualifiedName = isInstance ? rawQualifiedName.Substring(2) : rawQualifiedName; - if (qualifiedName == "..." || qualifiedName == "ellipsis") { - moduleName = @"builtins"; - moduleQualifiedName = moduleName; - typeName = "ellipsis"; + if (typeQualifiedName == "..." || typeQualifiedName == "ellipsis") { + nameParts = new[] { @"builtins", "ellipsis" }; return true; } // First chunk is qualified module name except dots in braces. // Builtin types don't have module prefix. - GetModuleNames(qualifiedName, out moduleQualifiedName, out moduleName); - - typeName = string.IsNullOrEmpty(moduleQualifiedName) - ? qualifiedName - : qualifiedName.Substring(moduleQualifiedName.Length).TrimStart('.'); + nameParts = GetParts(typeQualifiedName); + return nameParts.Count > 0; + } - moduleQualifiedName = moduleQualifiedName ?? @"builtins"; - moduleName = moduleName ?? @"builtins"; - typeName = string.IsNullOrEmpty(typeName) ? null : typeName; + public static string GetNameWithoutVersion(string qualifiedName) { + var index = qualifiedName.IndexOf('('); + return index > 0 ? qualifiedName.Substring(0, index) : qualifiedName; + } - return true; + private static IReadOnlyList GetParts(string qualifiedTypeName) { + var parts = new List(); + for (var i = 0; i < qualifiedTypeName.Length; i++) { + var part = GetSubPart(qualifiedTypeName, ref i); + if (string.IsNullOrEmpty(part)) { + break; + } + parts.Add(part); + } + return parts; } - private static void GetModuleNames(string qualifiedTypeName, out string moduleQualifiedName, out string moduleName) { - var openBraceIndex = -1; - var typeSeparatorDotIndex = -1; + private static string GetSubPart(string s, ref int i) { var skip = false; - - // types(3.7) - // mod.x - // mod(2.2.1).z - // typing.Union[typing.Any, mod.y] - for (var i = 0; i < qualifiedTypeName.Length; i++) { - var ch = qualifiedTypeName[i]; + var start = i; + for (; i < s.Length; i++) { + var ch = s[i]; if (ch == '(') { skip = true; - openBraceIndex = i; continue; } @@ -95,31 +101,12 @@ private static void GetModuleNames(string qualifiedTypeName, out string moduleQu } if (!skip && ch == '.') { - typeSeparatorDotIndex = i; + i++; break; } } - if(typeSeparatorDotIndex > 0) { - // mod.x or mod(2.2.1).x - moduleQualifiedName = qualifiedTypeName.Substring(0, typeSeparatorDotIndex); - } else { - // str or types(3.7) - moduleQualifiedName = openBraceIndex > 0 ? qualifiedTypeName : null; - } - - moduleName = null; - if (!string.IsNullOrEmpty(moduleQualifiedName)) { - if (openBraceIndex > 0) { - // types(3.7) - moduleName = qualifiedTypeName.Substring(0, openBraceIndex); - } else if(typeSeparatorDotIndex > 0) { - // mod.x - moduleName = qualifiedTypeName.Substring(0, typeSeparatorDotIndex); - } - } - - Debug.Assert(string.IsNullOrEmpty(moduleQualifiedName) == string.IsNullOrEmpty(moduleName)); + return s.Substring(start, i - start); } } } diff --git a/src/Caching/Test/BasicTests.cs b/src/Caching/Test/BasicTests.cs index 62543527f..1da13ef30 100644 --- a/src/Caching/Test/BasicTests.cs +++ b/src/Caching/Test/BasicTests.cs @@ -180,11 +180,11 @@ import requests [DataRow("types(3.7)", "types(3.7)", "types", null, false)] [DataRow("typing.Union[str, tuple]", "typing", "typing", "Union[str, tuple]", false)] [DataRow("typing.Union[typing.Any, mod.y]", "typing", "typing", "Union[typing.Any, mod.y]", false)] - public void QualifiedNames(string qualifiedName, string moduleQualifiedName, string moduleName, string typeName, bool isInstance) { - TypeNames.DeconstructQualifiedName(qualifiedName, out var actualModuleQualifiedName, out var actualModuleName, out var actualTypeName, out var actualIsInstance); - actualModuleQualifiedName.Should().Be(moduleQualifiedName); - actualModuleName.Should().Be(moduleName); - actualTypeName.Should().Be(typeName); + public void QualifiedNames(string rawQualifiedName, string qualifiedName, string moduleName, string typeName, bool isInstance) { + TypeNames.DeconstructQualifiedName(rawQualifiedName, out var actualQualifiedName, out var nameParts, out var actualIsInstance); + qualifiedName.Should().Be(qualifiedName); + nameParts[0].Should().Be(moduleName); + nameParts[1].Should().Be(typeName); actualIsInstance.Should().Be(isInstance); } } From 93bece37a9493e07323bc8776bd214593a0f2ebf Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Mon, 17 Jun 2019 21:09:23 -0700 Subject: [PATCH 74/82] Partial --- .../Definitions/IModuleDatabaseService.cs | 10 +- .../Ast/Impl/Modules/BuiltinsPythonModule.cs | 2 - .../Ast/Impl/Modules/PythonModule.Analysis.cs | 2 +- src/Analysis/Ast/Impl/Modules/PythonModule.cs | 11 +- .../Ast/Impl/Modules/PythonVariableModule.cs | 17 +-- .../Resolution/MainModuleResolution.cs | 2 +- .../Ast/Impl/Modules/SentinelModule.cs | 2 - .../Ast/Impl/Modules/SpecializedModule.cs | 1 - src/Analysis/Ast/Impl/Types/PythonType.cs | 2 +- src/Caching/Impl/Factories/ModuleFactory.cs | 2 +- src/Caching/Impl/Models/ModuleModel.cs | 10 +- src/Caching/Impl/ModuleDatabase.cs | 127 +++++++++--------- .../Impl/ModuleUniqueId.cs} | 16 +-- src/Caching/Impl/PythonDbModule.cs | 2 +- src/Caching/Impl/TypeNames.cs | 28 ++-- src/Caching/Test/AnalysisCachingTestBase.cs | 2 + src/Caching/Test/BasicTests.cs | 27 ++-- 17 files changed, 123 insertions(+), 140 deletions(-) rename src/{Analysis/Ast/Impl/Modules/ModuleQualifiedName.cs => Caching/Impl/ModuleUniqueId.cs} (83%) diff --git a/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs b/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs index 46127938c..243e65776 100644 --- a/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs +++ b/src/Analysis/Ast/Impl/Caching/Definitions/IModuleDatabaseService.cs @@ -13,25 +13,25 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. +using System.Threading; +using System.Threading.Tasks; using Microsoft.Python.Analysis.Types; namespace Microsoft.Python.Analysis.Caching { internal interface IModuleDatabaseService { /// - /// Retrieves module representation from module index database - /// or null if module does not exist. + /// Creates module representation from module persistent state. /// /// Module name. If the name is not qualified /// the module will ge resolved against active Python version. /// Module file path. /// Python module. /// Module storage state - ModuleStorageState TryGetModuleData(string moduleName, string filePath, out IPythonModule module); + ModuleStorageState TryCreateModule(string moduleName, string filePath, out IPythonModule module); /// /// Writes module data to the database. /// - /// Module analysis. - void StoreModuleAnalysis(IDocumentAnalysis analysis); + Task StoreModuleAnalysisAsync(IDocumentAnalysis analysis, CancellationToken cancellationToken = default); } } diff --git a/src/Analysis/Ast/Impl/Modules/BuiltinsPythonModule.cs b/src/Analysis/Ast/Impl/Modules/BuiltinsPythonModule.cs index e1243d913..f792b565f 100644 --- a/src/Analysis/Ast/Impl/Modules/BuiltinsPythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/BuiltinsPythonModule.cs @@ -36,8 +36,6 @@ internal sealed class BuiltinsPythonModule : CompiledPythonModule, IBuiltinsPyth public BuiltinsPythonModule(string moduleName, string filePath, IServiceContainer services) : base(moduleName, ModuleType.Builtins, filePath, null, services) { } // TODO: builtins stub - public override string QualifiedName => $"{Name}({Interpreter.Configuration.Version})"; - public override IMember GetMember(string name) => _hiddenNames.Contains(name) ? null : base.GetMember(name); public IMember GetAnyMember(string name) => base.GetMember(name); diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.Analysis.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.Analysis.cs index b8ad6c832..709d44cfe 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.Analysis.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.Analysis.cs @@ -111,7 +111,7 @@ private IDocumentAnalysis CreateAnalysis(int version, ModuleWalker walker, bool if (analysis.Document.ModuleType != ModuleType.Stub) { var dbs = Services.GetService(); - dbs?.StoreModuleAnalysis(analysis); + dbs?.StoreModuleAnalysisAsync(analysis).DoNotWait(); } return analysis; diff --git a/src/Analysis/Ast/Impl/Modules/PythonModule.cs b/src/Analysis/Ast/Impl/Modules/PythonModule.cs index 948143727..f29529264 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonModule.cs @@ -115,16 +115,7 @@ internal PythonModule(ModuleCreationOptions creationOptions, IServiceContainer s #region IPythonType public string Name { get; } - - public virtual string QualifiedName { - get { - if (string.IsNullOrEmpty(FilePath) || ModuleType == ModuleType.User) { - return Name; - } - return string.IsNullOrEmpty(_qualifiedName) - ? _qualifiedName = this.CalculateQualifiedName(FileSystem) : _qualifiedName; - } - } + public string QualifiedName => Name; public BuiltinTypeId TypeId => BuiltinTypeId.Module; public bool IsBuiltin => true; diff --git a/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs b/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs index 73bfd0a45..267059894 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs @@ -29,20 +29,10 @@ namespace Microsoft.Python.Analysis.Modules { /// internal sealed class PythonVariableModule : LocatedMember, IPythonModule, IEquatable { private readonly Dictionary _children = new Dictionary(); - private readonly IFileSystem _fs; - private string _qualifiedName; - + public string Name { get; } - public string QualifiedName { - get { - if (string.IsNullOrEmpty(FilePath) || ModuleType == ModuleType.User || ModuleType == ModuleType.Stub) { - return Name; - } - return string.IsNullOrEmpty(_qualifiedName) - ? _qualifiedName = this.CalculateQualifiedName(_fs) - : _qualifiedName; - } - } + public string QualifiedName => Name; + public IPythonModule Module { get; } public IPythonInterpreter Interpreter { get; } @@ -70,7 +60,6 @@ private PythonVariableModule(string name, IPythonModule module, IServiceContaine Module = module; Name = module?.Name ?? name; Interpreter = module?.Interpreter ?? services.GetService(); - _fs = services.GetService(); SetDeclaringModule(this); } diff --git a/src/Analysis/Ast/Impl/Modules/Resolution/MainModuleResolution.cs b/src/Analysis/Ast/Impl/Modules/Resolution/MainModuleResolution.cs index 2a6a1e4e2..f5680e7a7 100644 --- a/src/Analysis/Ast/Impl/Modules/Resolution/MainModuleResolution.cs +++ b/src/Analysis/Ast/Impl/Modules/Resolution/MainModuleResolution.cs @@ -101,7 +101,7 @@ protected override IPythonModule CreateModule(string name) { } var dbs = _services.GetService(); - if (dbs != null && dbs.TryGetModuleData(name, moduleImport.ModulePath, out var m) != ModuleStorageState.DoesNotExist && m != null) { + if (dbs != null && dbs.TryCreateModule(name, moduleImport.ModulePath, out var m) != ModuleStorageState.DoesNotExist && m != null) { return m; } diff --git a/src/Analysis/Ast/Impl/Modules/SentinelModule.cs b/src/Analysis/Ast/Impl/Modules/SentinelModule.cs index 893f44477..9eca1e39e 100644 --- a/src/Analysis/Ast/Impl/Modules/SentinelModule.cs +++ b/src/Analysis/Ast/Impl/Modules/SentinelModule.cs @@ -19,7 +19,5 @@ namespace Microsoft.Python.Analysis.Modules { internal sealed class SentinelModule : PythonModule { public SentinelModule(string name, IServiceContainer services) : base(name, ModuleType.Unresolved, services) { } - - public override string QualifiedName => Name; } } diff --git a/src/Analysis/Ast/Impl/Modules/SpecializedModule.cs b/src/Analysis/Ast/Impl/Modules/SpecializedModule.cs index 74432abb8..0e3e5fbcb 100644 --- a/src/Analysis/Ast/Impl/Modules/SpecializedModule.cs +++ b/src/Analysis/Ast/Impl/Modules/SpecializedModule.cs @@ -33,7 +33,6 @@ internal abstract class SpecializedModule : PythonModule { protected SpecializedModule(string name, string modulePath, IServiceContainer services) : base(name, modulePath, ModuleType.Specialized, null, services) { } - public override string QualifiedName => Name; protected override string LoadContent() { // Exceptions are handled in the base return FileSystem.FileExists(FilePath) ? FileSystem.ReadTextWithRetry(FilePath) : string.Empty; diff --git a/src/Analysis/Ast/Impl/Types/PythonType.cs b/src/Analysis/Ast/Impl/Types/PythonType.cs index 51c6483e1..5c0a6f6d8 100644 --- a/src/Analysis/Ast/Impl/Types/PythonType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonType.cs @@ -61,7 +61,7 @@ private PythonType(string name, Location location, BuiltinTypeId typeId) : base( public virtual string QualifiedName => DeclaringModule.ModuleType == ModuleType.Builtins ? TypeId == BuiltinTypeId.Ellipsis ? "ellipsis" : Name - : $"{DeclaringModule.QualifiedName}.{Name}"; + : $"{DeclaringModule.Name}.{Name}"; public virtual string Documentation { get; private set; } public virtual BuiltinTypeId TypeId => _typeId; diff --git a/src/Caching/Impl/Factories/ModuleFactory.cs b/src/Caching/Impl/Factories/ModuleFactory.cs index 6fcca515a..667d9f3a4 100644 --- a/src/Caching/Impl/Factories/ModuleFactory.cs +++ b/src/Caching/Impl/Factories/ModuleFactory.cs @@ -65,7 +65,7 @@ public IMember ConstructMember(string rawQualifiedName) { try { // See if member is a module first. - var moduleName = TypeNames.GetNameWithoutVersion(nameParts[0]); + var moduleName = nameParts[0]; var module = moduleName == Module.Name ? Module : Module.Interpreter.ModuleResolution.GetOrLoadModule(moduleName); if (module == null) { return null; diff --git a/src/Caching/Impl/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs index b4fa247e3..dd1241e11 100644 --- a/src/Caching/Impl/Models/ModuleModel.cs +++ b/src/Caching/Impl/Models/ModuleModel.cs @@ -17,16 +17,18 @@ using System.Linq; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; +using Microsoft.Python.Core.IO; namespace Microsoft.Python.Analysis.Caching.Models { internal sealed class ModuleModel : MemberModel { + public string UniqueId { get; set; } public string Documentation { get; set; } public FunctionModel[] Functions { get; set; } public VariableModel[] Variables { get; set; } public ClassModel[] Classes { get; set; } // TODO: TypeVars, ... - public static ModuleModel FromAnalysis(IDocumentAnalysis analysis) { + public static ModuleModel FromAnalysis(IDocumentAnalysis analysis, IFileSystem fs) { var variables = new Dictionary(); var functions = new Dictionary(); var classes = new Dictionary(); @@ -60,9 +62,11 @@ public static ModuleModel FromAnalysis(IDocumentAnalysis analysis) { } } + var uniqueId = analysis.Document.GetUniqieId(fs); return new ModuleModel { - Id = analysis.Document.QualifiedName.GetHashCode(), - Name = analysis.Document.QualifiedName, + Id = uniqueId.GetHashCode(), + UniqueId = uniqueId, + Name = analysis.Document.Name, Documentation = analysis.Document.Documentation, Functions = functions.Values.ToArray(), Variables = variables.Values.ToArray(), diff --git a/src/Caching/Impl/ModuleDatabase.cs b/src/Caching/Impl/ModuleDatabase.cs index 4dcfe00fe..9e70abeaa 100644 --- a/src/Caching/Impl/ModuleDatabase.cs +++ b/src/Caching/Impl/ModuleDatabase.cs @@ -16,10 +16,11 @@ using System; using System.IO; using System.Linq; +using System.Runtime.CompilerServices; using System.Threading; +using System.Threading.Tasks; using LiteDB; using Microsoft.Python.Analysis.Caching.Models; -using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Core; using Microsoft.Python.Core.IO; @@ -29,7 +30,6 @@ namespace Microsoft.Python.Analysis.Caching { public sealed class ModuleDatabase : IModuleDatabaseService { private const int _databaseFormatVersion = 1; - private readonly object _lock = new object(); private readonly IServiceContainer _services; private readonly ILogger _log; private readonly IFileSystem _fs; @@ -52,98 +52,103 @@ public ModuleDatabase(IServiceContainer services) { /// Module file path. /// Python module. /// Module storage state - public ModuleStorageState TryGetModuleData(string moduleName, string filePath, out IPythonModule module) { + public ModuleStorageState TryCreateModule(string moduleName, string filePath, out IPythonModule module) { module = null; - lock (_lock) { - // We don't cache results here. Module resolution service decides when to call in here - // and it is responsible of overall management of the loaded Python modules. - for (var retries = 50; retries > 0; --retries) { - try { - // TODO: make combined db rather than per module? - var dbPath = FindDatabaseFile(moduleName, filePath, out var qualifiedName); - if (string.IsNullOrEmpty(dbPath)) { - return ModuleStorageState.DoesNotExist; - } - - using (var db = new LiteDatabase(dbPath)) { - if (!db.CollectionExists("modules")) { - return ModuleStorageState.Corrupted; - } + // We don't cache results here. Module resolution service decides when to call in here + // and it is responsible of overall management of the loaded Python modules. + for (var retries = 50; retries > 0; --retries) { + try { + // TODO: make combined db rather than per module? + var dbPath = FindDatabaseFile(moduleName, filePath); + if (string.IsNullOrEmpty(dbPath)) { + return ModuleStorageState.DoesNotExist; + } - var modules = db.GetCollection("modules"); - var model = modules.Find(m => m.Name == qualifiedName).FirstOrDefault(); - if (model == null) { - return ModuleStorageState.DoesNotExist; - } + using (var db = new LiteDatabase(dbPath)) { + if (!db.CollectionExists("modules")) { + return ModuleStorageState.Corrupted; + } - module = new PythonDbModule(model, filePath, _services); - return ModuleStorageState.Complete; + var modules = db.GetCollection("modules"); + var model = modules.Find(m => m.Name == moduleName).FirstOrDefault(); + if (model == null) { + return ModuleStorageState.DoesNotExist; } - } catch (Exception ex) when (ex is IOException || ex is UnauthorizedAccessException) { - Thread.Sleep(10); + + module = new PythonDbModule(model, filePath, _services); + return ModuleStorageState.Complete; } + } catch (Exception ex) when (ex is IOException || ex is UnauthorizedAccessException) { + Thread.Sleep(10); } - - return ModuleStorageState.DoesNotExist; } + return ModuleStorageState.DoesNotExist; } - public void StoreModuleAnalysis(IDocumentAnalysis analysis) { - lock (_lock) { - var model = ModuleModel.FromAnalysis(analysis); - Exception ex = null; - for (var retries = 50; retries > 0; --retries) { - try { - if (!_fs.DirectoryExists(_databaseFolder)) { - _fs.CreateDirectory(_databaseFolder); - } + public Task StoreModuleAnalysisAsync(IDocumentAnalysis analysis, CancellationToken cancellationToken = default) + => Task.Run(() => StoreModuleAnalysis(analysis, cancellationToken)); + + private void StoreModuleAnalysis(IDocumentAnalysis analysis, CancellationToken cancellationToken = default) { + var model = ModuleModel.FromAnalysis(analysis, _fs); + Exception ex = null; + for (var retries = 50; retries > 0; --retries) { + cancellationToken.ThrowIfCancellationRequested(); + try { + if (!_fs.DirectoryExists(_databaseFolder)) { + _fs.CreateDirectory(_databaseFolder); + } - using (var db = new LiteDatabase(Path.Combine(_databaseFolder, $"{model.Name}.db"))) { - var modules = db.GetCollection("modules"); - modules.Upsert(model); - } - } catch (Exception ex1) when (ex1 is IOException || ex1 is UnauthorizedAccessException) { - ex = ex1; - Thread.Sleep(10); - } catch (Exception ex2) { - ex = ex2; - break; + cancellationToken.ThrowIfCancellationRequested(); + using (var db = new LiteDatabase(Path.Combine(_databaseFolder, $"{model.UniqueId}.db"))) { + var modules = db.GetCollection("modules"); + modules.Upsert(model); } + } catch (Exception ex1) when (ex1 is IOException || ex1 is UnauthorizedAccessException) { + ex = ex1; + Thread.Sleep(10); + } catch (Exception ex2) { + ex = ex2; + break; } + } - if (ex != null) { - _log?.Log(System.Diagnostics.TraceEventType.Warning, $"Unable to write analysis of {model.Name} to database. Exception {ex.Message}"); - if (ex.IsCriticalException()) { - throw ex; - } + if (ex != null) { + _log?.Log(System.Diagnostics.TraceEventType.Warning, $"Unable to write analysis of {model.Name} to database. Exception {ex.Message}"); + if (ex.IsCriticalException()) { + throw ex; } } } - private string FindDatabaseFile(string moduleName, string filePath, out string qualifiedName) { + /// + /// Locates database file based on module information. Module is identified + /// by name, version, current Python interpreter version and/or hash of the + /// module content (typically file sizes). + /// + private string FindDatabaseFile(string moduleName, string filePath) { var interpreter = _services.GetService(); - qualifiedName = ModuleQualifiedName.CalculateQualifiedName(moduleName, filePath, interpreter, _fs); - if(string.IsNullOrEmpty(qualifiedName)) { + var uniqueId = ModuleUniqueId.GetUniqieId(moduleName, filePath, interpreter, _fs); + if (string.IsNullOrEmpty(uniqueId)) { return null; } // Try module name as is. - var dbPath = Path.Combine(_databaseFolder, $"{qualifiedName}.db"); - if(_fs.FileExists(dbPath)) { + var dbPath = Path.Combine(_databaseFolder, $"{uniqueId}.db"); + if (_fs.FileExists(dbPath)) { return dbPath; } - + // TODO: resolving to a different version can be an option // Try with the major.minor Python version. var pythonVersion = interpreter.Configuration.Version; - dbPath = Path.Combine(_databaseFolder, $"{qualifiedName}({pythonVersion.Major}.{pythonVersion.Minor}).db"); + dbPath = Path.Combine(_databaseFolder, $"{uniqueId}({pythonVersion.Major}.{pythonVersion.Minor}).db"); if (_fs.FileExists(dbPath)) { return dbPath; } // Try with just the major Python version. - dbPath = Path.Combine(_databaseFolder, $"{qualifiedName}({pythonVersion.Major}).db"); + dbPath = Path.Combine(_databaseFolder, $"{uniqueId}({pythonVersion.Major}).db"); return _fs.FileExists(dbPath) ? dbPath : null; } } diff --git a/src/Analysis/Ast/Impl/Modules/ModuleQualifiedName.cs b/src/Caching/Impl/ModuleUniqueId.cs similarity index 83% rename from src/Analysis/Ast/Impl/Modules/ModuleQualifiedName.cs rename to src/Caching/Impl/ModuleUniqueId.cs index 57f12cb29..d479a9964 100644 --- a/src/Analysis/Ast/Impl/Modules/ModuleQualifiedName.cs +++ b/src/Caching/Impl/ModuleUniqueId.cs @@ -21,12 +21,12 @@ using Microsoft.Python.Analysis.Types; using Microsoft.Python.Core.IO; -namespace Microsoft.Python.Analysis.Modules { - internal static class ModuleQualifiedName { - public static string CalculateQualifiedName(this IPythonModule module, IFileSystem fs) - => CalculateQualifiedName(module.Name, module.FilePath, module.Interpreter, fs); +namespace Microsoft.Python.Analysis.Caching { + internal static class ModuleUniqueId { + public static string GetUniqieId(this IPythonModule module, IFileSystem fs) + => GetUniqieId(module.Name, module.FilePath, module.Interpreter, fs); - public static string CalculateQualifiedName(string moduleName, string filePath, IPythonInterpreter interpreter, IFileSystem fs) { + public static string GetUniqieId(string moduleName, string filePath, IPythonInterpreter interpreter, IFileSystem fs) { var config = interpreter.Configuration; var sitePackagesPath = PythonLibraryPath.GetSitePackagesPath(config); @@ -59,12 +59,6 @@ public static string CalculateQualifiedName(string moduleName, string filePath, return $"{moduleName}.{HashModuleContent(Path.GetDirectoryName(filePath), fs)}"; } - public static string GetModuleName(string moduleQualifiedName) { - var index = moduleQualifiedName.IndexOf('('); - return index >= 0 ? moduleQualifiedName.Substring(0, index) : moduleQualifiedName; - } - - private static string HashModuleContent(string moduleFolder, IFileSystem fs) { // Hash file sizes using (var sha256 = SHA256.Create()) { diff --git a/src/Caching/Impl/PythonDbModule.cs b/src/Caching/Impl/PythonDbModule.cs index 38eb1bb55..e54562f72 100644 --- a/src/Caching/Impl/PythonDbModule.cs +++ b/src/Caching/Impl/PythonDbModule.cs @@ -21,7 +21,7 @@ namespace Microsoft.Python.Analysis.Caching { internal sealed class PythonDbModule : SpecializedModule { public PythonDbModule(ModuleModel model, string filePath, IServiceContainer services) - : base(ModuleQualifiedName.GetModuleName(model.Name), string.Empty, services) { + : base(model.Name, string.Empty, services) { FilePath = filePath; GlobalScope = new GlobalScope(model, this, services); Documentation = model.Documentation; diff --git a/src/Caching/Impl/TypeNames.cs b/src/Caching/Impl/TypeNames.cs index 4eba970fe..ab2dd1c8c 100644 --- a/src/Caching/Impl/TypeNames.cs +++ b/src/Caching/Impl/TypeNames.cs @@ -42,8 +42,8 @@ public static string GetQualifiedName(this IMember m) { /// qualified name designates instance (prefixed with 'i:'). /// /// Raw qualified name to split. May include instance prefix. - /// Qualified name without optional instance prefix, such as A(3.6).B(3.6).C - /// Name parts such as 'A(3.6)', 'B(3.6)', 'C'. + /// Qualified name without optional instance prefix, such as A.B.C + /// Name parts such as 'A', 'B', 'C' from A.B.C. /// If true, the qualified name describes instance of a type. public static bool DeconstructQualifiedName(string rawQualifiedName, out string typeQualifiedName, out IReadOnlyList nameParts, out bool isInstance) { typeQualifiedName = null; @@ -61,6 +61,10 @@ public static bool DeconstructQualifiedName(string rawQualifiedName, out string nameParts = new[] { @"builtins", "ellipsis" }; return true; } + if (rawQualifiedName.IndexOf('.') < 0) { + nameParts = new[] { @"builtins", typeQualifiedName }; + return true; + } // First chunk is qualified module name except dots in braces. // Builtin types don't have module prefix. @@ -68,11 +72,6 @@ public static bool DeconstructQualifiedName(string rawQualifiedName, out string return nameParts.Count > 0; } - public static string GetNameWithoutVersion(string qualifiedName) { - var index = qualifiedName.IndexOf('('); - return index > 0 ? qualifiedName.Substring(0, index) : qualifiedName; - } - private static IReadOnlyList GetParts(string qualifiedTypeName) { var parts = new List(); for (var i = 0; i < qualifiedTypeName.Length; i++) { @@ -86,22 +85,23 @@ private static IReadOnlyList GetParts(string qualifiedTypeName) { } private static string GetSubPart(string s, ref int i) { - var skip = false; + var braceCounter = new Stack(); var start = i; for (; i < s.Length; i++) { var ch = s[i]; - if (ch == '(') { - skip = true; + if (ch == '[') { + braceCounter.Push(ch); continue; } - if (ch == ')') { - skip = false; + if (ch == ']') { + if (braceCounter.Count > 0) { + braceCounter.Pop(); + } } - if (!skip && ch == '.') { - i++; + if (braceCounter.Count == 0 && ch == '.') { break; } } diff --git a/src/Caching/Test/AnalysisCachingTestBase.cs b/src/Caching/Test/AnalysisCachingTestBase.cs index 208d5fb84..73d72347a 100644 --- a/src/Caching/Test/AnalysisCachingTestBase.cs +++ b/src/Caching/Test/AnalysisCachingTestBase.cs @@ -17,6 +17,7 @@ using System.Reflection; using System.Text; using Microsoft.Python.Analysis.Tests; +using Microsoft.Python.Core.IO; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json; using TestUtilities; @@ -42,5 +43,6 @@ protected string BaselineFilesFolder { } } + protected IFileSystem FileSystem => Services.GetService(); } } diff --git a/src/Caching/Test/BasicTests.cs b/src/Caching/Test/BasicTests.cs index 1da13ef30..608e5bab6 100644 --- a/src/Caching/Test/BasicTests.cs +++ b/src/Caching/Test/BasicTests.cs @@ -20,6 +20,7 @@ using Microsoft.Python.Analysis.Caching.Tests.FluentAssertions; using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Core.IO; using Microsoft.Python.Parsing.Tests; using Microsoft.VisualStudio.TestTools.UnitTesting; using TestUtilities; @@ -61,7 +62,7 @@ def func(): c = C() "; var analysis = await GetAnalysisAsync(code); - var model = ModuleModel.FromAnalysis(analysis); + var model = ModuleModel.FromAnalysis(analysis, FileSystem); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); } @@ -93,7 +94,7 @@ def methodB2(self): c = B().methodB1() "; var analysis = await GetAnalysisAsync(code); - var model = ModuleModel.FromAnalysis(analysis); + var model = ModuleModel.FromAnalysis(analysis, FileSystem); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); } @@ -102,7 +103,7 @@ def methodB2(self): public async Task Builtins() { var analysis = await GetAnalysisAsync(string.Empty); var builtins = analysis.Document.Interpreter.ModuleResolution.BuiltinsModule; - var model = ModuleModel.FromAnalysis(builtins.Analysis); + var model = ModuleModel.FromAnalysis(builtins.Analysis, FileSystem); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); @@ -116,7 +117,7 @@ public async Task Builtins() { public async Task Sys() { var analysis = await GetAnalysisAsync("import sys"); var sys = analysis.Document.Interpreter.ModuleResolution.GetImportedModule("sys"); - var model = ModuleModel.FromAnalysis(sys.Analysis); + var model = ModuleModel.FromAnalysis(sys.Analysis, FileSystem); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); @@ -139,7 +140,7 @@ import requests Assert.Inconclusive("'requests' package is not installed."); } - var model = ModuleModel.FromAnalysis(analysis); + var model = ModuleModel.FromAnalysis(analysis, FileSystem); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); } @@ -158,7 +159,7 @@ import requests } var rq = analysis.Document.Interpreter.ModuleResolution.GetImportedModule("requests"); - var model = ModuleModel.FromAnalysis(rq.Analysis); + var model = ModuleModel.FromAnalysis(rq.Analysis, FileSystem); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); @@ -173,18 +174,20 @@ import requests [DataRow("i:str", "builtins", "builtins", "str", true)] [DataRow("i:...", "builtins", "builtins", "ellipsis", true)] [DataRow("ellipsis", "builtins", "builtins", "ellipsis", false)] - [DataRow("i:builtins(3.7).str", "builtins(3.7)", "builtins", "str", true)] - [DataRow("mod(2.2.1).z", "mod(2.2.1)", "mod", "z", false)] - [DataRow("i:mod(2.2.1).z", "mod(2.2.1)", "mod", "z", true)] + [DataRow("i:builtins.str", "builtins", "builtins", "str", true)] [DataRow("i:mod.x", "mod", "mod", "x", true)] - [DataRow("types(3.7)", "types(3.7)", "types", null, false)] [DataRow("typing.Union[str, tuple]", "typing", "typing", "Union[str, tuple]", false)] [DataRow("typing.Union[typing.Any, mod.y]", "typing", "typing", "Union[typing.Any, mod.y]", false)] + [DataRow("typing.Union[typing.Union[str, int], mod.y]", "typing", "typing", "Union[typing.Union[str, int], mod.y]", false)] public void QualifiedNames(string rawQualifiedName, string qualifiedName, string moduleName, string typeName, bool isInstance) { TypeNames.DeconstructQualifiedName(rawQualifiedName, out var actualQualifiedName, out var nameParts, out var actualIsInstance); qualifiedName.Should().Be(qualifiedName); - nameParts[0].Should().Be(moduleName); - nameParts[1].Should().Be(typeName); + if (string.IsNullOrEmpty(qualifiedName)) { + nameParts.Should().BeNull(); + } else { + nameParts[0].Should().Be(moduleName); + nameParts[1].Should().Be(typeName); + } actualIsInstance.Should().Be(isInstance); } } From 55b6a3f1688eeb94f7f1f20c2fab3b4d6ad85abe Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Mon, 17 Jun 2019 21:46:14 -0700 Subject: [PATCH 75/82] Test staility --- src/Caching/Impl/Models/ClassModel.cs | 3 +- src/Caching/Impl/Models/FunctionModel.cs | 3 +- src/Caching/Impl/Models/ModuleModel.cs | 8 +- src/Caching/Impl/Models/PropertyModel.cs | 3 +- src/Caching/Impl/Models/VariableModel.cs | 7 +- src/Caching/Impl/ModuleDatabase.cs | 5 +- src/Caching/Impl/ModuleUniqueId.cs | 36 +- src/Caching/Test/AnalysisCachingTestBase.cs | 2 - src/Caching/Test/BasicTests.cs | 12 +- src/Caching/Test/Files/Builtins.json | 1558 +++++++++++++++++- src/Caching/Test/Files/NestedClasses.json | 53 +- src/Caching/Test/Files/SmokeTest.json | 29 +- src/Caching/Test/Files/Sys.json | 685 ++++++-- src/Core/Impl/Extensions/StringExtensions.cs | 10 + 14 files changed, 2189 insertions(+), 225 deletions(-) diff --git a/src/Caching/Impl/Models/ClassModel.cs b/src/Caching/Impl/Models/ClassModel.cs index 57bf0bcbe..066642855 100644 --- a/src/Caching/Impl/Models/ClassModel.cs +++ b/src/Caching/Impl/Models/ClassModel.cs @@ -19,6 +19,7 @@ using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Utilities; using Microsoft.Python.Analysis.Values; +using Microsoft.Python.Core; namespace Microsoft.Python.Analysis.Caching.Models { [DebuggerDisplay("c:{Name}")] @@ -83,7 +84,7 @@ private ClassModel(IPythonClassType cls) { } Name = cls.TypeId == BuiltinTypeId.Ellipsis ? "ellipsis" : cls.Name; - Id = Name.GetHashCode(); + Id = Name.GetStableHash(); Documentation = cls.Documentation; Bases = cls.Bases.OfType().Select(t => t.GetQualifiedName()).ToArray(); Methods = methods.ToArray(); diff --git a/src/Caching/Impl/Models/FunctionModel.cs b/src/Caching/Impl/Models/FunctionModel.cs index aaaca007b..39bf2c374 100644 --- a/src/Caching/Impl/Models/FunctionModel.cs +++ b/src/Caching/Impl/Models/FunctionModel.cs @@ -16,6 +16,7 @@ using System.Diagnostics; using System.Linq; using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Core; namespace Microsoft.Python.Analysis.Caching.Models { [DebuggerDisplay("f:{Name}")] @@ -28,7 +29,7 @@ internal sealed class FunctionModel: MemberModel { public static FunctionModel FromType(IPythonFunctionType ft) { return new FunctionModel { - Id = ft.Name.GetHashCode(), + Id = ft.Name.GetStableHash(), Name = ft.Name, Documentation = ft.Documentation, Overloads = ft.Overloads.Select(FromOverload).ToArray() diff --git a/src/Caching/Impl/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs index dd1241e11..7fe6326f2 100644 --- a/src/Caching/Impl/Models/ModuleModel.cs +++ b/src/Caching/Impl/Models/ModuleModel.cs @@ -17,7 +17,7 @@ using System.Linq; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; -using Microsoft.Python.Core.IO; +using Microsoft.Python.Core; namespace Microsoft.Python.Analysis.Caching.Models { internal sealed class ModuleModel : MemberModel { @@ -28,7 +28,7 @@ internal sealed class ModuleModel : MemberModel { public ClassModel[] Classes { get; set; } // TODO: TypeVars, ... - public static ModuleModel FromAnalysis(IDocumentAnalysis analysis, IFileSystem fs) { + public static ModuleModel FromAnalysis(IDocumentAnalysis analysis, IServiceContainer services) { var variables = new Dictionary(); var functions = new Dictionary(); var classes = new Dictionary(); @@ -62,9 +62,9 @@ public static ModuleModel FromAnalysis(IDocumentAnalysis analysis, IFileSystem f } } - var uniqueId = analysis.Document.GetUniqieId(fs); + var uniqueId = analysis.Document.GetUniqieId(services); return new ModuleModel { - Id = uniqueId.GetHashCode(), + Id = uniqueId.GetStableHash(), UniqueId = uniqueId, Name = analysis.Document.Name, Documentation = analysis.Document.Documentation, diff --git a/src/Caching/Impl/Models/PropertyModel.cs b/src/Caching/Impl/Models/PropertyModel.cs index d1085a557..9d67c3c09 100644 --- a/src/Caching/Impl/Models/PropertyModel.cs +++ b/src/Caching/Impl/Models/PropertyModel.cs @@ -14,6 +14,7 @@ // permissions and limitations under the License. using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Core; namespace Microsoft.Python.Analysis.Caching.Models { internal sealed class PropertyModel: MemberModel { @@ -23,7 +24,7 @@ internal sealed class PropertyModel: MemberModel { public static PropertyModel FromType(IPythonPropertyType prop) { return new PropertyModel { - Id = prop.Name.GetHashCode(), + Id = prop.Name.GetStableHash(), Name = prop.Name, Documentation = prop.Documentation, ReturnType = prop.ReturnType.GetQualifiedName(), diff --git a/src/Caching/Impl/Models/VariableModel.cs b/src/Caching/Impl/Models/VariableModel.cs index 1c715e156..c326ddbdd 100644 --- a/src/Caching/Impl/Models/VariableModel.cs +++ b/src/Caching/Impl/Models/VariableModel.cs @@ -16,6 +16,7 @@ using System.Diagnostics; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; +using Microsoft.Python.Core; namespace Microsoft.Python.Analysis.Caching.Models { [DebuggerDisplay("v:{Name} = {Value}")] @@ -23,19 +24,19 @@ internal sealed class VariableModel: MemberModel { public string Value { get; set; } public static VariableModel FromVariable(IVariable v) => new VariableModel { - Id = v.Name.GetHashCode(), + Id = v.Name.GetStableHash(), Name = v.Name, Value = v.Value.GetQualifiedName() }; public static VariableModel FromInstance(string name, IPythonInstance inst) => new VariableModel { - Id = name.GetHashCode(), + Id = name.GetStableHash(), Name = name, Value = inst.GetQualifiedName() }; public static VariableModel FromType(string name, IPythonType t) => new VariableModel { - Id = name.GetHashCode(), + Id = name.GetStableHash(), Name = name, Value = t.GetQualifiedName() }; diff --git a/src/Caching/Impl/ModuleDatabase.cs b/src/Caching/Impl/ModuleDatabase.cs index 9e70abeaa..87b65d625 100644 --- a/src/Caching/Impl/ModuleDatabase.cs +++ b/src/Caching/Impl/ModuleDatabase.cs @@ -21,6 +21,7 @@ using System.Threading.Tasks; using LiteDB; using Microsoft.Python.Analysis.Caching.Models; +using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; using Microsoft.Python.Core; using Microsoft.Python.Core.IO; @@ -89,7 +90,7 @@ public Task StoreModuleAnalysisAsync(IDocumentAnalysis analysis, CancellationTok => Task.Run(() => StoreModuleAnalysis(analysis, cancellationToken)); private void StoreModuleAnalysis(IDocumentAnalysis analysis, CancellationToken cancellationToken = default) { - var model = ModuleModel.FromAnalysis(analysis, _fs); + var model = ModuleModel.FromAnalysis(analysis, _services); Exception ex = null; for (var retries = 50; retries > 0; --retries) { cancellationToken.ThrowIfCancellationRequested(); @@ -127,7 +128,7 @@ private void StoreModuleAnalysis(IDocumentAnalysis analysis, CancellationToken c /// private string FindDatabaseFile(string moduleName, string filePath) { var interpreter = _services.GetService(); - var uniqueId = ModuleUniqueId.GetUniqieId(moduleName, filePath, interpreter, _fs); + var uniqueId = ModuleUniqueId.GetUniqieId(moduleName, filePath, ModuleType.Specialized, _services); if (string.IsNullOrEmpty(uniqueId)) { return null; } diff --git a/src/Caching/Impl/ModuleUniqueId.cs b/src/Caching/Impl/ModuleUniqueId.cs index d479a9964..bcd6d85ce 100644 --- a/src/Caching/Impl/ModuleUniqueId.cs +++ b/src/Caching/Impl/ModuleUniqueId.cs @@ -18,18 +18,40 @@ using System.Linq; using System.Security.Cryptography; using Microsoft.Python.Analysis.Core.Interpreter; +using Microsoft.Python.Analysis.Modules; using Microsoft.Python.Analysis.Types; +using Microsoft.Python.Core; using Microsoft.Python.Core.IO; namespace Microsoft.Python.Analysis.Caching { internal static class ModuleUniqueId { - public static string GetUniqieId(this IPythonModule module, IFileSystem fs) - => GetUniqieId(module.Name, module.FilePath, module.Interpreter, fs); + public static string GetUniqieId(this IPythonModule module, IServiceContainer services) + => GetUniqieId(module.Name, module.FilePath, module.ModuleType, services); + + public static string GetUniqieId(string moduleName, string filePath, ModuleType moduleType, IServiceContainer services) { + var interpreter = services.GetService(); + var stubCache = services.GetService(); + var fs = services.GetService(); - public static string GetUniqieId(string moduleName, string filePath, IPythonInterpreter interpreter, IFileSystem fs) { var config = interpreter.Configuration; - var sitePackagesPath = PythonLibraryPath.GetSitePackagesPath(config); + var standardLibraryPath = PythonLibraryPath.GetStandardLibraryPath(config); + + if (moduleType == ModuleType.User) { + // Only for tests. + return $"{moduleName}"; + } + if (moduleType == ModuleType.Builtins || + moduleType == ModuleType.CompiledBuiltin || + moduleType == ModuleType.Compiled || + string.IsNullOrEmpty(filePath) || + fs.IsPathUnderRoot(stubCache.StubCacheFolder, filePath) || + fs.IsPathUnderRoot(standardLibraryPath, filePath)) { + // If module is a standard library, unique id is its name + interpreter version. + return $"{moduleName}({config.Version.Major}.{config.Version.Minor})"; + } + + var sitePackagesPath = PythonLibraryPath.GetSitePackagesPath(config); if (!string.IsNullOrEmpty(filePath) && fs.IsPathUnderRoot(sitePackagesPath, filePath)) { // If module is in site-packages and is versioned, then unique id = name + version + interpreter version. // Example: 'requests' and 'requests-2.21.0.dist-info'. @@ -49,12 +71,6 @@ public static string GetUniqieId(string moduleName, string filePath, IPythonInte } } - var standardLibraryPath = PythonLibraryPath.GetStandardLibraryPath(config); - if (string.IsNullOrEmpty(filePath) || fs.IsPathUnderRoot(standardLibraryPath, filePath)) { - // If module is a standard library, unique id is its name + interpreter version. - return $"{moduleName}({config.Version.Major}.{config.Version.Minor})"; - } - // If all else fails, hash module data. return $"{moduleName}.{HashModuleContent(Path.GetDirectoryName(filePath), fs)}"; } diff --git a/src/Caching/Test/AnalysisCachingTestBase.cs b/src/Caching/Test/AnalysisCachingTestBase.cs index 73d72347a..e22be40a4 100644 --- a/src/Caching/Test/AnalysisCachingTestBase.cs +++ b/src/Caching/Test/AnalysisCachingTestBase.cs @@ -42,7 +42,5 @@ protected string BaselineFilesFolder { return Path.GetFullPath(Path.Combine(outDirectory, "..", "..", "..", "src", "Caching", "Test", "Files")); } } - - protected IFileSystem FileSystem => Services.GetService(); } } diff --git a/src/Caching/Test/BasicTests.cs b/src/Caching/Test/BasicTests.cs index 608e5bab6..694e0ccfa 100644 --- a/src/Caching/Test/BasicTests.cs +++ b/src/Caching/Test/BasicTests.cs @@ -62,7 +62,7 @@ def func(): c = C() "; var analysis = await GetAnalysisAsync(code); - var model = ModuleModel.FromAnalysis(analysis, FileSystem); + var model = ModuleModel.FromAnalysis(analysis, Services); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); } @@ -94,7 +94,7 @@ def methodB2(self): c = B().methodB1() "; var analysis = await GetAnalysisAsync(code); - var model = ModuleModel.FromAnalysis(analysis, FileSystem); + var model = ModuleModel.FromAnalysis(analysis, Services); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); } @@ -103,7 +103,7 @@ def methodB2(self): public async Task Builtins() { var analysis = await GetAnalysisAsync(string.Empty); var builtins = analysis.Document.Interpreter.ModuleResolution.BuiltinsModule; - var model = ModuleModel.FromAnalysis(builtins.Analysis, FileSystem); + var model = ModuleModel.FromAnalysis(builtins.Analysis, Services); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); @@ -117,7 +117,7 @@ public async Task Builtins() { public async Task Sys() { var analysis = await GetAnalysisAsync("import sys"); var sys = analysis.Document.Interpreter.ModuleResolution.GetImportedModule("sys"); - var model = ModuleModel.FromAnalysis(sys.Analysis, FileSystem); + var model = ModuleModel.FromAnalysis(sys.Analysis, Services); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); @@ -140,7 +140,7 @@ import requests Assert.Inconclusive("'requests' package is not installed."); } - var model = ModuleModel.FromAnalysis(analysis, FileSystem); + var model = ModuleModel.FromAnalysis(analysis, Services); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); } @@ -159,7 +159,7 @@ import requests } var rq = analysis.Document.Interpreter.ModuleResolution.GetImportedModule("requests"); - var model = ModuleModel.FromAnalysis(rq.Analysis, FileSystem); + var model = ModuleModel.FromAnalysis(rq.Analysis, Services); var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); diff --git a/src/Caching/Test/Files/Builtins.json b/src/Caching/Test/Files/Builtins.json index a09f2fdb7..8fff2c8a0 100644 --- a/src/Caching/Test/Files/Builtins.json +++ b/src/Caching/Test/Files/Builtins.json @@ -1,4 +1,5 @@ { + "UniqueId": "builtins(3.7)", "Documentation": "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.", "Functions": [ { @@ -12,6 +13,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24816593, "Name": "type" }, { @@ -56,6 +58,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 186877360, "Name": "__build_class__" }, { @@ -100,6 +103,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -200972932, "Name": "__import__" }, { @@ -120,6 +124,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 781563, "Name": "abs" }, { @@ -140,6 +145,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 781866, "Name": "all" }, { @@ -160,6 +166,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 781941, "Name": "any" }, { @@ -180,6 +187,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 751576474, "Name": "ascii" }, { @@ -200,6 +208,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 782736, "Name": "bin" }, { @@ -226,6 +235,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1356147896, "Name": "breakpoint" }, { @@ -246,6 +256,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1205971407, "Name": "callable" }, { @@ -266,6 +277,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 783670, "Name": "chr" }, { @@ -316,6 +328,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1914543556, "Name": "compile" }, { @@ -336,6 +349,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1298046352, "Name": "copyright" }, { @@ -356,6 +370,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1836401501, "Name": "credits" }, { @@ -382,6 +397,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1314690939, "Name": "delattr" }, { @@ -402,6 +418,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 784662, "Name": "dir" }, { @@ -428,6 +445,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1901256616, "Name": "divmod" }, { @@ -460,6 +478,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24366387, "Name": "eval" }, { @@ -492,6 +511,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24368424, "Name": "exec" }, { @@ -518,6 +538,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24368565, "Name": "exit" }, { @@ -544,6 +565,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1963936462, "Name": "format" }, { @@ -576,6 +598,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1355208272, "Name": "getattr" }, { @@ -589,6 +612,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1551006009, "Name": "globals" }, { @@ -615,6 +639,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2127271828, "Name": "hasattr" }, { @@ -635,6 +660,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24436133, "Name": "hash" }, { @@ -667,6 +693,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24439768, "Name": "help" }, { @@ -687,6 +714,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 788388, "Name": "hex" }, { @@ -707,6 +735,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 25458, "Name": "id" }, { @@ -727,6 +756,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 758828563, "Name": "input" }, { @@ -753,6 +783,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1317005078, "Name": "isinstance" }, { @@ -779,6 +810,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1314249287, "Name": "issubclass" }, { @@ -805,6 +837,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24483759, "Name": "iter" }, { @@ -825,6 +858,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 792222, "Name": "len" }, { @@ -845,6 +879,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1596689482, "Name": "license" }, { @@ -858,6 +893,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2135253311, "Name": "locals" }, { @@ -896,6 +932,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 793069, "Name": "max" }, { @@ -934,6 +971,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 793307, "Name": "min" }, { @@ -960,6 +998,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24618890, "Name": "next" }, { @@ -980,6 +1019,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 795049, "Name": "oct" }, { @@ -1042,6 +1082,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24658657, "Name": "open" }, { @@ -1062,6 +1103,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 795498, "Name": "ord" }, { @@ -1094,6 +1136,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 796385, "Name": "pow" }, { @@ -1107,6 +1150,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 765405430, "Name": "print" }, { @@ -1133,6 +1177,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24723174, "Name": "quit" }, { @@ -1146,6 +1191,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 766750598, "Name": "range" }, { @@ -1166,6 +1212,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24737804, "Name": "repr" }, { @@ -1192,6 +1239,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 767174615, "Name": "round" }, { @@ -1224,6 +1272,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -879649444, "Name": "setattr" }, { @@ -1244,6 +1293,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1958845036, "Name": "sorted" }, { @@ -1270,6 +1320,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 799444, "Name": "sum" }, { @@ -1290,6 +1341,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24853187, "Name": "vars" }, { @@ -1303,188 +1355,234 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 783823, "Name": "cmp" } ], "Variables": [ { "Value": "object", + "Id": 376535734, "Name": "__Object__" }, { "Value": "int", + "Id": -1660953576, "Name": "__Int__" }, { "Value": "bool", + "Id": -149570207, "Name": "__Bool__" }, { "Value": "int", + "Id": 136686707, "Name": "__Long__" }, { "Value": "float", + "Id": -1172856571, "Name": "__Float__" }, { "Value": "complex", + "Id": -1125625831, "Name": "__Complex__" }, { "Value": "tuple", + "Id": -1373807759, "Name": "__Tuple__" }, { "Value": "list", + "Id": 131307029, "Name": "__List__" }, { "Value": "dict", + "Id": -98202835, "Name": "__Dict__" }, { "Value": "set", + "Id": -1651986485, "Name": "__Set__" }, { "Value": "frozenset", + "Id": -1845664181, "Name": "__FrozenSet__" }, { "Value": "bytes", + "Id": -50989228, "Name": "__Bytes__" }, { "Value": "bytes_iterator", + "Id": 1196082274, "Name": "__BytesIterator__" }, { "Value": "str", + "Id": -667382010, "Name": "__Unicode__" }, { "Value": "str_iterator", + "Id": 899385876, "Name": "__UnicodeIterator__" }, { "Value": "str", + "Id": -1651541542, "Name": "__Str__" }, { "Value": "str_iterator", + "Id": -1693163288, "Name": "__StrIterator__" }, { "Value": "module", + "Id": -318216541, "Name": "__Module__" }, { "Value": "function", + "Id": -56357041, "Name": "__Function__" }, { "Value": "wrapper_descriptor", + "Id": 2031680028, "Name": "__BuiltinMethodDescriptor__" }, { "Value": "builtin_function_or_method", + "Id": -998173500, "Name": "__BuiltinFunction__" }, { "Value": "generator", + "Id": 1086442300, "Name": "__Generator__" }, { "Value": "property", + "Id": -919605748, "Name": "__Property__" }, { "Value": "classmethod", + "Id": -991650526, "Name": "__ClassMethod__" }, { "Value": "staticmethod", + "Id": 1863225126, "Name": "__StaticMethod__" }, { "Value": "ellipsis", + "Id": 961323528, "Name": "__Ellipsis__" }, { "Value": "tuple_iterator", + "Id": 1754184575, "Name": "__TupleIterator__" }, { "Value": "list_iterator", + "Id": 692195875, "Name": "__ListIterator__" }, { "Value": "dict_keys", + "Id": -414283327, "Name": "__DictKeys__" }, { "Value": "dict_values", + "Id": -623419857, "Name": "__DictValues__" }, { "Value": "dict_items", + "Id": -1322081197, "Name": "__DictItems__" }, { "Value": "set_iterator", + "Id": 1366627801, "Name": "__SetIterator__" }, { "Value": "callable_iterator", + "Id": 1819825725, "Name": "__CallableIterator__" }, { "Value": null, + "Id": -2048509720, "Name": "__builtin_module_names__" }, { "Value": "i:ellipsis", + "Id": 1631567368, "Name": "Ellipsis" }, { "Value": "i:OSError", + "Id": 763574764, "Name": "EnvironmentError" }, { "Value": "i:OSError", + "Id": -172840821, "Name": "IOError" }, { "Value": "i:NotImplementedType", + "Id": -1818427354, "Name": "NotImplemented" }, { "Value": "i:OSError", + "Id": 1763918588, "Name": "WindowsError" }, { "Value": null, + "Id": -1636005055, "Name": "__doc__" }, { "Value": null, + "Id": 1097116834, "Name": "__name__" }, { "Value": null, + "Id": 75395663, "Name": "__package__" }, { "Value": "bool", + "Id": 23856709, "Name": "True" }, { "Value": "bool", + "Id": 726114124, "Name": "False" }, { "Value": "__NoneType__", + "Id": 23674863, "Name": "None" } ], @@ -1525,6 +1623,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -1545,6 +1644,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -1565,6 +1665,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -1585,6 +1686,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -1611,6 +1713,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -1618,15 +1721,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 2136768640, "Name": "NotImplementedType" }, { @@ -1637,19 +1743,23 @@ "Fields": [ { "Value": null, + "Id": 1097116834, "Name": "__name__" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1423120691, "Name": "__Unknown__" }, { @@ -1660,15 +1770,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1499999113, "Name": "__NoneType__" }, { @@ -1699,6 +1812,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2095540485, "Name": "__delattr__" }, { @@ -1719,6 +1833,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1636169386, "Name": "__dir__" }, { @@ -1745,6 +1860,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -1771,6 +1887,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 695475534, "Name": "__format__" }, { @@ -1797,6 +1914,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -1823,6 +1941,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -1849,6 +1968,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -1869,6 +1989,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 925523557, "Name": "__hash__" }, { @@ -1901,6 +2022,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -1921,6 +2043,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -1947,6 +2070,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -1973,6 +2097,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -1999,6 +2124,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -2019,6 +2145,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -2045,6 +2172,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -491007883, "Name": "__reduce_ex__" }, { @@ -2065,6 +2193,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -2097,6 +2226,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -736377828, "Name": "__setattr__" }, { @@ -2117,6 +2247,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1069167279, "Name": "__sizeof__" }, { @@ -2137,6 +2268,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -2163,6 +2295,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -2170,15 +2303,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -2085620202, "Name": "object" }, { @@ -2205,6 +2341,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1639147525, "Name": "__abs__" }, { @@ -2231,6 +2368,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1639102358, "Name": "__add__" }, { @@ -2257,6 +2395,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1638804448, "Name": "__and__" }, { @@ -2277,6 +2416,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 766562625, "Name": "__bool__" }, { @@ -2297,6 +2437,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 785777820, "Name": "__ceil__" }, { @@ -2323,6 +2464,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 589685672, "Name": "__divmod__" }, { @@ -2349,6 +2491,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -2369,6 +2512,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1457457445, "Name": "__float__" }, { @@ -2389,6 +2533,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1457872597, "Name": "__floor__" }, { @@ -2415,6 +2560,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 778272028, "Name": "__floordiv__" }, { @@ -2441,6 +2587,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 695475534, "Name": "__format__" }, { @@ -2467,6 +2614,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -2493,6 +2641,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -2513,6 +2662,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -488627138, "Name": "__getnewargs__" }, { @@ -2539,6 +2689,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -2559,6 +2710,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 925523557, "Name": "__hash__" }, { @@ -2579,6 +2731,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -127776229, "Name": "__index__" }, { @@ -2611,6 +2764,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -2631,6 +2785,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -2651,6 +2806,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1631400904, "Name": "__int__" }, { @@ -2671,6 +2827,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 849070445, "Name": "__invert__" }, { @@ -2697,6 +2854,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -2723,6 +2881,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1527613741, "Name": "__lshift__" }, { @@ -2749,6 +2908,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -2775,6 +2935,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627692405, "Name": "__mod__" }, { @@ -2801,6 +2962,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627505971, "Name": "__mul__" }, { @@ -2827,6 +2989,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -2847,6 +3010,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627063911, "Name": "__neg__" }, { @@ -2873,6 +3037,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748671418, "Name": "__or__" }, { @@ -2893,6 +3058,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1624907427, "Name": "__pos__" }, { @@ -2925,6 +3091,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1624903583, "Name": "__pow__" }, { @@ -2951,6 +3118,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1211364358, "Name": "__radd__" }, { @@ -2977,6 +3145,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1211662268, "Name": "__rand__" }, { @@ -3003,6 +3172,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1249754484, "Name": "__rdivmod__" }, { @@ -3023,6 +3193,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -3049,6 +3220,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1692159232, "Name": "__rfloordiv__" }, { @@ -3075,6 +3247,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -311826415, "Name": "__rlshift__" }, { @@ -3101,6 +3274,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222774311, "Name": "__rmod__" }, { @@ -3127,6 +3301,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222960745, "Name": "__rmul__" }, { @@ -3153,6 +3328,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1623061346, "Name": "__ror__" }, { @@ -3179,6 +3355,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -685599785, "Name": "__round__" }, { @@ -3211,6 +3388,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1225563133, "Name": "__rpow__" }, { @@ -3237,6 +3415,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1555101003, "Name": "__rrshift__" }, { @@ -3263,6 +3442,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -900426137, "Name": "__rshift__" }, { @@ -3289,6 +3469,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1228492261, "Name": "__rsub__" }, { @@ -3315,6 +3496,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1563284312, "Name": "__rtruediv__" }, { @@ -3341,6 +3523,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1232946496, "Name": "__rxor__" }, { @@ -3361,6 +3544,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1069167279, "Name": "__sizeof__" }, { @@ -3381,6 +3565,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -3407,6 +3592,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621974455, "Name": "__sub__" }, { @@ -3433,6 +3619,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -3459,6 +3646,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -375214324, "Name": "__truediv__" }, { @@ -3479,6 +3667,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1175294069, "Name": "__trunc__" }, { @@ -3505,6 +3694,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1617520220, "Name": "__xor__" }, { @@ -3525,6 +3715,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 641823151, "Name": "bit_length" }, { @@ -3545,6 +3736,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -903692703, "Name": "conjugate" }, { @@ -3583,6 +3775,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -190029075, "Name": "from_bytes" }, { @@ -3615,6 +3808,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -71556418, "Name": "to_bytes" } ], @@ -3623,39 +3817,46 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 985628143, "Name": "denominator" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 24476897, "Name": "imag" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 1522491474, "Name": "numerator" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 24737333, "Name": "real" } ], "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 789624, "Name": "int" }, { @@ -3688,6 +3889,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1638804448, "Name": "__and__" }, { @@ -3714,6 +3916,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -3734,6 +3937,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -3760,6 +3964,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748671418, "Name": "__or__" }, { @@ -3786,6 +3991,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1211662268, "Name": "__rand__" }, { @@ -3806,6 +4012,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -3832,6 +4039,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1623061346, "Name": "__ror__" }, { @@ -3858,6 +4066,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1232946496, "Name": "__rxor__" }, { @@ -3878,6 +4087,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -3904,6 +4114,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -3930,6 +4141,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1617520220, "Name": "__xor__" }, { @@ -3968,6 +4180,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -190029075, "Name": "from_bytes" } ], @@ -3975,15 +4188,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 24270721, "Name": "bool" }, { @@ -4010,6 +4226,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1639147525, "Name": "__abs__" }, { @@ -4036,6 +4253,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1639102358, "Name": "__add__" }, { @@ -4056,6 +4274,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 766562625, "Name": "__bool__" }, { @@ -4082,6 +4301,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 589685672, "Name": "__divmod__" }, { @@ -4108,6 +4328,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -4128,6 +4349,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1457457445, "Name": "__float__" }, { @@ -4154,6 +4376,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 778272028, "Name": "__floordiv__" }, { @@ -4180,6 +4403,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 695475534, "Name": "__format__" }, { @@ -4206,6 +4430,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -4232,6 +4457,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -4264,6 +4490,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1018863830, "Name": "__getformat__" }, { @@ -4284,6 +4511,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -488627138, "Name": "__getnewargs__" }, { @@ -4310,6 +4538,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -4330,6 +4559,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 925523557, "Name": "__hash__" }, { @@ -4362,6 +4592,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -4382,6 +4613,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -4402,6 +4634,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1631400904, "Name": "__int__" }, { @@ -4428,6 +4661,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -4454,6 +4688,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -4480,6 +4715,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627692405, "Name": "__mod__" }, { @@ -4506,6 +4742,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627505971, "Name": "__mul__" }, { @@ -4532,6 +4769,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -4552,6 +4790,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627063911, "Name": "__neg__" }, { @@ -4572,6 +4811,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1624907427, "Name": "__pos__" }, { @@ -4604,6 +4844,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1624903583, "Name": "__pow__" }, { @@ -4630,6 +4871,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1211364358, "Name": "__radd__" }, { @@ -4656,6 +4898,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1249754484, "Name": "__rdivmod__" }, { @@ -4676,6 +4919,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -4702,6 +4946,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1692159232, "Name": "__rfloordiv__" }, { @@ -4728,6 +4973,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222774311, "Name": "__rmod__" }, { @@ -4754,6 +5000,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222960745, "Name": "__rmul__" }, { @@ -4780,6 +5027,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -685599785, "Name": "__round__" }, { @@ -4812,6 +5060,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1225563133, "Name": "__rpow__" }, { @@ -4838,6 +5087,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1228492261, "Name": "__rsub__" }, { @@ -4864,6 +5114,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1563284312, "Name": "__rtruediv__" }, { @@ -4902,6 +5153,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1822027019, "Name": "__set_format__" }, { @@ -4922,6 +5174,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -4948,6 +5201,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621974455, "Name": "__sub__" }, { @@ -4974,6 +5228,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -5000,6 +5255,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -375214324, "Name": "__truediv__" }, { @@ -5020,6 +5276,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1175294069, "Name": "__trunc__" }, { @@ -5040,6 +5297,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1148559724, "Name": "as_integer_ratio" }, { @@ -5060,6 +5318,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -903692703, "Name": "conjugate" }, { @@ -5092,6 +5351,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 835611450, "Name": "fromhex" }, { @@ -5112,6 +5372,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 788388, "Name": "hex" }, { @@ -5132,6 +5393,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 783186560, "Name": "is_integer" } ], @@ -5140,27 +5402,32 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 24476897, "Name": "imag" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 24737333, "Name": "real" } ], "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 755996837, "Name": "float" }, { @@ -5187,6 +5454,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1639147525, "Name": "__abs__" }, { @@ -5213,6 +5481,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1639102358, "Name": "__add__" }, { @@ -5233,6 +5502,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 766562625, "Name": "__bool__" }, { @@ -5259,6 +5529,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 589685672, "Name": "__divmod__" }, { @@ -5285,6 +5556,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -5305,6 +5577,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1457457445, "Name": "__float__" }, { @@ -5331,6 +5604,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 778272028, "Name": "__floordiv__" }, { @@ -5357,6 +5631,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 695475534, "Name": "__format__" }, { @@ -5383,6 +5658,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -5409,6 +5685,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -5429,6 +5706,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -488627138, "Name": "__getnewargs__" }, { @@ -5455,6 +5733,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -5475,6 +5754,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 925523557, "Name": "__hash__" }, { @@ -5507,6 +5787,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -5527,6 +5808,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -5547,6 +5829,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1631400904, "Name": "__int__" }, { @@ -5573,6 +5856,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -5599,6 +5883,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -5625,6 +5910,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627692405, "Name": "__mod__" }, { @@ -5651,6 +5937,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627505971, "Name": "__mul__" }, { @@ -5677,6 +5964,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -5697,6 +5985,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627063911, "Name": "__neg__" }, { @@ -5717,6 +6006,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1624907427, "Name": "__pos__" }, { @@ -5749,6 +6039,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1624903583, "Name": "__pow__" }, { @@ -5775,6 +6066,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1211364358, "Name": "__radd__" }, { @@ -5801,6 +6093,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1249754484, "Name": "__rdivmod__" }, { @@ -5821,6 +6114,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -5847,6 +6141,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1692159232, "Name": "__rfloordiv__" }, { @@ -5873,6 +6168,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222774311, "Name": "__rmod__" }, { @@ -5899,6 +6195,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222960745, "Name": "__rmul__" }, { @@ -5931,6 +6228,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1225563133, "Name": "__rpow__" }, { @@ -5957,6 +6255,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1228492261, "Name": "__rsub__" }, { @@ -5983,6 +6282,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1563284312, "Name": "__rtruediv__" }, { @@ -6003,6 +6303,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -6029,6 +6330,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621974455, "Name": "__sub__" }, { @@ -6055,6 +6357,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -6081,6 +6384,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -375214324, "Name": "__truediv__" }, { @@ -6101,6 +6405,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -903692703, "Name": "conjugate" } ], @@ -6109,27 +6414,32 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 24476897, "Name": "imag" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 24737333, "Name": "real" } ], "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1914540871, "Name": "complex" }, { @@ -6162,6 +6472,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1639102358, "Name": "__add__" }, { @@ -6188,6 +6499,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1841774666, "Name": "__contains__" }, { @@ -6214,6 +6526,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -6240,6 +6553,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -6266,6 +6580,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -6292,6 +6607,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -293179214, "Name": "__getitem__" }, { @@ -6312,6 +6628,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -488627138, "Name": "__getnewargs__" }, { @@ -6338,6 +6655,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -6358,6 +6676,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 925523557, "Name": "__hash__" }, { @@ -6390,6 +6709,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -6410,6 +6730,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -6430,6 +6751,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -6456,6 +6778,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -6476,6 +6799,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1628904226, "Name": "__len__" }, { @@ -6502,6 +6826,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -6528,6 +6853,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627505971, "Name": "__mul__" }, { @@ -6554,6 +6880,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -6574,6 +6901,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -6600,6 +6928,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222960745, "Name": "__rmul__" }, { @@ -6626,6 +6955,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -6652,6 +6982,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 753321816, "Name": "count" }, { @@ -6690,6 +7021,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 758816539, "Name": "index" } ], @@ -6697,15 +7029,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 769195537, "Name": "tuple" }, { @@ -6738,6 +7073,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1639102358, "Name": "__add__" }, { @@ -6764,6 +7100,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1841774666, "Name": "__contains__" }, { @@ -6790,6 +7127,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1970845273, "Name": "__delitem__" }, { @@ -6816,6 +7154,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -6842,6 +7181,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -6868,6 +7208,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -6894,6 +7235,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -293179214, "Name": "__getitem__" }, { @@ -6920,6 +7262,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -6946,6 +7289,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 953701999, "Name": "__iadd__" }, { @@ -6972,6 +7316,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965298386, "Name": "__imul__" }, { @@ -7004,6 +7349,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -7024,6 +7370,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -7044,6 +7391,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -7070,6 +7418,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -7090,6 +7439,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1628904226, "Name": "__len__" }, { @@ -7116,6 +7466,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -7142,6 +7493,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627505971, "Name": "__mul__" }, { @@ -7168,6 +7520,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -7188,6 +7541,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -7208,6 +7562,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1525741209, "Name": "__reversed__" }, { @@ -7234,6 +7589,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222960745, "Name": "__rmul__" }, { @@ -7266,6 +7622,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -507796290, "Name": "__setitem__" }, { @@ -7286,6 +7643,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1069167279, "Name": "__sizeof__" }, { @@ -7312,6 +7670,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -7338,6 +7697,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1821647345, "Name": "append" }, { @@ -7358,6 +7718,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 753216662, "Name": "clear" }, { @@ -7378,6 +7739,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24300556, "Name": "copy" }, { @@ -7404,6 +7766,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 753321816, "Name": "count" }, { @@ -7430,6 +7793,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1943671281, "Name": "extend" }, { @@ -7468,6 +7832,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 758816539, "Name": "index" }, { @@ -7500,6 +7865,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2048923024, "Name": "insert" }, { @@ -7526,6 +7892,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 796378, "Name": "pop" }, { @@ -7552,6 +7919,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1996862629, "Name": "remove" }, { @@ -7572,6 +7940,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1765188885, "Name": "reverse" }, { @@ -7592,6 +7961,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24777269, "Name": "sort" } ], @@ -7599,19 +7969,23 @@ "Fields": [ { "Value": null, + "Id": 925523557, "Name": "__hash__" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 24562997, "Name": "list" }, { @@ -7644,6 +8018,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1841774666, "Name": "__contains__" }, { @@ -7670,6 +8045,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1970845273, "Name": "__delitem__" }, { @@ -7696,6 +8072,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -7722,6 +8099,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -7748,6 +8126,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -7774,6 +8153,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -293179214, "Name": "__getitem__" }, { @@ -7800,6 +8180,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -7826,6 +8207,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -7846,6 +8228,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -7866,6 +8249,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -7892,6 +8276,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -7912,6 +8297,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1628904226, "Name": "__len__" }, { @@ -7938,6 +8324,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -7964,6 +8351,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -7984,6 +8372,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -8016,6 +8405,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -507796290, "Name": "__setitem__" }, { @@ -8036,6 +8426,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1069167279, "Name": "__sizeof__" }, { @@ -8062,6 +8453,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -8082,6 +8474,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 753216662, "Name": "clear" }, { @@ -8102,6 +8495,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24300556, "Name": "copy" }, { @@ -8140,6 +8534,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 134240693, "Name": "fromkeys" }, { @@ -8172,6 +8567,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 787423, "Name": "get" }, { @@ -8192,6 +8588,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 758996489, "Name": "items" }, { @@ -8212,6 +8609,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24529547, "Name": "keys" }, { @@ -8244,6 +8642,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 796378, "Name": "pop" }, { @@ -8276,6 +8675,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1035642093, "Name": "popitem" }, { @@ -8308,6 +8708,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 178640630, "Name": "setdefault" }, { @@ -8334,6 +8735,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1901098080, "Name": "update" }, { @@ -8354,6 +8756,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1886064647, "Name": "values" } ], @@ -8361,19 +8764,23 @@ "Fields": [ { "Value": null, + "Id": 925523557, "Name": "__hash__" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 24324173, "Name": "dict" }, { @@ -8406,6 +8813,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1638804448, "Name": "__and__" }, { @@ -8432,6 +8840,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1841774666, "Name": "__contains__" }, { @@ -8458,6 +8867,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -8484,6 +8894,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -8510,6 +8921,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -8536,6 +8948,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -8562,6 +8975,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 953999909, "Name": "__iand__" }, { @@ -8588,6 +9002,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -8608,6 +9023,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -8634,6 +9050,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1631373035, "Name": "__ior__" }, { @@ -8660,6 +9077,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 970829902, "Name": "__isub__" }, { @@ -8680,6 +9098,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -8706,6 +9125,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 975284137, "Name": "__ixor__" }, { @@ -8732,6 +9152,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -8752,6 +9173,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1628904226, "Name": "__len__" }, { @@ -8778,6 +9200,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -8804,6 +9227,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -8830,6 +9254,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748671418, "Name": "__or__" }, { @@ -8856,6 +9281,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1211662268, "Name": "__rand__" }, { @@ -8876,6 +9302,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -8896,6 +9323,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -8922,6 +9350,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1623061346, "Name": "__ror__" }, { @@ -8948,6 +9377,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1228492261, "Name": "__rsub__" }, { @@ -8974,6 +9404,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1232946496, "Name": "__rxor__" }, { @@ -8994,6 +9425,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1069167279, "Name": "__sizeof__" }, { @@ -9020,6 +9452,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621974455, "Name": "__sub__" }, { @@ -9046,6 +9479,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -9072,6 +9506,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1617520220, "Name": "__xor__" }, { @@ -9098,6 +9533,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 781610, "Name": "add" }, { @@ -9118,6 +9554,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 753216662, "Name": "clear" }, { @@ -9138,6 +9575,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24300556, "Name": "copy" }, { @@ -9164,6 +9602,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -946813804, "Name": "difference" }, { @@ -9190,6 +9629,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2053694164, "Name": "difference_update" }, { @@ -9216,6 +9656,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1193668441, "Name": "discard" }, { @@ -9242,6 +9683,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2011414560, "Name": "intersection" }, { @@ -9268,6 +9710,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1074130488, "Name": "intersection_update" }, { @@ -9294,6 +9737,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1041514301, "Name": "isdisjoint" }, { @@ -9320,6 +9764,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2076857571, "Name": "issubset" }, { @@ -9346,6 +9791,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -911398520, "Name": "issuperset" }, { @@ -9366,6 +9812,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 796378, "Name": "pop" }, { @@ -9392,6 +9839,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1996862629, "Name": "remove" }, { @@ -9418,6 +9866,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 796556764, "Name": "symmetric_difference" }, { @@ -9444,6 +9893,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -81680244, "Name": "symmetric_difference_update" }, { @@ -9470,6 +9920,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 769903896, "Name": "union" }, { @@ -9496,6 +9947,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1901098080, "Name": "update" } ], @@ -9503,19 +9955,23 @@ "Fields": [ { "Value": null, + "Id": 925523557, "Name": "__hash__" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 798955, "Name": "set" }, { @@ -9548,6 +10004,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1638804448, "Name": "__and__" }, { @@ -9574,6 +10031,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1841774666, "Name": "__contains__" }, { @@ -9600,6 +10058,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -9626,6 +10085,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -9652,6 +10112,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -9678,6 +10139,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -9698,6 +10160,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 925523557, "Name": "__hash__" }, { @@ -9724,6 +10187,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -9744,6 +10208,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -9764,6 +10229,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -9790,6 +10256,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -9810,6 +10277,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1628904226, "Name": "__len__" }, { @@ -9836,6 +10304,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -9862,6 +10331,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -9888,6 +10358,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748671418, "Name": "__or__" }, { @@ -9914,6 +10385,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1211662268, "Name": "__rand__" }, { @@ -9934,6 +10406,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -9954,6 +10427,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -9980,6 +10454,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1623061346, "Name": "__ror__" }, { @@ -10006,6 +10481,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1228492261, "Name": "__rsub__" }, { @@ -10032,6 +10508,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1232946496, "Name": "__rxor__" }, { @@ -10052,6 +10529,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1069167279, "Name": "__sizeof__" }, { @@ -10078,6 +10556,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621974455, "Name": "__sub__" }, { @@ -10104,6 +10583,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -10130,6 +10610,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1617520220, "Name": "__xor__" }, { @@ -10150,6 +10631,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24300556, "Name": "copy" }, { @@ -10176,6 +10658,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -946813804, "Name": "difference" }, { @@ -10202,6 +10685,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2011414560, "Name": "intersection" }, { @@ -10228,6 +10712,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1041514301, "Name": "isdisjoint" }, { @@ -10254,6 +10739,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2076857571, "Name": "issubset" }, { @@ -10280,6 +10766,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -911398520, "Name": "issuperset" }, { @@ -10306,6 +10793,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 796556764, "Name": "symmetric_difference" }, { @@ -10332,6 +10820,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 769903896, "Name": "union" } ], @@ -10339,15 +10828,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 233394059, "Name": "frozenset" }, { @@ -10380,6 +10872,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1639102358, "Name": "__add__" }, { @@ -10406,6 +10899,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1841774666, "Name": "__contains__" }, { @@ -10432,6 +10926,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -10458,6 +10953,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -10484,6 +10980,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -10510,6 +11007,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -293179214, "Name": "__getitem__" }, { @@ -10530,6 +11028,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -488627138, "Name": "__getnewargs__" }, { @@ -10556,6 +11055,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -10576,6 +11076,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 925523557, "Name": "__hash__" }, { @@ -10614,6 +11115,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -10634,6 +11136,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -10660,6 +11163,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -10680,6 +11184,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1628904226, "Name": "__len__" }, { @@ -10706,6 +11211,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -10732,6 +11238,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627692405, "Name": "__mod__" }, { @@ -10758,6 +11265,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627505971, "Name": "__mul__" }, { @@ -10784,6 +11292,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -10804,6 +11313,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -10830,6 +11340,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222774311, "Name": "__rmod__" }, { @@ -10856,6 +11367,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222960745, "Name": "__rmul__" }, { @@ -10876,6 +11388,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -10902,6 +11415,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -10922,6 +11436,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -145846717, "Name": "capitalize" }, { @@ -10954,6 +11469,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1868701484, "Name": "center" }, { @@ -10992,6 +11508,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 753321816, "Name": "count" }, { @@ -11024,6 +11541,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1896998085, "Name": "decode" }, { @@ -11062,6 +11580,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1172635435, "Name": "endswith" }, { @@ -11088,6 +11607,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -2134490001, "Name": "expandtabs" }, { @@ -11126,6 +11646,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24384080, "Name": "find" }, { @@ -11158,6 +11679,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 835611450, "Name": "fromhex" }, { @@ -11178,6 +11700,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 788388, "Name": "hex" }, { @@ -11216,6 +11739,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 758816539, "Name": "index" }, { @@ -11236,6 +11760,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -781168486, "Name": "isalnum" }, { @@ -11256,6 +11781,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -781166979, "Name": "isalpha" }, { @@ -11276,6 +11802,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -780970896, "Name": "isascii" }, { @@ -11296,6 +11823,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -778494388, "Name": "isdigit" }, { @@ -11316,6 +11844,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -770912224, "Name": "islower" }, { @@ -11336,6 +11865,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -764439003, "Name": "isspace" }, { @@ -11356,6 +11886,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -763705481, "Name": "istitle" }, { @@ -11376,6 +11907,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -762577471, "Name": "isupper" }, { @@ -11402,6 +11934,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24508865, "Name": "join" }, { @@ -11434,6 +11967,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 761484705, "Name": "ljust" }, { @@ -11454,6 +11988,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 761635146, "Name": "lower" }, { @@ -11480,6 +12015,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2139470083, "Name": "lstrip" }, { @@ -11512,6 +12048,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1060805443, "Name": "maketrans" }, { @@ -11538,6 +12075,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -2024653645, "Name": "partition" }, { @@ -11576,6 +12114,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1770538307, "Name": "replace" }, { @@ -11614,6 +12153,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 766894964, "Name": "rfind" }, { @@ -11652,6 +12192,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1993149833, "Name": "rindex" }, { @@ -11684,6 +12225,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 767025831, "Name": "rjust" }, { @@ -11710,6 +12252,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1107721713, "Name": "rpartition" }, { @@ -11742,6 +12285,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1983847233, "Name": "rsplit" }, { @@ -11768,6 +12312,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1983722307, "Name": "rstrip" }, { @@ -11800,6 +12345,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 768119139, "Name": "split" }, { @@ -11826,6 +12372,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1291658108, "Name": "splitlines" }, { @@ -11864,6 +12411,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 65206254, "Name": "startswith" }, { @@ -11890,6 +12438,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 768244065, "Name": "strip" }, { @@ -11910,6 +12459,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1060209754, "Name": "swapcase" }, { @@ -11930,6 +12480,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 768841889, "Name": "title" }, { @@ -11962,6 +12513,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 827988759, "Name": "translate" }, { @@ -11982,6 +12534,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 769969899, "Name": "upper" }, { @@ -12008,6 +12561,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 774283078, "Name": "zfill" } ], @@ -12015,15 +12569,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 752694964, "Name": "bytes" }, { @@ -12056,6 +12613,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -12088,6 +12646,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -12108,6 +12667,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -12128,6 +12688,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -12148,6 +12709,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 358836041, "Name": "__length_hint__" }, { @@ -12168,6 +12730,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1101153034, "Name": "__next__" }, { @@ -12188,6 +12751,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -12214,6 +12778,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1719806726, "Name": "__setstate__" }, { @@ -12240,6 +12805,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -12247,15 +12813,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1994109543, "Name": "bytes_iterator" }, { @@ -12288,6 +12857,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1639102358, "Name": "__add__" }, { @@ -12314,6 +12884,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1841774666, "Name": "__contains__" }, { @@ -12340,6 +12911,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -12366,6 +12938,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 695475534, "Name": "__format__" }, { @@ -12392,6 +12965,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -12418,6 +12992,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -12444,6 +13019,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -293179214, "Name": "__getitem__" }, { @@ -12464,6 +13040,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -488627138, "Name": "__getnewargs__" }, { @@ -12490,6 +13067,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -12510,6 +13088,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 925523557, "Name": "__hash__" }, { @@ -12548,6 +13127,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -12568,6 +13148,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -12594,6 +13175,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -12614,6 +13196,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1628904226, "Name": "__len__" }, { @@ -12640,6 +13223,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -12666,6 +13250,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627692405, "Name": "__mod__" }, { @@ -12692,6 +13277,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627505971, "Name": "__mul__" }, { @@ -12718,6 +13304,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -12738,6 +13325,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -12764,6 +13352,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222774311, "Name": "__rmod__" }, { @@ -12790,6 +13379,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222960745, "Name": "__rmul__" }, { @@ -12810,6 +13400,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1069167279, "Name": "__sizeof__" }, { @@ -12830,6 +13421,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -12856,6 +13448,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -12876,6 +13469,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -145846717, "Name": "capitalize" }, { @@ -12896,6 +13490,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1400072264, "Name": "casefold" }, { @@ -12928,6 +13523,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1868701484, "Name": "center" }, { @@ -12966,6 +13562,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 753321816, "Name": "count" }, { @@ -12998,6 +13595,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1933938925, "Name": "encode" }, { @@ -13036,6 +13634,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1172635435, "Name": "endswith" }, { @@ -13062,6 +13661,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -2134490001, "Name": "expandtabs" }, { @@ -13100,6 +13700,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24384080, "Name": "find" }, { @@ -13132,6 +13733,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1963936462, "Name": "format" }, { @@ -13158,6 +13760,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1943930987, "Name": "format_map" }, { @@ -13196,6 +13799,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 758816539, "Name": "index" }, { @@ -13216,6 +13820,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -781168486, "Name": "isalnum" }, { @@ -13236,6 +13841,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -781166979, "Name": "isalpha" }, { @@ -13256,6 +13862,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -780970896, "Name": "isascii" }, { @@ -13276,6 +13883,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -927011664, "Name": "isdecimal" }, { @@ -13296,6 +13904,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -778494388, "Name": "isdigit" }, { @@ -13316,6 +13925,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 401040106, "Name": "isidentifier" }, { @@ -13336,6 +13946,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -770912224, "Name": "islower" }, { @@ -13356,6 +13967,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -174721940, "Name": "isnumeric" }, { @@ -13376,6 +13988,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 346760998, "Name": "isprintable" }, { @@ -13396,6 +14009,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -764439003, "Name": "isspace" }, { @@ -13416,6 +14030,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -763705481, "Name": "istitle" }, { @@ -13436,6 +14051,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -762577471, "Name": "isupper" }, { @@ -13462,6 +14078,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24508865, "Name": "join" }, { @@ -13494,6 +14111,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 761484705, "Name": "ljust" }, { @@ -13514,6 +14132,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 761635146, "Name": "lower" }, { @@ -13540,6 +14159,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2139470083, "Name": "lstrip" }, { @@ -13578,6 +14198,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1060805443, "Name": "maketrans" }, { @@ -13604,6 +14225,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -2024653645, "Name": "partition" }, { @@ -13642,6 +14264,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1770538307, "Name": "replace" }, { @@ -13680,6 +14303,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 766894964, "Name": "rfind" }, { @@ -13718,6 +14342,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1993149833, "Name": "rindex" }, { @@ -13750,6 +14375,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 767025831, "Name": "rjust" }, { @@ -13776,6 +14402,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1107721713, "Name": "rpartition" }, { @@ -13808,6 +14435,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1983847233, "Name": "rsplit" }, { @@ -13834,6 +14462,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1983722307, "Name": "rstrip" }, { @@ -13866,6 +14495,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 768119139, "Name": "split" }, { @@ -13892,6 +14522,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1291658108, "Name": "splitlines" }, { @@ -13930,6 +14561,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 65206254, "Name": "startswith" }, { @@ -13956,6 +14588,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 768244065, "Name": "strip" }, { @@ -13976,6 +14609,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1060209754, "Name": "swapcase" }, { @@ -13996,6 +14630,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 768841889, "Name": "title" }, { @@ -14022,6 +14657,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 827988759, "Name": "translate" }, { @@ -14042,6 +14678,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 769969899, "Name": "upper" }, { @@ -14068,6 +14705,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 774283078, "Name": "zfill" } ], @@ -14075,15 +14713,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 799418, "Name": "str" }, { @@ -14116,6 +14757,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -14148,6 +14790,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -14168,6 +14811,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -14188,6 +14832,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -14208,6 +14853,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 358836041, "Name": "__length_hint__" }, { @@ -14228,6 +14874,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1101153034, "Name": "__next__" }, { @@ -14248,6 +14895,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -14274,6 +14922,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1719806726, "Name": "__setstate__" }, { @@ -14300,6 +14949,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -14307,15 +14957,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1858697299, "Name": "str_iterator" }, { @@ -14348,6 +15001,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2095540485, "Name": "__delattr__" }, { @@ -14368,6 +15022,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1636169386, "Name": "__dir__" }, { @@ -14394,6 +15049,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -14426,6 +15082,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -14446,6 +15103,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -14466,6 +15124,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -14498,6 +15157,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -736377828, "Name": "__setattr__" }, { @@ -14524,6 +15184,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -14531,15 +15192,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -2131035837, "Name": "module" }, { @@ -14578,6 +15242,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 782173109, "Name": "__call__" }, { @@ -14610,6 +15275,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1633516065, "Name": "__get__" }, { @@ -14642,6 +15308,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -14662,6 +15329,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -14682,6 +15350,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -14708,6 +15377,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -14716,59 +15386,70 @@ "Documentation": "", "ReturnType": "i:dict", "Attributes": 0, + "Id": 1058045229, "Name": "__annotations__" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 2101485316, "Name": "__closure__" }, { "Documentation": "", "ReturnType": "i:object", "Attributes": 0, + "Id": 794857348, "Name": "__code__" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -1308361943, "Name": "__defaults__" }, { "Documentation": "", "ReturnType": "i:dict", "Attributes": 0, + "Id": -1338696519, "Name": "__globals__" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -56184875, "Name": "__kwdefaults__" } ], "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": null, + "Id": 1097116834, "Name": "__name__" }, { "Value": null, + "Id": -1879833807, "Name": "__qualname__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1535808273, "Name": "function" }, { @@ -14807,6 +15488,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 782173109, "Name": "__call__" }, { @@ -14839,6 +15521,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1633516065, "Name": "__get__" }, { @@ -14865,6 +15548,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -14885,6 +15569,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -14905,6 +15590,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -14925,6 +15611,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -14951,6 +15638,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -14959,33 +15647,40 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 1840816120, "Name": "__objclass__" } ], "Fields": [ { "Value": null, + "Id": 1097116834, "Name": "__name__" }, { "Value": null, + "Id": -1879833807, "Name": "__qualname__" }, { "Value": null, + "Id": 174109373, "Name": "__text_signature__" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -98573582, "Name": "wrapper_descriptor" }, { @@ -15024,6 +15719,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 782173109, "Name": "__call__" }, { @@ -15050,6 +15746,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -15076,6 +15773,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -15102,6 +15800,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -15128,6 +15827,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -15148,6 +15848,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 925523557, "Name": "__hash__" }, { @@ -15168,6 +15869,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -15194,6 +15896,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -15220,6 +15923,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -15246,6 +15950,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -15266,6 +15971,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -15286,6 +15992,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -15312,6 +16019,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -15320,33 +16028,40 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 1243927843, "Name": "__self__" } ], "Fields": [ { "Value": null, + "Id": 1097116834, "Name": "__name__" }, { "Value": null, + "Id": -1879833807, "Name": "__qualname__" }, { "Value": null, + "Id": 174109373, "Name": "__text_signature__" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -713894391, "Name": "builtin_function_or_method" }, { @@ -15373,6 +16088,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1636294316, "Name": "__del__" }, { @@ -15399,6 +16115,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -15431,6 +16148,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -15451,6 +16169,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -15471,6 +16190,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -15491,6 +16211,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1101153034, "Name": "__next__" }, { @@ -15511,6 +16232,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -15537,6 +16259,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -15557,6 +16280,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 753226817, "Name": "close" }, { @@ -15583,6 +16307,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24767519, "Name": "send" }, { @@ -15621,6 +16346,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 768810287, "Name": "throw" } ], @@ -15629,47 +16355,56 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 1450385203, "Name": "gi_code" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 2015125735, "Name": "gi_frame" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 1663620793, "Name": "gi_running" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -1949084879, "Name": "gi_yieldfrom" } ], "Fields": [ { "Value": null, + "Id": 1097116834, "Name": "__name__" }, { "Value": null, + "Id": -1879833807, "Name": "__qualname__" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 62112924, "Name": "generator" }, { @@ -15702,6 +16437,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1041108482, "Name": "__delete__" }, { @@ -15734,6 +16470,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1633516065, "Name": "__get__" }, { @@ -15760,6 +16497,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -15792,6 +16530,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -15812,6 +16551,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -15844,6 +16584,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1622433813, "Name": "__set__" }, { @@ -15870,6 +16611,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -15896,6 +16638,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1314572240, "Name": "deleter" }, { @@ -15922,6 +16665,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1983396834, "Name": "getter" }, { @@ -15948,6 +16692,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1968020650, "Name": "setter" } ], @@ -15956,39 +16701,46 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 305214020, "Name": "__isabstractmethod__" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 24379004, "Name": "fdel" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 24381895, "Name": "fget" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 24393427, "Name": "fset" } ], "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 385079020, "Name": "property" }, { @@ -16027,6 +16779,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1633516065, "Name": "__get__" }, { @@ -16053,6 +16806,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -16073,6 +16827,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -16099,6 +16854,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -16107,27 +16863,32 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 886581915, "Name": "__func__" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 305214020, "Name": "__isabstractmethod__" } ], "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1347789854, "Name": "classmethod" }, { @@ -16166,6 +16927,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1633516065, "Name": "__get__" }, { @@ -16192,6 +16954,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -16212,6 +16975,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -16238,6 +17002,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -16246,27 +17011,32 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 886581915, "Name": "__func__" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 305214020, "Name": "__isabstractmethod__" } ], "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -382457242, "Name": "staticmethod" }, { @@ -16299,6 +17069,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -16331,6 +17102,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -16351,6 +17123,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -16371,6 +17144,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -16391,6 +17165,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -16417,6 +17192,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -16424,15 +17200,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1566923240, "Name": "ellipsis" }, { @@ -16465,6 +17244,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -16497,6 +17277,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -16517,6 +17298,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -16537,6 +17319,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -16557,6 +17340,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 358836041, "Name": "__length_hint__" }, { @@ -16577,6 +17361,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1101153034, "Name": "__next__" }, { @@ -16597,6 +17382,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -16623,6 +17409,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1719806726, "Name": "__setstate__" }, { @@ -16649,6 +17436,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -16656,15 +17444,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1210482396, "Name": "tuple_iterator" }, { @@ -16697,6 +17488,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -16729,6 +17521,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -16749,6 +17542,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -16769,6 +17563,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -16789,6 +17584,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 358836041, "Name": "__length_hint__" }, { @@ -16809,6 +17605,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1101153034, "Name": "__next__" }, { @@ -16829,6 +17626,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -16855,6 +17653,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1719806726, "Name": "__setstate__" }, { @@ -16881,6 +17680,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -16888,15 +17688,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -235571144, "Name": "list_iterator" }, { @@ -16929,6 +17732,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1638804448, "Name": "__and__" }, { @@ -16955,6 +17759,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1841774666, "Name": "__contains__" }, { @@ -16981,6 +17786,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -17007,6 +17813,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -17033,6 +17840,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -17059,6 +17867,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -17091,6 +17900,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -17111,6 +17921,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -17131,6 +17942,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -17157,6 +17969,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -17177,6 +17990,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1628904226, "Name": "__len__" }, { @@ -17203,6 +18017,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -17229,6 +18044,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -17255,6 +18071,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748671418, "Name": "__or__" }, { @@ -17281,6 +18098,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1211662268, "Name": "__rand__" }, { @@ -17301,6 +18119,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -17327,6 +18146,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1623061346, "Name": "__ror__" }, { @@ -17353,6 +18173,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1228492261, "Name": "__rsub__" }, { @@ -17379,6 +18200,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1232946496, "Name": "__rxor__" }, { @@ -17405,6 +18227,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621974455, "Name": "__sub__" }, { @@ -17431,6 +18254,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -17457,6 +18281,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1617520220, "Name": "__xor__" }, { @@ -17483,6 +18308,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1041514301, "Name": "isdisjoint" } ], @@ -17490,19 +18316,23 @@ "Fields": [ { "Value": null, + "Id": 925523557, "Name": "__hash__" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1189615962, "Name": "dict_keys" }, { @@ -17535,6 +18365,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -17567,6 +18398,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -17587,6 +18419,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -17607,6 +18440,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -17627,6 +18461,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1628904226, "Name": "__len__" }, { @@ -17647,6 +18482,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -17673,6 +18509,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -17680,15 +18517,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -448794284, "Name": "dict_values" }, { @@ -17721,6 +18561,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1638804448, "Name": "__and__" }, { @@ -17747,6 +18588,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1841774666, "Name": "__contains__" }, { @@ -17773,6 +18615,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -17799,6 +18642,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -17825,6 +18669,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -17851,6 +18696,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -17883,6 +18729,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -17903,6 +18750,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -17923,6 +18771,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -17949,6 +18798,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -17969,6 +18819,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1628904226, "Name": "__len__" }, { @@ -17995,6 +18846,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -18021,6 +18873,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -18047,6 +18900,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748671418, "Name": "__or__" }, { @@ -18073,6 +18927,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1211662268, "Name": "__rand__" }, { @@ -18093,6 +18948,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -18119,6 +18975,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1623061346, "Name": "__ror__" }, { @@ -18145,6 +19002,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1228492261, "Name": "__rsub__" }, { @@ -18171,6 +19029,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1232946496, "Name": "__rxor__" }, { @@ -18197,6 +19056,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621974455, "Name": "__sub__" }, { @@ -18223,6 +19083,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -18249,6 +19110,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1617520220, "Name": "__xor__" }, { @@ -18275,6 +19137,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1041514301, "Name": "isdisjoint" } ], @@ -18282,19 +19145,23 @@ "Fields": [ { "Value": null, + "Id": 925523557, "Name": "__hash__" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1775191374, "Name": "dict_items" }, { @@ -18327,6 +19194,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -18359,6 +19227,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -18379,6 +19248,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -18399,6 +19269,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -18419,6 +19290,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 358836041, "Name": "__length_hint__" }, { @@ -18439,6 +19311,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1101153034, "Name": "__next__" }, { @@ -18459,6 +19332,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -18485,6 +19359,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -18492,15 +19367,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1644830398, "Name": "set_iterator" }, { @@ -18533,6 +19411,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -18565,6 +19444,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -18585,6 +19465,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -18605,6 +19486,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -18625,6 +19507,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1101153034, "Name": "__next__" }, { @@ -18645,6 +19528,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -18671,6 +19555,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -18678,15 +19563,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1412442334, "Name": "callable_iterator" }, { @@ -18725,6 +19613,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -18745,6 +19634,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -18771,6 +19661,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -18778,15 +19669,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1785145959, "Name": "ArithmeticError" }, { @@ -18825,6 +19719,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -18845,6 +19740,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -18871,6 +19767,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -18878,15 +19775,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 109523997, "Name": "AssertionError" }, { @@ -18925,6 +19825,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -18945,6 +19846,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -18971,6 +19873,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -18978,15 +19881,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1621479619, "Name": "AttributeError" }, { @@ -19019,6 +19925,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2095540485, "Name": "__delattr__" }, { @@ -19045,6 +19952,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -19077,6 +19985,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -19097,6 +20006,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -19117,6 +20027,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -19137,6 +20048,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -19169,6 +20081,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -736377828, "Name": "__setattr__" }, { @@ -19195,6 +20108,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1719806726, "Name": "__setstate__" }, { @@ -19215,6 +20129,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -19241,6 +20156,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -19261,6 +20177,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1335409846, "Name": "with_traceback" } ], @@ -19269,45 +20186,53 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -1513911310, "Name": "__cause__" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -2133475976, "Name": "__context__" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 687994684, "Name": "__suppress_context__" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -832142859, "Name": "__traceback__" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 24243572, "Name": "args" } ], "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -964931161, "Name": "BaseException" }, { @@ -19346,6 +20271,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -19366,6 +20292,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -19392,6 +20319,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -19399,15 +20327,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1410423402, "Name": "BlockingIOError" }, { @@ -19446,6 +20377,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -19466,6 +20398,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -19492,6 +20425,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -19499,15 +20433,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 555518862, "Name": "BrokenPipeError" }, { @@ -19546,6 +20483,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -19566,6 +20504,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -19592,6 +20531,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -19599,15 +20539,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -707233519, "Name": "BufferError" }, { @@ -19646,6 +20589,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -19666,6 +20610,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -19692,6 +20637,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -19699,15 +20645,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1247228520, "Name": "BytesWarning" }, { @@ -19746,6 +20695,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -19766,6 +20716,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -19792,6 +20743,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -19799,15 +20751,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 935166142, "Name": "ChildProcessError" }, { @@ -19846,6 +20801,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -19866,6 +20822,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -19892,6 +20849,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -19899,15 +20857,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -36589970, "Name": "ConnectionAbortedError" }, { @@ -19946,6 +20907,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -19966,6 +20928,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -19992,6 +20955,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -19999,15 +20963,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 853386419, "Name": "ConnectionError" }, { @@ -20046,6 +21013,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -20066,6 +21034,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -20092,6 +21061,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -20099,15 +21069,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -39655411, "Name": "ConnectionRefusedError" }, { @@ -20146,6 +21119,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -20166,6 +21140,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -20192,6 +21167,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -20199,15 +21175,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1510727214, "Name": "ConnectionResetError" }, { @@ -20246,6 +21225,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -20266,6 +21246,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -20292,6 +21273,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -20299,15 +21281,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1216241665, "Name": "DeprecationWarning" }, { @@ -20346,6 +21331,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -20366,6 +21352,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -20392,6 +21379,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -20399,15 +21387,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 542668707, "Name": "EOFError" }, { @@ -20446,6 +21437,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -20466,6 +21458,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -20492,6 +21485,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -20499,15 +21493,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1034216968, "Name": "Exception" }, { @@ -20546,6 +21543,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -20566,6 +21564,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -20592,6 +21591,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -20599,15 +21599,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 21666521, "Name": "FileExistsError" }, { @@ -20646,6 +21649,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -20666,6 +21670,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -20692,6 +21697,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -20699,15 +21705,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1270506650, "Name": "FileNotFoundError" }, { @@ -20746,6 +21755,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -20766,6 +21776,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -20792,6 +21803,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -20799,15 +21811,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1068572533, "Name": "FloatingPointError" }, { @@ -20846,6 +21861,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -20866,6 +21882,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -20892,6 +21909,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -20899,15 +21917,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -860777086, "Name": "FutureWarning" }, { @@ -20946,6 +21967,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -20966,6 +21988,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -20992,6 +22015,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -20999,15 +22023,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -192384070, "Name": "GeneratorExit" }, { @@ -21046,6 +22073,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -21066,6 +22094,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -21086,6 +22115,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -21106,6 +22136,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -21132,6 +22163,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -21140,33 +22172,39 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 793610, "Name": "msg" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 24614690, "Name": "name" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 24674492, "Name": "path" } ], "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1786736844, "Name": "ImportError" }, { @@ -21205,6 +22243,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -21225,6 +22264,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -21251,6 +22291,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -21258,15 +22299,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1670622560, "Name": "ImportWarning" }, { @@ -21305,6 +22349,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -21325,6 +22370,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -21351,6 +22397,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -21358,15 +22405,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1378449398, "Name": "IndentationError" }, { @@ -21405,6 +22455,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -21425,6 +22476,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -21451,6 +22503,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -21458,15 +22511,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 41375693, "Name": "IndexError" }, { @@ -21505,6 +22561,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -21525,6 +22582,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -21551,6 +22609,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -21558,15 +22617,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 2118943517, "Name": "InterruptedError" }, { @@ -21605,6 +22667,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -21625,6 +22688,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -21651,6 +22715,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -21658,15 +22723,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -539766661, "Name": "IsADirectoryError" }, { @@ -21705,6 +22773,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -21725,6 +22794,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -21745,6 +22815,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -21771,6 +22842,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -21778,15 +22850,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1919927328, "Name": "KeyError" }, { @@ -21825,6 +22900,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -21845,6 +22921,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -21871,6 +22948,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -21878,15 +22956,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -568533275, "Name": "KeyboardInterrupt" }, { @@ -21925,6 +23006,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -21945,6 +23027,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -21971,6 +23054,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -21978,15 +23062,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1976997911, "Name": "LookupError" }, { @@ -22025,6 +23112,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -22045,6 +23133,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -22071,6 +23160,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -22078,15 +23168,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1736548592, "Name": "MemoryError" }, { @@ -22125,6 +23218,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -22145,6 +23239,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -22171,6 +23266,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -22178,15 +23274,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -118265290, "Name": "ModuleNotFoundError" }, { @@ -22225,6 +23324,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -22245,6 +23345,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -22271,6 +23372,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -22278,15 +23380,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1306030106, "Name": "NameError" }, { @@ -22325,6 +23430,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -22345,6 +23451,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -22371,6 +23478,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -22378,15 +23486,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1883438976, "Name": "NotADirectoryError" }, { @@ -22425,6 +23536,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -22445,6 +23557,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -22471,6 +23584,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -22478,15 +23592,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1801259394, "Name": "NotImplementedError" }, { @@ -22525,6 +23642,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -22545,6 +23663,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -22565,6 +23684,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -22585,6 +23705,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -22611,6 +23732,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -22619,51 +23741,60 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 464662681, "Name": "characters_written" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 755255343, "Name": "errno" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 643451678, "Name": "filename" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -1527834412, "Name": "filename2" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -1125301362, "Name": "strerror" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 263850179, "Name": "winerror" } ], "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 971730573, "Name": "OSError" }, { @@ -22702,6 +23833,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -22722,6 +23854,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -22748,6 +23881,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -22755,15 +23889,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1655264177, "Name": "OverflowError" }, { @@ -22802,6 +23939,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -22822,6 +23960,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -22848,6 +23987,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -22855,15 +23995,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 47161640, "Name": "PendingDeprecationWarning" }, { @@ -22902,6 +24045,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -22922,6 +24066,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -22948,6 +24093,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -22955,15 +24101,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1499984798, "Name": "PermissionError" }, { @@ -23002,6 +24151,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -23022,6 +24172,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -23048,6 +24199,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -23055,15 +24207,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -592570570, "Name": "ProcessLookupError" }, { @@ -23102,6 +24257,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -23122,6 +24278,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -23148,6 +24305,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -23155,15 +24313,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 973317053, "Name": "RecursionError" }, { @@ -23202,6 +24363,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -23222,6 +24384,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -23248,6 +24411,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -23255,15 +24419,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1682887028, "Name": "ReferenceError" }, { @@ -23302,6 +24469,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -23322,6 +24490,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -23348,6 +24517,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -23355,15 +24525,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1905008279, "Name": "ResourceWarning" }, { @@ -23402,6 +24575,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -23422,6 +24596,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -23448,6 +24623,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -23455,15 +24631,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -377412921, "Name": "RuntimeError" }, { @@ -23502,6 +24681,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -23522,6 +24702,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -23548,6 +24729,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -23555,15 +24737,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 686869659, "Name": "RuntimeWarning" }, { @@ -23590,6 +24775,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -23610,6 +24796,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -23636,6 +24823,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -23643,15 +24831,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1964459226, "Name": "StopAsyncIteration" }, { @@ -23678,6 +24869,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -23698,6 +24890,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -23724,6 +24917,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -23732,21 +24926,25 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 770443194, "Name": "value" } ], "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1951844828, "Name": "StopIteration" }, { @@ -23785,6 +24983,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -23805,6 +25004,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -23825,6 +25025,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -23851,6 +25052,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -23859,51 +25061,60 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 643451678, "Name": "filename" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 2130043788, "Name": "lineno" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 793610, "Name": "msg" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -2082031766, "Name": "offset" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 207370550, "Name": "print_file_and_line" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 24797636, "Name": "text" } ], "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 289812302, "Name": "SyntaxError" }, { @@ -23942,6 +25153,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -23962,6 +25174,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -23988,6 +25201,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -23995,15 +25209,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1940181858, "Name": "SyntaxWarning" }, { @@ -24042,6 +25259,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -24062,6 +25280,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -24088,6 +25307,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -24095,15 +25315,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1217398654, "Name": "SystemError" }, { @@ -24142,6 +25365,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -24162,6 +25386,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -24188,6 +25413,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -24196,21 +25422,25 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 24300164, "Name": "code" } ], "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -39265436, "Name": "SystemExit" }, { @@ -24249,6 +25479,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -24269,6 +25500,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -24295,6 +25527,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -24302,15 +25535,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 511833258, "Name": "TabError" }, { @@ -24349,6 +25585,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -24369,6 +25606,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -24395,6 +25633,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -24402,15 +25641,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1980648738, "Name": "TimeoutError" }, { @@ -24449,6 +25691,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -24469,6 +25712,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -24495,6 +25739,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -24502,15 +25747,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -2020536169, "Name": "TypeError" }, { @@ -24549,6 +25797,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -24569,6 +25818,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -24595,6 +25845,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -24602,15 +25853,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -268625301, "Name": "UnboundLocalError" }, { @@ -24649,6 +25903,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -24669,6 +25924,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -24689,6 +25945,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -24715,6 +25972,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -24723,45 +25981,53 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -1205524886, "Name": "encoding" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 785764, "Name": "end" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -2085620202, "Name": "object" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -1997216485, "Name": "reason" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 768228011, "Name": "start" } ], "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 2029423124, "Name": "UnicodeDecodeError" }, { @@ -24800,6 +26066,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -24820,6 +26087,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -24840,6 +26108,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -24866,6 +26135,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -24874,45 +26144,53 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -1205524886, "Name": "encoding" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 785764, "Name": "end" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -2085620202, "Name": "object" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -1997216485, "Name": "reason" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 768228011, "Name": "start" } ], "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1536149780, "Name": "UnicodeEncodeError" }, { @@ -24951,6 +26229,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -24971,6 +26250,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -24997,6 +26277,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -25004,15 +26285,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -477523230, "Name": "UnicodeError" }, { @@ -25051,6 +26335,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -25071,6 +26356,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -25091,6 +26377,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -25117,6 +26404,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -25125,45 +26413,53 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -1205524886, "Name": "encoding" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 785764, "Name": "end" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -2085620202, "Name": "object" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -1997216485, "Name": "reason" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 768228011, "Name": "start" } ], "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1013392832, "Name": "UnicodeTranslateError" }, { @@ -25202,6 +26498,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -25222,6 +26519,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -25248,6 +26546,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -25255,15 +26554,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1029856778, "Name": "UnicodeWarning" }, { @@ -25302,6 +26604,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -25322,6 +26625,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -25348,6 +26652,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -25355,15 +26660,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1164383418, "Name": "UserWarning" }, { @@ -25396,6 +26704,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -25416,6 +26725,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -25442,6 +26752,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -25449,15 +26760,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1337555598, "Name": "ValueError" }, { @@ -25496,6 +26810,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -25516,6 +26831,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -25542,6 +26858,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -25549,15 +26866,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -75935867, "Name": "Warning" }, { @@ -25596,6 +26916,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -25616,6 +26937,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -25642,6 +26964,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -25649,15 +26972,18 @@ "Fields": [ { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 840427580, "Name": "ZeroDivisionError" }, { @@ -25690,6 +27016,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1639102358, "Name": "__add__" }, { @@ -25710,6 +27037,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1312536510, "Name": "__alloc__" }, { @@ -25736,6 +27064,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1841774666, "Name": "__contains__" }, { @@ -25762,6 +27091,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1970845273, "Name": "__delitem__" }, { @@ -25788,6 +27118,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -25814,6 +27145,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -25840,6 +27172,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -25866,6 +27199,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -293179214, "Name": "__getitem__" }, { @@ -25892,6 +27226,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -25918,6 +27253,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 953701999, "Name": "__iadd__" }, { @@ -25944,6 +27280,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965298386, "Name": "__imul__" }, { @@ -25982,6 +27319,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -26002,6 +27340,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -26022,6 +27361,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -26048,6 +27388,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -26068,6 +27409,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1628904226, "Name": "__len__" }, { @@ -26094,6 +27436,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -26120,6 +27463,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627692405, "Name": "__mod__" }, { @@ -26146,6 +27490,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627505971, "Name": "__mul__" }, { @@ -26172,6 +27517,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -26192,6 +27538,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -26218,6 +27565,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -491007883, "Name": "__reduce_ex__" }, { @@ -26238,6 +27586,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -26264,6 +27613,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222774311, "Name": "__rmod__" }, { @@ -26290,6 +27640,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222960745, "Name": "__rmul__" }, { @@ -26322,6 +27673,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -507796290, "Name": "__setitem__" }, { @@ -26342,6 +27694,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1069167279, "Name": "__sizeof__" }, { @@ -26362,6 +27715,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -26388,6 +27742,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -26414,6 +27769,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1821647345, "Name": "append" }, { @@ -26434,6 +27790,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -145846717, "Name": "capitalize" }, { @@ -26454,6 +27811,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1868701484, "Name": "center" }, { @@ -26474,6 +27832,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 753216662, "Name": "clear" }, { @@ -26494,6 +27853,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24300556, "Name": "copy" }, { @@ -26520,6 +27880,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 753321816, "Name": "count" }, { @@ -26552,6 +27913,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1896998085, "Name": "decode" }, { @@ -26590,6 +27952,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1172635435, "Name": "endswith" }, { @@ -26616,6 +27979,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -2134490001, "Name": "expandtabs" }, { @@ -26642,6 +28006,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1943671281, "Name": "extend" }, { @@ -26680,6 +28045,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24384080, "Name": "find" }, { @@ -26712,6 +28078,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 835611450, "Name": "fromhex" }, { @@ -26732,6 +28099,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 788388, "Name": "hex" }, { @@ -26758,6 +28126,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 758816539, "Name": "index" }, { @@ -26790,6 +28159,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2048923024, "Name": "insert" }, { @@ -26810,6 +28180,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -781168486, "Name": "isalnum" }, { @@ -26830,6 +28201,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -781166979, "Name": "isalpha" }, { @@ -26850,6 +28222,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -780970896, "Name": "isascii" }, { @@ -26870,6 +28243,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -778494388, "Name": "isdigit" }, { @@ -26890,6 +28264,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -770912224, "Name": "islower" }, { @@ -26910,6 +28285,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -764439003, "Name": "isspace" }, { @@ -26930,6 +28306,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -763705481, "Name": "istitle" }, { @@ -26950,6 +28327,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -762577471, "Name": "isupper" }, { @@ -26976,6 +28354,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24508865, "Name": "join" }, { @@ -26996,6 +28375,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 761484705, "Name": "ljust" }, { @@ -27016,6 +28396,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 761635146, "Name": "lower" }, { @@ -27042,6 +28423,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2139470083, "Name": "lstrip" }, { @@ -27074,6 +28456,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1060805443, "Name": "maketrans" }, { @@ -27100,6 +28483,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -2024653645, "Name": "partition" }, { @@ -27126,6 +28510,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 796378, "Name": "pop" }, { @@ -27152,6 +28537,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1996862629, "Name": "remove" }, { @@ -27190,6 +28576,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1770538307, "Name": "replace" }, { @@ -27210,6 +28597,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1765188885, "Name": "reverse" }, { @@ -27248,6 +28636,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 766894964, "Name": "rfind" }, { @@ -27286,6 +28675,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1993149833, "Name": "rindex" }, { @@ -27306,6 +28696,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 767025831, "Name": "rjust" }, { @@ -27332,6 +28723,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1107721713, "Name": "rpartition" }, { @@ -27364,6 +28756,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1983847233, "Name": "rsplit" }, { @@ -27390,6 +28783,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1983722307, "Name": "rstrip" }, { @@ -27422,6 +28816,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 768119139, "Name": "split" }, { @@ -27448,6 +28843,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1291658108, "Name": "splitlines" }, { @@ -27486,6 +28882,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 65206254, "Name": "startswith" }, { @@ -27512,6 +28909,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 768244065, "Name": "strip" }, { @@ -27532,6 +28930,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1060209754, "Name": "swapcase" }, { @@ -27552,6 +28951,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 768841889, "Name": "title" }, { @@ -27584,6 +28984,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 827988759, "Name": "translate" }, { @@ -27604,6 +29005,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 769969899, "Name": "upper" }, { @@ -27630,6 +29032,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 774283078, "Name": "zfill" } ], @@ -27637,19 +29040,23 @@ "Fields": [ { "Value": null, + "Id": 925523557, "Name": "__hash__" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 2020778010, "Name": "bytearray" }, { @@ -27682,6 +29089,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -27714,6 +29122,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -27734,6 +29143,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -27754,6 +29164,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -27774,6 +29185,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1101153034, "Name": "__next__" }, { @@ -27794,6 +29206,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -27820,6 +29233,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -27827,15 +29241,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 22552621, "Name": "enumerate" }, { @@ -27868,6 +29285,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -27900,6 +29318,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -27920,6 +29339,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -27940,6 +29360,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -27960,6 +29381,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1101153034, "Name": "__next__" }, { @@ -27980,6 +29402,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -28006,6 +29429,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -28013,15 +29437,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1958223439, "Name": "filter" }, { @@ -28054,6 +29481,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -28086,6 +29514,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -28106,6 +29535,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -28126,6 +29556,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -28146,6 +29577,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1101153034, "Name": "__next__" }, { @@ -28166,6 +29598,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -28192,6 +29625,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -28199,15 +29633,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 793061, "Name": "map" }, { @@ -28240,6 +29677,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1970845273, "Name": "__delitem__" }, { @@ -28260,6 +29698,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 631946913, "Name": "__enter__" }, { @@ -28286,6 +29725,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -28306,6 +29746,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 860590709, "Name": "__exit__" }, { @@ -28332,6 +29773,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -28358,6 +29800,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -28384,6 +29827,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -293179214, "Name": "__getitem__" }, { @@ -28410,6 +29854,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -28430,6 +29875,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 925523557, "Name": "__hash__" }, { @@ -28462,6 +29908,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -28482,6 +29929,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -28508,6 +29956,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -28528,6 +29977,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1628904226, "Name": "__len__" }, { @@ -28554,6 +30004,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -28580,6 +30031,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -28600,6 +30052,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -28632,6 +30085,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -507796290, "Name": "__setitem__" }, { @@ -28658,6 +30112,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -28684,6 +30139,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24287190, "Name": "cast" }, { @@ -28704,6 +30160,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 788388, "Name": "hex" }, { @@ -28724,6 +30181,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1774440432, "Name": "release" }, { @@ -28744,6 +30202,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 278236889, "Name": "tobytes" }, { @@ -28764,6 +30223,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1930404752, "Name": "tolist" } ], @@ -28772,87 +30232,102 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -1098052229, "Name": "c_contiguous" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 1992441311, "Name": "contiguous" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -710804072, "Name": "f_contiguous" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 1963936462, "Name": "format" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -1738304853, "Name": "itemsize" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -2113788012, "Name": "nbytes" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 24617457, "Name": "ndim" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 795008, "Name": "obj" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 511489881, "Name": "readonly" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 767870442, "Name": "shape" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": -451836733, "Name": "strides" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 1220081495, "Name": "suboffsets" } ], "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -689070467, "Name": "memoryview" }, { @@ -28885,6 +30360,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -28917,6 +30393,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -28937,6 +30414,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -28957,6 +30435,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -28977,6 +30456,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 358836041, "Name": "__length_hint__" }, { @@ -28997,6 +30477,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1101153034, "Name": "__next__" }, { @@ -29017,6 +30498,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -29043,6 +30525,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1719806726, "Name": "__setstate__" }, { @@ -29069,6 +30552,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -29076,15 +30560,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1113719513, "Name": "reversed" }, { @@ -29117,6 +30604,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -29143,6 +30631,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -29169,6 +30658,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -29195,6 +30685,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -29233,6 +30724,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -29253,6 +30745,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -29279,6 +30772,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -29305,6 +30799,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -29331,6 +30826,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -29351,6 +30847,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -29371,6 +30868,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -29397,6 +30895,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -29417,6 +30916,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -921644112, "Name": "indices" } ], @@ -29425,37 +30925,44 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 768228011, "Name": "start" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 24781667, "Name": "step" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 24781977, "Name": "stop" } ], "Fields": [ { "Value": null, + "Id": 925523557, "Name": "__hash__" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 767996891, "Name": "slice" }, { @@ -29494,6 +31001,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1633516065, "Name": "__get__" }, { @@ -29520,6 +31028,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -29552,6 +31061,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -29572,6 +31082,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -29592,6 +31103,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -29618,6 +31130,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -29626,33 +31139,39 @@ "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 1243927843, "Name": "__self__" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 2069653788, "Name": "__self_class__" }, { "Documentation": "", "ReturnType": null, "Attributes": 0, + "Id": 185188451, "Name": "__thisclass__" } ], "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 768271812, "Name": "super" }, { @@ -29685,6 +31204,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -29717,6 +31237,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -29737,6 +31258,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -29757,6 +31279,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -29777,6 +31300,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1101153034, "Name": "__next__" }, { @@ -29797,6 +31321,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -29823,6 +31348,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -29830,15 +31356,18 @@ "Fields": [ { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 805802, "Name": "zip" }, { @@ -29877,6 +31406,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 782173109, "Name": "__call__" }, { @@ -29903,6 +31433,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2095540485, "Name": "__delattr__" }, { @@ -29923,6 +31454,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1636169386, "Name": "__dir__" }, { @@ -29949,6 +31481,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -29987,6 +31520,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -30007,6 +31541,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -30033,6 +31568,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1213275748, "Name": "__instancecheck__" }, { @@ -30071,6 +31607,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1556881104, "Name": "__prepare__" }, { @@ -30091,6 +31628,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -30123,6 +31661,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -736377828, "Name": "__setattr__" }, { @@ -30143,6 +31682,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1069167279, "Name": "__sizeof__" }, { @@ -30169,6 +31709,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -25004647, "Name": "__subclasscheck__" }, { @@ -30189,6 +31730,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1804067837, "Name": "__subclasses__" }, { @@ -30215,6 +31757,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" } ], @@ -30222,53 +31765,66 @@ "Fields": [ { "Value": null, + "Id": -1388753224, "Name": "__basicsize__" }, { "Value": "i:dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": null, + "Id": -198224608, "Name": "__dictoffset__" }, { "Value": null, + "Id": 1444705936, "Name": "__flags__" }, { "Value": null, + "Id": 919460331, "Name": "__itemsize__" }, { "Value": "i:tuple", + "Id": -1627592461, "Name": "__mro__" }, { "Value": null, + "Id": 1097116834, "Name": "__name__" }, { "Value": null, + "Id": -1879833807, "Name": "__qualname__" }, { "Value": null, + "Id": 174109373, "Name": "__text_signature__" }, { "Value": null, + "Id": 1521523639, "Name": "__weakrefoffset__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 24816593, "Name": "type" } ], - "Name": "builtins(3.7)" + "Id": -1981595346, + "Name": "builtins" } \ No newline at end of file diff --git a/src/Caching/Test/Files/NestedClasses.json b/src/Caching/Test/Files/NestedClasses.json index 505fb0381..47007f715 100644 --- a/src/Caching/Test/Files/NestedClasses.json +++ b/src/Caching/Test/Files/NestedClasses.json @@ -1,50 +1,51 @@ { + "UniqueId": "module", "Documentation": "", "Functions": [], "Variables": [ { "Value": "bool", - "Id": -284397016, + "Id": -529376420, "Name": "__debug__" }, { "Value": "str", - "Id": 1716814261, + "Id": -1636005055, "Name": "__doc__" }, { "Value": "str", - "Id": -1651825028, + "Id": 875442003, "Name": "__file__" }, { "Value": "str", - "Id": 359927558, + "Id": 1097116834, "Name": "__name__" }, { "Value": "str", - "Id": 1376117645, + "Id": 75395663, "Name": "__package__" }, { "Value": "list", - "Id": -1181510515, + "Id": 1154586556, "Name": "__path__" }, { "Value": "dict", - "Id": -2101168703, + "Id": 817929997, "Name": "__dict__" }, { "Value": "i:str", - "Id": 1524797253, + "Id": 833, "Name": "x" }, { "Value": "i:module.C", - "Id": -466436537, + "Id": 812, "Name": "c" } ], @@ -73,7 +74,7 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Id": 1064115010, + "Id": -1909501047, "Name": "methodA" } ], @@ -81,18 +82,18 @@ "Fields": [ { "Value": "dict", - "Id": -2101168703, + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", - "Id": -184559367, + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], - "Id": 1589709533, + "Id": 778, "Name": "A" }, { @@ -119,7 +120,7 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Id": -31822871, + "Id": 935009767, "Name": "methodB1" }, { @@ -140,7 +141,7 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Id": 485037146, + "Id": 935009768, "Name": "methodB2" } ], @@ -148,17 +149,17 @@ "Fields": [ { "Value": "i:int", - "Id": 1524797253, + "Id": 833, "Name": "x" }, { "Value": "dict", - "Id": -2101168703, + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", - "Id": -184559367, + "Id": 1225024228, "Name": "__weakref__" } ], @@ -188,7 +189,7 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Id": 506751156, + "Id": 965872103, "Name": "__init__" }, { @@ -209,7 +210,7 @@ "Attributes": 0, "Classes": null, "Functions": null, - "Id": 1910290968, + "Id": -1909501045, "Name": "methodC" } ], @@ -217,30 +218,30 @@ "Fields": [ { "Value": "i:int", - "Id": 466874038, + "Id": 834, "Name": "y" }, { "Value": "dict", - "Id": -2101168703, + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", - "Id": -184559367, + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], - "Id": 339060664, + "Id": 780, "Name": "C" } ], - "Id": 431513585, + "Id": 779, "Name": "B" } ], - "Id": 1345059090, + "Id": -2131035837, "Name": "module" } \ No newline at end of file diff --git a/src/Caching/Test/Files/SmokeTest.json b/src/Caching/Test/Files/SmokeTest.json index 316251847..22deb28a6 100644 --- a/src/Caching/Test/Files/SmokeTest.json +++ b/src/Caching/Test/Files/SmokeTest.json @@ -1,4 +1,5 @@ { + "UniqueId": "module", "Documentation": "", "Functions": [ { @@ -12,44 +13,54 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24395611, "Name": "func" } ], "Variables": [ { "Value": "bool", + "Id": -529376420, "Name": "__debug__" }, { "Value": "str", + "Id": -1636005055, "Name": "__doc__" }, { "Value": "str", + "Id": 875442003, "Name": "__file__" }, { "Value": "str", + "Id": 1097116834, "Name": "__name__" }, { "Value": "str", + "Id": 75395663, "Name": "__package__" }, { "Value": "list", + "Id": 1154586556, "Name": "__path__" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "i:str", + "Id": 833, "Name": "x" }, { "Value": "i:module.C", + "Id": 812, "Name": "c" } ], @@ -78,6 +89,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -98,32 +110,47 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -2139806792, "Name": "method" } ], - "Properties": [], + "Properties": [ + { + "Documentation": "", + "ReturnType": "i:int", + "Attributes": 0, + "Id": 24690682, + "Name": "prop" + } + ], "Fields": [ { "Value": "i:int", + "Id": 833, "Name": "x" }, { "Value": "i:int", + "Id": 834, "Name": "y" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 780, "Name": "C" } ], + "Id": -2131035837, "Name": "module" } \ No newline at end of file diff --git a/src/Caching/Test/Files/Sys.json b/src/Caching/Test/Files/Sys.json index 4e1ad5c96..f9ac44526 100644 --- a/src/Caching/Test/Files/Sys.json +++ b/src/Caching/Test/Files/Sys.json @@ -1,4 +1,5 @@ { + "UniqueId": "sys(3.7)", "Documentation": "This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught exception\nlast_value -- value of last uncaught exception\nlast_traceback -- traceback of last uncaught exception\n These three are only available in an interactive session after a\n traceback has been printed.\n\nStatic objects:\n\nbuiltin_module_names -- tuple of module names built into this interpreter\ncopyright -- copyright notice pertaining to this interpreter\nexec_prefix -- prefix used to find the machine-specific Python library\nexecutable -- absolute path of the executable binary of the Python interpreter\nfloat_info -- a struct sequence with information about the float implementation.\nfloat_repr_style -- string indicating the style of repr() output for floats\nhash_info -- a struct sequence with information about the hash algorithm.\nhexversion -- version information encoded as a single integer\nimplementation -- Python implementation information.\nint_info -- a struct sequence with information about the int implementation.\nmaxsize -- the largest supported length of containers.\nmaxunicode -- the value of the largest Unicode code point\nplatform -- platform identifier\nprefix -- prefix used to find the Python library\nthread_info -- a struct sequence with information about the thread implementation.\nversion -- the version of this interpreter as a string\nversion_info -- version information as a named tuple\ndllhandle -- [Windows only] integer handle of the Python DLL\nwinver -- [Windows only] version number of the Python DLL\n_enablelegacywindowsfsencoding -- [Windows only] \n__stdin__ -- the original stdin; don't touch!\n__stdout__ -- the original stdout; don't touch!\n__stderr__ -- the original stderr; don't touch!\n__displayhook__ -- the original displayhook; don't touch!\n__excepthook__ -- the original excepthook; don't touch!\n\nFunctions:\n\ndisplayhook() -- print an object to the screen, and save it in builtins._\nexcepthook() -- print an exception and its traceback to sys.stderr\nexc_info() -- return thread-safe information about the current exception\nexit() -- exit the interpreter by raising SystemExit\ngetdlopenflags() -- returns flags to be used for dlopen() calls\ngetprofile() -- get the global profiling function\ngetrefcount() -- return the reference count for an object (plus one :-)\ngetrecursionlimit() -- return the max recursion depth for the interpreter\ngetsizeof() -- return the size of an object in bytes\ngettrace() -- get the global debug tracing function\nsetcheckinterval() -- control how often the interpreter checks for events\nsetdlopenflags() -- set the flags to be used for dlopen() calls\nsetprofile() -- set the global profiling function\nsetrecursionlimit() -- set the max recursion depth for the interpreter\nsettrace() -- set the global debug tracing function\n", "Functions": [ { @@ -12,6 +13,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1623088213, "Name": "__breakpointhook__" }, { @@ -25,6 +27,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 629764782, "Name": "__displayhook__" }, { @@ -38,6 +41,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1425218131, "Name": "__excepthook__" }, { @@ -51,6 +55,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1727507378, "Name": "__interactivehook__" }, { @@ -64,6 +69,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1527505257, "Name": "_clear_type_cache" }, { @@ -77,6 +83,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 813545300, "Name": "_current_frames" }, { @@ -90,6 +97,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1370295892, "Name": "_debugmallocstats" }, { @@ -103,6 +111,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1047770159, "Name": "_enablelegacywindowsfsencoding" }, { @@ -117,12 +126,13 @@ "Kind": 0 } ], - "ReturnType": "i:types(3.7).FrameType" + "ReturnType": "i:types.FrameType" } ], "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1848744703, "Name": "_getframe" }, { @@ -149,6 +159,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1414470549, "Name": "breakpointhook" }, { @@ -175,6 +186,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1158985352, "Name": "call_tracing" }, { @@ -188,6 +200,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1252442422, "Name": "callstats" }, { @@ -208,6 +221,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 388872302, "Name": "displayhook" }, { @@ -221,6 +235,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -935045484, "Name": "exc_info" }, { @@ -242,7 +257,7 @@ }, { "Name": "traceback", - "Type": "types(3.7).TracebackType", + "Type": "types.TracebackType", "DefaultValue": null, "Kind": 0 } @@ -253,6 +268,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 305517843, "Name": "excepthook" }, { @@ -273,6 +289,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 24368565, "Name": "exit" }, { @@ -286,6 +303,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -932626587, "Name": "get_asyncgen_hooks" }, { @@ -299,6 +317,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1605124845, "Name": "get_coroutine_origin_tracking_depth" }, { @@ -312,6 +331,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1829443124, "Name": "get_coroutine_wrapper" }, { @@ -325,6 +345,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1953654962, "Name": "getallocatedblocks" }, { @@ -338,6 +359,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2065023054, "Name": "getcheckinterval" }, { @@ -351,6 +373,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1935348949, "Name": "getdefaultencoding" }, { @@ -364,6 +387,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 346962379, "Name": "getfilesystemencodeerrors" }, { @@ -377,6 +401,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -946006243, "Name": "getfilesystemencoding" }, { @@ -390,6 +415,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 682573034, "Name": "getprofile" }, { @@ -403,6 +429,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 949225272, "Name": "getrecursionlimit" }, { @@ -423,6 +450,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -37310149, "Name": "getrefcount" }, { @@ -449,6 +477,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1485394487, "Name": "getsizeof" }, { @@ -462,6 +491,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1633191528, "Name": "getswitchinterval" }, { @@ -475,6 +505,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -920747834, "Name": "gettrace" }, { @@ -482,12 +513,13 @@ "Overloads": [ { "Parameters": [], - "ReturnType": "i:sys(3.7)._WinVersion" + "ReturnType": "i:sys._WinVersion" } ], "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1280212332, "Name": "getwindowsversion" }, { @@ -508,6 +540,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2048952809, "Name": "intern" }, { @@ -521,6 +554,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1710543065, "Name": "is_finalizing" }, { @@ -553,6 +587,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -12592935, "Name": "set_asyncgen_hooks" }, { @@ -573,6 +608,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 836059129, "Name": "set_coroutine_origin_tracking_depth" }, { @@ -593,6 +629,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 706767832, "Name": "set_coroutine_wrapper" }, { @@ -613,6 +650,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 233580226, "Name": "setcheckinterval" }, { @@ -633,6 +671,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1675589026, "Name": "setprofile" }, { @@ -653,6 +692,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 9072452, "Name": "setrecursionlimit" }, { @@ -673,6 +713,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1721622948, "Name": "setswitchinterval" }, { @@ -693,196 +734,244 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1481860294, "Name": "settrace" } ], "Variables": [ { - "Value": "_io.gUdbe7JPo__mmtlB2OEXEoJfodVUlyVJH8hq4p8uxB0=", + "Value": "_io", + "Id": 668243680, "Name": "_mod__io" }, { "Value": "builtins", + "Id": -1070584715, "Name": "_mod_builtins" }, { - "Value": "types(3.7)", + "Value": "types", + "Id": -2043043116, "Name": "_mod_types" }, { "Value": "i:str", + "Id": -1636005055, "Name": "__doc__" }, { "Value": "i:str", + "Id": 1097116834, "Name": "__name__" }, { "Value": "i:str", + "Id": 75395663, "Name": "__package__" }, { - "Value": "i:_io(3.7).TextIOWrapper", + "Value": "i:_io.TextIOWrapper", + "Id": 1612032761, "Name": "__stderr__" }, { - "Value": "i:_io(3.7).TextIOWrapper", + "Value": "i:_io.TextIOWrapper", + "Id": 329210449, "Name": "__stdin__" }, { - "Value": "i:_io(3.7).TextIOWrapper", + "Value": "i:_io.TextIOWrapper", + "Id": 1621359266, "Name": "__stdout__" }, { "Value": "i:str", + "Id": 677051350, "Name": "_framework" }, { "Value": "i:tuple", + "Id": 24173482, "Name": "_git" }, { "Value": "i:NoneType", + "Id": 749413383, "Name": "_home" }, { "Value": "i:dict", + "Id": 1595009614, "Name": "_xoptions" }, { "Value": "i:int", + "Id": 1834311484, "Name": "api_version" }, { "Value": "i:list", + "Id": 24243575, "Name": "argv" }, { "Value": "i:str", + "Id": 1664944041, "Name": "base_exec_prefix" }, { "Value": "i:str", + "Id": 1039099721, "Name": "base_prefix" }, { "Value": "i:tuple", + "Id": 1963179240, "Name": "builtin_module_names" }, { "Value": "i:str", + "Id": 2033693967, "Name": "byteorder" }, { "Value": "i:str", + "Id": 1298046352, "Name": "copyright" }, { "Value": "i:int", + "Id": -1200168491, "Name": "dllhandle" }, { "Value": "i:bool", + "Id": 1675585612, "Name": "dont_write_bytecode" }, { "Value": "i:str", + "Id": 62274953, "Name": "exec_prefix" }, { "Value": "i:str", + "Id": -2135911519, "Name": "executable" }, { "Value": "i:str", + "Id": 92603457, "Name": "float_repr_style" }, { "Value": "i:int", + "Id": -471599948, "Name": "hexversion" }, { "Value": null, + "Id": 1997289353, "Name": "implementation" }, { "Value": "i:int", + "Id": -2020000914, "Name": "maxsize" }, { "Value": "i:int", + "Id": 842058832, "Name": "maxunicode" }, { "Value": "i:list", + "Id": -1294259224, "Name": "meta_path" }, { "Value": "i:dict", + "Id": -1637601392, "Name": "modules" }, { "Value": "i:list", + "Id": 24674492, "Name": "path" }, { "Value": "i:list", + "Id": -1506404755, "Name": "path_hooks" }, { "Value": "i:dict", + "Id": 376899064, "Name": "path_importer_cache" }, { "Value": "i:str", + "Id": -1042062966, "Name": "platform" }, { "Value": "i:str", + "Id": -2042362519, "Name": "prefix" }, { - "Value": "i:_io(3.7).TextIOWrapper", + "Value": "i:_io.TextIOWrapper", + "Id": -1954658503, "Name": "stderr" }, { - "Value": "i:_io(3.7).TextIOWrapper", + "Value": "i:_io.TextIOWrapper", + "Id": 768230609, "Name": "stdin" }, { - "Value": "i:_io(3.7).TextIOWrapper", + "Value": "i:_io.TextIOWrapper", + "Id": -1954648798, "Name": "stdout" }, { "Value": "i:str", + "Id": 1781540065, "Name": "version" }, { "Value": "i:list", + "Id": -707130143, "Name": "warnoptions" }, { "Value": "i:str", + "Id": -1849986786, "Name": "winver" }, { - "Value": "i:sys(3.7).__float_info", + "Value": "i:sys.__float_info", + "Id": 602612744, "Name": "float_info" }, { - "Value": "i:sys(3.7).__hash_info", + "Value": "i:sys.__hash_info", + "Id": 84475656, "Name": "hash_info" }, { - "Value": "i:sys(3.7).__int_info", + "Value": "i:sys.__int_info", + "Id": 1942821909, "Name": "int_info" }, { - "Value": "i:sys(3.7).__thread_info", + "Value": "i:sys.__thread_info", + "Id": 604643660, "Name": "thread_info" }, { - "Value": "i:sys(3.7).__version_info", + "Value": "i:sys.__version_info", + "Id": 1738857804, "Name": "version_info" } ], @@ -918,6 +1007,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1639102358, "Name": "__add__" }, { @@ -944,6 +1034,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1841774666, "Name": "__contains__" }, { @@ -970,6 +1061,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2095540485, "Name": "__delattr__" }, { @@ -990,6 +1082,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1636169386, "Name": "__dir__" }, { @@ -1016,6 +1109,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -1042,6 +1136,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 695475534, "Name": "__format__" }, { @@ -1068,6 +1163,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -1094,6 +1190,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -1120,6 +1217,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -293179214, "Name": "__getitem__" }, { @@ -1140,6 +1238,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -488627138, "Name": "__getnewargs__" }, { @@ -1166,6 +1265,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -1186,6 +1286,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 925523557, "Name": "__hash__" }, { @@ -1218,6 +1319,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -1238,6 +1340,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -1258,6 +1361,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -1284,6 +1388,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -1304,6 +1409,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1628904226, "Name": "__len__" }, { @@ -1330,6 +1436,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -1356,6 +1463,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627505971, "Name": "__mul__" }, { @@ -1382,6 +1490,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -1402,6 +1511,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -1428,6 +1538,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -491007883, "Name": "__reduce_ex__" }, { @@ -1448,6 +1559,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -1474,6 +1586,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222960745, "Name": "__rmul__" }, { @@ -1506,6 +1619,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -736377828, "Name": "__setattr__" }, { @@ -1526,6 +1640,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1069167279, "Name": "__sizeof__" }, { @@ -1546,6 +1661,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -1572,6 +1688,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -1598,6 +1715,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 753321816, "Name": "count" }, { @@ -1636,6 +1754,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 758816539, "Name": "index" } ], @@ -1643,87 +1762,108 @@ "Fields": [ { "Value": "i:int", + "Id": 2130352401, "Name": "bytes_warning" }, { "Value": "i:int", + "Id": 753929372, "Name": "debug" }, { "Value": "i:bool", + "Id": -1816482652, "Name": "dev_mode" }, { "Value": "i:int", + "Id": 1675585612, "Name": "dont_write_bytecode" }, { "Value": "i:int", + "Id": 557578535, "Name": "hash_randomization" }, { "Value": "i:int", + "Id": -175101059, "Name": "ignore_environment" }, { "Value": "i:int", + "Id": -907580899, "Name": "inspect" }, { "Value": "i:int", + "Id": 518040171, "Name": "interactive" }, { "Value": "i:int", + "Id": 1954000432, "Name": "isolated" }, { "Value": "i:int", + "Id": 1247591617, "Name": "n_fields" }, { "Value": "i:int", + "Id": -1428290577, "Name": "n_sequence_fields" }, { "Value": "i:int", + "Id": 1605593504, "Name": "n_unnamed_fields" }, { "Value": "i:int", + "Id": -754777330, "Name": "no_site" }, { "Value": "i:int", + "Id": 113341396, "Name": "no_user_site" }, { "Value": "i:int", + "Id": 1299139572, "Name": "optimize" }, { "Value": "i:int", + "Id": 766418045, "Name": "quiet" }, { "Value": "i:int", + "Id": 1084304250, "Name": "utf8_mode" }, { "Value": "i:int", + "Id": 1781039499, "Name": "verbose" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 755983568, "Name": "flags" }, { @@ -1740,7 +1880,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1757,6 +1897,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1639102358, "Name": "__add__" }, { @@ -1766,7 +1907,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1783,6 +1924,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1841774666, "Name": "__contains__" }, { @@ -1792,7 +1934,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1809,6 +1951,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2095540485, "Name": "__delattr__" }, { @@ -1818,7 +1961,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1835,6 +1978,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1636169386, "Name": "__dir__" }, { @@ -1844,7 +1988,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1861,6 +2005,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -1870,7 +2015,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1893,6 +2038,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 695475534, "Name": "__format__" }, { @@ -1902,7 +2048,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1919,6 +2065,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -1928,7 +2075,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1945,6 +2092,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -1954,7 +2102,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1971,6 +2119,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -293179214, "Name": "__getitem__" }, { @@ -1980,7 +2129,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1997,6 +2146,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -488627138, "Name": "__getnewargs__" }, { @@ -2006,7 +2156,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2023,6 +2173,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -2032,7 +2183,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 } @@ -2043,6 +2194,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 925523557, "Name": "__hash__" }, { @@ -2052,7 +2204,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2075,6 +2227,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -2084,7 +2237,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 } @@ -2095,6 +2248,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -2104,7 +2258,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 } @@ -2115,6 +2269,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -2124,7 +2279,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2141,6 +2296,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -2150,7 +2306,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 } @@ -2161,6 +2317,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1628904226, "Name": "__len__" }, { @@ -2170,7 +2327,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2187,6 +2344,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -2196,7 +2354,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2213,6 +2371,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627505971, "Name": "__mul__" }, { @@ -2222,7 +2381,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2239,6 +2398,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -2248,7 +2408,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 } @@ -2259,6 +2419,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -2268,7 +2429,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2291,6 +2452,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -491007883, "Name": "__reduce_ex__" }, { @@ -2300,7 +2462,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 } @@ -2311,6 +2473,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -2320,7 +2483,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2337,6 +2500,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222960745, "Name": "__rmul__" }, { @@ -2346,7 +2510,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2369,6 +2533,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -736377828, "Name": "__setattr__" }, { @@ -2378,7 +2543,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2395,6 +2560,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1069167279, "Name": "__sizeof__" }, { @@ -2404,7 +2570,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 } @@ -2415,6 +2581,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -2424,7 +2591,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2441,6 +2608,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -2450,7 +2618,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2473,6 +2641,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 753321816, "Name": "count" }, { @@ -2482,7 +2651,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__float_info", + "Type": "sys.__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2517,6 +2686,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 758816539, "Name": "index" } ], @@ -2524,71 +2694,88 @@ "Fields": [ { "Value": "i:int", + "Id": 784651, "Name": "dig" }, { "Value": "i:float", + "Id": -105571469, "Name": "epsilon" }, { "Value": "i:int", + "Id": 1518794292, "Name": "mant_dig" }, { "Value": "i:float", + "Id": 793069, "Name": "max" }, { "Value": "i:int", + "Id": 992667279, "Name": "max_10_exp" }, { "Value": "i:int", + "Id": -2020600629, "Name": "max_exp" }, { "Value": "i:float", + "Id": 793307, "Name": "min" }, { "Value": "i:int", + "Id": -830300703, "Name": "min_10_exp" }, { "Value": "i:int", + "Id": -1800802631, "Name": "min_exp" }, { "Value": "i:int", + "Id": 1247591617, "Name": "n_fields" }, { "Value": "i:int", + "Id": -1428290577, "Name": "n_sequence_fields" }, { "Value": "i:int", + "Id": 1605593504, "Name": "n_unnamed_fields" }, { "Value": "i:int", + "Id": 766741069, "Name": "radix" }, { "Value": "i:int", + "Id": -1987390596, "Name": "rounds" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1290755624, "Name": "__float_info" }, { @@ -2605,7 +2792,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2622,6 +2809,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1639102358, "Name": "__add__" }, { @@ -2631,7 +2819,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2648,6 +2836,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1841774666, "Name": "__contains__" }, { @@ -2657,7 +2846,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2674,6 +2863,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2095540485, "Name": "__delattr__" }, { @@ -2683,7 +2873,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2700,6 +2890,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1636169386, "Name": "__dir__" }, { @@ -2709,7 +2900,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2726,6 +2917,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -2735,7 +2927,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2758,6 +2950,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 695475534, "Name": "__format__" }, { @@ -2767,7 +2960,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2784,6 +2977,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -2793,7 +2987,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2810,6 +3004,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -2819,7 +3014,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2836,6 +3031,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -293179214, "Name": "__getitem__" }, { @@ -2845,7 +3041,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2862,6 +3058,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -488627138, "Name": "__getnewargs__" }, { @@ -2871,7 +3068,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2888,6 +3085,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -2897,7 +3095,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 } @@ -2908,6 +3106,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 925523557, "Name": "__hash__" }, { @@ -2917,7 +3116,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2940,6 +3139,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -2949,7 +3149,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 } @@ -2960,6 +3160,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -2969,7 +3170,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 } @@ -2980,6 +3181,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -2989,7 +3191,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3006,6 +3208,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -3015,7 +3218,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 } @@ -3026,6 +3229,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1628904226, "Name": "__len__" }, { @@ -3035,7 +3239,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3052,6 +3256,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -3061,7 +3266,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3078,6 +3283,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627505971, "Name": "__mul__" }, { @@ -3087,7 +3293,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3104,6 +3310,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -3113,7 +3320,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 } @@ -3124,6 +3331,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -3133,7 +3341,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3156,6 +3364,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -491007883, "Name": "__reduce_ex__" }, { @@ -3165,7 +3374,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 } @@ -3176,6 +3385,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -3185,7 +3395,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3202,6 +3412,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222960745, "Name": "__rmul__" }, { @@ -3211,7 +3422,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3234,6 +3445,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -736377828, "Name": "__setattr__" }, { @@ -3243,7 +3455,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3260,6 +3472,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1069167279, "Name": "__sizeof__" }, { @@ -3269,7 +3482,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 } @@ -3280,6 +3493,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -3289,7 +3503,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3306,6 +3520,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -3315,7 +3530,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3338,6 +3553,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 753321816, "Name": "count" }, { @@ -3347,7 +3563,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__hash_info", + "Type": "sys.__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3382,6 +3598,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 758816539, "Name": "index" } ], @@ -3389,63 +3606,78 @@ "Fields": [ { "Value": "i:str", + "Id": 646712, "Name": "algorithm" }, { "Value": "i:int", + "Id": 1883651780, "Name": "cutoff" }, { "Value": "i:int", + "Id": 84262752, "Name": "hash_bits" }, { "Value": "i:int", + "Id": 24476897, "Name": "imag" }, { "Value": "i:int", + "Id": 789610, "Name": "inf" }, { "Value": "i:int", + "Id": -1637600896, "Name": "modulus" }, { "Value": "i:int", + "Id": 1247591617, "Name": "n_fields" }, { "Value": "i:int", + "Id": -1428290577, "Name": "n_sequence_fields" }, { "Value": "i:int", + "Id": 1605593504, "Name": "n_unnamed_fields" }, { "Value": "i:int", + "Id": 794020, "Name": "nan" }, { "Value": "i:int", + "Id": 403740637, "Name": "seed_bits" }, { "Value": "i:int", + "Id": 771597327, "Name": "width" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": -1417346840, "Name": "__hash_info" }, { @@ -3462,7 +3694,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3479,6 +3711,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1639102358, "Name": "__add__" }, { @@ -3488,7 +3721,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3505,6 +3738,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1841774666, "Name": "__contains__" }, { @@ -3514,7 +3748,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3531,6 +3765,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2095540485, "Name": "__delattr__" }, { @@ -3540,7 +3775,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3557,6 +3792,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1636169386, "Name": "__dir__" }, { @@ -3566,7 +3802,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3583,6 +3819,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -3592,7 +3829,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3615,6 +3852,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 695475534, "Name": "__format__" }, { @@ -3624,7 +3862,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3641,6 +3879,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -3650,7 +3889,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3667,6 +3906,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -3676,7 +3916,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3693,6 +3933,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -293179214, "Name": "__getitem__" }, { @@ -3702,7 +3943,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3719,6 +3960,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -488627138, "Name": "__getnewargs__" }, { @@ -3728,7 +3970,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3745,6 +3987,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -3754,7 +3997,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 } @@ -3765,6 +4008,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 925523557, "Name": "__hash__" }, { @@ -3774,7 +4018,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3797,6 +4041,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -3806,7 +4051,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 } @@ -3817,6 +4062,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -3826,7 +4072,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 } @@ -3837,6 +4083,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -3846,7 +4093,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3863,6 +4110,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -3872,7 +4120,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 } @@ -3883,6 +4131,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1628904226, "Name": "__len__" }, { @@ -3892,7 +4141,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3909,6 +4158,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -3918,7 +4168,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3935,6 +4185,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627505971, "Name": "__mul__" }, { @@ -3944,7 +4195,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3961,6 +4212,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -3970,7 +4222,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 } @@ -3981,6 +4233,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -3990,7 +4243,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4013,6 +4266,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -491007883, "Name": "__reduce_ex__" }, { @@ -4022,7 +4276,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 } @@ -4033,6 +4287,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -4042,7 +4297,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4059,6 +4314,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222960745, "Name": "__rmul__" }, { @@ -4068,7 +4324,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4091,6 +4347,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -736377828, "Name": "__setattr__" }, { @@ -4100,7 +4357,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4117,6 +4374,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1069167279, "Name": "__sizeof__" }, { @@ -4126,7 +4384,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 } @@ -4137,6 +4395,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -4146,7 +4405,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4163,6 +4422,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -4172,7 +4432,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4195,6 +4455,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 753321816, "Name": "count" }, { @@ -4204,7 +4465,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__int_info", + "Type": "sys.__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4239,6 +4500,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 758816539, "Name": "index" } ], @@ -4246,35 +4508,43 @@ "Fields": [ { "Value": "i:int", + "Id": 1945378665, "Name": "bits_per_digit" }, { "Value": "i:int", + "Id": 1247591617, "Name": "n_fields" }, { "Value": "i:int", + "Id": -1428290577, "Name": "n_sequence_fields" }, { "Value": "i:int", + "Id": 1605593504, "Name": "n_unnamed_fields" }, { "Value": "i:int", + "Id": -1534275235, "Name": "sizeof_digit" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 785997365, "Name": "__int_info" }, { @@ -4291,7 +4561,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4308,6 +4578,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1639102358, "Name": "__add__" }, { @@ -4317,7 +4588,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4334,6 +4605,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1841774666, "Name": "__contains__" }, { @@ -4343,7 +4615,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4360,6 +4632,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2095540485, "Name": "__delattr__" }, { @@ -4369,7 +4642,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4386,6 +4659,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1636169386, "Name": "__dir__" }, { @@ -4395,7 +4669,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4412,6 +4686,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -4421,7 +4696,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4444,6 +4719,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 695475534, "Name": "__format__" }, { @@ -4453,7 +4729,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4470,6 +4746,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -4479,7 +4756,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4496,6 +4773,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -4505,7 +4783,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4522,6 +4800,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -293179214, "Name": "__getitem__" }, { @@ -4531,7 +4810,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4548,6 +4827,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -488627138, "Name": "__getnewargs__" }, { @@ -4557,7 +4837,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4574,6 +4854,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -4583,7 +4864,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 } @@ -4594,6 +4875,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 925523557, "Name": "__hash__" }, { @@ -4603,7 +4885,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4626,6 +4908,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -4635,7 +4918,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 } @@ -4646,6 +4929,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -4655,7 +4939,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 } @@ -4666,6 +4950,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -4675,7 +4960,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4692,6 +4977,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -4701,7 +4987,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 } @@ -4712,6 +4998,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1628904226, "Name": "__len__" }, { @@ -4721,7 +5008,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4738,6 +5025,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -4747,7 +5035,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4764,6 +5052,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627505971, "Name": "__mul__" }, { @@ -4773,7 +5062,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4790,6 +5079,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -4799,7 +5089,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 } @@ -4810,6 +5100,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -4819,7 +5110,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4842,6 +5133,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -491007883, "Name": "__reduce_ex__" }, { @@ -4851,7 +5143,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 } @@ -4862,6 +5154,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -4871,7 +5164,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4888,6 +5181,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222960745, "Name": "__rmul__" }, { @@ -4897,7 +5191,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4920,6 +5214,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -736377828, "Name": "__setattr__" }, { @@ -4929,7 +5224,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4946,6 +5241,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1069167279, "Name": "__sizeof__" }, { @@ -4955,7 +5251,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 } @@ -4966,6 +5262,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -4975,7 +5272,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4992,6 +5289,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -5001,7 +5299,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -5024,6 +5322,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 753321816, "Name": "count" }, { @@ -5033,7 +5332,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__thread_info", + "Type": "sys.__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -5068,6 +5367,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 758816539, "Name": "index" } ], @@ -5075,39 +5375,48 @@ "Fields": [ { "Value": "i:NoneType", + "Id": 24568258, "Name": "lock" }, { "Value": "i:int", + "Id": 1247591617, "Name": "n_fields" }, { "Value": "i:int", + "Id": -1428290577, "Name": "n_sequence_fields" }, { "Value": "i:int", + "Id": 1605593504, "Name": "n_unnamed_fields" }, { "Value": "i:str", + "Id": 24614690, "Name": "name" }, { "Value": "i:NoneType", + "Id": 1781540065, "Name": "version" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 462236460, "Name": "__thread_info" }, { @@ -5124,7 +5433,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5141,6 +5450,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1639102358, "Name": "__add__" }, { @@ -5150,7 +5460,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5167,6 +5477,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1841774666, "Name": "__contains__" }, { @@ -5176,7 +5487,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5193,6 +5504,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 2095540485, "Name": "__delattr__" }, { @@ -5202,7 +5514,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5219,6 +5531,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1636169386, "Name": "__dir__" }, { @@ -5228,7 +5541,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5245,6 +5558,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748372547, "Name": "__eq__" }, { @@ -5254,7 +5568,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5277,6 +5591,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 695475534, "Name": "__format__" }, { @@ -5286,7 +5601,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5303,6 +5618,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748420597, "Name": "__ge__" }, { @@ -5312,7 +5628,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5329,6 +5645,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1329277859, "Name": "__getattribute__" }, { @@ -5338,7 +5655,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5355,6 +5672,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -293179214, "Name": "__getitem__" }, { @@ -5364,7 +5682,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5381,6 +5699,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -488627138, "Name": "__getnewargs__" }, { @@ -5390,7 +5709,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5407,6 +5726,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748435012, "Name": "__gt__" }, { @@ -5416,7 +5736,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 } @@ -5427,6 +5747,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 925523557, "Name": "__hash__" }, { @@ -5436,7 +5757,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5459,6 +5780,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 965872103, "Name": "__init__" }, { @@ -5468,7 +5790,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 } @@ -5479,6 +5801,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1040523408, "Name": "__init_subclass__" }, { @@ -5488,7 +5811,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 } @@ -5499,6 +5822,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 971292143, "Name": "__iter__" }, { @@ -5508,7 +5832,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5525,6 +5849,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748569552, "Name": "__le__" }, { @@ -5534,7 +5859,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 } @@ -5545,6 +5870,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1628904226, "Name": "__len__" }, { @@ -5554,7 +5880,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5571,6 +5897,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748583967, "Name": "__lt__" }, { @@ -5580,7 +5907,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5597,6 +5924,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1627505971, "Name": "__mul__" }, { @@ -5606,7 +5934,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5623,6 +5951,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1748629134, "Name": "__ne__" }, { @@ -5632,7 +5961,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 } @@ -5643,6 +5972,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -544113923, "Name": "__reduce__" }, { @@ -5652,7 +5982,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5675,6 +6005,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -491007883, "Name": "__reduce_ex__" }, { @@ -5684,7 +6015,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 } @@ -5695,6 +6026,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1215429388, "Name": "__repr__" }, { @@ -5704,7 +6036,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5721,6 +6053,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1222960745, "Name": "__rmul__" }, { @@ -5730,7 +6063,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5753,6 +6086,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -736377828, "Name": "__setattr__" }, { @@ -5762,7 +6096,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5779,6 +6113,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 1069167279, "Name": "__sizeof__" }, { @@ -5788,7 +6123,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 } @@ -5799,6 +6134,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1621988870, "Name": "__str__" }, { @@ -5808,7 +6144,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5825,6 +6161,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": -1374911630, "Name": "__subclasshook__" }, { @@ -5834,7 +6171,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5857,6 +6194,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 753321816, "Name": "count" }, { @@ -5866,7 +6204,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys(3.7).__version_info", + "Type": "sys.__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5901,6 +6239,7 @@ "Attributes": 0, "Classes": null, "Functions": null, + "Id": 758816539, "Name": "index" } ], @@ -5908,49 +6247,61 @@ "Fields": [ { "Value": "i:int", + "Id": 762129410, "Name": "major" }, { "Value": "i:int", + "Id": 762361101, "Name": "micro" }, { "Value": "i:int", + "Id": 762371582, "Name": "minor" }, { "Value": "i:int", + "Id": 1247591617, "Name": "n_fields" }, { "Value": "i:int", + "Id": -1428290577, "Name": "n_sequence_fields" }, { "Value": "i:int", + "Id": 1605593504, "Name": "n_unnamed_fields" }, { "Value": "i:str", + "Id": -112134796, "Name": "releaselevel" }, { "Value": "i:int", + "Id": -1968090933, "Name": "serial" }, { "Value": "dict", + "Id": 817929997, "Name": "__dict__" }, { "Value": "object", + "Id": 1225024228, "Name": "__weakref__" } ], "GenericParameters": null, "InnerClasses": [], + "Id": 1619201900, "Name": "__version_info" } ], - "Name": "sys(3.7)" + "Id": -1012399873, + "Name": "sys" } \ No newline at end of file diff --git a/src/Core/Impl/Extensions/StringExtensions.cs b/src/Core/Impl/Extensions/StringExtensions.cs index 5f380aaac..40fb89068 100644 --- a/src/Core/Impl/Extensions/StringExtensions.cs +++ b/src/Core/Impl/Extensions/StringExtensions.cs @@ -298,5 +298,15 @@ public static string NormalizeLineEndings(this string s, string lineEnding = nul lineEnding = lineEnding ?? Environment.NewLine; return string.Join(lineEnding, s.SplitLines()); } + + public static int GetStableHash(this string s) { + unchecked { + var hash = 23; + foreach (var c in s) { + hash = hash * 31 + c; + } + return hash; + } + } } } From 5e9bf8e09d9dcab7413325cb20817441ce3c090d Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Mon, 17 Jun 2019 22:29:47 -0700 Subject: [PATCH 76/82] Perf bug --- src/Caching/Impl/Factories/ModuleFactory.cs | 7 ++++++- src/Caching/Impl/ModuleDatabase.cs | 2 +- src/LanguageServer/Impl/Implementation/Server.cs | 5 ++++- src/LanguageServer/Impl/Protocol/Classes.cs | 5 +++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Caching/Impl/Factories/ModuleFactory.cs b/src/Caching/Impl/Factories/ModuleFactory.cs index 667d9f3a4..d8465d6f1 100644 --- a/src/Caching/Impl/Factories/ModuleFactory.cs +++ b/src/Caching/Impl/Factories/ModuleFactory.cs @@ -75,7 +75,12 @@ public IMember ConstructMember(string rawQualifiedName) { ? GetMemberFromThisModule(nameParts, 1) : GetMemberFromModule(module, nameParts, 1); - return isInstance && member != null ? new PythonInstance(member.GetPythonType()) : member; + if (!isInstance) { + return member; + } + + var t = member.GetPythonType() ?? module.Interpreter.UnknownType; + return new PythonInstance(t); } finally { _processing.Pop(); } diff --git a/src/Caching/Impl/ModuleDatabase.cs b/src/Caching/Impl/ModuleDatabase.cs index 87b65d625..f8a1860f0 100644 --- a/src/Caching/Impl/ModuleDatabase.cs +++ b/src/Caching/Impl/ModuleDatabase.cs @@ -16,7 +16,6 @@ using System; using System.IO; using System.Linq; -using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; using LiteDB; @@ -103,6 +102,7 @@ private void StoreModuleAnalysis(IDocumentAnalysis analysis, CancellationToken c using (var db = new LiteDatabase(Path.Combine(_databaseFolder, $"{model.UniqueId}.db"))) { var modules = db.GetCollection("modules"); modules.Upsert(model); + return; } } catch (Exception ex1) when (ex1 is IOException || ex1 is UnauthorizedAccessException) { ex = ex1; diff --git a/src/LanguageServer/Impl/Implementation/Server.cs b/src/LanguageServer/Impl/Implementation/Server.cs index 63b26a64a..ea00a82c6 100644 --- a/src/LanguageServer/Impl/Implementation/Server.cs +++ b/src/LanguageServer/Impl/Implementation/Server.cs @@ -143,7 +143,10 @@ public async Task InitializeAsync(InitializeParams @params, Ca TypeshedPath = @params.initializationOptions.typeStubSearchPaths.FirstOrDefault() }; - _services.AddService(new ModuleDatabase(_services)); + if (@params.initializationOptions.enableAnalysCache != false) { + _services.AddService(new ModuleDatabase(_services)); + } + _interpreter = await PythonInterpreter.CreateAsync(configuration, _rootDir, _services, cancellationToken); _services.AddService(_interpreter); diff --git a/src/LanguageServer/Impl/Protocol/Classes.cs b/src/LanguageServer/Impl/Protocol/Classes.cs index a83096d4b..37cb7a2cb 100644 --- a/src/LanguageServer/Impl/Protocol/Classes.cs +++ b/src/LanguageServer/Impl/Protocol/Classes.cs @@ -158,6 +158,11 @@ public sealed class InterpreterProperties { /// Path to a writable folder where analyzer can cache its data. /// public string cacheFolderPath; + + /// + /// Turns off analysis caching. + /// + public bool? enableAnalysCache; } [Serializable] From eadd62226fd574b740e1cd2ef6d204525c6f776f Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Tue, 18 Jun 2019 12:35:20 -0700 Subject: [PATCH 77/82] Baseline, remove debug code, deactivate db --- src/Caching/Impl/Factories/ModuleFactory.cs | 3 +- src/Caching/Test/Files/Requests.json | 28 +++++++++---------- .../Impl/Implementation/Server.cs | 2 +- src/LanguageServer/Impl/Program.cs | 2 +- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/Caching/Impl/Factories/ModuleFactory.cs b/src/Caching/Impl/Factories/ModuleFactory.cs index d8465d6f1..6aa8faefd 100644 --- a/src/Caching/Impl/Factories/ModuleFactory.cs +++ b/src/Caching/Impl/Factories/ModuleFactory.cs @@ -94,10 +94,9 @@ private IMember GetMemberFromModule(IPythonModule module, IReadOnlyList var member = module?.GetMember(nameParts[index++]); for (; index < nameParts.Count; index++) { var memberName = nameParts[index]; - var typeArgs = GetTypeArguments(memberName, out var typeName); + var typeArgs = GetTypeArguments(memberName, out _); var mc = member as IMemberContainer; - Debug.Assert(mc != null); member = mc?.GetMember(memberName); diff --git a/src/Caching/Test/Files/Requests.json b/src/Caching/Test/Files/Requests.json index ce31023f0..43b63a16e 100644 --- a/src/Caching/Test/Files/Requests.json +++ b/src/Caching/Test/Files/Requests.json @@ -143,72 +143,72 @@ "Name": "packages" }, { - "Value": null, + "Value": "requests.models.Request", "Id": -104689032, "Name": "Request" }, { - "Value": null, + "Value": "requests.models.Response", "Id": 1102541176, "Name": "Response" }, { - "Value": null, + "Value": "requests.models.PreparedRequest", "Id": 1337118331, "Name": "PreparedRequest" }, { - "Value": null, + "Value": "request", "Id": -1769342312, "Name": "request" }, { - "Value": null, + "Value": "get", "Id": 787423, "Name": "get" }, { - "Value": null, + "Value": "head", "Id": 24439415, "Name": "head" }, { - "Value": null, + "Value": "post", "Id": 24687927, "Name": "post" }, { - "Value": null, + "Value": "patch", "Id": 764909201, "Name": "patch" }, { - "Value": null, + "Value": "put", "Id": 796568, "Name": "put" }, { - "Value": null, + "Value": "delete", "Id": 1897257090, "Name": "delete" }, { - "Value": null, + "Value": "options", "Id": 180457127, "Name": "options" }, { - "Value": null, + "Value": "session", "Id": -880047457, "Name": "session" }, { - "Value": null, + "Value": "requests.sessions.Session", "Id": 784605823, "Name": "Session" }, { - "Value": null, + "Value": "i:requests.structures.LookupDict", "Id": 753305199, "Name": "codes" }, diff --git a/src/LanguageServer/Impl/Implementation/Server.cs b/src/LanguageServer/Impl/Implementation/Server.cs index ea00a82c6..36ada3708 100644 --- a/src/LanguageServer/Impl/Implementation/Server.cs +++ b/src/LanguageServer/Impl/Implementation/Server.cs @@ -144,7 +144,7 @@ public async Task InitializeAsync(InitializeParams @params, Ca }; if (@params.initializationOptions.enableAnalysCache != false) { - _services.AddService(new ModuleDatabase(_services)); + //_services.AddService(new ModuleDatabase(_services)); } _interpreter = await PythonInterpreter.CreateAsync(configuration, _rootDir, _services, cancellationToken); diff --git a/src/LanguageServer/Impl/Program.cs b/src/LanguageServer/Impl/Program.cs index 24adfa924..024f9af18 100644 --- a/src/LanguageServer/Impl/Program.cs +++ b/src/LanguageServer/Impl/Program.cs @@ -13,7 +13,7 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. -#define WAIT_FOR_DEBUGGER +// #define WAIT_FOR_DEBUGGER using System; using System.Diagnostics; From ba8758151b41ee5ef716e1ec2a4d2e10a2279817 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Tue, 18 Jun 2019 15:39:50 -0700 Subject: [PATCH 78/82] Test fixes --- src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs | 8 ++++++-- src/Analysis/Ast/Impl/Extensions/PythonTypeExtensions.cs | 2 -- src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs | 1 - .../Ast/Impl/Types/Definitions/IPythonClassType.cs | 2 +- src/Analysis/Ast/Impl/Types/PythonPropertyType.cs | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs index 12929e458..5011e967c 100644 --- a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs +++ b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs @@ -245,7 +245,7 @@ private void MergeStub() { if (!IsStubBetterType(sourceType, stubType)) { continue;; } - if (sourceType == null || !sourceType.DeclaringModule.Equals(_stubAnalysis.Document)) { + if (sourceType == null || !sourceType.DeclaringModule.Equals(_stubAnalysis.Document.PrimaryModule)) { // Only handle members declared in this module. continue; } @@ -262,6 +262,10 @@ private void MergeStub() { var memberType = member?.GetPythonType(); var stubMemberType = stubMember.GetPythonType(); + + if (!Module.Equals(memberType?.DeclaringModule) || !_stubAnalysis.Document.Equals(stubMemberType.DeclaringModule)) { + continue; // Leave items that come from another module alone. + } if (!IsStubBetterType(memberType, stubMemberType)) { continue; } @@ -275,7 +279,7 @@ private void MergeStub() { // Re-declare variable with the data from the stub unless member is a module. // Modules members that are modules should remain as they are, i.e. os.path // should remain library with its own stub attached. - if (!(stubType is IPythonModule)) { + if (!(stubType is IPythonModule) && stubType.DeclaringModule.Equals(_stubAnalysis.Document)) { sourceType.TransferDocumentationAndLocation(stubType); // TODO: choose best type between the scrape and the stub. Stub probably should always win. var source = Eval.CurrentScope.Variables[v.Name]?.Source ?? VariableSource.Declaration; diff --git a/src/Analysis/Ast/Impl/Extensions/PythonTypeExtensions.cs b/src/Analysis/Ast/Impl/Extensions/PythonTypeExtensions.cs index 557cc9515..c53711004 100644 --- a/src/Analysis/Ast/Impl/Extensions/PythonTypeExtensions.cs +++ b/src/Analysis/Ast/Impl/Extensions/PythonTypeExtensions.cs @@ -38,8 +38,6 @@ public static void TransferDocumentationAndLocation(this IPythonType s, IPythonT var srcModule = src.Location.Module; var dstModule = dst.Location.Module; - Debug.Assert(srcModule.Equals(dstModule) || - (dstModule.ModuleType == Modules.ModuleType.Stub && dstModule.PrimaryModule.Equals(srcModule))); dst.Location = src.Location; } } diff --git a/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs b/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs index 267059894..2b6bd7634 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs @@ -19,7 +19,6 @@ using Microsoft.Python.Analysis.Types; using Microsoft.Python.Analysis.Values; using Microsoft.Python.Core; -using Microsoft.Python.Core.IO; namespace Microsoft.Python.Analysis.Modules { /// diff --git a/src/Analysis/Ast/Impl/Types/Definitions/IPythonClassType.cs b/src/Analysis/Ast/Impl/Types/Definitions/IPythonClassType.cs index 38fd776a5..852860bef 100644 --- a/src/Analysis/Ast/Impl/Types/Definitions/IPythonClassType.cs +++ b/src/Analysis/Ast/Impl/Types/Definitions/IPythonClassType.cs @@ -20,7 +20,7 @@ namespace Microsoft.Python.Analysis.Types { /// /// Represents Python class type definition. /// - public interface IPythonClassType : IPythonType, ILocatedMember { + public interface IPythonClassType : IPythonType { /// /// Class definition node in the AST. /// diff --git a/src/Analysis/Ast/Impl/Types/PythonPropertyType.cs b/src/Analysis/Ast/Impl/Types/PythonPropertyType.cs index 56913f45a..0eba0d916 100644 --- a/src/Analysis/Ast/Impl/Types/PythonPropertyType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonPropertyType.cs @@ -18,7 +18,7 @@ using Microsoft.Python.Parsing.Ast; namespace Microsoft.Python.Analysis.Types { - class PythonPropertyType : PythonType, IPythonPropertyType { + internal sealed class PythonPropertyType : PythonType, IPythonPropertyType { private IPythonFunctionOverload _getter; public PythonPropertyType(FunctionDefinition fd, Location location, IPythonType declaringType, bool isAbstract) From a7975936ac0c455f740ab14ad4828a6f2a588137 Mon Sep 17 00:00:00 2001 From: MikhailArkhipov Date: Tue, 18 Jun 2019 16:04:12 -0700 Subject: [PATCH 79/82] Test fix --- src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs index 5011e967c..c6216ebf3 100644 --- a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs +++ b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs @@ -245,10 +245,6 @@ private void MergeStub() { if (!IsStubBetterType(sourceType, stubType)) { continue;; } - if (sourceType == null || !sourceType.DeclaringModule.Equals(_stubAnalysis.Document.PrimaryModule)) { - // Only handle members declared in this module. - continue; - } // If types are the classes, merge members. // Otherwise, replace type from one from the stub. From db6c7fcb4e89f4c8d466cdfeafd4dbef0c16da09 Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Tue, 18 Jun 2019 19:38:43 -0700 Subject: [PATCH 80/82] Simplify a bit --- .../Ast/Impl/Analyzer/Handlers/ImportHandler.cs | 4 ++-- src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs | 8 +++++--- .../Ast/Impl/Extensions/PythonTypeExtensions.cs | 2 -- .../Ast/Impl/Modules/PythonVariableModule.cs | 17 ++++++++--------- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/Analysis/Ast/Impl/Analyzer/Handlers/ImportHandler.cs b/src/Analysis/Ast/Impl/Analyzer/Handlers/ImportHandler.cs index 64394f977..3562c7f12 100644 --- a/src/Analysis/Ast/Impl/Analyzer/Handlers/ImportHandler.cs +++ b/src/Analysis/Ast/Impl/Analyzer/Handlers/ImportHandler.cs @@ -174,7 +174,7 @@ private PythonVariableModule GetOrCreateVariableModule(in string fullName, in Py return variableModule; } - variableModule = new PythonVariableModule(fullName, Eval.Services); + variableModule = new PythonVariableModule(fullName, Eval.Interpreter); _variableModules[fullName] = variableModule; parentModule?.AddChildModule(memberName, variableModule); return variableModule; @@ -186,7 +186,7 @@ private PythonVariableModule GetOrCreateVariableModule(in IPythonModule module, return variableModule; } - variableModule = new PythonVariableModule(module, Eval.Services); + variableModule = new PythonVariableModule(module); _variableModules[moduleFullName] = variableModule; parentModule?.AddChildModule(memberName, variableModule); return variableModule; diff --git a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs index c6216ebf3..427845247 100644 --- a/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs +++ b/src/Analysis/Ast/Impl/Analyzer/ModuleWalker.cs @@ -228,6 +228,8 @@ private void MergeStub() { return; } + var builtins = Module.Interpreter.ModuleResolution.BuiltinsModule; + // Note that scrape can pick up more functions than the stub contains // Or the stub can have definitions that scraping had missed. Therefore // merge is the combination of the two with the documentation coming @@ -259,8 +261,8 @@ private void MergeStub() { var memberType = member?.GetPythonType(); var stubMemberType = stubMember.GetPythonType(); - if (!Module.Equals(memberType?.DeclaringModule) || !_stubAnalysis.Document.Equals(stubMemberType.DeclaringModule)) { - continue; // Leave items that come from another module alone. + if (builtins.Equals(memberType?.DeclaringModule) || builtins.Equals(stubMemberType.DeclaringModule)) { + continue; // Leave builtins alone. } if (!IsStubBetterType(memberType, stubMemberType)) { continue; @@ -275,7 +277,7 @@ private void MergeStub() { // Re-declare variable with the data from the stub unless member is a module. // Modules members that are modules should remain as they are, i.e. os.path // should remain library with its own stub attached. - if (!(stubType is IPythonModule) && stubType.DeclaringModule.Equals(_stubAnalysis.Document)) { + if (!(stubType is IPythonModule) && !builtins.Equals(stubType.DeclaringModule)) { sourceType.TransferDocumentationAndLocation(stubType); // TODO: choose best type between the scrape and the stub. Stub probably should always win. var source = Eval.CurrentScope.Variables[v.Name]?.Source ?? VariableSource.Declaration; diff --git a/src/Analysis/Ast/Impl/Extensions/PythonTypeExtensions.cs b/src/Analysis/Ast/Impl/Extensions/PythonTypeExtensions.cs index c53711004..4cc3d38a6 100644 --- a/src/Analysis/Ast/Impl/Extensions/PythonTypeExtensions.cs +++ b/src/Analysis/Ast/Impl/Extensions/PythonTypeExtensions.cs @@ -36,8 +36,6 @@ public static void TransferDocumentationAndLocation(this IPythonType s, IPythonT dst.SetDocumentation(documentation); } - var srcModule = src.Location.Module; - var dstModule = dst.Location.Module; dst.Location = src.Location; } } diff --git a/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs b/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs index 2b6bd7634..16d8a0c1f 100644 --- a/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs +++ b/src/Analysis/Ast/Impl/Modules/PythonVariableModule.cs @@ -49,17 +49,16 @@ internal sealed class PythonVariableModule : LocatedMember, IPythonModule, IEqua public Uri Uri => Module?.Uri; public override PythonMemberType MemberType => PythonMemberType.Module; - public PythonVariableModule(string name, IServiceContainer services) - : this(name, null, services) { } - - public PythonVariableModule(IPythonModule module, IServiceContainer services) - : this(module.Name, module, services) { } + public PythonVariableModule(string name, IPythonInterpreter interpreter) : base(null) { + Name = name; + Interpreter = interpreter; + SetDeclaringModule(this); + } - private PythonVariableModule(string name, IPythonModule module, IServiceContainer services) : base(module) { + public PythonVariableModule(IPythonModule module): base(module) { + Name = module.Name; + Interpreter = module.Interpreter; Module = module; - Name = module?.Name ?? name; - Interpreter = module?.Interpreter ?? services.GetService(); - SetDeclaringModule(this); } public void AddChildModule(string memberName, PythonVariableModule module) => _children[memberName] = module; From f73fed0f3ee3431c2f88b87787efbb1e0870a1ed Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Tue, 18 Jun 2019 20:44:48 -0700 Subject: [PATCH 81/82] Baselines and use : separator --- .../Extensions/PythonFunctionExtensions.cs | 2 +- .../Specializations/Typing/Types/AnyType.cs | 2 +- .../Typing/Types/GenericType.cs | 2 +- .../Typing/Values/TypingType.cs | 2 +- src/Analysis/Ast/Impl/Types/PythonType.cs | 2 +- .../Ast/Impl/Types/PythonUnionType.cs | 2 +- src/Caching/Impl/ModuleUniqueId.cs | 22 +- src/Caching/Impl/TypeNames.cs | 35 +- src/Caching/Test/BasicTests.cs | 61 +- src/Caching/Test/Files/NestedClasses.json | 14 +- src/Caching/Test/Files/Requests.json | 71 +- src/Caching/Test/Files/SmokeTest.json | 6 +- src/Caching/Test/Files/Sys.json | 813 +++++++++++++----- 13 files changed, 719 insertions(+), 315 deletions(-) diff --git a/src/Analysis/Ast/Impl/Extensions/PythonFunctionExtensions.cs b/src/Analysis/Ast/Impl/Extensions/PythonFunctionExtensions.cs index 0d8301240..4e8b4685e 100644 --- a/src/Analysis/Ast/Impl/Extensions/PythonFunctionExtensions.cs +++ b/src/Analysis/Ast/Impl/Extensions/PythonFunctionExtensions.cs @@ -42,7 +42,7 @@ public static string GetQualifiedName(this IPythonClassMember cm) { for (var p = cm.DeclaringType as IPythonClassMember; p != null; p = p.DeclaringType as IPythonClassMember) { s.Push(p.Name); } - return string.Join(".", s); + return $"{cm.DeclaringModule}:{string.Join(".", s)}"; } } diff --git a/src/Analysis/Ast/Impl/Specializations/Typing/Types/AnyType.cs b/src/Analysis/Ast/Impl/Specializations/Typing/Types/AnyType.cs index 1ded666cf..0dc11baa3 100644 --- a/src/Analysis/Ast/Impl/Specializations/Typing/Types/AnyType.cs +++ b/src/Analysis/Ast/Impl/Specializations/Typing/Types/AnyType.cs @@ -24,7 +24,7 @@ public AnyType(IPythonModule declaringModule) : base(declaringModule) { } public override PythonMemberType MemberType => PythonMemberType.Class; public string Name => "Any"; - public string QualifiedName => $"{DeclaringModule.QualifiedName}.{Name}"; + public string QualifiedName => $"{DeclaringModule.Name}:{Name}"; public BuiltinTypeId TypeId => BuiltinTypeId.Type; public string Documentation => Name; public bool IsBuiltin => false; diff --git a/src/Analysis/Ast/Impl/Specializations/Typing/Types/GenericType.cs b/src/Analysis/Ast/Impl/Specializations/Typing/Types/GenericType.cs index 61c71c24a..cae3191c1 100644 --- a/src/Analysis/Ast/Impl/Specializations/Typing/Types/GenericType.cs +++ b/src/Analysis/Ast/Impl/Specializations/Typing/Types/GenericType.cs @@ -80,7 +80,7 @@ public IPythonType CreateSpecificType(IReadOnlyList typeArguments) #region IPythonType public string Name { get; } - public string QualifiedName => $"{DeclaringModule.QualifiedName}.{Name}"; + public string QualifiedName => $"{DeclaringModule.Name}:{Name}"; public IMember GetMember(string name) => null; public IEnumerable GetMemberNames() => Enumerable.Empty(); public BuiltinTypeId TypeId { get; } = BuiltinTypeId.Unknown; diff --git a/src/Analysis/Ast/Impl/Specializations/Typing/Values/TypingType.cs b/src/Analysis/Ast/Impl/Specializations/Typing/Values/TypingType.cs index 480c1da54..251611453 100644 --- a/src/Analysis/Ast/Impl/Specializations/Typing/Values/TypingType.cs +++ b/src/Analysis/Ast/Impl/Specializations/Typing/Values/TypingType.cs @@ -28,7 +28,7 @@ internal sealed class TypingType : LocatedMember, IPythonType { public TypingType(IPythonModule declaringModule, IPythonType type): base(declaringModule) { _type = type ?? throw new ArgumentNullException(nameof(type)); Name = $"Type[{_type.Name}]"; - QualifiedName = $"{DeclaringModule.QualifiedName}.Type[{_type.QualifiedName}]"; + QualifiedName = $"{DeclaringModule.Name}:Type[{_type.QualifiedName}]"; } public override PythonMemberType MemberType => PythonMemberType.Class; diff --git a/src/Analysis/Ast/Impl/Types/PythonType.cs b/src/Analysis/Ast/Impl/Types/PythonType.cs index 5c0a6f6d8..3365a057f 100644 --- a/src/Analysis/Ast/Impl/Types/PythonType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonType.cs @@ -61,7 +61,7 @@ private PythonType(string name, Location location, BuiltinTypeId typeId) : base( public virtual string QualifiedName => DeclaringModule.ModuleType == ModuleType.Builtins ? TypeId == BuiltinTypeId.Ellipsis ? "ellipsis" : Name - : $"{DeclaringModule.Name}.{Name}"; + : $"{DeclaringModule.Name}:{Name}"; public virtual string Documentation { get; private set; } public virtual BuiltinTypeId TypeId => _typeId; diff --git a/src/Analysis/Ast/Impl/Types/PythonUnionType.cs b/src/Analysis/Ast/Impl/Types/PythonUnionType.cs index f4f53f11d..c6d05aaf3 100644 --- a/src/Analysis/Ast/Impl/Types/PythonUnionType.cs +++ b/src/Analysis/Ast/Impl/Types/PythonUnionType.cs @@ -48,7 +48,7 @@ public string Name { } public string QualifiedName { - get { lock (_lock) { return CodeFormatter.FormatSequence("typing.Union", '[', _types.Select(t => t.QualifiedName).ToArray()); } } + get { lock (_lock) { return CodeFormatter.FormatSequence("typing:Union", '[', _types.Select(t => t.QualifiedName).ToArray()); } } } public BuiltinTypeId TypeId => BuiltinTypeId.Type; diff --git a/src/Caching/Impl/ModuleUniqueId.cs b/src/Caching/Impl/ModuleUniqueId.cs index bcd6d85ce..ea1e584b3 100644 --- a/src/Caching/Impl/ModuleUniqueId.cs +++ b/src/Caching/Impl/ModuleUniqueId.cs @@ -33,25 +33,15 @@ public static string GetUniqieId(string moduleName, string filePath, ModuleType var stubCache = services.GetService(); var fs = services.GetService(); - var config = interpreter.Configuration; - var standardLibraryPath = PythonLibraryPath.GetStandardLibraryPath(config); - if (moduleType == ModuleType.User) { // Only for tests. return $"{moduleName}"; } - if (moduleType == ModuleType.Builtins || - moduleType == ModuleType.CompiledBuiltin || - moduleType == ModuleType.Compiled || - string.IsNullOrEmpty(filePath) || - fs.IsPathUnderRoot(stubCache.StubCacheFolder, filePath) || - fs.IsPathUnderRoot(standardLibraryPath, filePath)) { - // If module is a standard library, unique id is its name + interpreter version. - return $"{moduleName}({config.Version.Major}.{config.Version.Minor})"; - } - + var config = interpreter.Configuration; + var standardLibraryPath = PythonLibraryPath.GetStandardLibraryPath(config); var sitePackagesPath = PythonLibraryPath.GetSitePackagesPath(config); + if (!string.IsNullOrEmpty(filePath) && fs.IsPathUnderRoot(sitePackagesPath, filePath)) { // If module is in site-packages and is versioned, then unique id = name + version + interpreter version. // Example: 'requests' and 'requests-2.21.0.dist-info'. @@ -71,6 +61,12 @@ public static string GetUniqieId(string moduleName, string filePath, ModuleType } } + if (moduleType == ModuleType.Builtins || moduleType == ModuleType.CompiledBuiltin || + string.IsNullOrEmpty(filePath) || fs.IsPathUnderRoot(standardLibraryPath, filePath)) { + // If module is a standard library, unique id is its name + interpreter version. + return $"{moduleName}({config.Version.Major}.{config.Version.Minor})"; + } + // If all else fails, hash module data. return $"{moduleName}.{HashModuleContent(Path.GetDirectoryName(filePath), fs)}"; } diff --git a/src/Caching/Impl/TypeNames.cs b/src/Caching/Impl/TypeNames.cs index ab2dd1c8c..b88354272 100644 --- a/src/Caching/Impl/TypeNames.cs +++ b/src/Caching/Impl/TypeNames.cs @@ -41,35 +41,40 @@ public static string GetQualifiedName(this IMember m) { /// Splits qualified type name in form of i:A(3.6).B.C into parts. as well as determines if /// qualified name designates instance (prefixed with 'i:'). /// - /// Raw qualified name to split. May include instance prefix. - /// Qualified name without optional instance prefix, such as A.B.C - /// Name parts such as 'A', 'B', 'C' from A.B.C. + /// Qualified name to split. May include instance prefix. + /// Module name. + /// Module member names such as 'A', 'B', 'C' from module:A.B.C. /// If true, the qualified name describes instance of a type. - public static bool DeconstructQualifiedName(string rawQualifiedName, out string typeQualifiedName, out IReadOnlyList nameParts, out bool isInstance) { - typeQualifiedName = null; - nameParts = null; + public static bool DeconstructQualifiedName(string qualifiedName, out string moduleName, out IReadOnlyList memberNames, out bool isInstance) { + moduleName = null; + memberNames = null; isInstance = false; - if (string.IsNullOrEmpty(rawQualifiedName)) { + if (string.IsNullOrEmpty(qualifiedName)) { return false; } - isInstance = rawQualifiedName.StartsWith("i:"); - typeQualifiedName = isInstance ? rawQualifiedName.Substring(2) : rawQualifiedName; + isInstance = qualifiedName.StartsWith("i:"); + qualifiedName = isInstance ? qualifiedName.Substring(2) : qualifiedName; - if (typeQualifiedName == "..." || typeQualifiedName == "ellipsis") { - nameParts = new[] { @"builtins", "ellipsis" }; + if (qualifiedName == "..." || qualifiedName == "ellipsis") { + moduleName = @"builtins"; + memberNames = new[] { "ellipsis" }; return true; } - if (rawQualifiedName.IndexOf('.') < 0) { - nameParts = new[] { @"builtins", typeQualifiedName }; + + var moduleSeparatorIndex = qualifiedName.IndexOf(':'); + if (moduleSeparatorIndex < 0) { + moduleName = @"builtins"; + memberNames = new[] { qualifiedName }; return true; } + moduleName = qualifiedName.Substring(0, moduleSeparatorIndex); // First chunk is qualified module name except dots in braces. // Builtin types don't have module prefix. - nameParts = GetParts(typeQualifiedName); - return nameParts.Count > 0; + memberNames = GetParts(qualifiedName.Substring(moduleSeparatorIndex+1)); + return !string.IsNullOrEmpty(moduleName); } private static IReadOnlyList GetParts(string qualifiedTypeName) { diff --git a/src/Caching/Test/BasicTests.cs b/src/Caching/Test/BasicTests.cs index 694e0ccfa..277b60814 100644 --- a/src/Caching/Test/BasicTests.cs +++ b/src/Caching/Test/BasicTests.cs @@ -13,6 +13,7 @@ // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. +using System; using System.IO; using System.Threading.Tasks; using FluentAssertions; @@ -104,10 +105,10 @@ public async Task Builtins() { var analysis = await GetAnalysisAsync(string.Empty); var builtins = analysis.Document.Interpreter.ModuleResolution.BuiltinsModule; var model = ModuleModel.FromAnalysis(builtins.Analysis, Services); - + var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); - + var dbModule = new PythonDbModule(model, null, Services); dbModule.Should().HaveSameMembersAs(builtins); } @@ -127,24 +128,6 @@ public async Task Sys() { } } - [TestMethod, Priority(0)] - public async Task VersionedModule() { - const string code = @" -import requests -x = requests.get('microsoft.com') -"; - var analysis = await GetAnalysisAsync(code, PythonVersions.LatestAvailable3X); - var v = analysis.GlobalScope.Variables["requests"]; - v.Should().NotBeNull(); - if (v.Value.GetPythonType().ModuleType == ModuleType.Unresolved) { - Assert.Inconclusive("'requests' package is not installed."); - } - - var model = ModuleModel.FromAnalysis(analysis, Services); - var json = ToJson(model); - Baseline.CompareToFile(BaselineFileName, json); - } - [TestMethod, Priority(0)] public async Task Requests() { const string code = @" @@ -160,6 +143,13 @@ import requests var rq = analysis.Document.Interpreter.ModuleResolution.GetImportedModule("requests"); var model = ModuleModel.FromAnalysis(rq.Analysis, Services); + + var u = model.UniqueId; + u.Should().Contain("(").And.EndWith(")"); + var open = u.IndexOf('('); + // Verify this looks like a version. + new Version(u.Substring(open + 1, u.IndexOf(')') - open - 1)); + var json = ToJson(model); Baseline.CompareToFile(BaselineFileName, json); @@ -169,24 +159,23 @@ import requests } [DataTestMethod, Priority(0)] - [DataRow("", null, null, null, false)] - [DataRow("str", "builtins", "builtins", "str", false)] - [DataRow("i:str", "builtins", "builtins", "str", true)] - [DataRow("i:...", "builtins", "builtins", "ellipsis", true)] - [DataRow("ellipsis", "builtins", "builtins", "ellipsis", false)] - [DataRow("i:builtins.str", "builtins", "builtins", "str", true)] - [DataRow("i:mod.x", "mod", "mod", "x", true)] - [DataRow("typing.Union[str, tuple]", "typing", "typing", "Union[str, tuple]", false)] - [DataRow("typing.Union[typing.Any, mod.y]", "typing", "typing", "Union[typing.Any, mod.y]", false)] - [DataRow("typing.Union[typing.Union[str, int], mod.y]", "typing", "typing", "Union[typing.Union[str, int], mod.y]", false)] - public void QualifiedNames(string rawQualifiedName, string qualifiedName, string moduleName, string typeName, bool isInstance) { - TypeNames.DeconstructQualifiedName(rawQualifiedName, out var actualQualifiedName, out var nameParts, out var actualIsInstance); - qualifiedName.Should().Be(qualifiedName); + [DataRow("", null, null, false)] + [DataRow("str", "builtins", "str", false)] + [DataRow("i:str", "builtins", "str", true)] + [DataRow("i:...", "builtins", "ellipsis", true)] + [DataRow("ellipsis", "builtins", "ellipsis", false)] + [DataRow("i:builtins:str", "builtins", "str", true)] + [DataRow("i:mod:x", "mod", "x", true)] + [DataRow("typing:Union[str, tuple]", "typing", "Union[str, tuple]", false)] + [DataRow("typing:Union[typing:Any, mod:y]", "typing", "Union[typing:Any, mod:y]", false)] + [DataRow("typing:Union[typing:Union[str, int], mod:y]", "typing", "Union[typing:Union[str, int], mod:y]", false)] + public void QualifiedNames(string qualifiedName, string moduleName, string typeName, bool isInstance) { + TypeNames.DeconstructQualifiedName(qualifiedName, out var actualModuleName, out var actualMemberNames, out var actualIsInstance); + actualModuleName.Should().Be(moduleName); if (string.IsNullOrEmpty(qualifiedName)) { - nameParts.Should().BeNull(); + actualMemberNames.Should().BeNull(); } else { - nameParts[0].Should().Be(moduleName); - nameParts[1].Should().Be(typeName); + actualMemberNames[0].Should().Be(typeName); } actualIsInstance.Should().Be(isInstance); } diff --git a/src/Caching/Test/Files/NestedClasses.json b/src/Caching/Test/Files/NestedClasses.json index 47007f715..51771c683 100644 --- a/src/Caching/Test/Files/NestedClasses.json +++ b/src/Caching/Test/Files/NestedClasses.json @@ -44,7 +44,7 @@ "Name": "x" }, { - "Value": "i:module.C", + "Value": "i:module:C", "Id": 812, "Name": "c" } @@ -63,7 +63,7 @@ "Parameters": [ { "Name": "self", - "Type": "module.A", + "Type": "module:A", "DefaultValue": null, "Kind": 0 } @@ -109,12 +109,12 @@ "Parameters": [ { "Name": "self", - "Type": "module.B", + "Type": "module:B", "DefaultValue": null, "Kind": 0 } ], - "ReturnType": "i:module.C" + "ReturnType": "i:module:C" } ], "Attributes": 0, @@ -130,7 +130,7 @@ "Parameters": [ { "Name": "self", - "Type": "module.B", + "Type": "module:B", "DefaultValue": null, "Kind": 0 } @@ -178,7 +178,7 @@ "Parameters": [ { "Name": "self", - "Type": "module.C", + "Type": "module:C", "DefaultValue": null, "Kind": 0 } @@ -199,7 +199,7 @@ "Parameters": [ { "Name": "self", - "Type": "module.C", + "Type": "module:C", "DefaultValue": null, "Kind": 0 } diff --git a/src/Caching/Test/Files/Requests.json b/src/Caching/Test/Files/Requests.json index 43b63a16e..ab5e67df4 100644 --- a/src/Caching/Test/Files/Requests.json +++ b/src/Caching/Test/Files/Requests.json @@ -1,5 +1,5 @@ { - "UniqueId": "requests(3.7)", + "UniqueId": "requests(2.21.0)", "Documentation": "Requests HTTP Library\r\n~~~~~~~~~~~~~~~~~~~~~\r\n\r\nRequests is an HTTP library, written in Python, for human beings. Basic GET\r\nusage:\r\n\r\n >>> import requests\r\n >>> r = requests.get('https://www.python.org')\r\n >>> r.status_code\r\n 200\r\n >>> 'Python is a programming language' in r.content\r\n True\r\n\r\n... or POST:\r\n\r\n >>> payload = dict(key1='value1', key2='value2')\r\n >>> r = requests.post('https://httpbin.org/post', data=payload)\r\n >>> print(r.text)\r\n {\r\n ...\r\n \"form\": {\r\n \"key2\": \"value2\",\r\n \"key1\": \"value1\"\r\n },\r\n ...\r\n }\r\n\r\nThe other HTTP methods are supported - see `requests.api`. Full documentation\r\nis at .\r\n\r\n:copyright: (c) 2017 by Kenneth Reitz.\r\n:license: Apache 2.0, see LICENSE for more details.\r\n", "Functions": [ { @@ -68,7 +68,7 @@ "Name": "warnings" }, { - "Value": null, + "Value": "requests.exceptions:RequestsDependencyWarning", "Id": -802098666, "Name": "RequestsDependencyWarning" }, @@ -78,12 +78,12 @@ "Name": "pyopenssl" }, { - "Value": null, + "Value": "urllib3.exceptions:DependencyWarning", "Id": -891041158, "Name": "DependencyWarning" }, { - "Value": null, + "Value": "i:typing:Any", "Id": 916650529, "Name": "__title__" }, @@ -98,12 +98,12 @@ "Name": "__url__" }, { - "Value": null, + "Value": "i:typing:Any", "Id": 1161199201, "Name": "__version__" }, { - "Value": null, + "Value": "i:typing:Any", "Id": -1840123721, "Name": "__build__" }, @@ -118,12 +118,12 @@ "Name": "__author_email__" }, { - "Value": null, + "Value": "i:typing:Any", "Id": -386551926, "Name": "__license__" }, { - "Value": null, + "Value": "i:typing:Any", "Id": 1739624272, "Name": "__copyright__" }, @@ -143,117 +143,117 @@ "Name": "packages" }, { - "Value": "requests.models.Request", + "Value": "requests.models:Request", "Id": -104689032, "Name": "Request" }, { - "Value": "requests.models.Response", + "Value": "requests.models:Response", "Id": 1102541176, "Name": "Response" }, { - "Value": "requests.models.PreparedRequest", + "Value": "requests.models:PreparedRequest", "Id": 1337118331, "Name": "PreparedRequest" }, { - "Value": "request", + "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:request", "Id": -1769342312, "Name": "request" }, { - "Value": "get", + "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:get", "Id": 787423, "Name": "get" }, { - "Value": "head", + "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:head", "Id": 24439415, "Name": "head" }, { - "Value": "post", + "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:post", "Id": 24687927, "Name": "post" }, { - "Value": "patch", + "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:patch", "Id": 764909201, "Name": "patch" }, { - "Value": "put", + "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:put", "Id": 796568, "Name": "put" }, { - "Value": "delete", + "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:delete", "Id": 1897257090, "Name": "delete" }, { - "Value": "options", + "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:options", "Id": 180457127, "Name": "options" }, { - "Value": "session", + "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:session", "Id": -880047457, "Name": "session" }, { - "Value": "requests.sessions.Session", + "Value": "requests.sessions:Session", "Id": 784605823, "Name": "Session" }, { - "Value": "i:requests.structures.LookupDict", + "Value": "i:typing:Any", "Id": 753305199, "Name": "codes" }, { - "Value": null, + "Value": "requests.exceptions:RequestException", "Id": 355509431, "Name": "RequestException" }, { - "Value": null, + "Value": "requests.exceptions:Timeout", "Id": 1780673866, "Name": "Timeout" }, { - "Value": null, + "Value": "requests.exceptions:URLRequired", "Id": 1361573271, "Name": "URLRequired" }, { - "Value": null, + "Value": "requests.exceptions:TooManyRedirects", "Id": 511002043, "Name": "TooManyRedirects" }, { - "Value": null, + "Value": "requests.exceptions:HTTPError", "Id": -1546903511, "Name": "HTTPError" }, { - "Value": null, + "Value": "requests.exceptions:ConnectionError", "Id": 853386419, "Name": "ConnectionError" }, { - "Value": null, + "Value": "requests.exceptions:FileModeWarning", "Id": 1675678790, "Name": "FileModeWarning" }, { - "Value": null, + "Value": "requests.exceptions:ConnectTimeout", "Id": -1047738098, "Name": "ConnectTimeout" }, { - "Value": null, + "Value": "requests.exceptions:ReadTimeout", "Id": -1711523244, "Name": "ReadTimeout" }, @@ -263,12 +263,17 @@ "Name": "logging" }, { - "Value": null, + "Value": "logging:NullHandler", "Id": -1600735444, "Name": "NullHandler" + }, + { + "Value": "typing:Any", + "Id": 751189, + "Name": "Any" } ], "Classes": [], - "Id": -790460774, + "Id": -203071489, "Name": "requests" } \ No newline at end of file diff --git a/src/Caching/Test/Files/SmokeTest.json b/src/Caching/Test/Files/SmokeTest.json index 22deb28a6..eb1096502 100644 --- a/src/Caching/Test/Files/SmokeTest.json +++ b/src/Caching/Test/Files/SmokeTest.json @@ -59,7 +59,7 @@ "Name": "x" }, { - "Value": "i:module.C", + "Value": "i:module:C", "Id": 812, "Name": "c" } @@ -78,7 +78,7 @@ "Parameters": [ { "Name": "self", - "Type": "module.C", + "Type": "module:C", "DefaultValue": null, "Kind": 0 } @@ -99,7 +99,7 @@ "Parameters": [ { "Name": "self", - "Type": "module.C", + "Type": "module:C", "DefaultValue": null, "Kind": 0 } diff --git a/src/Caching/Test/Files/Sys.json b/src/Caching/Test/Files/Sys.json index f9ac44526..b4affbe79 100644 --- a/src/Caching/Test/Files/Sys.json +++ b/src/Caching/Test/Files/Sys.json @@ -117,6 +117,10 @@ { "Documentation": "_getframe([depth]) -> frameobject\n\nReturn a frame object from the call stack. If optional integer depth is\ngiven, return the frame object that many calls below the top of the stack.\nIf that is deeper than the call stack, ValueError is raised. The default\nfor depth is zero, returning the frame at the top of the call stack.\n\nThis function should be used for internal and specialized\npurposes only.", "Overloads": [ + { + "Parameters": [], + "ReturnType": "i:types:FrameType" + }, { "Parameters": [ { @@ -126,7 +130,7 @@ "Kind": 0 } ], - "ReturnType": "i:types.FrameType" + "ReturnType": "i:types:FrameType" } ], "Attributes": 0, @@ -175,12 +179,12 @@ }, { "Name": "args", - "Type": "typing.Any", + "Type": "typing:Any", "DefaultValue": null, "Kind": 0 } ], - "ReturnType": "i:typing._T" + "ReturnType": "i:typing:_T" } ], "Attributes": 0, @@ -245,7 +249,7 @@ "Parameters": [ { "Name": "type_", - "Type": "typing.Type[BaseException]", + "Type": "typing:Type[BaseException]", "DefaultValue": null, "Kind": 0 }, @@ -257,7 +261,7 @@ }, { "Name": "traceback", - "Type": "types.TracebackType", + "Type": "types:TracebackType", "DefaultValue": null, "Kind": 0 } @@ -439,7 +443,7 @@ "Parameters": [ { "Name": "arg", - "Type": "typing.Any", + "Type": "typing:Any", "DefaultValue": null, "Kind": 0 } @@ -456,6 +460,17 @@ { "Documentation": "getsizeof(object, default) -> int\n\nReturn the size of object in bytes.", "Overloads": [ + { + "Parameters": [ + { + "Name": "obj", + "Type": "object", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:int" + }, { "Parameters": [ { @@ -513,7 +528,7 @@ "Overloads": [ { "Parameters": [], - "ReturnType": "i:sys._WinVersion" + "ReturnType": "i:sys:_WinVersion" } ], "Attributes": 0, @@ -770,17 +785,17 @@ "Name": "__package__" }, { - "Value": "i:_io.TextIOWrapper", + "Value": "i:_io:TextIOWrapper", "Id": 1612032761, "Name": "__stderr__" }, { - "Value": "i:_io.TextIOWrapper", + "Value": "i:_io:TextIOWrapper", "Id": 329210449, "Name": "__stdin__" }, { - "Value": "i:_io.TextIOWrapper", + "Value": "i:_io:TextIOWrapper", "Id": 1621359266, "Name": "__stdout__" }, @@ -825,7 +840,7 @@ "Name": "base_prefix" }, { - "Value": "i:tuple", + "Value": "i:list", "Id": 1963179240, "Name": "builtin_module_names" }, @@ -870,7 +885,7 @@ "Name": "hexversion" }, { - "Value": null, + "Value": "i:_implementation", "Id": 1997289353, "Name": "implementation" }, @@ -920,17 +935,17 @@ "Name": "prefix" }, { - "Value": "i:_io.TextIOWrapper", + "Value": "i:_io:TextIOWrapper", "Id": -1954658503, "Name": "stderr" }, { - "Value": "i:_io.TextIOWrapper", + "Value": "i:_io:TextIOWrapper", "Id": 768230609, "Name": "stdin" }, { - "Value": "i:_io.TextIOWrapper", + "Value": "i:_io:TextIOWrapper", "Id": -1954648798, "Name": "stdout" }, @@ -950,29 +965,134 @@ "Name": "winver" }, { - "Value": "i:sys.__float_info", + "Value": "i:sys:__float_info", "Id": 602612744, "Name": "float_info" }, { - "Value": "i:sys.__hash_info", + "Value": "i:sys:__hash_info", "Id": 84475656, "Name": "hash_info" }, { - "Value": "i:sys.__int_info", + "Value": "i:sys:__int_info", "Id": 1942821909, "Name": "int_info" }, { - "Value": "i:sys.__thread_info", + "Value": "i:sys:__thread_info", "Id": 604643660, "Name": "thread_info" }, { - "Value": "i:sys.__version_info", + "Value": "i:sys:__version_info", "Id": 1738857804, "Name": "version_info" + }, + { + "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:getdlopenflags", + "Id": 503242166, + "Name": "getdlopenflags" + }, + { + "Value": "sys:_WinVersion", + "Id": -506845532, + "Name": "_WinVersion" + }, + { + "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:setdlopenflags", + "Id": -1268494038, + "Name": "setdlopenflags" + }, + { + "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:settscdump", + "Id": 1891924589, + "Name": "settscdump" + }, + { + "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:gettotalrefcount", + "Id": -1618095583, + "Name": "gettotalrefcount" + }, + { + "Value": "typing:List", + "Id": 23609685, + "Name": "List" + }, + { + "Value": "typing:Sequence", + "Id": -1502554888, + "Name": "Sequence" + }, + { + "Value": "typing:Any", + "Id": 751189, + "Name": "Any" + }, + { + "Value": "typing:Dict", + "Id": 23370861, + "Name": "Dict" + }, + { + "Value": "typing:Tuple", + "Id": 739642865, + "Name": "Tuple" + }, + { + "Value": "typing:Optional", + "Id": 1363847319, + "Name": "Optional" + }, + { + "Value": "typing:Union", + "Id": 740351224, + "Name": "Union" + }, + { + "Value": "Microsoft.Python.Analysis.Specializations.Typing.TypingModule:TypeVar", + "Id": -2053481098, + "Name": "TypeVar" + }, + { + "Value": "typing:Type", + "Id": 23863281, + "Name": "Type" + }, + { + "Value": "types:FrameType", + "Id": -1970702352, + "Name": "FrameType" + }, + { + "Value": "_importlib_modulespec:ModuleType", + "Id": -1551859907, + "Name": "ModuleType" + }, + { + "Value": "types:TracebackType", + "Id": -612342225, + "Name": "TracebackType" + }, + { + "Value": "importlib.abc:MetaPathFinder", + "Id": -1792761721, + "Name": "MetaPathFinder" + }, + { + "Value": "typing:_T", + "Id": 25132, + "Name": "_T" + }, + { + "Value": "i:types:TracebackType", + "Id": 2060329242, + "Name": "last_traceback" + }, + { + "Value": "i:tuple", + "Id": -1174870545, + "Name": "subversion" } ], "Classes": [ @@ -1505,7 +1625,7 @@ "Kind": 0 } ], - "ReturnType": "i:typing.Union[str, tuple]" + "ReturnType": "i:typing:Union[str, tuple]" } ], "Attributes": 0, @@ -1532,7 +1652,7 @@ "Kind": 0 } ], - "ReturnType": "i:typing.Union[str, tuple]" + "ReturnType": "i:typing:Union[str, tuple]" } ], "Attributes": 0, @@ -1880,7 +2000,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1907,7 +2027,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1934,7 +2054,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1961,7 +2081,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -1988,7 +2108,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2015,7 +2135,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2048,7 +2168,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2075,7 +2195,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2102,7 +2222,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2129,7 +2249,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2156,7 +2276,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2183,7 +2303,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 } @@ -2204,7 +2324,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2237,7 +2357,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 } @@ -2258,7 +2378,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 } @@ -2279,7 +2399,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2306,7 +2426,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 } @@ -2327,7 +2447,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2354,7 +2474,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2381,7 +2501,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2408,12 +2528,12 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 } ], - "ReturnType": "i:typing.Union[str, tuple]" + "ReturnType": "i:typing:Union[str, tuple]" } ], "Attributes": 0, @@ -2429,7 +2549,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2446,7 +2566,7 @@ "Kind": 0 } ], - "ReturnType": "i:typing.Union[str, tuple]" + "ReturnType": "i:typing:Union[str, tuple]" } ], "Attributes": 0, @@ -2462,7 +2582,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 } @@ -2483,7 +2603,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2510,7 +2630,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2543,7 +2663,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2570,7 +2690,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 } @@ -2591,7 +2711,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2618,7 +2738,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2651,7 +2771,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__float_info", + "Type": "sys:__float_info", "DefaultValue": null, "Kind": 0 }, @@ -2792,7 +2912,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2819,7 +2939,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2846,7 +2966,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2873,7 +2993,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2900,7 +3020,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2927,7 +3047,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2960,7 +3080,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -2987,7 +3107,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3014,7 +3134,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3041,7 +3161,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3068,7 +3188,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3095,7 +3215,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 } @@ -3116,7 +3236,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3149,7 +3269,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 } @@ -3170,7 +3290,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 } @@ -3191,7 +3311,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3218,7 +3338,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 } @@ -3239,7 +3359,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3266,7 +3386,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3293,7 +3413,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3320,12 +3440,12 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 } ], - "ReturnType": "i:typing.Union[str, tuple]" + "ReturnType": "i:typing:Union[str, tuple]" } ], "Attributes": 0, @@ -3341,7 +3461,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3358,7 +3478,7 @@ "Kind": 0 } ], - "ReturnType": "i:typing.Union[str, tuple]" + "ReturnType": "i:typing:Union[str, tuple]" } ], "Attributes": 0, @@ -3374,7 +3494,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 } @@ -3395,7 +3515,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3422,7 +3542,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3455,7 +3575,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3482,7 +3602,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 } @@ -3503,7 +3623,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3530,7 +3650,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3563,7 +3683,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__hash_info", + "Type": "sys:__hash_info", "DefaultValue": null, "Kind": 0 }, @@ -3694,7 +3814,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3721,7 +3841,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3748,7 +3868,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3775,7 +3895,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3802,7 +3922,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3829,7 +3949,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3862,7 +3982,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3889,7 +4009,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3916,7 +4036,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3943,7 +4063,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3970,7 +4090,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -3997,7 +4117,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 } @@ -4018,7 +4138,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4051,7 +4171,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 } @@ -4072,7 +4192,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 } @@ -4093,7 +4213,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4120,7 +4240,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 } @@ -4141,7 +4261,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4168,7 +4288,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4195,7 +4315,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4222,12 +4342,12 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 } ], - "ReturnType": "i:typing.Union[str, tuple]" + "ReturnType": "i:typing:Union[str, tuple]" } ], "Attributes": 0, @@ -4243,7 +4363,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4260,7 +4380,7 @@ "Kind": 0 } ], - "ReturnType": "i:typing.Union[str, tuple]" + "ReturnType": "i:typing:Union[str, tuple]" } ], "Attributes": 0, @@ -4276,7 +4396,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 } @@ -4297,7 +4417,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4324,7 +4444,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4357,7 +4477,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4384,7 +4504,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 } @@ -4405,7 +4525,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4432,7 +4552,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4465,7 +4585,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__int_info", + "Type": "sys:__int_info", "DefaultValue": null, "Kind": 0 }, @@ -4561,7 +4681,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4588,7 +4708,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4615,7 +4735,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4642,7 +4762,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4669,7 +4789,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4696,7 +4816,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4729,7 +4849,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4756,7 +4876,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4783,7 +4903,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4810,7 +4930,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4837,7 +4957,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4864,7 +4984,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 } @@ -4885,7 +5005,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4918,7 +5038,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 } @@ -4939,7 +5059,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 } @@ -4960,7 +5080,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -4987,7 +5107,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 } @@ -5008,7 +5128,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -5035,7 +5155,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -5062,7 +5182,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -5089,12 +5209,12 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 } ], - "ReturnType": "i:typing.Union[str, tuple]" + "ReturnType": "i:typing:Union[str, tuple]" } ], "Attributes": 0, @@ -5110,7 +5230,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -5127,7 +5247,7 @@ "Kind": 0 } ], - "ReturnType": "i:typing.Union[str, tuple]" + "ReturnType": "i:typing:Union[str, tuple]" } ], "Attributes": 0, @@ -5143,7 +5263,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 } @@ -5164,7 +5284,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -5191,7 +5311,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -5224,7 +5344,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -5251,7 +5371,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 } @@ -5272,7 +5392,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -5299,7 +5419,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -5332,7 +5452,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__thread_info", + "Type": "sys:__thread_info", "DefaultValue": null, "Kind": 0 }, @@ -5433,7 +5553,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5460,7 +5580,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5487,7 +5607,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5514,7 +5634,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5541,7 +5661,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5568,7 +5688,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5601,7 +5721,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5628,7 +5748,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5655,7 +5775,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5682,7 +5802,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5709,7 +5829,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5736,7 +5856,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 } @@ -5757,7 +5877,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5790,7 +5910,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 } @@ -5804,27 +5924,6 @@ "Id": 1040523408, "Name": "__init_subclass__" }, - { - "Documentation": "Implement iter(self).", - "Overloads": [ - { - "Parameters": [ - { - "Name": "self", - "Type": "sys.__version_info", - "DefaultValue": null, - "Kind": 0 - } - ], - "ReturnType": null - } - ], - "Attributes": 0, - "Classes": null, - "Functions": null, - "Id": 971292143, - "Name": "__iter__" - }, { "Documentation": "Return self<=value.", "Overloads": [ @@ -5832,7 +5931,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5859,7 +5958,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 } @@ -5880,7 +5979,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5907,7 +6006,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5934,7 +6033,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5961,12 +6060,12 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 } ], - "ReturnType": "i:typing.Union[str, tuple]" + "ReturnType": "i:typing:Union[str, tuple]" } ], "Attributes": 0, @@ -5982,7 +6081,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -5999,7 +6098,7 @@ "Kind": 0 } ], - "ReturnType": "i:typing.Union[str, tuple]" + "ReturnType": "i:typing:Union[str, tuple]" } ], "Attributes": 0, @@ -6015,7 +6114,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 } @@ -6036,7 +6135,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -6063,7 +6162,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -6096,7 +6195,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -6123,7 +6222,7 @@ "Parameters": [ { "Name": "self", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 } @@ -6144,7 +6243,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -6171,7 +6270,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -6204,7 +6303,7 @@ "Parameters": [ { "Name": "cls", - "Type": "sys.__version_info", + "Type": "sys:__version_info", "DefaultValue": null, "Kind": 0 }, @@ -6245,6 +6344,11 @@ ], "Properties": [], "Fields": [ + { + "Value": "tuple_iterator", + "Id": 971292143, + "Name": "__iter__" + }, { "Value": "i:int", "Id": 762129410, @@ -6300,6 +6404,311 @@ "InnerClasses": [], "Id": 1619201900, "Name": "__version_info" + }, + { + "Documentation": "sys.flags\n\nFlags provided through command line arguments or environment vars.", + "Bases": [ + "object" + ], + "Methods": [], + "Properties": [], + "Fields": [ + { + "Value": "i:int", + "Id": 753929372, + "Name": "debug" + }, + { + "Value": "i:int", + "Id": 514096161, + "Name": "division_warning" + }, + { + "Value": "i:int", + "Id": -907580899, + "Name": "inspect" + }, + { + "Value": "i:int", + "Id": 518040171, + "Name": "interactive" + }, + { + "Value": "i:int", + "Id": 1299139572, + "Name": "optimize" + }, + { + "Value": "i:int", + "Id": 1675585612, + "Name": "dont_write_bytecode" + }, + { + "Value": "i:int", + "Id": 113341396, + "Name": "no_user_site" + }, + { + "Value": "i:int", + "Id": -754777330, + "Name": "no_site" + }, + { + "Value": "i:int", + "Id": -175101059, + "Name": "ignore_environment" + }, + { + "Value": "i:int", + "Id": 1781039499, + "Name": "verbose" + }, + { + "Value": "i:int", + "Id": 2130352401, + "Name": "bytes_warning" + }, + { + "Value": "i:int", + "Id": 766418045, + "Name": "quiet" + }, + { + "Value": "i:int", + "Id": 557578535, + "Name": "hash_randomization" + }, + { + "Value": "dict", + "Id": 817929997, + "Name": "__dict__" + }, + { + "Value": "object", + "Id": 1225024228, + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Id": 1755030623, + "Name": "_flags" + }, + { + "Documentation": "sys.float_info\n\nA structseq holding information about the float type. It contains low level\ninformation about the precision and internal representation. Please study\nyour system's :file:`float.h` for more information.", + "Bases": [ + "object" + ], + "Methods": [], + "Properties": [], + "Fields": [ + { + "Value": "i:float", + "Id": -105571469, + "Name": "epsilon" + }, + { + "Value": "i:int", + "Id": 784651, + "Name": "dig" + }, + { + "Value": "i:int", + "Id": 1518794292, + "Name": "mant_dig" + }, + { + "Value": "i:float", + "Id": 793069, + "Name": "max" + }, + { + "Value": "i:int", + "Id": -2020600629, + "Name": "max_exp" + }, + { + "Value": "i:int", + "Id": 992667279, + "Name": "max_10_exp" + }, + { + "Value": "i:float", + "Id": 793307, + "Name": "min" + }, + { + "Value": "i:int", + "Id": -1800802631, + "Name": "min_exp" + }, + { + "Value": "i:int", + "Id": -830300703, + "Name": "min_10_exp" + }, + { + "Value": "i:int", + "Id": 766741069, + "Name": "radix" + }, + { + "Value": "i:int", + "Id": -1987390596, + "Name": "rounds" + }, + { + "Value": "dict", + "Id": 817929997, + "Name": "__dict__" + }, + { + "Value": "object", + "Id": 1225024228, + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Id": -1254930983, + "Name": "_float_info" + }, + { + "Documentation": "hash_info\n\nA struct sequence providing parameters used for computing\nhashes. The attributes are read only.", + "Bases": [ + "object" + ], + "Methods": [], + "Properties": [], + "Fields": [ + { + "Value": "i:int", + "Id": 771597327, + "Name": "width" + }, + { + "Value": "i:int", + "Id": -1637600896, + "Name": "modulus" + }, + { + "Value": "i:int", + "Id": 789610, + "Name": "inf" + }, + { + "Value": "i:int", + "Id": 794020, + "Name": "nan" + }, + { + "Value": "i:int", + "Id": 24476897, + "Name": "imag" + }, + { + "Value": "dict", + "Id": 817929997, + "Name": "__dict__" + }, + { + "Value": "object", + "Id": 1225024228, + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Id": 440196887, + "Name": "_hash_info" + }, + { + "Documentation": "sys.int_info\n\nA struct sequence that holds information about Python's\ninternal representation of integers. The attributes are read only.", + "Bases": [ + "object" + ], + "Methods": [], + "Properties": [], + "Fields": [ + { + "Value": "i:int", + "Id": 1945378665, + "Name": "bits_per_digit" + }, + { + "Value": "i:int", + "Id": -1534275235, + "Name": "sizeof_digit" + }, + { + "Value": "dict", + "Id": 817929997, + "Name": "__dict__" + }, + { + "Value": "object", + "Id": 1225024228, + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Id": 430276134, + "Name": "_int_info" + }, + { + "Documentation": "sys.version_info\n\nVersion information as a named tuple.", + "Bases": [ + "object" + ], + "Methods": [], + "Properties": [], + "Fields": [ + { + "Value": "i:int", + "Id": 762129410, + "Name": "major" + }, + { + "Value": "i:int", + "Id": 762371582, + "Name": "minor" + }, + { + "Value": "i:int", + "Id": 762361101, + "Name": "micro" + }, + { + "Value": "i:str", + "Id": -112134796, + "Name": "releaselevel" + }, + { + "Value": "i:int", + "Id": -1968090933, + "Name": "serial" + }, + { + "Value": "tuple_iterator", + "Id": 971292143, + "Name": "__iter__" + }, + { + "Value": "dict", + "Id": 817929997, + "Name": "__dict__" + }, + { + "Value": "object", + "Id": 1225024228, + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Id": -949236003, + "Name": "_version_info" } ], "Id": -1012399873, From 4054d5ab2c6877dec156a6ce5355dc5eef6f0526 Mon Sep 17 00:00:00 2001 From: Mikhail Arkhipov Date: Tue, 18 Jun 2019 22:06:56 -0700 Subject: [PATCH 82/82] Baselines --- .../Extensions/PythonFunctionExtensions.cs | 3 +- src/Caching/Impl/Factories/ModuleFactory.cs | 26 ++- src/Caching/Impl/GlobalScope.cs | 3 - src/Caching/Impl/Models/ModuleModel.cs | 7 +- src/Caching/Impl/Models/VariableModel.cs | 2 +- src/Caching/Impl/ModuleUniqueId.cs | 1 - src/Caching/Impl/TypeNames.cs | 2 +- src/Caching/Test/Files/Requests.json | 38 ++-- src/Caching/Test/Files/Sys.json | 176 +++++++++++++++--- 9 files changed, 189 insertions(+), 69 deletions(-) diff --git a/src/Analysis/Ast/Impl/Extensions/PythonFunctionExtensions.cs b/src/Analysis/Ast/Impl/Extensions/PythonFunctionExtensions.cs index 4e8b4685e..a53be479c 100644 --- a/src/Analysis/Ast/Impl/Extensions/PythonFunctionExtensions.cs +++ b/src/Analysis/Ast/Impl/Extensions/PythonFunctionExtensions.cs @@ -42,8 +42,7 @@ public static string GetQualifiedName(this IPythonClassMember cm) { for (var p = cm.DeclaringType as IPythonClassMember; p != null; p = p.DeclaringType as IPythonClassMember) { s.Push(p.Name); } - return $"{cm.DeclaringModule}:{string.Join(".", s)}"; + return $"{cm.DeclaringModule.Name}:{string.Join(".", s)}"; } - } } diff --git a/src/Caching/Impl/Factories/ModuleFactory.cs b/src/Caching/Impl/Factories/ModuleFactory.cs index 6aa8faefd..ad0fe4d6c 100644 --- a/src/Caching/Impl/Factories/ModuleFactory.cs +++ b/src/Caching/Impl/Factories/ModuleFactory.cs @@ -53,27 +53,26 @@ public void Dispose() { public IPythonType ConstructType(string qualifiedName) => ConstructMember(qualifiedName)?.GetPythonType(); - public IMember ConstructMember(string rawQualifiedName) { - if (!TypeNames.DeconstructQualifiedName(rawQualifiedName, out _, out var nameParts, out var isInstance)) { + public IMember ConstructMember(string qualifiedName) { + if (!TypeNames.DeconstructQualifiedName(qualifiedName, out var moduleName, out var memberNames, out var isInstance)) { return null; } // TODO: better resolve circular references. - if (!_processing.Push(rawQualifiedName) || nameParts.Count < 2) { + if (!_processing.Push(qualifiedName) || memberNames.Count < 2) { return null; } try { // See if member is a module first. - var moduleName = nameParts[0]; var module = moduleName == Module.Name ? Module : Module.Interpreter.ModuleResolution.GetOrLoadModule(moduleName); if (module == null) { return null; } var member = moduleName == Module.Name - ? GetMemberFromThisModule(nameParts, 1) - : GetMemberFromModule(module, nameParts, 1); + ? GetMemberFromThisModule(memberNames) + : GetMemberFromModule(module, memberNames); if (!isInstance) { return member; @@ -86,14 +85,13 @@ public IMember ConstructMember(string rawQualifiedName) { } } - private IMember GetMemberFromModule(IPythonModule module, IReadOnlyList nameParts, int index) { - if (index >= nameParts.Count) { + private IMember GetMemberFromModule(IPythonModule module, IReadOnlyList memberNames) { + if (memberNames.Count == 0) { return null; } - var member = module?.GetMember(nameParts[index++]); - for (; index < nameParts.Count; index++) { - var memberName = nameParts[index]; + IMember member = module; + foreach (var memberName in memberNames) { var typeArgs = GetTypeArguments(memberName, out _); var mc = member as IMemberContainer; @@ -113,13 +111,13 @@ private IMember GetMemberFromModule(IPythonModule module, IReadOnlyList return member; } - private IMember GetMemberFromThisModule(IReadOnlyList nameParts, int index) { - if (index >= nameParts.Count) { + private IMember GetMemberFromThisModule(IReadOnlyList memberNames) { + if (memberNames.Count == 0) { return null; } // TODO: nested classes, etc (traverse parts and recurse). - var name = nameParts[index]; + var name = memberNames[0]; return ClassFactory.TryCreate(name) ?? (FunctionFactory.TryCreate(name) ?? (IMember)VariableFactory.TryCreate(name)); diff --git a/src/Caching/Impl/GlobalScope.cs b/src/Caching/Impl/GlobalScope.cs index 5c791eaa3..d484c0d66 100644 --- a/src/Caching/Impl/GlobalScope.cs +++ b/src/Caching/Impl/GlobalScope.cs @@ -26,14 +26,11 @@ namespace Microsoft.Python.Analysis.Caching { internal sealed class GlobalScope : IGlobalScope { private readonly VariableCollection _scopeVariables = new VariableCollection(); - private readonly IPythonInterpreter _interpreter; public GlobalScope(ModuleModel model, IPythonModule module, IServiceContainer services) { Module = module; Name = model.Name; - _interpreter = services.GetService(); - using (var mf = new ModuleFactory(model, module)) { // TODO: store real location in models diff --git a/src/Caching/Impl/Models/ModuleModel.cs b/src/Caching/Impl/Models/ModuleModel.cs index 7fe6326f2..9a01a1a29 100644 --- a/src/Caching/Impl/Models/ModuleModel.cs +++ b/src/Caching/Impl/Models/ModuleModel.cs @@ -40,15 +40,18 @@ public static ModuleModel FromAnalysis(IDocumentAnalysis analysis, IServiceConta .Where(v => exportedNames.Contains(v.Name) || v.Source == VariableSource.Declaration || v.Source == VariableSource.Builtin)) { // Create type model before variable since variable needs it. string typeName = null; + switch (v.Value) { - case IPythonFunctionType ft when ft.DeclaringModule.Equals(analysis.Document): + case IPythonFunctionType ft + when ft.DeclaringModule.Equals(analysis.Document) || ft.DeclaringModule.Equals(analysis.Document.Stub): if (!functions.ContainsKey(ft.Name)) { typeName = ft.Name; functions[ft.Name] = FunctionModel.FromType(ft); } break; - case IPythonClassType cls when cls.DeclaringModule.Equals(analysis.Document): + case IPythonClassType cls + when cls.DeclaringModule.Equals(analysis.Document) || cls.DeclaringModule.Equals(analysis.Document.Stub): if (!classes.ContainsKey(cls.Name)) { typeName = cls.Name; classes[cls.Name] = ClassModel.FromType(cls); diff --git a/src/Caching/Impl/Models/VariableModel.cs b/src/Caching/Impl/Models/VariableModel.cs index c326ddbdd..f80a41555 100644 --- a/src/Caching/Impl/Models/VariableModel.cs +++ b/src/Caching/Impl/Models/VariableModel.cs @@ -38,7 +38,7 @@ internal sealed class VariableModel: MemberModel { public static VariableModel FromType(string name, IPythonType t) => new VariableModel { Id = name.GetStableHash(), Name = name, - Value = t.GetQualifiedName() + Value = t.QualifiedName }; } } diff --git a/src/Caching/Impl/ModuleUniqueId.cs b/src/Caching/Impl/ModuleUniqueId.cs index ea1e584b3..7c5e7524d 100644 --- a/src/Caching/Impl/ModuleUniqueId.cs +++ b/src/Caching/Impl/ModuleUniqueId.cs @@ -30,7 +30,6 @@ public static string GetUniqieId(this IPythonModule module, IServiceContainer se public static string GetUniqieId(string moduleName, string filePath, ModuleType moduleType, IServiceContainer services) { var interpreter = services.GetService(); - var stubCache = services.GetService(); var fs = services.GetService(); if (moduleType == ModuleType.User) { diff --git a/src/Caching/Impl/TypeNames.cs b/src/Caching/Impl/TypeNames.cs index b88354272..5408d724f 100644 --- a/src/Caching/Impl/TypeNames.cs +++ b/src/Caching/Impl/TypeNames.cs @@ -25,7 +25,7 @@ public static string GetQualifiedName(this IMember m) { if (!t.IsUnknown()) { switch (m) { case IPythonInstance _: - return $"i:{GetQualifiedName(t)}"; + return $"i:{t.QualifiedName}"; case IPythonType pt when pt.DeclaringModule.ModuleType == ModuleType.Builtins: return pt.TypeId == BuiltinTypeId.Ellipsis ? "ellipsis" : pt.Name; case IPythonType pt: diff --git a/src/Caching/Test/Files/Requests.json b/src/Caching/Test/Files/Requests.json index ab5e67df4..84f951687 100644 --- a/src/Caching/Test/Files/Requests.json +++ b/src/Caching/Test/Files/Requests.json @@ -83,52 +83,52 @@ "Name": "DependencyWarning" }, { - "Value": "i:typing:Any", + "Value": "i:str", "Id": 916650529, "Name": "__title__" }, { - "Value": null, + "Value": "i:str", "Id": -1883656187, "Name": "__description__" }, { - "Value": null, + "Value": "i:str", "Id": -1620207176, "Name": "__url__" }, { - "Value": "i:typing:Any", + "Value": "i:str", "Id": 1161199201, "Name": "__version__" }, { - "Value": "i:typing:Any", + "Value": "i:int", "Id": -1840123721, "Name": "__build__" }, { - "Value": null, + "Value": "i:str", "Id": 1654469090, "Name": "__author__" }, { - "Value": null, + "Value": "i:str", "Id": -94198849, "Name": "__author_email__" }, { - "Value": "i:typing:Any", + "Value": "i:str", "Id": -386551926, "Name": "__license__" }, { - "Value": "i:typing:Any", + "Value": "i:str", "Id": 1739624272, "Name": "__copyright__" }, { - "Value": null, + "Value": "i:str", "Id": 782136591, "Name": "__cake__" }, @@ -158,47 +158,47 @@ "Name": "PreparedRequest" }, { - "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:request", + "Value": "requests.api:request", "Id": -1769342312, "Name": "request" }, { - "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:get", + "Value": "requests.api:get", "Id": 787423, "Name": "get" }, { - "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:head", + "Value": "requests.api:head", "Id": 24439415, "Name": "head" }, { - "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:post", + "Value": "requests.api:post", "Id": 24687927, "Name": "post" }, { - "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:patch", + "Value": "requests.api:patch", "Id": 764909201, "Name": "patch" }, { - "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:put", + "Value": "requests.api:put", "Id": 796568, "Name": "put" }, { - "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:delete", + "Value": "requests.api:delete", "Id": 1897257090, "Name": "delete" }, { - "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:options", + "Value": "requests.api:options", "Id": 180457127, "Name": "options" }, { - "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:session", + "Value": "requests.sessions:session", "Id": -880047457, "Name": "session" }, diff --git a/src/Caching/Test/Files/Sys.json b/src/Caching/Test/Files/Sys.json index b4affbe79..45eb533cb 100644 --- a/src/Caching/Test/Files/Sys.json +++ b/src/Caching/Test/Files/Sys.json @@ -751,6 +751,76 @@ "Functions": null, "Id": -1481860294, "Name": "settrace" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Id": 503242166, + "Name": "getdlopenflags" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "n", + "Type": "int", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:__NoneType__" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Id": -1268494038, + "Name": "setdlopenflags" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [ + { + "Name": "on_flag", + "Type": "bool", + "DefaultValue": null, + "Kind": 0 + } + ], + "ReturnType": "i:__NoneType__" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Id": 1891924589, + "Name": "settscdump" + }, + { + "Documentation": null, + "Overloads": [ + { + "Parameters": [], + "ReturnType": "i:int" + } + ], + "Attributes": 0, + "Classes": null, + "Functions": null, + "Id": -1618095583, + "Name": "gettotalrefcount" } ], "Variables": [ @@ -989,31 +1059,6 @@ "Id": 1738857804, "Name": "version_info" }, - { - "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:getdlopenflags", - "Id": 503242166, - "Name": "getdlopenflags" - }, - { - "Value": "sys:_WinVersion", - "Id": -506845532, - "Name": "_WinVersion" - }, - { - "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:setdlopenflags", - "Id": -1268494038, - "Name": "setdlopenflags" - }, - { - "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:settscdump", - "Id": 1891924589, - "Name": "settscdump" - }, - { - "Value": "Microsoft.Python.Analysis.Modules.StubPythonModule:gettotalrefcount", - "Id": -1618095583, - "Name": "gettotalrefcount" - }, { "Value": "typing:List", "Id": 23609685, @@ -1050,7 +1095,7 @@ "Name": "Union" }, { - "Value": "Microsoft.Python.Analysis.Specializations.Typing.TypingModule:TypeVar", + "Value": "typing:TypeVar", "Id": -2053481098, "Name": "TypeVar" }, @@ -6709,6 +6754,85 @@ "InnerClasses": [], "Id": -949236003, "Name": "_version_info" + }, + { + "Documentation": "Built-in immutable sequence.\n\nIf no argument is given, the constructor returns an empty tuple.\nIf iterable is specified the tuple is initialized from iterable's items.\n\nIf the argument is a tuple, the return value is the same object.", + "Bases": [ + "object" + ], + "Methods": [], + "Properties": [], + "Fields": [ + { + "Value": "i:int", + "Id": 762129410, + "Name": "major" + }, + { + "Value": "i:int", + "Id": 762371582, + "Name": "minor" + }, + { + "Value": "i:int", + "Id": 752565431, + "Name": "build" + }, + { + "Value": "i:int", + "Id": -1042062966, + "Name": "platform" + }, + { + "Value": "i:str", + "Id": -2093362438, + "Name": "service_pack" + }, + { + "Value": "i:int", + "Id": -1573389776, + "Name": "service_pack_minor" + }, + { + "Value": "i:int", + "Id": -1573631948, + "Name": "service_pack_major" + }, + { + "Value": "i:int", + "Id": 642126643, + "Name": "suite_mast" + }, + { + "Value": "i:int", + "Id": -1438724575, + "Name": "product_type" + }, + { + "Value": "i:tuple", + "Id": -1420100829, + "Name": "platform_version" + }, + { + "Value": "tuple_iterator", + "Id": 971292143, + "Name": "__iter__" + }, + { + "Value": "dict", + "Id": 817929997, + "Name": "__dict__" + }, + { + "Value": "object", + "Id": 1225024228, + "Name": "__weakref__" + } + ], + "GenericParameters": null, + "InnerClasses": [], + "Id": -506845532, + "Name": "_WinVersion" } ], "Id": -1012399873,