microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.69k stars 767 forks source link

No suggestion for container of `Literal` with fallback #6123

Open nineteendo opened 1 month ago

nineteendo commented 1 month ago

Environment data

Code Snippet

import json
from typing import Any, Container, Literal, overload

@overload
def dumps(obj: Any, *, allow: Container[Literal["nan"]] = ()) -> str: ...
@overload
def dumps(obj: Any, *, allow: Container[str] = ()) -> str: ...

def dumps(obj: Any, *, allow: Container[str] = ()) -> str:
    return json.dumps(obj, allow_nan="nan" in allow)

dumps(None, allow=[""])

Expected behavior

I'm expecting a list of suggested features:

image

Actual behavior

I get no suggestions:

image

[!NOTE] This doesn't match the behaviour of singletons:

from typing import IO, Any, Literal, overload

@overload
def open_file(filename: str, mode: Literal["r", "w"]) -> IO[str]: ...
@overload
def open_file(filename: str, mode: str) -> IO[Any]: ...

def open_file(filename: str, mode: str) -> IO[Any]:
    return open(filename, mode)

open_file("file.txt", "")

image

Logs

2024-07-12 17:36:09.143 [info] (Client) Pylance async client (2024.7.1) started with python extension (2024.10.0)
2024-07-12 17:36:10.277 [info] [Info  - 5:36:10 PM] (4412) Server root directory: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist
2024-07-12 17:36:10.277 [info] [Info  - 5:36:10 PM] (4412) Experimental Pylance language server 2024.7.1 (pyright version 1.1.369, commit 1168be71) starting
2024-07-12 17:36:10.306 [info] [Info  - 5:36:10 PM] (4412) Starting service instance "<default>"
2024-07-12 17:36:10.347 [info] (4412) No pyproject.toml file found.
2024-07-12 17:36:10.349 [info] [Info  - 5:36:10 PM] (4412) Setting pythonPath for service "<default>": "c:\Users\wanne\AppData\Local\Programs\Python\Python312\python.exe"
2024-07-12 17:36:10.349 [info] [Info  - 5:36:10 PM] (4412) Setting environmentName for service "<default>": "3.12.4 (global)"
2024-07-12 17:36:10.350 [info] [Info  - 5:36:10 PM] (4412) No include entries specified; assuming \<default workspace root>
2024-07-12 17:36:10.350 [info] [Info  - 5:36:10 PM] (4412) Auto-excluding **/node_modules
2024-07-12 17:36:10.351 [info] [Info  - 5:36:10 PM] (4412) Auto-excluding **/__pycache__
2024-07-12 17:36:10.351 [info] [Info  - 5:36:10 PM] (4412) Auto-excluding **/.*
2024-07-12 17:36:10.444 [info] [Info  - 5:36:10 PM] (4412) Assuming Python version 3.12.4.final.0
2024-07-12 17:36:10.444 [info] (4412) Assuming Python platform Windows
2024-07-12 17:36:10.626 [info] [Info  - 5:36:10 PM] (4412) Search paths for file:///%3Cdefault%20workspace%20root%3E
2024-07-12 17:36:10.626 [info] [Info  - 5:36:10 PM] (4412)   c:\Users\wanne\.vscode\extensions\ms-python.vscode-pylance-2024.7.1\dist\typeshed-fallback\stdlib
2024-07-12 17:36:10.626 [info] [Info  - 5:36:10 PM] (4412)   \<default workspace root>
2024-07-12 17:36:10.627 [info] [Info  - 5:36:10 PM] (4412)   \<default workspace root>\typings
2024-07-12 17:36:10.627 [info] [Info  - 5:36:10 PM] (4412)   c:\Users\wanne\.vscode\extensions\ms-python.vscode-pylance-2024.7.1\dist\typeshed-fallback\stubs\...
2024-07-12 17:36:10.627 [info] [Info  - 5:36:10 PM] (4412)   c:\Users\wanne\.vscode\extensions\ms-python.vscode-pylance-2024.7.1\dist\bundled\stubs
2024-07-12 17:36:10.627 [info] [Info  - 5:36:10 PM] (4412)   c:\Users\wanne\AppData\Local\Programs\Python\Python312\DLLs
2024-07-12 17:36:10.628 [info] [Info  - 5:36:10 PM] (4412)   c:\Users\wanne\AppData\Local\Programs\Python\Python312\Lib
2024-07-12 17:36:10.629 [info] [Info  - 5:36:10 PM] (4412)   c:\Users\wanne\AppData\Local\Programs\Python\Python312
2024-07-12 17:36:10.629 [info] [Info  - 5:36:10 PM] (4412)   c:\Users\wanne\AppData\Roaming\Python\Python312\site-packages
2024-07-12 17:36:10.630 [info] [Info  - 5:36:10 PM] (4412)   c:\Users\wanne\AppData\Local\Programs\Python\Python312\Lib\site-packages
2024-07-12 17:36:10.631 [info] [Info  - 5:36:10 PM] (4412) Adding fs watcher for library directories:
 file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/DLLs
