Commit Graph

17 Commits

Author SHA1 Message Date
Alex Waygood
27983aa929 ast.NodeVisitor: add visit_TryStar on 3.11+ (#9418) 2022-12-27 18:36:53 +01:00
Alex Waygood
154452ffc2 ast.NodeVisitor: Add visit_* methods for ast nodes new in 3.8-3.10 (#9413) 2022-12-26 20:27:44 -08:00
Nikita Sobolev
0e4c59a076 ast.get_docstring does not work with arbitrary AST nodes (#9407) 2022-12-24 18:43:44 +00:00
kasium
f9cd5ee859 Improve ast types; revert several "redundant numeric union" changes from #7906 (#9130)
* Adapt number types in ast

Since mypy  0.990 type promotions was limited.
This means that complex is not longer promoted to int/float, therefore
we should adapt the types to list all possible types

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2022-11-14 09:41:23 +00:00
Shantanu
093c58bfa2 ast: parse accepts PathLike filename (#9020) 2022-10-28 11:18:38 -07:00
Jelle Zijlstra
5bcd4c1a93 ast: parse takes a ReadableBuffer (#9002)
parse() is basically just a wrapper around compile(), which we
already have as taking ReadableBuffer.
2022-10-27 13:28:02 -07:00
Nikita Sobolev
4e5d9d1cca Add missing metaclasses in ast and contextlib (#8497) 2022-08-08 16:08:07 +01:00
Jelle Zijlstra
250f3d92e7 ast: fix stubtest issues (#7877)
Add annotations for `_ast.Tuple.dims` and `ast.main()`. Add allowlist comments for others.
2022-05-19 10:13:08 +01:00
Alex Waygood
97a74bc1aa Import from collections.abc wherever possible (#7635) 2022-04-18 12:50:37 +02:00
Sebastian Rittau
7a3eb5a481 Use tuple instead of _typing.Tuple in ast (#7639) 2022-04-16 16:15:42 +01:00
Shantanu
b88a6f19cd Upgrade black version (#7089) 2022-01-30 16:27:06 -08:00
Shantanu
f9cedff5af ast: allow non-literal strings (#6566)
Co-authored-by: hauntsaninja <>
2021-12-10 21:48:46 -08:00
Pavel Karateev
739a052c40 Add more ast.parse() mode overrides (#6522)
eval -> Expression
func_type -> FunctionType
single -> Interactive

We need (simplified) to cover all cases in Python >= 3.8

- 1 case: parse(filename: str = ...)
- 4 cases: parse(filename: str, mode: Literal[...])
- 4 cases: parse(*, mode: Literal[...])
2021-12-10 09:22:23 -08:00
Akuli
a5bc1e037f Add mypy error codes to '# type: ignore' comments (#6379) 2021-11-26 07:07:56 +01:00
Alex Waygood
fbb89f9fd5 Fix isort w.r.t. _ast/_collections_abc/_tracemalloc/_warnings (#6329) 2021-11-17 08:29:44 -08:00
Akuli
1409f6e892 change ast files to use new union syntax (#5880) 2021-08-08 15:47:33 +02:00
Ivan Levkivskyi
16ae4c6120 Re-organize directory structure (#4971)
See discussion in #2491

Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
2021-01-27 12:00:39 +00:00