Commit graph

1099 commits

Author SHA1 Message Date
Ray Zeng
953c590088 Rename metadata runner to _resolver 2019-08-06 16:58:56 -07:00
Ray Zeng
f52ee1b1b2 fix Python version details in readme 2019-08-06 16:55:08 -07:00
Ray Zeng
9ae23ce81a Add installation instructions to readme 2019-08-06 16:55:08 -07:00
Jennifer Taylor
101ff70857 Lots of work on Why LibCST section
Fixed Why LibCST printed example as it was out of date.
Unrolled README example into Why LibCST section to decouple since this page explicitly uses "fn(1, 2)" snippet and the readme is going to change.
Added justification and pros/cons to LibCST.
Added graphviz to render the non-default parts of LibCST tree (identical to how we render non-default parts of the AST).
2019-08-06 16:55:08 -07:00
Ray Zeng
f25109bdec Add tagline below logo 2019-08-06 16:55:08 -07:00
Ray Zeng
dbc10f0dc6 Tweak wording of intro 2019-08-06 16:55:08 -07:00
Ray Zeng
0e826834a2 Update readme with shorter examples and test runner examples 2019-08-06 16:55:08 -07:00
jimmylai
6138e74542
[document] add jupyter based tutorial page
* [document] add jupyter based tutorial page

* add return type and fix typos
2019-08-06 16:34:03 -07:00
jimmylai
04804d03af
improve setup.py to be ready for publishing package to pypi
* improve setup.py to be ready for publishing package to pypi

* remove dev from version
2019-08-06 16:09:47 -07:00
Jennifer Taylor
d3ce7da7ce Drop annotation indicator attribute.
We pass down the correct default annotation indicator to use in 100% of code rendering places, so this becomes a useless bit of initialization. We already set this to a sentinel by default, and the only thing that having an explicit str gives us is the inability to copy an annotation from a param to a return or vice versa. So, out it goes. This means we can't render Annotation by itself, so the test that was using this behavior is out too.
2019-08-05 17:13:17 -07:00
Ray Zeng
8428ad906f Added docstring to libcst.tool.dump and reordered args to hint at their precedence 2019-08-05 16:44:19 -07:00
Jennifer Taylor
567fc1884c Refactor libcst.tool to allow for "dump" to be exported. 2019-08-05 16:44:19 -07:00
Jennifer Taylor
944f987b1f Better documentation for visitors. 2019-08-05 10:56:33 -07:00
jimmylai
f7a192306c Add Logo to README 2019-08-05 10:44:17 -07:00
Benjamin Woodruff
593968da65 Add the logo to the docs/source/_static/ directory 2019-08-05 10:44:17 -07:00
Jennifer Taylor
9ca3d39fb6 Rename Ellipses to Ellipsis to match AST and Python stuff. 2019-08-02 17:17:38 -07:00
Benjamin Woodruff
a4af00dd7f Update the expression documentation
I haven't gone through every expression and cleaned it up yet, but I
have completed the `Names and Object Attributes`, `Operations and
Comparisons`, `Control Flow`, and `Lambda and Function Calls` sections,
as well as part of the `Literal Values` section.
2019-08-02 15:50:17 -07:00
Jennifer Taylor
c5c9425d05 Loosen types on deep_equals.
As written, this makes it a type-checker error if you pass in a value of
other that doesn't match the type of the node you're checking against.
If you want to ask a generic question similar to 'Does this equal
Node("True")', you can't use this function. It calls into a helper that
allows for (and checks as a base case) different types to be passed in,
so lets loosen types here to make this useful.
2019-08-02 15:34:37 -07:00
Jennifer Taylor
ac1a6fd054 Fix deprecation warning. 2019-08-01 18:28:54 -07:00
Jennifer Taylor
64ff2b1996 Better repr for partial configuration.
This adds a __repr__ to various types in the parser config, so that the
generated documentation for functions using these types renders easier
to read.
2019-08-01 16:14:12 -07:00
Jennifer Taylor
47a3c75670 Add documentation for parse_module and parse_expression. 2019-08-01 14:55:19 -07:00
Benjamin Woodruff
f2c887604f Group expression documentation into subcategories
Groups the expression nodes into much smaller subcategories for improved
readablility.

Some nodes defined in the expression module were grouped with statements
because they made more sense there (from a documentation perspective).

This also adds a local table of contents to the top of the nodes page
which better reveals all of the subcategories.

