apache / gravitino

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
https://gravitino.apache.org
Apache License 2.0
1.1k stars 348 forks source link

[Improvement] reportUndefinedVariable warning in types.py #5536

Open SophieTech88 opened 2 weeks ago

SophieTech88 commented 2 weeks ago

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

https://github.com/apache/gravitino/issues/5200