LibCST
LibCST copied to clipboard
Add data to nodes
I would like to add some data around cst objects, e.g., for function calls where the function was defined. To this end, I need to add attributes to cst objects, see this discussion. Unfortunately, this is not possible right now since all objects are protected from adding attributes via __slotted__ (or @add_slots).
Is there another way for adding data to nodes?
Normally I'd recommend metadata providers for this; while they're a bit cumbersome, they essentially let you store arbitrary data keyed by the identity of a CSTNode.