It also exports and categorizes
`BaseAssignTargetExpression`/`BaseDelTargetExpression`. These nodes were
referenced in type annotations of other nodes, so they need to be
exported if only for documentation reasons.
2019-08-01 14:54:36 -07:00
Jennifer Taylor
8d000ababc Add a motivation section for LibCST documentation. 2019-08-01 14:51:00 -07:00
jimmylai
aee5ff7857
[document] formatting why_libcst 2019-08-01 14:05:29 -07:00
Jennifer Taylor
8e81384789 Update base README.rst to at least advertise the current python version. 2019-08-01 14:04:38 -07:00
Jennifer Taylor
47be0b1681 Hardcode parser version to Python 3.7 for now. 2019-08-01 14:04:38 -07:00
Jennifer Taylor
374d66d09a Minor formatting nits. 2019-08-01 14:03:51 -07:00
Benjamin Woodruff
aec1e9f2f3
Clean up relative sphinx class/func references
Removes the leading dot in node references (due to a misunderstanding I had), and uses tilde-based prefixes for restructured text references for consistency with the rest of the docs.
2019-08-01 13:40:27 -07:00
jimmylai
d642fbfff7
[document] fix code block formatting 2019-08-01 13:34:32 -07:00
jimmylai
b6dd33ab9d
[document] remove redundant verbose whitespace comments and fix some formatting 2019-08-01 12:10:12 -07:00
jimmylai
88064092af
[document] Use ReadTheDot Theme 2019-08-01 12:09:32 -07:00
Jennifer Taylor
2e20694ff9 Reorder Statement section of node documentation to have better groups. 2019-07-31 17:27:49 -07:00
Jennifer Taylor
5a5b3ccd2e Pass through and update docs for all statement nodes. 2019-07-31 17:27:49 -07:00
Jennifer Taylor
29199ca764 Update documentation on base nodes in statement. 2019-07-31 17:27:49 -07:00
Benjamin Woodruff
88cb0cb88e Remove BaseAtom
I added this originally because it's part of Python's grammar, but since
we merged parenthesis and friends into expressions instead of forming
separate nodes, BaseAtom doesn't have much use.

This fixes also a few bugs:
- A decorator requires a `dotted_name`, so it can only take a `Name` or
  an `Attribute` node, not any atom.
- A `Call` node's function can be any expression, not just a fixed list
  of `BaseExpression` subclasses.
2019-07-31 13:34:07 -07:00
Benjamin Woodruff
c7fa739087 Add parser for Dict and DictComp
This finishes the parser! 🎉

A few related changes were made:
- `DummyNode` was removed, as it's no longer needed.
- `lpar`/`rpar` was removed from `StarredDictElement`, because I found
  out that it's not valid syntax while developing the parsing logic.
2019-07-31 13:07:01 -07:00
jimmylai
370eec82dc
fix attribute document formatting. 2019-07-31 12:55:19 -07:00
Jennifer Taylor
ebb4681258 Separate operators into groups, add basic description to all existing groups. 2019-07-30 17:36:51 -07:00
Jennifer Taylor
27b98e4541 Add better documentation to operator nodes. 2019-07-30 17:36:51 -07:00
Jennifer Taylor
504d2aff20 Docs for Module. 2019-07-30 16:20:38 -07:00
Jennifer Taylor
59d6cb6404 Docs for whitespace nodes. 2019-07-30 16:20:38 -07:00
Benjamin Woodruff
cf2dfa5ee6 Define DictComp node
This defines the node and adds tests for it, but doesn't implement the
parser for it. That will come in a later PR.
2019-07-30 15:53:07 -07:00
Jennifer Taylor
27b8cab777 Delete rogue test files. 2019-07-30 14:40:22 -07:00
jimmylai
4da4b92966
Use Custom Sphinx Patch to generate nice docs 2019-07-29 17:57:14 -07:00
Benjamin Woodruff
c0ac3d7049 Switch from automodule to autoclass everywhere
- Now that we're exporting everything from the top-level libcst package,
  automodule makes a mess of things.
- While it does create more boilerplate, using autoclass/autofunction
  instead of automodule gives us a lot more control over the order in
  which nodes are presented, so we can group them by various categories.

This diff also exports BaseParenthesizableWhitespace, because nodes
refer to it by type, and so it's needed for documentation purposes.
2019-07-29 10:51:59 -07:00
Ray Zeng
a41ab9af91 Calculate syntactic position for statement nodes (5)
Calculate positions for raise, assert, global and nonlocal statements
(and also for op nodes).
2019-07-26 12:48:22 -07:00
Ray Zeng
b9c22a3715 Calculate syntactic position for statement nodes (4)
Calculate positions for with, for and while
2019-07-26 12:48:22 -07:00
Ray Zeng
a42cd37e23 Calculate syntactic position for statement nodes (3)
Calculate positions for assign, function definitions and class
definitions.
2019-07-26 12:48:22 -07:00
Ray Zeng
093acc994b Calculate syntactic position for statement nodes (2)
Calculates positions for try, except, finally and import statements
2019-07-26 12:48:22 -07:00
Ray Zeng
89fb7fe524 Calculate syntactic position for statement nodes (1)
This commit covers most simple statements and if statements.
2019-07-26 12:48:22 -07:00