LibCST/libcst/_nodes
Benjamin Woodruff 88ac18872c Add a reentrant (incremental) codegen API
**Context:** This is an experimental performance optimization that we're
hoping to use for our internal linter at Instagram. I added some
documentation, but it's unsupported, and isn't very user-friendly.

This adds `ExperimentalReentrantCodegenProvider`, which tracks the
codegen's internal state (indentation level, character offsets,
encoding, etc.) and for each statement, it stores a `CodegenPartial`
object.

The `CodegenPartial` object has enough information about the previous
codegen pass to run the codegen on part of a tree and patch the result
back into the original module's string.

In cases where we need to generate a bunch of small independent patches
for the same file (and we can't just generate a new tree with each patch
applied), this *should* be a faster alternative.

I don't have any performance numbers because I still need to test this
end-to-end with our internal codebase, but I'd be shocked if it was
slower than what we're doing.

This could theoretically live outside of LibCST, but it depends on a
whole bunch of LibCST internals, so there's some value in making sure
that this is in sync with the rest of LibCST.
2019-10-28 17:23:26 -07:00
..
tests Add a reentrant (incremental) codegen API 2019-10-28 17:23:26 -07:00
__init__.py Make nodes package private 2019-07-26 12:48:22 -07:00
base.py Rename before_visit/after_leave to before_codegen/after_codegen 2019-10-28 11:05:35 -07:00
deep_equals.py Fix internal underscore convention. 2019-09-17 13:52:42 -07:00
expression.py Implement the walrus operator node as NamedExpr. 2019-10-24 15:25:21 -07:00
internal.py Add a reentrant (incremental) codegen API 2019-10-28 17:23:26 -07:00
module.py Add a reentrant (incremental) codegen API 2019-10-28 17:23:26 -07:00
op.py Fix non-unique tree generated by LibCST in some circumstances. 2019-09-25 12:36:33 -07:00
statement.py Fix non-unique tree generated by LibCST in some circumstances. 2019-09-25 12:36:33 -07:00
whitespace.py Fix non-unique tree generated by LibCST in some circumstances. 2019-09-25 12:36:33 -07:00