ruff/crates/ty_python_semantic/src
David Peter f73bb45be6
[ty] Rename Type unwrapping methods (#20857)
## Summary

Rename "unwrapping" methods on `Type` from e.g.
`Type::into_class_literal` to `Type::as_class_literal`. I personally
find that name more intuitive, since no transformation of any kind is
happening. We are just unwrapping from certain enum variants. An
alternative would be `try_as_class_literal`, which would follow the
[`strum` naming
scheme](https://docs.rs/strum/latest/strum/derive.EnumTryAs.html), but
is slightly longer.

Also rename `Type::into_callable` to `Type::try_upcast_to_callable`.
Note that I intentionally kept names like
`FunctionType::into_callable_type`, because those return `CallableType`,
not `Option<Type<…>>`.

## Test Plan

Pure refactoring
2025-10-14 09:53:29 +02:00
..
module_resolver [ty] Enforce that typing_extensions must come from a stdlib search path (#20715) 2025-10-06 11:43:34 +00:00
semantic_index [ty] Rename Type unwrapping methods (#20857) 2025-10-14 09:53:29 +02:00
types [ty] Rename Type unwrapping methods (#20857) 2025-10-14 09:53:29 +02:00
util [ty] Avoid overcounting shared memory usage (#19773) 2025-08-06 15:32:02 -04:00
ast_node_ref.rs [ty] Implement the legacy PEP-484 convention for indicating positional-only parameters (#20248) 2025-09-05 17:56:06 +01:00
db.rs [ty] Track open files in the server (#19264) 2025-07-18 19:33:35 +05:30
dunder_all.rs [ty] Integrate type context for bidirectional inference (#20337) 2025-09-11 15:19:12 -04:00
lib.rs [ty] Move class_member to member module (#20837) 2025-10-13 10:58:37 +02:00
lint.rs [ty] Add LSP debug information command (#20379) 2025-09-20 11:15:13 +00:00
list.rs Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
module_name.rs [ty] Export some stuff from ty_python_semantic 2025-09-17 13:59:28 -04:00
node_key.rs [ty] Implement the legacy PEP-484 convention for indicating positional-only parameters (#20248) 2025-09-05 17:56:06 +01:00
place.rs [ty] Rename Type unwrapping methods (#20857) 2025-10-14 09:53:29 +02:00
program.rs [ty] Track heap usage of salsa structs (#19790) 2025-08-12 13:28:44 +02:00
pull_types.rs Update Rust toolchain to 1.88 and MSRV to 1.86 (#19011) 2025-06-28 20:24:00 +02:00
python_platform.rs [ty] Track heap usage of salsa structs (#19790) 2025-08-12 13:28:44 +02:00
rank.rs [ty] Garbage-collect reachability constraints (#19414) 2025-07-21 14:16:27 -04:00
semantic_index.rs [ty] Implement the legacy PEP-484 convention for indicating positional-only parameters (#20248) 2025-09-05 17:56:06 +01:00
semantic_model.rs [ty] Do not re-export ide_support attributes from types (#20769) 2025-10-08 17:45:28 +02:00
site_packages.rs [ty] improve base conda distinction from child conda (#20675) 2025-10-03 13:56:06 +00:00
suppression.rs Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
types.rs [ty] Rename Type unwrapping methods (#20857) 2025-10-14 09:53:29 +02:00
unpack.rs [ty] Track heap usage of salsa structs (#19790) 2025-08-12 13:28:44 +02:00