file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib
file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312
file:///c%3A/Users/wanne/AppData/Roaming/Python/Python312/site-packages
file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/site-packages
2024-07-12 17:36:10.632 [info] [Info  - 5:36:10 PM] (4412) Adding fs watcher for directories:
 file:///%3Cdefault%20workspace%20root%3E
2024-07-12 17:36:10.632 [info] (4412) Searching for source files
2024-07-12 17:36:10.633 [info] [Error - 5:36:10 PM] (4412) File or directory "\<default workspace root>" does not exist.
2024-07-12 17:36:10.634 [info] [Info  - 5:36:10 PM] (4412) No source files found.
2024-07-12 17:36:10.639 [info] (4412) pytest configurations: {"message":"script","classes":["Test"],"files":["test_*.py","*_test.py"],"functions":["test"]}
2024-07-12 17:36:10.681 [info] (4412) [IDX(FG)] index libraries file:///%3Cdefault%20workspace%20root%3E (index) ...
2024-07-12 17:36:10.682 [info] (4412) [IDX(FG)]   read stdlib indices (39ms)
2024-07-12 17:36:10.684 [info] (4412) [IDX(FG)] index libraries file:///%3Cdefault%20workspace%20root%3E (index) [succeed] (43ms)
2024-07-12 17:36:10.689 [info] (4412) pytest configurations: {"message":"spawn c:\\Users\\wanne\\AppData\\Local\\Programs\\Python\\Python312\\python.exe ENOENT","classes":["Test"],"files":["test_*.py","*_test.py"],"functions":["test"]}
2024-07-12 17:36:10.699 [info] (4412) No pyproject.toml file found.
2024-07-12 17:36:10.700 [info] [Info  - 5:36:10 PM] (4412) Setting pythonPath for service "<default>": "c:\Users\wanne\AppData\Local\Programs\Python\Python312\python.exe"
2024-07-12 17:36:10.700 [info] [Info  - 5:36:10 PM] (4412) Setting environmentName for service "<default>": "3.12.4 (global)"
2024-07-12 17:36:10.700 [info] [Info  - 5:36:10 PM] (4412) No include entries specified; assuming \<default workspace root>
2024-07-12 17:36:10.700 [info] [Info  - 5:36:10 PM] (4412) Auto-excluding **/node_modules
2024-07-12 17:36:10.700 [info] [Info  - 5:36:10 PM] (4412) Auto-excluding **/__pycache__
2024-07-12 17:36:10.701 [info] [Info  - 5:36:10 PM] (4412) Auto-excluding **/.*
2024-07-12 17:36:10.791 [info] [Info  - 5:36:10 PM] (4412) Assuming Python version 3.12.4.final.0
2024-07-12 17:36:10.791 [info] (4412) Assuming Python platform Windows
2024-07-12 17:36:10.959 [info] [Info  - 5:36:10 PM] (4412) Search paths for file:///%3Cdefault%20workspace%20root%3E
2024-07-12 17:36:10.959 [info] [Info  - 5:36:10 PM] (4412)   c:\Users\wanne\.vscode\extensions\ms-python.vscode-pylance-2024.7.1\dist\typeshed-fallback\stdlib
2024-07-12 17:36:10.959 [info] [Info  - 5:36:10 PM] (4412)   \<default workspace root>
2024-07-12 17:36:10.959 [info] [Info  - 5:36:10 PM] (4412)   \<default workspace root>\typings
2024-07-12 17:36:10.960 [info] [Info  - 5:36:10 PM] (4412)   c:\Users\wanne\.vscode\extensions\ms-python.vscode-pylance-2024.7.1\dist\typeshed-fallback\stubs\...
2024-07-12 17:36:10.960 [info] [Info  - 5:36:10 PM] (4412)   c:\Users\wanne\.vscode\extensions\ms-python.vscode-pylance-2024.7.1\dist\bundled\stubs
2024-07-12 17:36:10.960 [info] [Info  - 5:36:10 PM] (4412)   c:\Users\wanne\AppData\Local\Programs\Python\Python312\DLLs
2024-07-12 17:36:10.960 [info] [Info  - 5:36:10 PM] (4412)   c:\Users\wanne\AppData\Local\Programs\Python\Python312\Lib
2024-07-12 17:36:10.961 [info] [Info  - 5:36:10 PM] (4412)   c:\Users\wanne\AppData\Local\Programs\Python\Python312
2024-07-12 17:36:10.963 [info] [Info  - 5:36:10 PM] (4412)   c:\Users\wanne\AppData\Roaming\Python\Python312\site-packages
2024-07-12 17:36:10.977 [info] [Info  - 5:36:10 PM] (4412)   c:\Users\wanne\AppData\Local\Programs\Python\Python312\Lib\site-packages
2024-07-12 17:36:10.981 [info] [Info  - 5:36:10 PM] (4412) Adding fs watcher for library directories:
 file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/DLLs
