Commit graph

10 commits

Author SHA1 Message Date
Jennifer Taylor
1190dc8a2f Import parser from the top level
This was a pain, because apparently we can't refer to
"static_analysis.libcst" as a module before its finished executing, due
to https://bugs.python.org/issue25294. To combat this, I had to change
to direct importing inside parser, which was a bit of a pain due to the
number of nodes used. But, it works.
2019-07-26 12:48:22 -07:00
Jennifer Taylor
032cd49e6d Import nodes from top level instead of libcst.nodes 2019-07-26 12:48:22 -07:00
Jennifer Taylor
3dec7be6ef Export things from libcst's base__init__.py
Go through and clean up where we export things from in the top level
directories. This is the first pass at cleaning up the public API. In
this diff I clean up all top-level exports that were coming out of .py
files and instead export them from libcst's base module itself.

I also didn't export a few of the things defined in newly underscored
files because they were only used internally.
2019-07-26 12:48:22 -07:00
Ray Zeng
0b0ffb8824 Fix batched vistor dependency resolution
Adds logic to gather metadata dependencies from `BatchableCSTVisitors`
when constructing a batched visitor.
2019-07-22 20:04:37 -07:00
Ray Zeng
9e622ac74e Define batchable visitors
Defines a batchable visitor API for libcst.
2019-07-22 20:04:37 -07:00
Benjamin Woodruff
8fba418f2c Add runtime type validation support
This ports `CSTNode.validate_types_shallow` and
`CSTNode.validate_types_deep`, as well as `libcst._type_enforce` to the
open-source release.

These are useful if someone wants to use LibCST without a static type
checker.

These weren't originally included because `libcst._type_enforce` wasn't
3.7 compatible.
2019-07-22 19:53:49 -07:00
Benjamin Woodruff
76b5ac0de2 Add config files to make tools easier to use
- `pyproject.toml` is supported by isort and black, and lets us call
  those tools without supplying a ton of arguments.
- `.editorconfig` is supported by a wide range of editors, and can
  automatically set per-project configuration.
- `.pyre_configuration` is used by pyre.
- I added test discovery to the `setup.py` file, which required some
  extra `__init__.py` files.
2019-07-22 19:53:49 -07:00
Benjamin Woodruff
7c069518a5 Make libcst/tests/test_tool.py pyre-strict 2019-07-22 19:53:49 -07:00
Jennifer Taylor
bb72c70a3b Hand-roll print instead of using implicit repr, allowing us to filter
most irrelevant node attributes out.
2019-06-05 14:25:29 -07:00
Jennifer Taylor
0719faa198 Initial export of LibCST to github. 2019-05-31 14:16:53 -07:00