I'm using Tree-sitter to parse Python code and extract ASTs, and trying to manually traverse ASTs to infer types based on assignments and function definitions.
But I'm struggling with accurately resolving types (variables, functions, classes) due to Python's dynamic typing. Specifically, challenges arise with:
- Inferring types in dynamically typed contexts.
- Handling types from external modules/packages.
- Leveraging Python's type annotations for improved type resolution.
I just need to resolve type that I have defined in my repository.
For example:
car.py class Car# ...Now in a different class:
from car import Carcar = Car()# ...bmw = car# ...I need to know BMW is a car.
How can I successfully navigate type resolution in Python with Tree-sitter?