pylance-release
pylance-release copied to clipboard
Pylance incorrectly reports no arguments expected to pandas context manager
Environment data
- Language Server version: 2022.6.20
- OS and version: Ubuntu 22.04
- Python version (& distribution if applicable, e.g. Anaconda): 3.10.4
Code Snippet
import pandas as pd
with pd.option_context('display.max_rows', 10):
pass
Repro Steps
- In VSCode working diretory, place a file
pyrightconfig.json
with the following content:
{
"typeCheckingMode": "basic",
}
- Paste the python snippet in a new python file.
Expected behavior
No error should occur.
Actual behavior
Pylance reports 2 errors:
- Expected no arguments to "option_context" constructor.
- Object of type "option_context" cannot be used with "with" because it does not implement enter.
Neither of this errors should occur, as the source codes for this context manager is correct. Also, when running pyright from the command line, these errors don't appear.