Commit Graph

83 Commits

Author SHA1 Message Date
Alex Waygood 10febc4fe0 stdlib: remove unused type: ignore comments (#11061) 2023-11-23 14:00:07 +01:00
Jelle Zijlstra 5030b7419b stdlib: Use pos-only parameters for many Protocols (#10985) 2023-11-06 18:09:04 +01:00
Alex Waygood a08d4c8d2e Remove many redundant inheritances from Generic[] (#10933) 2023-10-26 20:07:20 +02:00
plokmijnuhby cec86eb22e Replace __init__ with __new__ in builtins and types (#10761) 2023-09-25 14:12:23 +02:00
Alex Waygood 03b4bb9cce Stdlib: add many missing __hash__ and __eq__ methods (#10464) 2023-07-17 14:21:02 +02:00
James Hilton-Balfe 4cfc49882e Rename Generator-like type params to be more obvious (#10330)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-21 13:50:33 +01:00
Nikita Sobolev f0e9ec11e4 Add AsyncGeneratorType.ag_suspended (#10288)
New in Python 3.12
2023-06-09 08:40:23 +01:00
Shantanu be85cc7121 builtins: updates for py312 (#10211)
Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2023-06-04 01:05:40 +01:00
James Hilton-Balfe acfde4e40b Add stubs for types.get_original_bases (#10073)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-04-23 22:13:43 +01:00
Alex Waygood dd2818a41d Stdlib: add container default values (#9909) 2023-03-21 09:12:34 +01:00
Alex Waygood 257e287fec Stdlib: correct many parameter names (#9815) 2023-03-04 09:53:12 +00:00
Alex Waygood c5b5dd4bf4 Various stdlib dunders: correct parameter names; improve types; add defaults (#9761)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-02-19 22:44:20 +00:00
Alex Waygood 53747b264e Stdlib: add 'obvious' default values (#9688) 2023-02-07 13:00:40 +01: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
Alex Waygood 307aadc632 Improve the signature of types.MappingProxyType.__eq__ (#9581) 2023-01-23 14:41:27 +01:00
Jukka Lehtosalo d5b88c552c Add __eq__ to types.MappingProxyType (#9580)
The type has a custom __eq__:
https://github.com/python/cpython/blob/v3.11.1/Objects/descrobject.c#L1906

This helps fix this mypy false positive when using `--strict-equality`:
```
from types import MappingProxyType

p = MappingProxyType({'x': 1})
d = {'x': 1}
print(p == d)  # error: Non-overlapping equality check
```

The fragment prints `True` so the comparison is valid.
2023-01-23 09:55:25 +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 597e1a0078 Bump various test dependencies (#9549) 2023-01-16 11:04:45 -08:00
zhykzhykzhyk d6237d09c7 Add constructor to CellType (#9399) 2022-12-26 20:43:35 -08:00
Huazuo Gao cdf5cc34f2 types: fix signature of coroutine (#9333) 2022-12-05 12:00:32 -08:00
Anh71me 39d37ec54c types: add __getitem__ on GenericAlias (#9172)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-11-13 06:45:56 -08:00
Nikita Sobolev ce4668a132 Use Incomplete instead of Any in __getattr__ (#8903) 2022-10-15 18:54:21 +01:00
Nikita Sobolev 6e985ef3de stdlib mapping classes: Use better names for various pos-only parameters (#8637) 2022-08-28 23:29:00 +01:00
Nikita Sobolev 0259068ad6 Remove duplicate definitions in sub-classes (#8594) 2022-08-26 17:10:55 +02:00
Alex Waygood 553700e355 Move some protocol definitions closer to their usage sites (#8436) 2022-07-29 06:26:27 -07:00
Alex Waygood edc0ecd857 Remove Python 3.6 branches from typeshed (#8269) 2022-07-11 10:55:17 +02:00
Alex Waygood 8b3b6bf7cd stdlib: Audit Callable[<parameters>, None] annotations (#8187) 2022-06-27 08:08:28 +02:00
Alex Waygood e7a5b7a762 Fix various __all__-related errors and omissions (#8031) 2022-06-07 23:29:55 +01:00
Alex Waygood 591593c85f Simplify __all__ for modules beginning with 'm' to 't' (#8028) 2022-06-07 20:14:15 +01:00
Jelle Zijlstra 56c8cbb314 Add GenericAlias.__typing_unpacked_tuple_args__ (#8015)
Fixes #8014 

python/cpython#92484
2022-06-03 08:26:41 +01:00
Jelle Zijlstra 0198d75153 types: 3.11 (and earlier) fixes (#7900)
- New attributes in 3.11
- Arguments to CodeType.__init__ are always positional (have fun)
- co_consts can use object instead of Any
2022-05-21 07:37:11 -07:00
Carl Meyer 7ca8303672 CodeType.co_linetable is of type bytes (#7856)
Although the specific format of the bytes is opaque and undocumented, the fact that it will be bytes is stable.

This is necessary in order for type checkers to allow creating one code object from another, since the `lnotab`
positional argument to `__init__` is typed as bytes.
2022-05-17 11:49:12 -07:00
Jelle Zijlstra b1ccd03d51 Add GenericAlias.__unpacked__ (#7774) 2022-05-03 15:41:45 +02:00
Alex Waygood 54af68c789 Add a few # noqas to unblock PyCQA/flake8-pyi#213 (#7658) 2022-04-18 17:57:48 +02:00
Alex Waygood 97a74bc1aa Import from collections.abc wherever possible (#7635) 2022-04-18 12:50:37 +02:00
Jelle Zijlstra cfb1381c2e Add types.FunctionType.__module__ (#7581)
This exists on builtins.function but not here.
2022-04-02 17:44:17 -07:00
Alex Waygood a3245db63c Remove unneeded # noqa comments, fix broken # noqa comments (#7561) 2022-03-28 23:17:44 +02:00
Alex Waygood 4308915e06 Make __hash__ a ClassVar for several classes where it is set to None (#7485) 2022-03-19 05:59:10 -07:00
Jelle Zijlstra 675de720d6 Add some missing items to sys.pyi and types.pyi (#7447) 2022-03-07 08:22:08 +01:00
Alex Waygood 1ebedcc2b4 Mark fields as readonly in builtins.pyi and types.pyi (#7392)
Add FunctionType.__builtins__
2022-02-28 13:23:34 +01:00
Alex Waygood d2ddda00cf Fix various __all__-related typos and omissions (#7378) 2022-02-25 15:10:00 +02:00
Alex Waygood 6a743348ca Add __all__ for most modules beginning with 't' (#7373) 2022-02-23 18:25:28 -08:00
Shantanu 075b8e02eb Update stubtest for async and dunder pos only checking (#7333)
Co-authored-by: hauntsaninja <>
2022-02-21 15:54:16 -08:00
Alex Waygood 5e7909d9b3 Fix positional-only differences in types (#7220) 2022-02-15 06:27:09 -08:00
Alex Waygood 690975b55d types: Add several missing __(qual)name__ attributes (#7216) 2022-02-15 08:07:39 +01:00
Nikita Sobolev 970b8a676c Use async def instead of def ... -> Awaitable in typing (#7105) 2022-02-02 13:14:08 +01:00
Shantanu b88a6f19cd Upgrade black version (#7089) 2022-01-30 16:27:06 -08:00
Alex Waygood 45a2dad83c Reduce use of Any in equality methods (#7081)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-01-30 00:59:00 +02:00
Nikita Sobolev e6cf110100 Improve FunctionType.__get__ with @overload (#7005) 2022-01-23 12:38:09 -08:00