Jimmy Lai
dea7c20794
add warning box to clarify Scope metadata only handles local variable
2019-10-08 15:48:59 -07:00
Jimmy Lai
9f8e69b1b3
[doc] use libcst.metadata for referencing metadata classes and add docstring for Scope magic functions
2019-10-08 15:48:59 -07:00
Jimmy Lai
c9dc3bfa70
address review feedback in #94
2019-10-08 15:48:59 -07:00
Jimmy Lai
13637b7d58
add docs for Assignments and Accesses
2019-10-08 15:48:59 -07:00
Jimmy Lai
855232e24f
test Access.referents and Assignment.references
2019-10-08 15:48:59 -07:00
Jimmy Lai
65cc4d23bd
add test case for Assignments and Accesses
2019-10-08 15:48:59 -07:00
Jimmy Lai
392426d6bd
add Scope.record_access and Access.record_assignment
2019-10-08 15:48:59 -07:00
Jimmy Lai
ee14c48e46
add Scope.assignments and Scope.accesses
2019-10-08 15:48:59 -07:00
Jimmy Lai
7a2d0048c7
add deprecation message to Assignment.accesses
2019-10-08 15:48:59 -07:00
Jimmy Lai
120fd04ce2
rename Assignment.accesses as Assignment.references and add Accesses/Assignments
2019-10-08 15:48:59 -07:00
Christopher Hunt
6520d25816
Fix visitor helper function name pattern in docs
2019-10-04 21:40:52 -07:00
Jimmy Lai
c92bc02d8c
rewrite ExpressionContextProvider to handle nested List/Tuple and Attribute
2019-10-04 15:16:55 -07:00
Jennifer Taylor
08b6657db2
Bump version to 0.2.0, update changelog.
2019-10-04 13:13:30 -07:00
Jennifer Taylor
8a8ea4b27b
Upgrade Pyre to 0.32.
...
This fixes a TODO, removes several ignore statements and most importantly, addresses a massive speed regression triggered by importing matchers.
2019-10-04 11:05:37 -07:00
Jennifer Taylor
27b5a1d286
Improve removing nodes from parents in LibCST.
...
Add a RemoveFromParent() function as a convenience to returning RemovalSentinel.REMOVE.
Introduce a `deep_remove()` on CSTNode analogous to `deep_replace()` but for removing.
2019-10-02 15:43:48 -07:00
Jennifer Taylor
2383bea74b
Export ProviderT so it can be used to type METADATA_DEPENDENCIES.
2019-10-02 15:15:18 -07:00
Jennifer Taylor
9fa2612673
Implement deep_replace helper on CSTNode.
2019-10-02 14:00:20 -07:00
Jimmy Lai
7b96b070ca
Organize document menu as three parts: introduction, tutorial and reference
2019-10-02 12:26:35 -07:00
Jennifer Taylor
32037efab9
Add a tutorial for matchers.
2019-10-01 15:28:58 -07:00
Jennifer Taylor
e8c19a983c
Fix issue with matchers that combine both @call and @visit decorators.
2019-10-01 15:28:58 -07:00
Jennifer Taylor
90ec997687
Fix warning in docs creation relating to scope provider.
2019-10-01 15:28:58 -07:00
Jennifer Taylor
e2868f703b
Add documentation to matchers.
2019-10-01 15:28:58 -07:00
Jennifer Taylor
271566bdbf
Add a .remove() method to CSTNode as a convenience to returning RemovalSentinel.REMOVE
2019-10-01 15:28:58 -07:00
Jimmy Lai
1488126df5
fix import asname support in get_qualified_names_for and add tests/docs
2019-10-01 14:24:20 -07:00
Jimmy Lai
826765bd93
add QualifiedNameProvider
2019-10-01 14:24:20 -07:00
Jimmy Lai
0948108dce
add binder link to notebook tutorial page
2019-10-01 13:41:29 -07:00
Jimmy Lai
cd25f15ff7
consolidate metadata imports
2019-10-01 13:40:24 -07:00
Jimmy Lai
fc2d8f8697
avoid redefine builtin function range
2019-09-30 14:38:25 -07:00
Jimmy Lai
9945a9b970
merge isinstance calls to be more simple and fast
2019-09-30 14:38:25 -07:00
Jimmy Lai
6680c2d05f
add nested function/class test cases and documents to Qualified Name Metadata
2019-09-30 12:03:19 -07:00
Jimmy Lai
1bdce26bf3
add QualifiedNameSource.BUILTIN and address review comments
2019-09-30 12:03:19 -07:00
Jimmy Lai
50b3c61794
add docs of get_qualified_names_for
2019-09-30 12:03:19 -07:00
Jimmy Lai
9fcf84cf2c
add QualifiedName and QualifiedNameSource enum
2019-09-30 12:03:19 -07:00
Jimmy Lai
881348df27
add get_fully_qualified_names_for tests for subscript and SimpleString typing
2019-09-30 12:03:19 -07:00
Jimmy Lai
e24ca294b6
use LocalScope in ScopeVisitor._new_scope to simplify typing
2019-09-30 12:03:19 -07:00
Jimmy Lai
894a0f7424
add local assignment (non-import assignment) supports to get_fully_qualified_names_for
2019-09-30 12:03:19 -07:00
Jimmy Lai
3123691788
add helper Scope.get_fully_qualified_names_for
2019-09-30 12:03:19 -07:00
jimmylai
4ad2139c8c
Add metadata provider to future in README.
2019-09-27 13:55:26 -07:00
Jennifer Taylor
dd99a424dc
Add future section, based on questions received.
2019-09-27 13:55:26 -07:00
Jennifer Taylor
42760505bf
Clarify LibCST license.
...
Make explicit in the LICENSE and README files the exact files that are not licensed under MIT since being forked. These files already have license information in their headers, but it is always good to be explicit at the top level as well. Also include a copy of the licenses in the LICENSE file to conform with requirements.
2019-09-27 13:55:26 -07:00
Jennifer Taylor
85417b957d
Initial export of matchers into LibCST.
2019-09-27 11:39:11 -07:00
Jimmy Lai
f2303cecd3
remove accidentally committed files.
2019-09-26 17:39:16 -07:00
Jimmy Lai
4cde536678
add more test cases to ParentNodeProviderTest
2019-09-26 17:39:16 -07:00
Jimmy Lai
db6092dffd
add docs of ParentNodeProvider
2019-09-26 17:39:16 -07:00
Jimmy Lai
132549db56
add parent node metadata provider
2019-09-26 17:39:16 -07:00
Jimmy Lai
643acd7771
remove redundant constructor
2019-09-26 17:39:16 -07:00
Jennifer Taylor
1d483ef787
Fix deep_clone behavior regarding BaseLeaf nodes.
...
We used _visit_and_replace_children to implement deep_clone, which was already
bad since it relied on the implicit behavior of _visit_and_replace_children to
make a copy on visit. If we fix that behavior in the future, deep_Clone would
have broken. However, its even more broken, because nodes that subclass from
BaseLeaf define their _visit_and_replace_children as returning self. So, not
only is this a bad coupling, but its also broken. Implement deep_clone properly
here.
2019-09-25 12:36:33 -07:00
Jennifer Taylor
de1db7f0f6
Add a test to verify that deep_clone works.
2019-09-25 12:36:33 -07:00
Jennifer Taylor
93ed095c9e
Fix non-unique tree generated by LibCST in some circumstances.
...
When parsing, we don't always fill in defaults unless we have a good reason to. That, coupled with the fact that we use dataclasses that allow you to set a default on creation instead of runtime construction means that we accidentally aliased a whole bunch of SimpleWhitespace nodes. Fix that by switching to the datalasses field() method which allows runtime evaluation. We do this by creating a simple (untyped, unfortunately) helper on CSTNode which makes for easier creation.
2019-09-25 12:36:33 -07:00
Jennifer Taylor
a6bdc9d03d
Add test case for uniqueness of resulting tree when parsing.
2019-09-25 12:36:33 -07:00