Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'"x" is not accessed' when used as kwarg in class definition that's not metaclass #1272

Closed
asleep-cult opened this issue May 11, 2021 · 4 comments
Labels
bug Something isn't working fixed in next version A fix has been implemented and will appear in an upcoming version

Comments

@asleep-cult
Copy link

Environment data

  • Language Server version: 2021.5.1
  • OS and version: Windows 10 Home build 19041.928
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 64 bit (AMD64)] on win32

Expected behaviour

There should be no '"x" is not accessed' message.

Actual behaviour

There is an '"x" is not accessed' message when x is used as a kwarg in a class definition that's not metaclass.

Logs

[Info  - 4:53:59 PM] Pylance language server 2021.5.1 (pyright df8b6b3c) starting
[Info  - 4:53:59 PM] Server root directory: c:\Users\User\.vscode\extensions\ms-python.vscode-pylance-2021.5.1\dist
[Info  - 4:53:59 PM] No configuration file found.
[Info  - 4:53:59 PM] No pyproject.toml file found.
[Info  - 4:53:59 PM] Setting pythonPath for service "new-snakecord": "C:\Users\User\AppData\Local\Programs\Python\Python39\python.exe"
[Warn  - 4:53:59 PM] stubPath c:\Development\new-snakecord\typings is not a valid directory.
[Info  - 4:53:59 PM] Assuming Python version 3.9
[Info  - 4:53:59 PM] Assuming Python platform Windows
Search paths for c:\Development\new-snakecord
  c:\Users\User\.vscode\extensions\ms-python.vscode-pylance-2021.5.1\dist\typeshed-fallback\stdlib
  c:\Development\new-snakecord
  C:\Users\User\AppData\Local\Programs\Python\Python39
  c:\Development\new-snakecord\typings
  c:\Users\User\.vscode\extensions\ms-python.vscode-pylance-2021.5.1\dist\typeshed-fallback\stubs\...
  c:\Users\User\.vscode\extensions\ms-python.vscode-pylance-2021.5.1\dist\bundled\stubs
  C:\Users\User\AppData\Local\Programs\Python\Python39
  C:\Users\User\AppData\Local\Programs\Python\Python39\DLLs
  C:\Users\User\AppData\Local\Programs\Python\Python39\lib
  C:\Users\User\AppData\Roaming\Python\Python39\site-packages
  C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages
