535 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
Advice
1
vote
1
replies
115
views
How do I help Pylance to know that the base class is still a test case?
I have a series of unit tests that should run for two different implementations of a same "interface." Those tests use only the methods that exist in both implementations. Since they end up identical, ...
2
votes
2
answers
87
views
VSCode/Pylance highlights "Import could not be resolved" after moving files from a subfolder to the root
I’m working on a Python project on Windows 11 using VSCode.
I recently reorganized my project by moving all files from a subfolder to the root folder so that the code can be executed directly from the ...
0
votes
2
answers
112
views
python: vscode doesnt highlight direct import from module
When I attempt to import a module from a local package (from core import config), VSCode's syntax highlighting isn't working. When hovering over config, it shows "config: Any" (the editor ...
1
vote
0
answers
85
views
How to prevent VS Code Pylance extension from analyzing opened editor files which are outside my project workspace?
Note: this is not a duplicate of How to prevent Pylance and pylint in vscode from analyzing python files not in current workspace? because this question is not about file path based exclusion, instead ...
0
votes
1
answer
97
views
Python in vscode does not autocomplete or suggest built in class method
I am using vscode for Python dev. I have the Microsoft Extensions (Pylance, Python, Python Debugger, PythonEnviroments) installed and working.
The issue is when I try to make a metaclass in vscode ...
2
votes
1
answer
63
views
Type hints for concurrent.futures.Executor subclasses
I have the following code developed in VSCode that runs without error:
import random
import time
from concurrent.futures import (
InterpreterPoolExecutor,
ProcessPoolExecutor,
...
0
votes
0
answers
109
views
Pylance extension in VS code isn't providing autocomplete/intellisense for objects, has 2 illegal state - object is disposed errors
Title pretty much says it all. Autocomplete works fine for variables I declare in the main script body, but when I instantiate an object of a class, autocomplete doesn't predict any of the class's ...
0
votes
1
answer
233
views
Visual Studio Code Python Language Server crashes with JavaScript out of memory
I have a large Python project I'd like to edit in Visual Studio Code.
However, the Python Language server keeps crashing with JavaScript out of memory errors, like one below.
How can I increase the ...
0
votes
1
answer
228
views
Python language features do not work with libraries installed in Poetry local virtual environment (.venv)
I have a Python Poetry project. Visual Studio Code features like auto-import and auto-complete do not work for the project dependency libraries. Pylance (the Python language server for Visual Studio ...
1
vote
1
answer
165
views
Pylance in devcontainer is loading forever
I am trying to set up a devcontainer on my desktop, but functions like autocomplete or go to function don't work. When I hover variable or function it shows never-ending load information Loading ...
1
vote
1
answer
95
views
How to fix Visual Studio Code tensorflow keras imports highlighting and suggestions?
So I'm working through tensorflow, I got into it recently, and I dont know the library well. I'd like to rely on suggestions on what to type, to be able to check what parameters are there to functions,...
0
votes
1
answer
98
views
Pylance problems in VS Code are not persisting in the UI
In Vs Code, every time i select a file, the previous pylance/ruff lintings diags on other files (problems tab) disappear. The consequence is i cannot see linting errors for all my project files or ...
-1
votes
1
answer
973
views
Type hint warning `"keys" is not a known attribute of "None"` for `Optional` in Pylance [duplicate]
Recently Pylance has started to add red underlines in my code. I've managed to fix most of it, but I have problems with Optional typing:
def realms(testenv:str, active:bool=True) -> Optional[Dict]:
...
2
votes
1
answer
311
views
reportAssignmentType Pylance error when using TypeVar
I'm trying to make a function that replaces some substrings inside strings with a preassigned value,
and I've extended it so that it works for list, dict, and tuple as well.
I used TypeVar to denote ...
1
vote
0
answers
110
views
Pylance is not recognizing "Methods:" section in a Python class docstring
Consider this Python class with docstring:
class TestClass:
'''
Summary line of docstring
Additional lines of docstring.
Attributes:
attr1 (int): this is the desc of a public ...