Commit Graph

207 Commits

Author SHA1 Message Date
Randolf Scholz 24827c4590 Made parameters of collections.abc members positional only (#15305) 2026-02-22 20:23:45 +01:00
Emmanuel Ferdman a19c15d754 [typing] Add missing _from_iterable classmethod to Set ABCs (#15331) 2026-02-12 12:12:10 +01:00
Felix Uhl 84c2067451 Make self a positional-only argument in all update overloads (#15322) 2026-01-24 22:51:47 +00:00
Randolf Scholz 35b688e98e Use contravariant type variable rather than object in Container (#15320) 2026-01-24 17:40:45 +01:00
Randolf Scholz 5c49b1fe49 Specialize plain slice type hints (#13007) 2026-01-23 10:35:39 +01:00
Victorien 82c9b97fef Add comment indicating default value of format parameter in typing.get_type_hints() (#15268) 2026-01-13 09:15:27 -08:00
Doug Hoskisson 11b39b8634 Forbid keyword arguments for certain Mapping methods (#15085) 2025-12-02 10:07:08 +01:00
Guo Ci 148b8e631d [typing] Add NewType.__name__ attribute (#15092) 2025-11-28 23:12:15 +01:00
Semyon Moroz 6b4e7f1246 [typing] Deprecate no_type_check_decorator (#15048) 2025-11-18 12:36:48 +01:00
Sebastian Rittau ce3094cc5e Remove typing._promote (#14958)
Part of #7580
2025-11-03 00:27:19 -08:00
Carl Meyer fe11cc058c TypeAliasType.__type_params__ can return forms from typing_extensions (#14848) 2025-10-07 16:45:48 +01:00
Carl Meyer f1f3c12801 TypeAliasType type_params accepts typing_extensions.TypeVar also (#14840) 2025-10-06 21:57:15 +01:00
Alex Waygood c7d0fd95f3 Make (Async)GeneratorType type parameters consistent with (Async)Generator type parameters (#14789)
Currently `Generator` is generic over three type variables that have defaults, but `GeneratorType` is generic over three type variables that do not have defaults. It seems like it probably makes more sense for them to be consistent? The vast majority of real-world `Generator`s are instances of `GeneratorType`
2025-09-27 08:48:19 -07:00
Alex Waygood cc0ce1e500 Revert "Byestring removal for 3.14 (#12490)" (#14743) 2025-09-19 09:09:22 +02:00
Jelle Zijlstra e8ba06f710 Add @disjoint_base decorator in the stdlib (#14599)
And fix some other new stubtest finds.
2025-08-24 07:27:14 -07:00
Jelle Zijlstra f32d9f08bd stdlib: add __slots__ (#14611) 2025-08-21 07:24:59 -07:00
Mantas 28abff1eb3 typing: make Generic definition reflect runtime (#14583)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-08-21 07:21:11 -07:00
Alex Waygood 8a56044cd6 Loosen Mapping.update() overloads a little (#14593) 2025-08-19 11:54:03 -07:00
Gatsik fef5d941b0 Add Protocols for mapping inside dictionary view objects (#14574) 2025-08-18 08:22:34 +02:00
Sebastian Rittau 554701e9b6 Fix ItemsView.__contains__ (#14576) 2025-08-15 11:52:09 +02:00
Brian Schubert d01dc82bd2 Mark various dunder methods as positional-only in the stdlib (#14528) 2025-08-05 17:57:39 -04:00
Brian Schubert 622df68c1c Add @type_check_only to stub-only private classes in stdlib (#14512) 2025-08-03 10:13:16 +02:00
Neil Mitchell dbd3ad356e Make Mapping.get(default) more constrained (#14360) 2025-07-02 11:24:32 +01:00
renovate[bot] 75d8c88ec5 Update most test/lint dependencies (#14354)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
2025-07-01 10:59:15 +01:00
Neil Mitchell a7ae4ecc61 Minor cleanups after #14099 (#14100)
We are confining `_KT` to `str`, so use that everywhere. Equivalent, but simpler.
2025-05-19 19:00:34 +02:00
Neil Mitchell 929aca4026 Fix MutableMapping.update to require string keys (#14099) 2025-05-19 11:55:20 -04:00
Jelle Zijlstra 30b7b679f5 Give up on AnnotationForm in typing.pyi (#13999)
From #13985
2025-05-11 15:39:50 -07:00
Sebastian Rittau b444909873 Copy typechecker-internal symbols to _typeshed._type_checker_internals (#13816) 2025-05-11 16:07:53 +02:00
Jelle Zijlstra 5ff32f377c 3.14: add annotationlib, update typing and inspect (#13985) 2025-05-10 14:25:06 -07:00
Sebastian Rittau 2d46095e3f Fix errors when type checking stdlib with Python 3.14 (#13977) 2025-05-09 21:04:35 +02:00
Joren Hammudoglu f6503fd9ab Drop Python 3.8 support in typing[_extensions] and types (#13763) 2025-04-02 08:56:56 +02:00
Avasam 19cea106f0 Bump ruff to 0.11.2 (#13757) 2025-04-01 17:31:38 +01:00
Jia Chen 693b66ae9a Make Any a proper class instead of an alias to object() (#13520) 2025-03-21 13:46:23 +01:00
Sebastian Rittau 52202f42a6 Add TypedDict.__{readonly,mutable}_keys__ (#13646) 2025-03-17 19:30:30 +01:00
Avasam 6d6e858e63 Enable Ruff PLC (Pylint Convention) (#13306) 2025-03-03 15:39:40 +01:00
James Hilton-Balfe ab75b691c2 Make collections.abcs more consistent with runtime implementation (#10816)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-12-27 21:31:59 -08:00
Shantanu 5b17f78c32 typing: broaden type_check_only TypeVar bound (#13317)
This is needed if we do https://discuss.python.org/t/protocol-classes-should-not-match-callable-proto/75475
2024-12-27 19:56:08 -08:00
Stephen Morton 3944c7839e Add __hash__ for a bunch of types that set it to None (#13286) 2024-12-23 23:16:22 -08:00
Stephen Morton 17408ee538 fix the __init__ of several C-classes (#13211) 2024-12-23 10:55:51 -08:00
Brian Schubert 318cebb776 Mark typing.TYPE_CHECKING as Final (#13180) 2024-12-03 22:23:19 +01:00
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