Commit Graph

18 Commits

Author SHA1 Message Date
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
Anh71me
1dd533acc0 stdlib/_ast.pyi: Fix ast.ImportFrom arg module _identifier to str (#8648) 2022-08-30 12:18:28 +02:00
Alex Waygood
fbddd2c4e2 stdlib: enforce CamelCase for type alias names (#8255) 2022-07-07 17:45:23 +02:00
Alex Waygood
8826d3a36f Rename some confusingly named type aliases (#8129) 2022-06-21 20:51:05 +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
Jelle Zijlstra
5c13f8bbce ast: FormattedValue.conversion cannot be None (#7810)
```
In [4]: ast.dump(ast.parse('f"{x!r}"'))
Out[4]: "Module(body=[Expr(value=JoinedStr(values=[FormattedValue(value=Name(id='x', ctx=Load()), conversion=114)]))], type_ignores=[])"

In [5]: ast.dump(ast.parse('f"{x}"'))
Out[5]: "Module(body=[Expr(value=JoinedStr(values=[FormattedValue(value=Name(id='x', ctx=Load()), conversion=-1)]))], type_ignores=[])"
```
(On 3.9 but I don't think this has changed since 3.6.)

The stdlib also assumes this: https://github.com/python/cpython/blob/main/Lib/ast.py#L1211 (`chr(None)` doesn't work).
2022-05-08 19:42:38 -07:00
Alex Waygood
b093c90a94 Use TypeAlias for type aliases where possible, part II (#7667) 2022-04-20 20:02:47 +01:00
Shantanu
b562089d13 ast: add TryStar in py311 (#7646)
Co-authored-by: hauntsaninja <>
2022-04-16 22:13:21 -07:00
Alex Waygood
61b22db692 Add many missing __match_args__ attributes (#7556)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-26 19:36:28 +00:00
Shantanu
b88a6f19cd Upgrade black version (#7089) 2022-01-30 16:27:06 -08:00
Alex Waygood
8af5e0d340 Use PEP 585 syntax in Python 2, protobuf & _ast stubs, where possible (#6949) 2022-01-18 07:14:03 -08:00
Nikita Sobolev
73d5098e0b Use Literal types in ast (#6824) 2022-01-05 11:27:58 +01:00
Akuli
ce11072dbe Big diff: use lower-case list and dict (#5888) 2021-08-08 09:26:35 -07:00
Akuli
1409f6e892 change ast files to use new union syntax (#5880) 2021-08-08 15:47:33 +02:00
Marc Mueller
bad2fea551 Use Literal for MatchSingleton (#5590) 2021-06-08 13:25:41 +02:00
Shantanu
a744c3746f ast: update for py310 (#5293) 2021-05-02 13:02:14 -07:00
Jon Banafato
2686e20060 Add missing tag attribute to TypeIgnore stub (#5238)
This attribute was [added in 3.8]. This change lets mypy resolve the
type correctly instead of failing with an attr-defined error.

[added in 3.8]: https://github.com/python/cpython/pull/13479
2021-04-21 18:48:45 -07: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