Implement PEP 585 annotation rewrites (#368)

This commit is contained in:
Charlie Marsh
2022-10-08 18:22:24 -04:00
committed by GitHub
parent 2bba643dd2
commit 806f3fd4f6
8 changed files with 138 additions and 4 deletions

View File

@@ -92,3 +92,10 @@ pub fn is_annotated_subscript(name: &str) -> bool {
pub fn is_pep593_annotated_subscript(name: &str) -> bool {
name == "Annotated"
}
static PEP_585_BUILTINS: Lazy<BTreeSet<&'static str>> =
Lazy::new(|| BTreeSet::from(["Dict", "FrozenSet", "List", "Set", "Tuple", "Type"]));
pub fn is_pep585_builtin(name: &str) -> bool {
PEP_585_BUILTINS.contains(name)
}