LibCST/libcst/metadata
Benjamin Woodruff 42c3f3f267 Add an unsafe_skip_copy option to MetadataWrapper
In certain cases (e.g. inside Instagram's lint framework) we know that
our tree originates from the parser, so we know that there shouldn't be
any duplicate nodes in our tree.

MetadataWrapper exists to copy the tree ensuring that there's no
duplicate nodes.

This diff provides an escape hatch on MetadataWrapper that allows us to
save a little time and avoid a copy when we know that it's safe to skip
the copy.

As part of this, I ran into some issues with `InitVar` and pyre, so I
removed `@dataclass` from the class. This means that this is techincally
a breaking change if someone depended on the MetadataWrapper being an
actual dataclass, but I think this is unlikely. I implemented `__repr__`
and added tests for hashing/equality behavior.
2019-10-29 13:35:38 -07:00
..
tests Add an unsafe_skip_copy option to MetadataWrapper 2019-10-29 13:35:38 -07:00
__init__.py Add a reentrant (incremental) codegen API 2019-10-28 17:23:26 -07:00
_resolver.py Update docstrings to reflect changes in API 2019-08-09 17:27:20 -07:00
base_provider.py Make BaseMetadataProvider[T] covariant over T 2019-10-10 18:08:44 -07:00
expression_context_provider.py rewrite ExpressionContextProvider to handle nested List/Tuple and Attribute 2019-10-04 15:16:55 -07:00
parent_node_provider.py add parent node metadata provider 2019-09-26 17:39:16 -07:00
position_provider.py Add a reentrant (incremental) codegen API 2019-10-28 17:23:26 -07:00
reentrant_codegen.py Rename CodegenPartial.get_*_node_code to get_*_statement_code 2019-10-28 17:23:26 -07:00
scope_provider.py add node to all LocalScope 2019-10-23 14:15:08 -07:00
wrapper.py Add an unsafe_skip_copy option to MetadataWrapper 2019-10-29 13:35:38 -07:00