injector_fw¶
LibCST Transformer for Injecting Framework Mappings.
This package provides the logic to modify framework adapter files (e.g. torch.py) by locating the specific class registered for a framework and injecting a new StandardMap definition into its definitions property.
It handles:
Definitions Injection: Appending the mapping to the definitions dictionary.
Smart Import Injection: Analyzing the target API path (e.g. scipy.special.erf) and injecting necessary top-level imports (import scipy) if missing.
Variant Parameter Injection: Supporting inject_args for adding fixed arguments.
Complex Literal Support: Recursively converting Lists, Tuples, and Dicts to CST nodes.