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

[Improvement] reportUndefinedVariable warning in types.py #5536

Open
SophieTech88 opened this issue Nov 11, 2024 · 0 comments
Open

[Improvement] reportUndefinedVariable warning in types.py #5536

SophieTech88 opened this issue Nov 11, 2024 · 0 comments
Labels
improvement Improvements on everything

Comments

@SophieTech88
Copy link
Contributor

SophieTech88 commented Nov 11, 2024

What would you like to be improved?

In the types.py for python client, I find there is a reportUndefinedVariable warning.

It is because in Python, when a class is nested inside another class, its full name includes the enclosing class (e.g., Types.NullType). If you omit the enclosing class (Types), the type checker (e.g., Pylance) cannot resolve the type correctly, leading to the reportUndefinedVariable warning.

How should we improve?

Add the Types. as a header to update the type variables in the types.py
Example: replace the _instance: "NullType" = None to _instance: Types.NullType = None.

related issue

#5200

@SophieTech88 SophieTech88 added the improvement Improvements on everything label Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvements on everything
Projects
None yet
Development

No branches or pull requests

1 participant