ruff
b1b2e384 - [ty] Add public `class_name` and `class_module_name` methods to `NominalInstanceType` (#23147)

Commit
95 days ago
[ty] Add public `class_name` and `class_module_name` methods to `NominalInstanceType` (#23147) Add two public convenience methods to `NominalInstanceType` so that external crates can retrieve the class name and defining module of an instance type without needing access to the `pub(super)` `class()` method or `pub(crate)` types like `ClassType` and `ClassLiteral`: - `class_name(&self, db) -> &Name`: Returns the class name (e.g. `"str"`) - `class_module_name(&self, db) -> Option<&ModuleName>`: Returns the fully qualified module name where the class is defined (e.g. `"pathlib"` for `pathlib.Path`), or `None` for scripts/notebooks. This enables tools that use `ty_python_semantic` as a library to extract structured type information from instance types for use cases like type attribution in code transformation tools.
Author
Parents
Loading