Commit graph

1099 commits

Author SHA1 Message Date
Lisa Roach
068b90595f
Fixes TypeInferenceProvider breakage with empty cache. (#476)
* Fixes TypeInferenceProvider breakage with empty cache.
2021-04-08 08:33:32 +01:00
Lisa Roach
e759ca8290
Fix leaking processes from TypeInferenceProvider (#474)
* Switches to subprocess.run.

* Updates cmd to avoid string escaping.
2021-04-02 20:08:54 +01:00
Zsolt Dollenstein
27ef2bf10e
Bump version to 0.3.18 (#470) 2021-03-29 09:49:29 -07:00
Tim Hatch
9a6fd56653
Improve handling of raw fstrings (#462) (#466) 2021-03-29 09:08:05 +01:00
Zsolt Dollenstein
1bd1c0890c
Add FullyQualifiedNameProvider (#465) 2021-03-26 17:15:57 +00:00
Luke Petre
4ab866e40f
Add BuiltinScope (#469)
* Add more builtin tests

* Introduce a BuiltinScope that sits above GlobalScope

* Address comments and fix lint

* Updating documentation

* Update scope illustration

* Add BuiltinScope to libcst.metadata

* Lazily create builtin assignments, update scope diagram
2021-03-24 12:12:56 -07:00
Caleb Donovick
0ee0831eb6
Add FlattenSentinel to support replacing a statement with multiple statements (#455)
* Add flatten_sentinal

* Add FlattenSentinal to __all__

* Fix lint errors

* Fix type errors

* Update test to use leave_Return

* Update and run codegen

* Add empty test

* Update docs

* autofix
2021-03-22 23:23:40 -07:00
Zsolt Dollenstein
507b453e74
Split QualifiedNameProvider out from libcst.metadata.scope_provider (#464)
* Split QualifiedNameProvider out of scope_provider.py

* merge test_qualified_name_provider into test_name_provider
2021-03-12 10:10:44 +00:00
Jimmy Lai
39ff458270
Bump version to 0.3.17 (#456) 2021-02-08 13:57:30 -08:00
Caleb Donovick
dacafdea8c
Update README.rst: venv dir must **not** be inside the libcst dir (#454)
Just spent a couple hours trying to figure out why I couldn't get pyre to work.  Only to figure out that having my venv inside the libcst dir was breaking pyre.
2021-02-08 10:51:49 -08:00
Zac Hatfield-Dodds
546f6289d3
Use dummy pool for jobs=1 (#436) 2021-01-27 10:14:37 +00:00
Bruno Alla
f78de1b786
Fix context.scratch leaking across files (#453) 2021-01-27 10:02:17 +00:00
Maggie Moss
c22ed6a4c6
Fix bug in apply annotations, add test. (#445) 2021-01-07 22:22:50 +00:00
Sebastian Kreft
ac381613ad
optimization: reduce the number of unused parallel processes (#440)
Instead of always launching the specified number of jobs or cpu_count, we should take into account how many files need to be processed and how many files are delivered at once to each process.

Note that this is similar to what fixit does, although they don't specify a chunk size.
2021-01-04 22:09:27 +08:00
Zsolt Dollenstein
df231f3fa5
bump version to 0.3.16 (#432) 2020-12-16 20:07:26 +00:00
Zsolt Dollenstein
1571cddc0c
Walrus operator's left hand side now has STORE expression context (#433) 2020-12-16 19:58:25 +00:00
Germán Méndez Bravo
753a4f575e
Gathering exports in augmented assignment statements (#426) 2020-12-15 18:17:44 -08:00
Ben Green
88dd0c39f0
Support PEP-604 style unions in decorator annotations (#429)
These unions were introduced in Python 3.10 and do not define __origin__,
so some extra checks are necessary to identify then. Since there is not
yet a 3.10 build, a somewhat hacky test was added to simulate one of
these new Unions.

Resolves #414.
2020-12-15 13:26:35 +00:00
Zsolt Dollenstein
660e533610
Don't allow out of order accesses in the global scope (#431) 2020-12-15 20:46:15 +08:00
Zsolt Dollenstein
5940211af5
Handle scope ordering in For statements (#430)
* Handle scope ordering in For statements

* no need to increment after For anymore
2020-12-15 16:58:56 +08:00
Germán Méndez Bravo
2f117f0bc3
Fix for not parsing subscripts such as cast()["from"] (#428) 2020-12-08 09:48:09 +08:00
Germán Méndez Bravo
8eee3cc922
Bump to version 0.3.15 (#425) 2020-12-01 11:21:15 -08:00
Zsolt Dollenstein
1326a0ee64
fix assignment/access ordering in comprehensions (#423) 2020-12-01 13:01:29 +00:00
Germán Méndez Bravo
2485d5a967
[Scope] Fix referencing of remaining objects in cast() (#422) 2020-11-30 12:50:23 +08:00
Tim Hatch
02fc4401bc
Support Named Unicode Characters and yield in f-strings (#424)
* Support named unicode characters in f-strings

This is the same as my pull request
https://github.com/davidhalter/parso/pull/160

* A small bugfix to what is allowed in f-string expressions

Thanks to https://github.com/davidhalter/parso/pull/159 for catching
that yield (as an expression, I suppose) is allowed on 3.6.
2020-11-30 12:42:13 +08:00
Zsolt Dollenstein
16b30fe4c3
add missing license header (#421) 2020-11-19 07:34:26 +08:00
Zsolt Dollenstein
77d8a903ee
bump version to 0.3.14 (#420)
* bump version to 0.3.14

* add whitespace
2020-11-18 09:55:35 +00:00
Germán Méndez Bravo
110095148f
Handle string type references in cast() (#418)
* Handle string type references in cast()

* Directly visit the first argument of cast()

Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>

Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
2020-11-17 18:55:44 +00:00
Zsolt Dollenstein
2ef730292b
[scope] keep track of assignment/access ordering (#413) 2020-11-17 17:40:50 +00:00
Tim Hatch
90df5a6a37
Allow generator expressions in f-strings (#419)
Fixes #388
2020-11-17 17:32:43 +00:00
Tim Hatch
31bae01ccb
Correct handling of walrus operator in function args (#417)
Previous behavior treated it as identical to equal, making a kwarg; it should
instead be a positional arg.  Includes several tests to make sure that
whitespace handling is correct.

Fixes #416
2020-11-12 21:14:34 -08:00
Aarni Koskela
7478d738ea
Codemod CLI multiprocessing simplification (#402)
Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
2020-11-09 12:59:36 +00:00
Zsolt Dollenstein
dd521f51e2
[scope] Visit concatenated f-strings (#411)
This PR makes sure scope analysis visits nodes under a ConcatenatedString.
2020-11-06 10:32:29 +00:00
Zsolt Dollenstein
a5de9e40a0
Pin linters (#412)
* pin linter versions
* fix lint errors
2020-11-03 18:28:05 +00:00
luciawlli
a1b1ae45d5
Add Access.is_type_hint for types used in classdef base and assignment values (#406) 2020-10-28 11:48:06 +00:00
Germán Méndez Bravo
01c8098965
Bump to version 0.3.13 (#403) 2020-10-12 14:04:44 -07:00
Germán Méndez Bravo
21d37b94b2
Support string annotations for type aliases (#401) 2020-10-12 11:12:28 -07:00
Caleb Donovick
6731aa5d29
Use correct type for AugAssign and AnnAssign target (#396)
* Use correct type

* Add tests

* Suppress intentional type errors in pyre
2020-10-01 13:45:41 -07:00
Zsolt Dollenstein
10d6451067
bump version to 0.3.12 (#398) 2020-10-01 15:49:02 +01:00
Zsolt Dollenstein
1d22a29d18
fix RemoveImportsVisitor crash when ImportAlias is inserted without comma (#397)
The comment preserving logic introduced in #392 assumed that in an ImportFrom node, ImportAliases have a comma property (except for the last one). That's only true if the ImportFrom node is parsed from actual source, but isn't necessarily true if it's constructed manually.
2020-10-01 10:50:04 +01:00
Caleb Donovick
34c1826c18
Provide STORE for {Class,Function}Def.name in ExpressionContextProvider (#394)
* Add failing test cases

* mark *Def names as STORE

* Update libcst/metadata/expression_context_provider.py

Co-authored-by: Jimmy Lai <yurinai@gmail.com>

* Fix lint

* Visit annotations and params

* Fix and extend tests

Co-authored-by: Jimmy Lai <yurinai@gmail.com>
2020-09-29 09:45:50 -07:00
Zsolt Dollenstein
efe0fdbf31
bump version to 0.3.11 (#395) 2020-09-28 09:28:07 -07:00
Zsolt Dollenstein
0a4d1e4985
Removing an import alias with a trailing standalone comment should preserve the comment (#392)
* failing test case

* implement fix

* fix linters
2020-09-24 14:31:39 -07:00
Batuhan Taskaya
6ae25834bb
Implement TypeOf matcher (#384)
* Implement TypeOf matcher

* Satisfy the type checker

* Expand the test case

* Fix the annotation of _raw_options

* Add documentation...
2020-09-10 11:09:59 -07:00
Jimmy Lai
6a02e2e995
[CI] add Fixit to tox -e lint (#386) 2020-09-09 17:33:49 -07:00
Jimmy Lai
3e63f914e5
[README] update Codecov badge (#382) 2020-09-06 09:29:12 +01:00
Jimmy Lai
7ca738bf39
Upgrade dev tools (Black/Flake8/isort) and read install requirements from requirements.txt (#380)
* Read install requirements from requirements.txt

* read extras_require from requirements-dev.txt

* add requirements-dev.txt to MANIFEST.in

* apply fixes for new version of Black and Flake8

* don't upgrade Pyre

* re-format
2020-08-31 10:44:55 -07:00
Jimmy Lai
748ae71909
[docs] add source code links to each class/function (#378) 2020-08-20 17:15:21 -07:00
Jimmy Lai
dc6e7ba6f7
[metadata] update return type of ParentNodeProvider to be CSTNode (#377) 2020-08-17 15:09:13 -07:00
Germán Méndez Bravo
6f9a12c538
Bump to version 0.3.10 (#376)
(cherry picked from commit aa1f7ced5d55ff059868964f26e0621a7afd5332)
2020-08-17 10:58:14 -07:00