mirror of
https://github.com/Instagram/LibCST.git
synced 2025-12-23 10:35:53 +00:00
We already have several places in unit tests that need this, as well as a spot in an existing codemod that could benefit from it. So, implement ensure_type which can be used to refine the type of a node to an exact node type. I purposefully left the node type as 'object' instead of libcst.CSTNode so that it could be used with RemovalSentinel or MaybeSentinel without needing to import these. |
||
|---|---|---|
| .. | ||
| metadata | ||
| nodes | ||
| parser | ||
| testing | ||
| tests | ||
| __init__.py | ||
| _add_slots.py | ||
| _maybe_sentinel.py | ||
| _removal_sentinel.py | ||
| _tabs.py | ||
| _type_enforce.py | ||
| batched_visitor.py | ||
| exceptions.py | ||
| helpers.py | ||
| matchers.py | ||
| tool.py | ||
| visitors.py | ||