mirror of
https://github.com/Instagram/LibCST.git
synced 2025-12-23 10:35:53 +00:00
This PR adds support for parsing and representing Type Parameters and Type Aliases as specified by PEP 695. What's missing are the scope rules, to be implemented in a future PR. Notable (user visible) changes: - new `TypeAlias` CST node, which is a `SmallStatement` - new CST nodes to represent TypeVarLikes: `TypeVar`, `TypeVarTuple`, `ParamSpec` - new helper CST nodes: `TypeParameters` to serve as a container for multiple TypeVarLikes, and `TypeParam` which is a single item in a `TypeParameters` (owning the separating comma) - extended `FunctionDef` and `ClassDef` with an optional `type_parameters` field, as well as `whitespace_after_type_parameters` to own the extra whitespace between type parameters and the following token - these new fields are added after all others to avoid breaking callers passing in fields as positional arguments - in `FunctionDef` and `ClassDef`, `whitespace_after_name` now owns the whitespace before the type parameters if they exist |
||
|---|---|---|
| .. | ||
| tests | ||
| __init__.py | ||
| base.py | ||
| deep_equals.py | ||
| expression.py | ||
| internal.py | ||
| module.py | ||
| op.py | ||
| statement.py | ||
| whitespace.py | ||