Commit graph

7 commits

Author SHA1 Message Date
Zsolt Dollenstein
6a5e7394c0
[RemoveUnusedImports] Support string type annotations (#353)
* [RemoveUnusedImports] Support string type annotations

This PR adds support for detecting imports being used by string type
annotations, as well as imports suppressed by comments.

It breaks up the existing visitor into multiple smaller, single-purpose
visitors, and composes them together.
2020-07-31 15:54:39 +01:00
Pradeep Kumar Srinivasan
1b9a52b074 Apply annotations from stub.
Basically move the apply_annotations code from Pyre.

Make it a ContextAwareTransformer named ApplyTypeAnnotationsVisitor. Use GatherImportsVisitor to collect imports. Add a static method `add_stub_to_context` so that users can schedule a stub whose types are to be applied later. Use `assertCodemod` and `data_provider` in the tests. Add documentation. Remove fixmes.
2020-03-23 09:16:37 -07:00
Jennifer Taylor
0ff9a6c5b7 Add a visitor which can remove unused imports using scope analysis. 2020-02-18 16:02:10 -08:00
Jennifer Taylor
8479513e8f Add a visitor that can gather exports specified in the __all__ module identifier. 2020-02-18 16:02:10 -08:00
Jimmy Lai
257fd5755e move ensure_future to libcst.helpers.expression 2020-01-10 12:15:38 -08:00
Jennifer Taylor
b319312de3 Add docstring for CodemodTest. 2020-01-08 17:17:48 -08:00
Jennifer Taylor
9bfc4faea9 Add documentation for libcst.codemod and friends. 2019-12-17 11:59:51 -08:00