[Info  - 4:53:59 PM] Searching for source files
[Info  - 4:53:59 PM] Found 37 source files
[Info  - 4:53:59 PM] Background analysis(1) root directory: c:\Users\User\.vscode\extensions\ms-python.vscode-pylance-2021.5.1\dist
[Info  - 4:53:59 PM] Background analysis(1) started
Background analysis message: setConfigOptions
Background analysis message: ensurePartialStubPackages
Background analysis message: setTrackedFiles
Background analysis message: markAllFilesDirty
Background analysis message: setFileOpened
Background analysis message: getSemanticTokens full
[BG(1)] getSemanticTokens full at c:\Development\new-snakecord\snakecord\snakecord\test.py ...
[BG(1)]   parsing: c:\Development\new-snakecord\snakecord\snakecord\test.py (23ms)
[BG(1)]   parsing: c:\Users\User\.vscode\extensions\ms-python.vscode-pylance-2021.5.1\dist\typeshed-fallback\stdlib\builtins.pyi [fs read 7ms] (230ms)
[BG(1)]   binding: c:\Users\User\.vscode\extensions\ms-python.vscode-pylance-2021.5.1\dist\typeshed-fallback\stdlib\builtins.pyi (75ms)
[BG(1)]   binding: c:\Development\new-snakecord\snakecord\snakecord\test.py (0ms)
[BG(1)]   parsing: c:\Users\User\.vscode\extensions\ms-python.vscode-pylance-2021.5.1\dist\typeshed-fallback\stdlib\typing.pyi [fs read 8ms] (98ms)
[BG(1)]   binding: c:\Users\User\.vscode\extensions\ms-python.vscode-pylance-2021.5.1\dist\typeshed-fallback\stdlib\typing.pyi (41ms)
[BG(1)]   parsing: c:\Users\User\.vscode\extensions\ms-python.vscode-pylance-2021.5.1\dist\typeshed-fallback\stdlib\_typeshed\__init__.pyi [fs read 3ms] (16ms)
[BG(1)]   binding: c:\Users\User\.vscode\extensions\ms-python.vscode-pylance-2021.5.1\dist\typeshed-fallback\stdlib\_typeshed\__init__.pyi (3ms)
[BG(1)]   parsing: c:\Users\User\.vscode\extensions\ms-python.vscode-pylance-2021.5.1\dist\typeshed-fallback\stdlib\typing_extensions.pyi [fs read 1ms] (11ms)
[BG(1)]   binding: c:\Users\User\.vscode\extensions\ms-python.vscode-pylance-2021.5.1\dist\typeshed-fallback\stdlib\typing_extensions.pyi (3ms)
[BG(1)]   parsing: c:\Development\new-snakecord\snakecord\snakecord\utils\__init__.py [fs read 0ms] (1ms)
[BG(1)]   binding: c:\Development\new-snakecord\snakecord\snakecord\utils\__init__.py ...
[BG(1)]     parsing: c:\Development\new-snakecord\snakecord\snakecord\utils\events.py [fs read 0ms] (18ms)
[BG(1)]     binding: c:\Development\new-snakecord\snakecord\snakecord\utils\events.py (10ms)
[BG(1)]     parsing: c:\Development\new-snakecord\snakecord\snakecord\utils\json.py [fs read 0ms] (14ms)
[BG(1)]     binding: c:\Development\new-snakecord\snakecord\snakecord\utils\json.py (5ms)
[BG(1)]     parsing: c:\Development\new-snakecord\snakecord\snakecord\utils\misc.py [fs read 0ms] (3ms)
[BG(1)]     binding: c:\Development\new-snakecord\snakecord\snakecord\utils\misc.py (0ms)
[BG(1)]     parsing: c:\Development\new-snakecord\snakecord\snakecord\utils\snowflake.py [fs read 0ms] (8ms)
[BG(1)]     binding: c:\Development\new-snakecord\snakecord\snakecord\utils\snowflake.py (5ms)
[BG(1)]     parsing: c:\Development\new-snakecord\snakecord\snakecord\utils\undefined.py [fs read 1ms] (3ms)
[BG(1)]     binding: c:\Development\new-snakecord\snakecord\snakecord\utils\undefined.py (0ms)
[BG(1)]   binding: c:\Development\new-snakecord\snakecord\snakecord\utils\__init__.py (70ms)
[BG(1)] getSemanticTokens full at c:\Development\new-snakecord\snakecord\snakecord\test.py (630ms)
Background analysis message: getSemanticTokens range
[BG(1)] getSemanticTokens range 0:0 - 5:0 at c:\Development\new-snakecord\snakecord\snakecord\test.py (1ms)
Background analysis message: analyze
[BG(1)] analyzing: c:\Development\new-snakecord\snakecord\snakecord\test.py ...
[BG(1)]   checking: c:\Development\new-snakecord\snakecord\snakecord\test.py (7ms)
[BG(1)] analyzing: c:\Development\new-snakecord\snakecord\snakecord\test.py (8ms)
Background analysis message: resumeAnalysis
Background analysis message: getDiagnosticsForRange
Background analysis message: getDiagnosticsForRange
[FG] parsing: c:\Development\new-snakecord\snakecord\snakecord\test.py (16ms)
[FG] parsing: c:\Users\User\.vscode\extensions\ms-python.vscode-pylance-2021.5.1\dist\typeshed-fallback\stdlib\builtins.pyi [fs read 4ms] (140ms)
[FG] binding: c:\Users\User\.vscode\extensions\ms-python.vscode-pylance-2021.5.1\dist\typeshed-fallback\stdlib\builtins.pyi (54ms)
[FG] binding: c:\Development\new-snakecord\snakecord\snakecord\test.py (0ms)

Code Snippet / Additional information

from .utils import EventDispatcher


class Something(a=EventDispatcher):
    pass

Capture

@erictraut
Copy link
Contributor

Thanks for the bug report. This will be fixed in the next release.

@erictraut erictraut added the fixed in next version A fix has been implemented and will appear in an upcoming version label May 14, 2021
@jakebailey
Copy link
Member

This issue has been fixed in version 2021.5.3, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202153-19-may-2021

@ChrisCarucci
Copy link

That's funny, I'm getting this error with the updated version.

@erictraut
Copy link
Contributor

@ChrisCarucci, this issue is closed. If you think that you are experiencing a bug, please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

4 participants