Commit Graph

167 Commits

Author SHA1 Message Date
Brian Schubert
693add9512 Update return type of Generator.close in 3.13 (#13127)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-11-26 13:32:07 -08:00
Stephen Morton
982fb8358b __reversed__ on dict views (#13073)
KeysView doesn't have __reversed__, but dict_keys does. When this
was added to typeshed, we didn't have dict_keys as a separate type.
2024-11-23 05:09:37 -08:00
Rebecca Chen
921c65304e Annotate TypedDict as _SpecialForm rather than object. (#12985)
* Annotate TypedDict as _SpecialForm rather than object.

Let's see if this works...

* Get typing_extensions.TypedDict as well, try to fix tests.

* Import typing_extensions.TypedDict, delete _SpecialForm.__getitem__.

* Back out deletion of _SpecialForm.__getitem__.
2024-11-19 22:50:42 -08:00
Stephen Morton
7c7629d909 add typing._Final (#13015)
This is the subset of typing module internal base classes
that are stable over all supported versions of python.
2024-11-16 16:55:38 +01:00
Stephen Morton
e8c2e5bb20 remove redundant inheritance from Iterator for typing.IO (#12870) 2024-10-22 01:29:03 +01:00
Stephen Morton
b62579b0d2 swap inheritance order for typing.Sequence (#12869)
This matches the order at runtime.
2024-10-21 22:37:02 +01:00
Victorien
db265afec5 Use Mapping for local Python namespace parameters (#12705) 2024-09-30 11:26:41 +02:00
Martin Huschenbett
46512118ea Return coroutine from AsyncGenerator.__anext__ (#12685)
The `__anext__` method of an asynchronous generator defined using the
`async def`/`yield` syntax returns an actual coroutine not just any
awaitable. Let the definition of the `AsyncGenerator` protocol reflect
this circumstance.

See https://discuss.python.org/t/types-for-asynchronous-generators-too-general/64515
for the motivation behind this change.
2024-09-23 11:34:56 +02:00
Avasam
3719f02dbf Using precise code for pyright: ignore and re-enabling various pyright tests (#12576) 2024-08-22 03:34:52 +02:00
Sebastian Rittau
7f38b116a0 Remove redundant overloads from IO (#12570) 2024-08-21 15:55:22 +02:00
Max Muoto
8a7f09e351 Byestring removal for 3.14 (#12490) 2024-08-06 07:16:49 -07:00
Jelle Zijlstra
d482d4e83c More precise type for TypeAliasType.__getitem__ (#12354)
At runtime, this always returns a GenericAlias; see typealias_subscript
in Objects/typevarobject.c. See microsoft/pyright#8444.
2024-07-17 06:37:31 -07:00
Kumar Aditya
98cf9a23eb Fix stubs for async generator methods (#12232) 2024-07-03 20:18:28 -07:00
Alex Waygood
3ab03deec3 Upgrade to latest 3.12 and 3.13 versions for stubtest (#12131) 2024-06-12 05:16:39 -06:00
Alex Waygood
2985ef414c typing(_extensions) updates for py313 (#12030) 2024-05-24 15:16:15 -04:00
Shantanu
54b39e1de4 Add __replace__ to namedtuple and structseq (#11939)
mypy will need its own change to truly understand namedtuple
2024-05-18 05:55:09 -04:00
Alex Waygood
240114ac1a More PEP-696 updates to typing(_extensions) stubs (#11925) 2024-05-16 22:05:45 -04:00
Alex Waygood
5b0816e784 Fix stdlib stubtest after latest typing-extensions release (#11923) 2024-05-16 16:53:19 -04:00
Max Muoto
3195f9fb1b Use TypeVar defaults for Generator and AsyncGenerator (#11867) 2024-05-13 15:21:43 -07:00
David Salvisberg
ea61ca5a30 [3.13] typing.(Async)ContextManager adds second type parameter (#11873)
This is in response to: https://github.com/python/cpython/pull/118681
2024-05-09 19:25:49 -07:00
Kaleb Barrett
9ca0b20529 Make Awaitable.__await__'s result type's send arg Any (#11788) 2024-04-25 07:09:33 -07:00
David Salvisberg
f274c78fe5 Make ExitStack, AbstractContextManager and AsyncAbstractContextManager generic in return type of __exit__ (#11048) 2024-04-22 16:43:08 +02:00
Kaleb Barrett
ff946a7349 Update Coroutine.cr_frame to return correct type (#11798)
Update Coroutine.cr_frame to return correct type
2024-04-20 12:51:36 -07:00
Avasam
12b9e48324 Update Ruff and enable F821 in stubs (#11771) 2024-04-17 09:50:58 -07:00
bzoracler
bc4b26fbcb Allow NewType.__supertype__ to also be a NewType (#11728) 2024-04-07 06:15:51 -04:00
Sebastian Rittau
630b49a291 Replace various Incompletes in stdlib (#11673)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-04-01 15:20:01 +01:00
Sebastian Rittau
027115e624 Remove bare incompletes (#11670) 2024-03-30 18:35:57 -07:00
Jelle Zijlstra
a6bdb25991 typing: Deprecate creating a NamedTuple with kwargs (#11567)
c5fa796619/Lib/typing.py (L2874)
2024-03-10 16:20:35 -07:00
Avasam
1a942aa36d Replace Flake8 checks with Ruff (except for flake8-pyi) (#11496)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-03-10 14:35:45 +00:00
Shantanu
470a13ab09 Use PEP 570 syntax in stdlib (#11250) 2024-03-09 14:50:16 -08:00
Alex Waygood
c49c84f319 A new shade of Black (#11362) 2024-02-04 16:38:55 -08: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
Viicos
54447f63a4 Use type instead of Type in typing.pyi (#11235) 2024-01-04 05:04:43 -08:00
Alex Waygood
0b36e65877 Remove redundant sys.version_info condition (#11087)
We're already inside an `if sys.version_info >= (3, 12)` block here; no need to check if `sys.version_info >= (3, 10)`
2023-11-29 19:10:48 +00:00
Alex Waygood
ef346aba0d Fixes to typing and typing_extensions stubs (#11086) 2023-11-29 19:00:58 +00:00
Alex Waygood
8023ba764a Remove redundant inheritances from Generic and various typing protocols (#10981) 2023-11-06 14:00:25 +01:00
Alex Waygood
a08d4c8d2e Remove many redundant inheritances from Generic[] (#10933) 2023-10-26 20:07:20 +02:00
Jelle Zijlstra
31495e53bd typing.pyi: IO.name may be bytes (#10738) 2023-09-20 08:24:22 +02:00
Alex Waygood
433204fb8f py312: Fix stubtest nits in typing/typing_extensions (#10659) 2023-09-04 15:39:11 +01:00
Alex Waygood
df08fcec5f Improve __(r)or__ signatures for TypedDict classes (#10565) 2023-08-12 18:27:35 +01:00
Eugene Toder
e86c61da86 More precise overloads for get/pop methods (#10501)
Fixes #10293

Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2023-07-26 16:37:32 +01:00
Jelle Zijlstra
f577c4c133 Update typing_extensions for 4.7.* (#10344) 2023-07-22 12:51:22 +01:00
Alex Waygood
03b4bb9cce Stdlib: add many missing __hash__ and __eq__ methods (#10464) 2023-07-17 14:21:02 +02:00
Alex Waygood
81b8211d0e Revert "Remove un-needed __hash__ methods from stdlib (#8465)" (#10426)
Reverts https://github.com/python/typeshed/pull/8465
Fixes https://github.com/python/typeshed/issues/10424
Closes https://github.com/python/typeshed/pull/10425

https://github.com/python/typeshed/pull/8465 caused regressions: see https://github.com/python/typeshed/issues/10424 and https://github.com/python/mypy/issues/13800. Since it didn't fix any known problems (just some stylistic nits that we had), let's just revert the PR.
2023-07-09 08:43:32 -07: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
Alex Waygood
640676bdb2 Mark arguments of typing.NamedTuple.__init__ as positional-only (#10292) 2023-06-11 12:28:01 +02:00
Sam Bull
e11dbc20da Add missing __eq__ to Mapping (#10297)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-10 13:56:08 +01:00
Shantanu
d6a85e2c48 Attempt to clarify the ByteString situation (#9783)
See https://github.com/python/cpython/issues/102092

This makes the behaviour of typing.ByteString better match its
documentation.
2023-05-27 21:37:38 -07:00
Alex Waygood
bb701b09db Improve NamedTuple stubs (#10220) 2023-05-25 08:37:52 -07:00