PY-79967 Support t-prefixed strings, Related PR: https://github.com/JetBrains/intellij-community/pull/302

* Add PYTHON314_PREFIXES to CompatibilityVisitor
* Patch typeshed, add t-string related stubs
* Infer `string.templatelib.Template` type for t-strings instead of plain `str`



GitOrigin-RevId: 0e913910ab9e0dca4052856b0585ce66265291c0
This commit is contained in:
Koudai Aono
2024-09-16 04:46:29 +09:00
committed by intellij-monorepo-bot
parent a1846f3078
commit 7239d2ef2c
11 changed files with 787 additions and 638 deletions

View File

@@ -117,4 +117,14 @@ public interface PyAstStringElement extends PsiElement {
* is allowed to have such prefix.
*/
boolean isFormatted();
/**
* Returns whether this string literal contains "t" or "T" prefix.
* <p>
* Template strings (t-strings) are a new feature in Python 3.14 for handling
* text templates with embedded expressions.
*/
default boolean isTemplate() {
return StringUtil.containsIgnoreCase(getPrefix(), "t");
}
}