Alex Waygood
9ed47fa8ec
Fix linting issues ( #12898 )
...
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-10-24 14:26:37 +01:00
Christoph Tyralla
8d02c2a6df
Use @deprecated for those visit methods of class NodeVisitor that deal with classes that have already been marked with @deprecated and add type: ignore[deprecated] comments. ( #12864 )
2024-10-21 13:44:57 +02:00
Stephen Morton
77510ae6a4
resort _ast and ast modules ( #11162 )
...
The classes imported from the _ast module are defined in C,
but set their __module__ to ast. This arrangement ensures that
the type stubs have the same.
related to https://github.com/python/typeshed/issues/3968
and the discussion in https://github.com/python/typeshed/issues/11141
2024-10-04 17:33:45 -07:00
Max Muoto
815d8bfb7b
ast removals for 3.14 (#12488 )
2024-08-10 23:51:19 +03:00
Kirill Podoprigora
1794cfd26e
[3.14] Add annotations for `ast.compare` ( #12111 )
...
Add annotations for ast.compare
2024-06-07 10:21:54 -06:00
Nikita Sobolev
16dadc8fb5
Add show_empty to ast.dump ( #11871 )
2024-05-07 12:42:16 +02:00
Kirill Podoprigora
74486c31a2
[3.13] Add optimize to ast.parse parameters ( #11870 )
2024-05-07 11:23:24 +02:00
Sebastian Rittau
53a8193d64
Update typing_extensions imports in stdlib ( #11244 )
...
Co-authored-by: AlexWaygood <alex.waygood@gmail.com >
2024-01-05 08:15:19 -08:00
Sebastian Rittau
23604858a6
Remove Python 3.7 branches ( #11238 )
2024-01-05 11:39:39 +01:00
Jelle Zijlstra
17f8a82376
ast: mark ast.Num etc. as deprecated ( #10994 )
2023-11-08 19:40:22 +01:00
bzoracler
8d0bdfe9ea
add missing method stub for match_case node ( #10783 )
...
`match_case` is a leaf node and is a valid target for `visit_*`. See 2ef2fffe3b/Lib/ast.py (L1697-L1704)
2023-09-26 13:27:11 -07:00
Alex Waygood
5b8193b9fd
ast.NodeVisitor: add the visit_foo methods for PEP-695 (#10759 )
2023-09-24 16:10:16 -07:00
plokmijnuhby
b1d4f29ed4
Add definition for visit_MatchSingleton to ast.NodeVisitor ( #10758 )
2023-09-24 16:26:17 +01:00
Jelle Zijlstra
628c88d995
Update ast for 3.12 ( #10201 )
2023-06-02 17:11:13 -07:00
Alex Waygood
33a62ae42d
Add more defaults to the stdlib ( #9606 )
...
Continuing work towards #8988 .
The first five commits were created using stubdefaulter on various Python versions; the following commits were all created manually by me to fix various problems. The main things this adds that weren't present in #9501 are:
- Defaults in Windows-only modules and Windows-only branches (because I'm running a Windows machine)
- Defaults in non-py311 branches
- Defaults for float parameters
- Defaults for overloads
2023-01-29 01:51:23 +00:00
Jelle Zijlstra
ddfaca3200
stdlib: add argument default values ( #9501 )
2023-01-18 09:37:34 +01:00
Avasam
c70d303985
Audit stdlib object annotations ( #9519 )
2023-01-17 15:40:00 +00:00
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