file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib
file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312
file:///c%3A/Users/wanne/AppData/Roaming/Python/Python312/site-packages
file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/site-packages
2024-07-12 17:36:10.981 [info] [Info  - 5:36:10 PM] (4412) Adding fs watcher for directories:
 file:///%3Cdefault%20workspace%20root%3E
2024-07-12 17:36:10.982 [info] (4412) Searching for source files
2024-07-12 17:36:10.982 [info] [Error - 5:36:10 PM] (4412) File or directory "\<default workspace root>" does not exist.
2024-07-12 17:36:10.982 [info] [Info  - 5:36:10 PM] (4412) No source files found.
2024-07-12 17:36:10.983 [info] (4412) [IDX(FG)] index libraries file:///%3Cdefault%20workspace%20root%3E (index) ...
2024-07-12 17:36:10.983 [info] (4412) [IDX(FG)]   read stdlib indices (1ms)
2024-07-12 17:36:10.983 [info] (4412) [IDX(FG)] index libraries file:///%3Cdefault%20workspace%20root%3E (index) [succeed] (2ms)
2024-07-12 17:36:11.054 [info] (4412) Attempting to resolve using local imports: __builtins__
2024-07-12 17:36:11.054 [info] (4412) Attempting to resolve using root path 'file:///c%3A/Users/wanne/Desktop'
2024-07-12 17:36:11.058 [info] (4412) [FG] parsing: file:///c%3A/Users/wanne/Desktop/test.py (86ms)
2024-07-12 17:36:11.139 [info] (4412) [FG] parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 5ms] (80ms)
2024-07-12 17:36:11.179 [info] (4412) [FG] binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/builtins.pyi (37ms)
2024-07-12 17:36:11.181 [info] (4412) [FG] binding: file:///c%3A/Users/wanne/Desktop/test.py (1ms)
2024-07-12 17:36:11.187 [info] (4412) pytest configurations: {"message":"spawn c:\\Users\\wanne\\AppData\\Local\\Programs\\Python\\Python312\\python.exe ENOENT","classes":["Test"],"files":["test_*.py","*_test.py"],"functions":["test"]}
2024-07-12 17:36:11.188 [info] [Info  - 5:36:11 PM] (4412) Background analysis(1) root directory: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist
2024-07-12 17:36:11.188 [info] [Info  - 5:36:11 PM] (4412) Background analysis(1) started
2024-07-12 17:36:11.251 [info] (4412) pytest configurations: {"message":"request cancelled","classes":["Test"],"files":["test_*.py","*_test.py"],"functions":["test"]}
2024-07-12 17:36:11.251 [info] (4412) pytest configurations: {"message":"spawn c:\\Users\\wanne\\AppData\\Local\\Programs\\Python\\Python312\\python.exe ENOENT","classes":["Test"],"files":["test_*.py","*_test.py"],"functions":["test"]}
2024-07-12 17:36:11.419 [info] (4412) pytest configurations: {"message":"spawn c:\\Users\\wanne\\AppData\\Local\\Programs\\Python\\Python312\\python.exe ENOENT","classes":["Test"],"files":["test_*.py","*_test.py"],"functions":["test"]}
2024-07-12 17:36:11.555 [info] (4412) Attempting to resolve using local imports: __builtins__
2024-07-12 17:36:11.555 [info] (4412) Attempting to resolve using root path 'file:///c%3A/Users/wanne/Desktop'
2024-07-12 17:36:11.559 [info] (4412) [BG(1)] SemanticTokens range 0:0 - 11:11 at file:///c%3A/Users/wanne/Desktop/test.py ...
2024-07-12 17:36:11.559 [info] (4412) [BG(1)]   parsing: file:///c%3A/Users/wanne/Desktop/test.py (137ms)
2024-07-12 17:36:11.641 [info] (4412) [BG(1)]   parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 5ms] (81ms)
2024-07-12 17:36:11.682 [info] (4412) [BG(1)]   binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/builtins.pyi (38ms)
2024-07-12 17:36:11.685 [info] (4412) [BG(1)]   binding: file:///c%3A/Users/wanne/Desktop/test.py (3ms)
2024-07-12 17:36:11.720 [info] (4412) [BG(1)]   parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/typing.pyi [fs read 2ms] (21ms)
2024-07-12 17:36:11.732 [info] (4412) [BG(1)]   binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/typing.pyi (12ms)
2024-07-12 17:36:11.753 [info] (4412) [BG(1)]   parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/types.pyi [fs read 0ms] (9ms)
2024-07-12 17:36:11.760 [info] (4412) [BG(1)]   binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/types.pyi (8ms)
2024-07-12 17:36:11.779 [info] (4412) [BG(1)]   parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi [fs read 1ms] (11ms)
2024-07-12 17:36:11.784 [info] (4412) [BG(1)]   binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi (4ms)
2024-07-12 17:36:11.794 [info] (4412) [BG(1)]   parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/abc.pyi [fs read 1ms] (2ms)
2024-07-12 17:36:11.797 [info] (4412) [BG(1)]   binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/abc.pyi (3ms)
2024-07-12 17:36:11.802 [info] (4412) [BG(1)]   parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/json/__init__.pyi [fs read 1ms] (3ms)
2024-07-12 17:36:11.803 [info] (4412) [BG(1)]   binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/json/__init__.pyi (1ms)
2024-07-12 17:36:11.820 [info] (4412) [BG(1)]   parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/json/encoder.pyi [fs read 1ms] (1ms)
2024-07-12 17:36:11.820 [info] (4412) [BG(1)]   binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/json/encoder.pyi (1ms)
2024-07-12 17:36:11.824 [info] (4412) [BG(1)]   parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/collections/abc.pyi [fs read 1ms] (1ms)
2024-07-12 17:36:11.826 [info] (4412) [BG(1)]   binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/collections/abc.pyi ...
2024-07-12 17:36:11.826 [info] (4412) [BG(1)]     parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/_collections_abc.pyi [fs read 0ms] (2ms)
2024-07-12 17:36:11.827 [info] (4412) [BG(1)]     binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/_collections_abc.pyi (0ms)
2024-07-12 17:36:11.827 [info] (4412) [BG(1)]   binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/collections/abc.pyi (4ms)
2024-07-12 17:36:11.846 [info] (4412) [BG(1)] SemanticTokens range 0:0 - 11:11 at file:///c%3A/Users/wanne/Desktop/test.py (426ms)
2024-07-12 17:36:11.849 [info] (4412) [BG(1)] SemanticTokens full at file:///c%3A/Users/wanne/Desktop/test.py (2ms)
2024-07-12 17:36:11.932 [info] (4412) Attempting to resolve using local imports: __builtins__
2024-07-12 17:36:11.932 [info] (4412) Attempting to resolve using root path 'file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib'
2024-07-12 17:36:11.935 [info] (4412) Attempting to resolve using local imports: _typing
2024-07-12 17:36:11.935 [info] (4412) Attempting to resolve using root path 'file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib'
2024-07-12 17:36:11.937 [info] (4412) [BG(1)] analyzing: file:///c%3A/Users/wanne/Desktop/test.py ...
2024-07-12 17:36:11.938 [info] (4412) [BG(1)]   checking: file:///c%3A/Users/wanne/Desktop/test.py ...
2024-07-12 17:36:11.938 [info] (4412) [BG(1)]     parsing: file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/typing.py [fs read 1ms] (68ms)
2024-07-12 17:36:11.939 [info] [Info  - 5:36:11 PM] (4412) Could not import '_typing' in file 'c:\Users\wanne\AppData\Local\Programs\Python\Python312\Lib\typing.py'
2024-07-12 17:36:11.939 [info] [Info  - 5:36:11 PM] (4412)   Looking in stubPath 'file:///%3Cdefault%20workspace%20root%3E/typings'
2024-07-12 17:36:11.940 [info] [Info  - 5:36:11 PM] (4412)   Attempting to resolve stub package using root path 'file:///%3Cdefault%20workspace%20root%3E/typings'
2024-07-12 17:36:11.940 [info] [Info  - 5:36:11 PM] (4412)   Attempting to resolve using root path 'file:///%3Cdefault%20workspace%20root%3E/typings'
2024-07-12 17:36:11.940 [info] [Info  - 5:36:11 PM] (4412)   Looking in root directory of execution environment 'file:///%3Cdefault%20workspace%20root%3E'
2024-07-12 17:36:11.941 [info] [Info  - 5:36:11 PM] (4412)   Attempting to resolve stub package using root path 'file:///%3Cdefault%20workspace%20root%3E'
2024-07-12 17:36:11.941 [info] [Info  - 5:36:11 PM] (4412)   Attempting to resolve using root path 'file:///%3Cdefault%20workspace%20root%3E'
2024-07-12 17:36:11.941 [info] [Info  - 5:36:11 PM] (4412)   Looking for typeshed stdlib path
2024-07-12 17:36:11.941 [info] [Info  - 5:36:11 PM] (4412)   Looking for typeshed stdlib path
2024-07-12 17:36:11.941 [info] [Info  - 5:36:11 PM] (4412)   Attempting to resolve using root path 'file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib'
2024-07-12 17:36:11.942 [info] [Info  - 5:36:11 PM] (4412)   Typeshed path not found
2024-07-12 17:36:11.942 [info] [Info  - 5:36:11 PM] (4412)   Finding python search paths
2024-07-12 17:36:11.942 [info] [Info  - 5:36:11 PM] (4412)   Executing interpreter: 'c:\Users\wanne\AppData\Local\Programs\Python\Python312\python.exe'
2024-07-12 17:36:11.942 [info] [Info  - 5:36:11 PM] (4412)   Skipping 'c:\Users\wanne\AppData\Local\Programs\Python\Python312\python312.zip' because it is not a valid directory
2024-07-12 17:36:11.942 [info] [Info  - 5:36:11 PM] (4412)   Received 5 paths from interpreter
2024-07-12 17:36:11.943 [info] [Info  - 5:36:11 PM] (4412)     file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/DLLs
2024-07-12 17:36:11.943 [info] [Info  - 5:36:11 PM] (4412)     file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib
2024-07-12 17:36:11.944 [info] [Info  - 5:36:11 PM] (4412)     file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312
2024-07-12 17:36:11.945 [info] [Info  - 5:36:11 PM] (4412)     file:///c%3A/Users/wanne/AppData/Roaming/Python/Python312/site-packages
2024-07-12 17:36:11.945 [info] [Info  - 5:36:11 PM] (4412)     file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/site-packages
2024-07-12 17:36:11.945 [info] [Info  - 5:36:11 PM] (4412)   Looking in python search path 'file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/DLLs'
2024-07-12 17:36:11.946 [info] [Info  - 5:36:11 PM] (4412)   Attempting to resolve stub package using root path 'file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/DLLs'
2024-07-12 17:36:11.946 [info] [Info  - 5:36:11 PM] (4412)   Attempting to resolve using root path 'file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/DLLs'
2024-07-12 17:36:11.947 [info] [Info  - 5:36:11 PM] (4412)   Looking in python search path 'file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib'
2024-07-12 17:36:11.947 [info] [Info  - 5:36:11 PM] (4412)   Attempting to resolve stub package using root path 'file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib'
2024-07-12 17:36:11.947 [info] [Info  - 5:36:11 PM] (4412)   Attempting to resolve using root path 'file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib'
2024-07-12 17:36:11.947 [info] [Info  - 5:36:11 PM] (4412)   Looking in python search path 'file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312'
2024-07-12 17:36:11.948 [info] [Info  - 5:36:11 PM] (4412)   Attempting to resolve stub package using root path 'file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312'
2024-07-12 17:36:11.948 [info] [Info  - 5:36:11 PM] (4412)   Attempting to resolve using root path 'file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312'
2024-07-12 17:36:11.948 [info] [Info  - 5:36:11 PM] (4412)   Looking in python search path 'file:///c%3A/Users/wanne/AppData/Roaming/Python/Python312/site-packages'
2024-07-12 17:36:11.948 [info] [Info  - 5:36:11 PM] (4412)   Attempting to resolve stub package using root path 'file:///c%3A/Users/wanne/AppData/Roaming/Python/Python312/site-packages'
2024-07-12 17:36:11.948 [info] [Info  - 5:36:11 PM] (4412)   Attempting to resolve using root path 'file:///c%3A/Users/wanne/AppData/Roaming/Python/Python312/site-packages'
2024-07-12 17:36:11.949 [info] [Info  - 5:36:11 PM] (4412)   Looking in python search path 'file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/site-packages'
2024-07-12 17:36:11.949 [info] [Info  - 5:36:11 PM] (4412)   Attempting to resolve stub package using root path 'file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/site-packages'
2024-07-12 17:36:11.949 [info] [Info  - 5:36:11 PM] (4412)   Attempting to resolve using root path 'file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/site-packages'
2024-07-12 17:36:11.949 [info] [Info  - 5:36:11 PM] (4412)   Looking in bundled stubs path 'file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/bundled/stubs'
2024-07-12 17:36:11.949 [info] [Info  - 5:36:11 PM] (4412)   Attempting to resolve stub package using root path 'file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/bundled/stubs'
2024-07-12 17:36:11.950 [info] [Info  - 5:36:11 PM] (4412)   Attempting to resolve using root path 'file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/bundled/stubs'
2024-07-12 17:36:11.950 [info] [Info  - 5:36:11 PM] (4412)   Looking for typeshed third-party path
2024-07-12 17:36:11.950 [info] [Info  - 5:36:11 PM] (4412)   Looking for typeshed stubs path
2024-07-12 17:36:11.950 [info] [Info  - 5:36:11 PM] (4412)   Typeshed path not found
2024-07-12 17:36:11.986 [info] (4412) [BG(1)]     binding: file:///c%3A/Users/wanne/AppData/Local/Programs/Python/Python312/Lib/typing.py (48ms)
2024-07-12 17:36:12.001 [info] (4412) [BG(1)]   checking: file:///c%3A/Users/wanne/Desktop/test.py (149ms)
2024-07-12 17:36:12.001 [info] (4412) [BG(1)] analyzing: file:///c%3A/Users/wanne/Desktop/test.py (150ms)
2024-07-12 17:36:12.041 [info] (4412) [BG(1)] SemanticTokens delta previousResultId:1720798571847 at file:///c%3A/Users/wanne/Desktop/test.py (2ms)
2024-07-12 17:36:14.013 [info] (4412) [FG] parsing: file:///c%3A/Users/wanne/Desktop/test.py (1ms)
2024-07-12 17:36:14.014 [info] (4412) [FG] binding: file:///c%3A/Users/wanne/Desktop/test.py (1ms)
2024-07-12 17:36:14.078 [info] (4412) [FG] parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/typing.pyi [fs read 1ms] (53ms)
2024-07-12 17:36:14.102 [info] (4412) [FG] binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/typing.pyi (20ms)
2024-07-12 17:36:14.139 [info] (4412) [FG] parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/types.pyi [fs read 1ms] (17ms)
2024-07-12 17:36:14.151 [info] (4412) [FG] binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/types.pyi (12ms)
2024-07-12 17:36:14.166 [info] (4412) [FG] parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi [fs read 1ms] (6ms)
2024-07-12 17:36:14.178 [info] (4412) [FG] binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi (11ms)
2024-07-12 17:36:14.187 [info] (4412) [FG] parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/abc.pyi [fs read 1ms] (3ms)
2024-07-12 17:36:14.189 [info] (4412) [FG] binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/abc.pyi (1ms)
2024-07-12 17:36:14.214 [info] (4412) [BG(1)] analyzing: file:///c%3A/Users/wanne/Desktop/test.py ...
2024-07-12 17:36:14.214 [info] (4412) [BG(1)]   parsing: file:///c%3A/Users/wanne/Desktop/test.py (0ms)
2024-07-12 17:36:14.214 [info] (4412) [BG(1)]   binding: file:///c%3A/Users/wanne/Desktop/test.py (2ms)
2024-07-12 17:36:14.215 [info] (4412) [FG] parsing: file:///c%3A/Users/wanne/Desktop/test.py (1ms)
2024-07-12 17:36:14.215 [info] (4412) [FG] binding: file:///c%3A/Users/wanne/Desktop/test.py (1ms)
2024-07-12 17:36:14.232 [info] [Info  - 5:36:14 PM] (4412) Heap stats: total_heap_size=54MB, used_heap_size=39MB, cross_worker_used_heap_size=39MB, total_physical_size=54MB, total_available_size=4055MB, heap_size_limit=4096MB
2024-07-12 17:36:14.330 [info] (4412) [BG(1)]   checking: file:///c%3A/Users/wanne/Desktop/test.py (2ms)
2024-07-12 17:36:14.330 [info] (4412) [BG(1)] analyzing: file:///c%3A/Users/wanne/Desktop/test.py (4ms)
2024-07-12 17:36:14.331 [info] (4412) [BG(1)] SemanticTokens delta previousResultId:1720798572039 at file:///c%3A/Users/wanne/Desktop/test.py ...
2024-07-12 17:36:14.331 [info] (4412) [BG(1)]   parsing: file:///c%3A/Users/wanne/Desktop/test.py (1ms)
2024-07-12 17:36:14.331 [info] (4412) [BG(1)]   binding: file:///c%3A/Users/wanne/Desktop/test.py (0ms)
2024-07-12 17:36:14.331 [info] (4412) [BG(1)] SemanticTokens delta previousResultId:1720798572039 at file:///c%3A/Users/wanne/Desktop/test.py (16ms)
2024-07-12 17:36:14.342 [info] (4412) [FG] parsing: file:///c%3A/Users/wanne/Desktop/test.py (1ms)
2024-07-12 17:36:14.343 [info] (4412) [FG] binding: file:///c%3A/Users/wanne/Desktop/test.py (1ms)
2024-07-12 17:36:14.408 [info] (4412) [FG] parsing: file:///c%3A/Users/wanne/Desktop/test.py (0ms)
2024-07-12 17:36:14.408 [info] (4412) [FG] binding: file:///c%3A/Users/wanne/Desktop/test.py (0ms)
2024-07-12 17:36:14.430 [info] (4412) [FG] parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/collections/abc.pyi [fs read 1ms] (2ms)
2024-07-12 17:36:14.434 [info] (4412) [FG] binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/collections/abc.pyi ...
2024-07-12 17:36:14.434 [info] (4412) [FG]   parsing: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/_collections_abc.pyi [fs read 1ms] (3ms)
2024-07-12 17:36:14.435 [info] (4412) [FG]   binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/_collections_abc.pyi (1ms)
2024-07-12 17:36:14.435 [info] (4412) [FG] binding: file:///c%3A/Users/wanne/.vscode/extensions/ms-python.vscode-pylance-2024.7.1/dist/typeshed-fallback/stdlib/collections/abc.pyi (5ms)
2024-07-12 17:36:14.991 [info] (4412) Attempting to resolve using local imports: __builtins__
2024-07-12 17:36:14.992 [info] (4412) Attempting to resolve using root path 'file:///c%3A/Users/wanne/AppData/Local/Temp/pyright-4412-0EhuURzpxT8t'
2024-07-12 17:36:14.992 [info] (4412) [FG] parsing: file:///c%3A/Users/wanne/AppData/Local/Temp/pyright-4412-0EhuURzpxT8t/builtins-4412-kkJ2rc2MjoM2-.py [fs read 28ms] (85ms)
2024-07-12 17:36:15.038 [info] (4412) [FG] binding: file:///c%3A/Users/wanne/AppData/Local/Temp/pyright-4412-0EhuURzpxT8t/builtins-4412-kkJ2rc2MjoM2-.py (45ms)
2024-07-12 17:36:15.049 [info] (4412) [BG(1)] analyzing: file:///c%3A/Users/wanne/Desktop/test.py ...
2024-07-12 17:36:15.049 [info] (4412) [BG(1)]   parsing: file:///c%3A/Users/wanne/Desktop/test.py (0ms)
2024-07-12 17:36:15.049 [info] (4412) [BG(1)]   binding: file:///c%3A/Users/wanne/Desktop/test.py (1ms)
2024-07-12 17:36:15.050 [info] (4412) [FG] parsing: file:///c%3A/Users/wanne/Desktop/test.py (0ms)
2024-07-12 17:36:15.050 [info] (4412) [FG] binding: file:///c%3A/Users/wanne/Desktop/test.py (0ms)
2024-07-12 17:36:15.052 [info] (4412) [BG(1)]   checking: file:///c%3A/Users/wanne/Desktop/test.py (3ms)
2024-07-12 17:36:15.052 [info] (4412) [BG(1)] analyzing: file:///c%3A/Users/wanne/Desktop/test.py (4ms)
2024-07-12 17:36:15.053 [info] (4412) [FG] parsing: file:///c%3A/Users/wanne/Desktop/test.py (1ms)
2024-07-12 17:36:15.054 [info] (4412) [FG] binding: file:///c%3A/Users/wanne/Desktop/test.py (0ms)
2024-07-12 17:36:15.068 [info] (4412) [BG(1)] SemanticTokens delta previousResultId:1720798574305 at file:///c%3A/Users/wanne/Desktop/test.py ...
2024-07-12 17:36:15.068 [info] (4412) [BG(1)]   parsing: file:///c%3A/Users/wanne/Desktop/test.py (1ms)
2024-07-12 17:36:15.069 [info] (4412) [BG(1)]   binding: file:///c%3A/Users/wanne/Desktop/test.py (1ms)
2024-07-12 17:36:15.074 [info] (4412) [BG(1)] SemanticTokens delta previousResultId:1720798574305 at file:///c%3A/Users/wanne/Desktop/test.py (17ms)
2024-07-12 17:36:15.330 [info] (4412) [BG(1)] analyzing: file:///c%3A/Users/wanne/Desktop/test.py ...
2024-07-12 17:36:15.331 [info] (4412) [BG(1)]   checking: file:///c%3A/Users/wanne/Desktop/test.py (2ms)
2024-07-12 17:36:15.331 [info] [Info  - 5:36:15 PM] (4412) Heap stats: total_heap_size=58MB, used_heap_size=43MB, cross_worker_used_heap_size=43MB, total_physical_size=58MB, total_available_size=4051MB, heap_size_limit=4096MB
2024-07-12 17:36:15.331 [info] (4412) [BG(1)] analyzing: file:///c%3A/Users/wanne/Desktop/test.py (3ms)
2024-07-12 17:36:15.341 [info] (4412) [BG(1)] SemanticTokens delta previousResultId:1720798575056 at file:///c%3A/Users/wanne/Desktop/test.py (0ms)
2024-07-12 17:36:15.535 [info] (4412) [FG] parsing: file:///c%3A/Users/wanne/Desktop/test.py (0ms)
2024-07-12 17:36:15.535 [info] (4412) [FG] binding: file:///c%3A/Users/wanne/Desktop/test.py (0ms)
2024-07-12 17:36:15.678 [info] (4412) [BG(1)] analyzing: file:///c%3A/Users/wanne/Desktop/test.py ...
2024-07-12 17:36:15.679 [info] (4412) [BG(1)]   parsing: file:///c%3A/Users/wanne/Desktop/test.py (2ms)
2024-07-12 17:36:15.679 [info] (4412) [BG(1)]   binding: file:///c%3A/Users/wanne/Desktop/test.py (1ms)
2024-07-12 17:36:15.699 [info] (4412) [BG(1)]   checking: file:///c%3A/Users/wanne/Desktop/test.py (20ms)
2024-07-12 17:36:15.700 [info] (4412) [BG(1)] analyzing: file:///c%3A/Users/wanne/Desktop/test.py (23ms)
2024-07-12 17:36:15.708 [info] (4412) [BG(1)] SemanticTokens delta previousResultId:1720798575340 at file:///c%3A/Users/wanne/Desktop/test.py (2ms)
2024-07-12 17:36:15.768 [info] (4412) [FG] parsing: file:///c%3A/Users/wanne/Desktop/test.py (0ms)
2024-07-12 17:36:15.768 [info] (4412) [FG] binding: file:///c%3A/Users/wanne/Desktop/test.py (1ms)
2024-07-12 17:36:16.064 [info] (4412) [BG(1)] SemanticTokens delta previousResultId:1720798575706 at file:///c%3A/Users/wanne/Desktop/test.py ...
2024-07-12 17:36:16.065 [info] (4412) [BG(1)]   parsing: file:///c%3A/Users/wanne/Desktop/test.py (1ms)
2024-07-12 17:36:16.065 [info] (4412) [BG(1)]   binding: file:///c%3A/Users/wanne/Desktop/test.py (0ms)
2024-07-12 17:36:16.078 [info] (4412) [BG(1)] SemanticTokens delta previousResultId:1720798575706 at file:///c%3A/Users/wanne/Desktop/test.py (14ms)
2024-07-12 17:36:16.383 [info] (4412) [BG(1)] analyzing: file:///c%3A/Users/wanne/Desktop/test.py ...
2024-07-12 17:36:16.384 [info] (4412) [BG(1)]   checking: file:///c%3A/Users/wanne/Desktop/test.py (6ms)
2024-07-12 17:36:16.384 [info] [Info  - 5:36:16 PM] (4412) Heap stats: total_heap_size=59MB, used_heap_size=41MB, cross_worker_used_heap_size=41MB, total_physical_size=59MB, total_available_size=4053MB, heap_size_limit=4096MB
2024-07-12 17:36:16.384 [info] (4412) [BG(1)] analyzing: file:///c%3A/Users/wanne/Desktop/test.py (6ms)
2024-07-12 17:36:16.400 [info] (4412) [BG(1)] SemanticTokens delta previousResultId:1720798576064 at file:///c%3A/Users/wanne/Desktop/test.py (1ms)
2024-07-12 17:36:16.525 [info] (4412) [FG] parsing: file:///c%3A/Users/wanne/Desktop/test.py (1ms)
2024-07-12 17:36:16.525 [info] (4412) [FG] binding: file:///c%3A/Users/wanne/Desktop/test.py (0ms)
2024-07-12 17:36:16.783 [info] (4412) [BG(1)] analyzing: file:///c%3A/Users/wanne/Desktop/test.py ...
2024-07-12 17:36:16.783 [info] (4412) [BG(1)]   parsing: file:///c%3A/Users/wanne/Desktop/test.py (1ms)
2024-07-12 17:36:16.783 [info] (4412) [BG(1)]   binding: file:///c%3A/Users/wanne/Desktop/test.py (0ms)
2024-07-12 17:36:16.804 [info] (4412) [BG(1)]   checking: file:///c%3A/Users/wanne/Desktop/test.py (23ms)
2024-07-12 17:36:16.805 [info] (4412) [BG(1)] analyzing: file:///c%3A/Users/wanne/Desktop/test.py (24ms)
2024-07-12 17:36:16.810 [info] (4412) [BG(1)] SemanticTokens delta previousResultId:1720798576398 at file:///c%3A/Users/wanne/Desktop/test.py (1ms)
nineteendo commented 1 month ago

@erictraut, something else seems to be going on here:

import json
from typing import Any, Container, Literal, overload

@overload
def dumps(obj: Any, *, allow: Container[Literal["nan"]] = ()) -> str: ...
@overload
def dumps(obj: Any, *, allow: Container[Literal["inf"]] = ()) -> str: ...

def dumps(obj: Any, *, allow: Container[str] = ()) -> str:
    return json.dumps(obj, allow_nan="nan" in allow or "inf" in allow)

The main issue is that the suggestion doesn't match the inferred type:

image

That just looks plain wrong.

heejaechang commented 1 month ago

let me take a look.