mirror of
https://github.com/Instagram/LibCST.git
synced 2025-12-23 10:35:53 +00:00
**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.
50 lines
856 B
ReStructuredText
50 lines
856 B
ReStructuredText
.. LibCST documentation master file, created by
|
|
sphinx-quickstart on Wed Jul 17 17:05:21 2019.
|
|
You can adapt this file completely to your liking, but it should at least
|
|
contain the root `toctree` directive.
|
|
|
|
======
|
|
LibCST
|
|
======
|
|
|
|
.. include:: ../../README.rst
|
|
:start-after: intro-start
|
|
:end-before: intro-end
|
|
|
|
.. toctree::
|
|
:maxdepth: 2
|
|
:caption: Introduction:
|
|
|
|
why_libcst
|
|
motivation
|
|
|
|
|
|
.. toctree::
|
|
:maxdepth: 2
|
|
:caption: Tutorial:
|
|
|
|
Parsing and Visitors <tutorial>
|
|
Metadata <metadata_tutorial>
|
|
Scope Analysis <scope_tutorial>
|
|
Matchers <matchers_tutorial>
|
|
Best Practices <best_practices>
|
|
|
|
|
|
.. toctree::
|
|
:maxdepth: 2
|
|
:caption: Reference:
|
|
|
|
parser
|
|
nodes
|
|
visitors
|
|
metadata
|
|
matchers
|
|
experimental
|
|
|
|
|
|
Indices and tables
|
|
==================
|
|
|
|
* :ref:`genindex`
|
|
* :ref:`modindex`
|
|
* :ref:`search`
|